lore-server: Return NotFound for revision info on an empty branch - #184
Open
bclarke123 wants to merge 2 commits into
Open
lore-server: Return NotFound for revision info on an empty branch#184bclarke123 wants to merge 2 commits into
bclarke123 wants to merge 2 commits into
Conversation
branch::load_latest returns the zero hash as its no-revisions-yet
sentinel for an existing branch, but the RevisionInfo handler marched
into state/metadata loads with it and failed as Internal
("file not found: metadata key") for every freshly created repository.
Guard the resolved signature and answer NotFound, mirroring the
existing zero-hash handling in revision_tree and load_optional_parent.
Signed-off-by: Ben Clarke <ben@arrayofstars.com>
Contributor
Author
|
Would appreciate if somebody with permission can rerun the linux smoke test here, the failure ( |
mjansson
reviewed
Sep 3, 2026
| // zero hash. Surface that as NotFound rather than proceeding into | ||
| // state/metadata loads that fail as Internal. | ||
| if signature.is_zero() { | ||
| return Err(Status::not_found("Branch has no revisions")); |
Collaborator
There was a problem hiding this comment.
It is only the default branch that can have a zero revision - and in that case I would argue that it should early respond with a successful response carrying that zero information
Per review: only the default branch can exist with no revisions, and that is not an error condition. Return an OK RevisionInfoResponse with no revision instead of NotFound; the optional revision field already expresses it. Signed-off-by: Ben Clarke <ben@arrayofstars.com>
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.
Summary
branch::load_latest returns the zero hash as its no-revisions-yet sentinel for an existing branch, but the RevisionInfo handler marched into state/metadata loads with it and failed as Internal ("file not found: metadata key") for every freshly created repository. Guard the resolved signature and answer NotFound, mirroring the existing zero-hash handling in revision_tree and load_optional_parent.
Possibly related to #113 - a client that hides repos whose latest-revision query errors would show the symptom this PR fixes
Checklist
Signed-off-by:line (DCO -- see CONTRIBUTING.md)cargo +nightly fmt --allproduces no changescargo clippy --all-targets -- -D warnings --no-depspassescargo testpassesuv run pytestpasses (when Python tooling is touched)docs/updated where behavior changed