Skip to content

fix(ci): skip version registration for latest release and sort by semver#338

Merged
dmitsh merged 2 commits into
NVIDIA:mainfrom
pdmack:fix/fern-publish-skip-latest-sort
May 20, 2026
Merged

fix(ci): skip version registration for latest release and sort by semver#338
dmitsh merged 2 commits into
NVIDIA:mainfrom
pdmack:fix/fern-publish-skip-latest-sort

Conversation

@pdmack

@pdmack pdmack commented May 19, 2026

Copy link
Copy Markdown
Contributor

Description

Port NVSentinel#1315 to topograph:

  • Skip registration when tag = latest release — the Latest · vX.Y.Z stamp already covers it, so a separate version entry would create a duplicate in the dropdown
  • Sort by semver descendingsort -rV after insertion so backport patches (e.g. v0.3.1 after v0.4.0) don't end up above newer releases

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.
  • All commits are signed off per DCO (git commit -s).

@pdmack pdmack requested a review from dmitsh as a code owner May 19, 2026 22:13
@greptile-apps

greptile-apps Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR removes the static latest-slug entry from fern/docs.yml and shifts to a purely position-based model where versions[0] (the semver-highest entry) is stamped "Latest · vX.Y.Z" at publish time. It also adds a sort -rV pass after each new-version insertion so backport patches (e.g. v0.3.1 arriving after v0.4.0) are placed correctly in the dropdown rather than appearing above newer releases.

  • Removed dedicated latest entry (slug: latest) from fern/docs.yml; the stamp step now targets versions[0] by position instead of by slug, and the prune arithmetic is simplified (no more +1 offset).
  • Added semver sort after each version insertion: slugs are extracted, sorted with sort -rV, the list is cleared, and entries are rebuilt in descending order.
  • Stamp step cleaned up: gh api call replaced by a direct yq read of versions[0].display-name, though the now-unused GH_TOKEN env binding was left behind.

Confidence Score: 4/5

Safe to merge for normal forward-release workflows; the sort and stamp logic work correctly for the common case.

The core changes are mechanically sound. The sort-and-rebuild loop hard-codes display-name from the raw slug, silently discarding any future custom labels, and the GH_TOKEN env binding is dead code left over from the old gh api call. Neither affects current behaviour.

.github/workflows/publish-fern-docs.yml — the sort rebuild loop and the unused GH_TOKEN env warrant a second look.

Important Files Changed

Filename Overview
.github/workflows/publish-fern-docs.yml Removes the dedicated latest slug entry and replaces it with a position-based stamp on versions[0]; adds sort -rV after insertion so backport patches land in the correct position; adjusts prune offsets to drop the old +1 accounting for the removed latest entry. Unused GH_TOKEN env left in the stamp step, and the sort rebuild loop hard-codes display-name from the slug rather than preserving the original value.
fern/docs.yml Removes the static latest / slug: latest entry; updates the comment to reflect the new "newest entry is stamped at publish time" contract. No structural issues.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Tag push / manual dispatch] --> B{is_release?}
    B -- false / pre-release --> G
    B -- true --> C{version file already exists?}
    C -- yes --> G
    C -- no --> D[Generate fern/versions/vX.Y.Z.yml from tag]
    D --> E[Append entry then sort -rV and rebuild list]
    E --> F[Prune oldest entries beyond MAX_VERSIONS]
    F --> G[Checkout frozen version content]
    G --> H[Stamp versions_0 as Latest vX.Y.Z]
    H --> I[fern generate docs - Publish]
    I --> J{is_release?}
    J -- false --> K[Done]
    J -- true --> L[Restore pre-stamp docs.yml]
    L --> M[Open PR to persist registry changes to main]
Loading

Reviews (3): Last reviewed commit: "fix(ci): frozen-only versioning — remove..." | Re-trigger Greptile

Comment thread .github/workflows/publish-fern-docs.yml Outdated
Comment thread .github/workflows/publish-fern-docs.yml Outdated
pdmack added 2 commits May 20, 2026 11:35
Port NVSentinel#1315:
- Skip registration when tag matches the latest GitHub release (the
  Latest stamp already covers it, avoiding a duplicate dropdown entry)
- Sort versioned entries by semver descending after insertion so
  backport patches don't appear above newer releases

Signed-off-by: Pete MacKinnon <[email protected]>
…ster

All dropdown versions now serve frozen content from their git tag.
The newest entry is stamped "Latest · vX.Y.Z" at publish time
(transient, not persisted). Removes the skip-latest logic that
caused version gaps.

- Remove the Latest entry pointing at live docs/index.yml
- Always register every release (no SHOULD_REGISTER skip)
- Stamp step targets the first version entry (newest after sort)
- Prune counts versions directly (no +1 offset for Latest)

Signed-off-by: Pete MacKinnon <[email protected]>
@pdmack pdmack force-pushed the fix/fern-publish-skip-latest-sort branch from f4f6498 to 3d31d7f Compare May 20, 2026 15:36
@github-actions

Copy link
Copy Markdown
Contributor

@pdmack

pdmack commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

Updated to frozen-only versioning — addresses the gap issue greptile flagged:

  • Removed the live "Latest" entry pointing at docs/index.yml entirely
  • All dropdown versions now serve frozen content from their git tag
  • Every release is always registered (no skip-latest logic, no SHOULD_REGISTER)
  • The newest entry is stamped "Latest · vX.Y.Z" at publish time (transient, not persisted)
  • Prune counts versions directly (no +1 offset)

Simulated locally — v0.4.0 publish shows Latest · v0.4.0, v0.3.0. A subsequent v0.5.0 release correctly produces Latest · v0.5.0, v0.4.0, v0.3.0. No gaps, no duplicates.

Aligned with the NVSentinel frozen-versions branch (pdmack/NVSentinel@pdmack/fern-frozen-versions).

@pdmack

pdmack commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai

@dmitsh dmitsh merged commit 1f7189f into NVIDIA:main May 20, 2026
7 checks passed
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