Repository navigation
fix(sieve): do not call the platform without a repository identity - #579
Merged
Merged
Conversation
mlieberman85
previously approved these changes
Oct 12, 2026
mlieberman85
left a comment
Contributor
There was a problem hiding this comment.
Thanks, I checked this on a repo with no remote: statuses are unchanged and the 15 /repos//… and /orgs/ calls are gone. A few small things:
- Yes, please add the rule to framework-design.md 3.8's
gh_apibehavior list (endpoint needs$OWNER/$REPOand has no value → ERROR, no call). github_branch_protectionreports the same case asevaluation; could both use one class?unavailableis documented as "the platform answered badly or never answered", so whichever you pick, it'd be good to make them match.- The message says "no git remote was found", but an empty owner can also come from a caller passing only
repo. Something like "no repository owner/name is known (no git remote, and none was given)" would avoid naming the wrong cause. - Optional follow-up:
execsteps (e.g.gh release list --repo $OWNER/$REPOin thehas_releasesdetect, toml:314) and themcpargs substitution still substitute an empty owner.
Drafted with Claude Code; reviewed and posted by me.
On a checkout with no git remote, detect_owner_repo returns an empty owner. gh_api_handler substituted it and asked the platform about /repos//name. The 404 that came back was reported as a platform answer, and a step declaring 404 in fail_on_status would have returned FAIL for a request that was never about the audited repository. Return ERROR (class unavailable) with a message that says the checkout has no repository identity, without calling the platform. github_branch_protection already refuses the same way. Signed-off-by: Marc-cn <130138935+Marc-cn@users.noreply.github.com> Assisted-by: Claude:claude-fable-5-1
Collaborator
Author
Marc-cn
force-pushed
the
fix/no-remote-platform-checks
branch
from
October 12, 2026 20:38
316cb68 to
3d7a714
Compare
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
On a checkout with no git remote,
detect_owner_reporeturns("", <directory name>). Thegh_apistep substitutes that into its endpoint and calls the platform anyway:Two problems with that:
fail_on_status, the handler returns FAIL with confidence 1.0 ("which proves failure for this control") for a request that was never about the audited repository. No baseline step declaresfail_on_statustoday, so this is a latent risk and not a wrong verdict I observed.This PR makes
gh_api_handlercheck before substituting: if the endpoint uses$OWNERor$REPOand the context has no value for it, it returnsERROR(classunavailable) without calling the platform:github_branch_protectionalready refuses the same way ("needs owner/repo"), so this brings the generic step in line with it. Endpoints that need neither, such as/user, are unaffected.What this does not decide: whether platform controls on a repository with no remote should be ERROR, N/A or something else. They were ERROR before and they still are. Related: #334, #344.
Type of Change
Framework Changes Checklist
docs/architecture/framework-design.md) if behavior changed (section 3.8 describes thegh_apistep; I have not edited it. Say if this case should be written down there)uv run python scripts/validate_sync.py --verboseand it passesTesting
uv run pytest tests/ -v): 5141 passed, 26 skipped (main: 5138)uv run ruff check .)Three tests in
tests/darnit/sieve/test_gh_api_handler.py, using the existing recorded responder: no owner gives ERROR and makes no call; no owner withfail_on_status: [404]gives ERROR and makes no call; an endpoint that needs no identity still runs. The first two fail without the fix.By hand,
darnit audit --tags level=1on a one-file repository with no remote: 26 controls and 10 errors before and after. Only the messages change, and nothing is requested from/repos//toyor/orgs/.AI assistance
Claude Fable 5. wrote the check, I ran every command and checked the results myself. The commit carries an
Assisted-by: Claude:claude-fable-5-1.Additional Notes
unavailable.github_branch_protectionsets no class for the same case.