fix(statuses): don't 404 a group card when nothing is published (audit M6) - #436
Draft
passcod wants to merge 1 commit into
Draft
fix(statuses): don't 404 a group card when nothing is published (audit M6)#436passcod wants to merge 1 commit into
passcod wants to merge 1 commit into
Conversation
`group_details` resolved the latest published version with `get_latest_matching(conn, "*")` and propagated the error with `?`. That call returns `NoMatchingVersions` (→ 404) when nothing is published at all, so a fresh deployment — or one where every version is still draft — 404s for every group and the status board renders empty. The two sibling endpoints that need the same value, `servers::get_detail` and `statuses::snapshot`, already map this to `version_distance: None`, with a comment saying a page shouldn't 404 just because no versions are published yet. This does the same: no published version to measure against is an unknown distance, not a missing group. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SGfH1cdFKPnKpM7ytRThft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes M6 (medium) from the audit in #370.
The bug
group_detailsresolved the latest published version withVersion::get_latest_matching(conn, "*")and propagated the error with?. That call returnsNoMatchingVersions— which maps to 404 — when nothing is published at all.So on a fresh deployment, or one where every version is still draft,
group_details404s for every group and the fleet status board renders empty or errored. The group exists and is perfectly healthy; the only thing missing is a release to compare against.The two sibling endpoints needing the same value,
servers::get_detailandstatuses::snapshot, already map this toversion_distance: Nonewith a comment saying a page shouldn't 404 just because no versions are published yet.group_detailswas the odd one out.The fix
Treat "no match" as "unknown latest", exactly as the siblings do:
latest_versionbecomes anOption, andversion_distanceisNonewhen either the card's version or the latest is unknown.Tests
group_card_is_served_when_no_version_is_published— a group with a healthy production central and only a draft version; asserts 200, the group's name, and a nullversion_distance. Confirmed to fail against the unfixed handler with404 NoMatchingVersions.Generated by Claude Code