Skip to content

Link version navigation by slug so platformed variants resolve - #871

Open
jenshenny wants to merge 1 commit into
ho/feature-branch-ca-server-changesfrom
jenshenny/version-navigation-slug
Open

Link version navigation by slug so platformed variants resolve#871
jenshenny wants to merge 1 commit into
ho/feature-branch-ca-server-changesfrom
jenshenny/version-navigation-slug

Conversation

@jenshenny

@jenshenny jenshenny commented Aug 11, 2026

Copy link
Copy Markdown

rubygems#6674

Link version navigation by slug so platformed variants resolve

Problem

The previous/next links on the version show page are built from the version number alone:

rubygem_version_path(rubygem.slug, latest_version.previous.number)

That path resolves via full_name = "name-number" — only ever the plain-ruby variant. When the adjacent number exists only as platformed versions, the link has always 404ed (pre-existing bug); content-addressable variants make this much more likely, since every skinny gem's slug carries its content address.

Version#previous/#next also used find_by(position: ±1) — and position is ranked by number alone, so all variants of a number share a position and the lookup returned an arbitrary row.

Fix

  • Link previous.slug / next.slug — the slug encodes the platform or content address, so every variant shape resolves
  • Make the adjacent-position lookup deterministic (order(:id).first)

Testing

Integration test builds a gem with a plain version, a platformed version, and a content-addressable version, then walks the navigation in both directions asserting the exact hrefs (scoped to the nav link classes) and following them to a 200. Verified the test fails without the fix (the next-link href pointed at the bare number and 404ed).

Found during the content-addressable deep review; pre-existing on master but surfaced by ABI variants, hence targeting the feature branch where the test can cover the content-addressed case.

The previous/next links on the version page were built from the
version number alone, which resolves the full_name name-number — only
ever the plain ruby variant. When the adjacent number exists only as
platformed or content-addressable versions the link 404ed. Link by
slug, which encodes the platform or content address, and make the
adjacent-position lookup deterministic since variants of a number
share a position.
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.

1 participant