Skip to content

Name the Fetched main in the Audit Run Stamp - #4260

Merged
ptr727 merged 7 commits into
developfrom
feature/audit-one-hub-commit-4238
Nov 17, 2026
Merged

ptr727 merged 7 commits into
developfrom
feature/audit-one-hub-commit-4238

Conversation

@ptr727

@ptr727 ptr727 commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Closes #4238

Problem

spec/audit.py stamped a run with the hub checkout's HEAD. The checks read two sources, though. The spec and the registry come from the checkout. The canonicals, their history, and the hub's tracked paths come from _hub_main_rev(), a freshly fetched main. That covers the tree:, verbatim:, and hub-only: findings. From a checkout not at that main, the stamp named one commit while those findings judged against another.

Fix

The stamp now names both commits where they differ:

audit run <UTC> | hub <head> | main <fetched-main>

At the fetched main it reads audit run <UTC> | hub <sha> as before. Where the fetch fails it reads | main unknown. The --issue body carries the same stamp.

The hub field takes a -dirty suffix where the working tree under the paths the run reads differs from HEAD, untracked files included. The fetch result is cached once per run, a failure included. So a fetch the stamp called unknown is never retried into a main the stamp did not name. A new hub_head helper serves both this stamp and spec/workflow_reuse.py's report stamp, each with its own read paths, spec among them for the report's code. The stamp is computed after the --issue usage check, so a usage error never waits on a fetch.

AUDIT.md section 8 now says which reads come from which commit. RESYNC.md says to quote the whole stamp.

Why not the refusal

The issue suggested refusing a checkout not at freshly fetched origin/main, as scripts/carry.py verify_hub does. That would not make the stamp truthful on its own:

  • RESYNC.md tells a run for an entry not yet on main to use a hub checkout at develop. verify_hub allows that too. The canonicals there still read main, so the stamp would still name one commit while the findings read another.
  • The audit reads main for its canonicals deliberately, so a run from develop never judges a carrier against unpromoted content. A refusal would end every run from develop or a feature branch, which hub development relies on.

Naming both commits keeps every supported run working and makes each stamp say what it measured.

Verification

  • tests/test_audit_helpers.py HubStampCase builds a hub clone one commit behind its origin/main and runs audit.main in sweep and --issue modes. It asserts the stamp names both commits, names HEAD alone at main, and reads main unknown when the fetch fails. The trailing-checkout case fails against the unfixed spec/audit.py.
  • HubStampCase also holds a failed fetch for the rest of the run, keeps both fields outside a checkout, marks a dirty read path, and ignores a change outside the read paths.
  • ShallowCloneCase now clears the fetch cache it can fill, so a later test never reads that test's commit. It and HubStampCase share one GitRepoCase.seed_hub fixture.
  • Full suite, spec/validate.py, the prose gate, ruff, and mypy pass. spec/audit.py is 2957 lines.

Local-review findings

Every introduced finding the local passes raised is fixed on this branch. None stays open.

🤖 Generated with Claude Code

ptr727 and others added 3 commits November 17, 2026 08:29
The run stamp named the hub checkout's HEAD, while the canonicals, their
history, and the hub's tracked paths are read from a freshly fetched
main. From a checkout not at that main, the stamp named one commit and
the tree, verbatim, and hub-only findings judged against another.

The stamp now adds "| main <sha>" wherever the fetched main differs
from HEAD, and "| main unknown" where the fetch fails. AUDIT.md and
RESYNC.md say which reads come from which commit.

Closes #4238

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A fetch failure the stamp recorded as "main unknown" could succeed on a
later read's retry, so findings would judge against a main the stamp
called unknown. The fetch result, failure included, is now cached once
per run.

A stamp with neither commit resolvable now keeps both fields. AUDIT.md
says the spec and registry are read from the checkout's working tree,
and what "main unknown" means.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
spec/audit.py now holds one short_rev helper, which the run stamp and
spec/workflow_reuse.py's report stamp both call. The audit tests seed
their hub fixture through one GitRepoCase helper, and the stamp test's
git call names its encoding.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings November 17, 2026 16:48
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Nov 17, 2026
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 20 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 7c082a0 and 20667b6.

Files selected for processing: 5

  • AUDIT.md
  • RESYNC.md
  • spec/audit.py
  • spec/workflow_reuse.py
  • tests/test_audit_helpers.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@ptr727

ptr727 commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 9ef4868975504e4914b3a64edac0094d0e99320e, the content this pull request carries at that commit against develop, and it recorded 2 findings.

Every read but the canonicals, their history, and the tracked paths
comes from the checkout's working tree, so uncommitted changes there
were not in the commit the stamp named. The hub field now takes a
-dirty suffix where tracked files hold uncommitted changes. AUDIT.md
names repo-config among the working-tree reads, and RESYNC.md says to
quote any main field with the stamp.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Active findings show the audit provenance contract omits repo-config inputs and fails to mark uncommitted changes, leaving snapshot stamps potentially inaccurate.

3 open issues
What changed in this PR

This PR updates audit run stamps to identify both the hub checkout revision and the freshly fetched main revision when they differ, improving provenance for audit findings.

Changes:

  • Cache fetched-main results, including failures, for each run.
  • Share abbreviated-revision formatting between audit and workflow reports.
  • Add coverage for trailing checkouts, matching revisions, fetch failures, and unavailable checkouts.
  • Update audit and resync documentation for the two-commit stamp.
File Description
tests/​test_audit_helpers.py Adds shared hub fixtures and coverage for audit stamp behavior across fetched, matching, failed, and unavailable revision scenarios.
spec/​workflow_reuse.py Reuses the audit module's shared abbreviated-revision helper for workflow report stamps.
spec/​audit.py Implements cached fetched-main resolution, dual-revision audit stamps, and shared revision formatting.
RESYNC.md Requires derived findings to quote the complete audit run stamp.
AUDIT.md Documents which revisions supply audit inputs and how those revisions are represented in run stamps.

Review effort: Lite

Comment thread spec/audit.py Resolved
Comment thread AUDIT.md Resolved
Comment thread spec/audit.py Resolved
ptr727 and others added 2 commits November 17, 2026 08:54
hub_head now names the checkout's HEAD with its -dirty suffix, and both
the audit run stamp and spec/workflow_reuse.py's report stamp call it.
The audit computes its stamp after the --issue usage check, so a usage
error no longer waits on a fetch of main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
hub_head now checks only the working-tree paths its caller reads,
untracked files included. The audit passes its spec, registry,
repo-config, and scripts trees, and workflow_reuse passes its two
workflow trees and the registry. AUDIT.md says the fetched main is the
field the stamp adds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 78.46%. Comparing base (7c082a0) to head (20667b6).
⚠️ Report is 4 commits behind head on develop.

Files with missing lines Patch % Lines
spec/audit.py 96.15% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4260      +/-   ##
===========================================
+ Coverage    78.20%   78.46%   +0.26%     
===========================================
  Files           42       42              
  Lines        15415    15434      +19     
===========================================
+ Hits         12055    12110      +55     
+ Misses        3360     3324      -36     
Flag Coverage Δ
python-3.13 78.46% <96.29%> (+0.26%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ptr727

ptr727 commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head f08a701343302bea8d7b1f4e4b0348b7ece1ff43, the content this pull request carries at that commit against develop, and it recorded 1 finding.

The report's numbers come from code under spec/ as well as from the
workflow trees and the registry. So an uncommitted edit there now marks
the report's hub stamp dirty too, and a test holds that caller's paths.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ptr727

ptr727 commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 20667b6fbd3a39d026ed8b8dc6a8ea3115ed36c3, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@ptr727

ptr727 commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@ptr727

ptr727 commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

/review

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ptr727
ptr727 merged commit 3bd10de into develop Nov 17, 2026
13 checks passed
@ptr727
ptr727 deleted the feature/audit-one-hub-commit-4238 branch November 17, 2026 17:26
ptr727 added a commit that referenced this pull request Nov 17, 2026
…trap Secret Restore (#4255)

## Summary

Promotes `develop` to `main`. It carries nine changes:

- [#4247](#4247): retires
the `CLAUDE.md` pointer file, the second half of #4074. The hub's copy
and its `spec/files.json` entry are gone, and a `retire` gap records
why. The audit now reports a retired path the hub no longer tracks. A
copy matching a past hub revision is reported for deletion, and any
other copy is reported for the maintainer. It merged on the maintainer's
go-ahead after reading its diff, which touches
`host-setup/agent-safety/README.md`.
- [#4256](#4256): that
match compares line endings alone, so a retired copy differing in an
action pin or a `needs:` list goes to the maintainer. It answers a
Copilot finding on this promotion.
- [#4260](#4260): the
audit run stamp names the commits it read. HEAD carries `-dirty` where
the read paths differ from it, and `main <sha>` is added where the
fetched `main` differs.
- [#4259](#4259):
`pr-review-conduct` states the `pr_review.py` spelling rule once for
every call a fleet skill prints. Under a restricted uv cache, a merge or
a branch delete is reported to the maintainer as a blocked write.
- [#4261](#4261):
`validate-task.yml` takes a `test-matrix-file` input, read through the
same validation as `test-matrix`.
- [#4257](#4257): the
pre-commit snippet says to exclude `hub_fetch_run.py` from a
repository's own ruff with `force-exclude = true`. The short-form
`AUDIT.md` snippet drops its two hub-audit authority sentences.
- [#4246](#4246):
`bootstrap.sh --secrets` and `bootstrap.ps1 -Secrets` restore named
secret buckets, on their own or as a step of a `--host` or `--dev`
stand-up.
- [#4250](#4250): `host-*`
buckets in `scripts/secrets_sync.py` may each hold the same
home-relative title.
- [#4258](#4258): a dry
run with no 1Password account is refused rather than enrolling one, and
the root-refused secrets tests skip on a root runner. It answers two
CodeRabbit findings on this promotion.

Hosts already carry the load-both setting the retirement relies on, from
the 2.0.1483 kit.

Closes #4074
Closes #4236
Closes #4238
Closes #4239
Closes #4242
Closes #4243
Closes #4248
Closes #4249

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants