Skip to content

Enable storage retention for hex - #452

Merged
andrew merged 2 commits into
git-pkgs:mainfrom
pinguinfuss:issue-306-retention-hex
Oct 13, 2026
Merged

andrew merged 2 commits into
git-pkgs:mainfrom
pinguinfuss:issue-306-retention-hex

Conversation

@pinguinfuss

Copy link
Copy Markdown
Contributor

Tarballs are stored under the name from the tarball filename, and purl keeps hex names as they are, so package rules use the default mapping with the name as published.

The filename parser splits versions like 4.1.5-1 at the wrong hyphen and files them under a package like amqp_client-4.1.5, so package rules don't reach them; the docs row says so until the parser is fixed.

Refs #306

@andrew andrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than documenting the 4.1.5-1 / 0.1.0-dev-10 split as a limitation, please fix parseTarballFilename in internal/handler/hex.go. It splits at the last hyphen followed by a digit, so amqp_client-4.1.5-1.tar is stored as package amqp_client-4.1.5, which is wrong for cooldown, policy and listings as well as retention rules. Hex package names can't contain a hyphen, so splitting at the first one (strings.Cut(base, "-")) is enough, with test cases for both version shapes.

With that in, the caveat in the hex docs row and the last two sentences of the init comment can go. The fix can be in this PR or a separate one merged first. This will also need rebasing for the docs/configuration.md table once the neighbouring retention PRs are in.

Tarballs are stored under the name from the tarball filename, and purl keeps hex names as they are, so package rules use the default mapping with the name as published.

The filename parser splits versions like 4.1.5-1 at the wrong hyphen and files them under a package like amqp_client-4.1.5, so package rules don't reach them; the docs row says so until the parser is fixed.

Refs git-pkgs#306
parseTarballFilename split at the last hyphen before a digit, so amqp_client-4.1.5-1.tar was stored as package amqp_client-4.1.5. Hex names can't contain a hyphen, so it now splits at the first one. The docs caveat is gone.

Refs git-pkgs#306
@pinguinfuss
pinguinfuss force-pushed the issue-306-retention-hex branch from 97f6613 to c3c1204 Compare October 12, 2026 18:44
@pinguinfuss
pinguinfuss requested a review from andrew October 12, 2026 19:49
@pinguinfuss

Copy link
Copy Markdown
Contributor Author

Fixed in c3c1204: parseTarballFilename now splits at the first hyphen with strings.Cut. Tests cover 4.1.5-1, 0.1.0-dev-10 and -rc.1, and the caveat is gone from the docs and the init comment. Rebased onto main for the docs table. As with gem, rows cached under the old wrong names age out on their own.

@andrew
andrew merged commit c96b4a9 into git-pkgs:main Oct 13, 2026
6 checks passed
@pinguinfuss
pinguinfuss deleted the issue-306-retention-hex branch October 13, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants