Repository navigation
Deepen the Trusted account rule behind its own module - #864
Merged
Merged
Conversation
The rule moves out of the GitHub adapter into src/trust.rs, over a four-read Reads interface the adapter implements, so each edge case is tested in memory. Integration tests that only varied the rule give way to those unit tests; each caller's wiring and the adapter's reading stay, with edit history now read past its first page in a test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An unreadable edit after the first untrusted one failed the whole check once edits were parsed up front; main returned the untrusted verdict. Reads::edits now yields each edit as the rule reaches it. The Spec run's wiring test for its Spec's labelling is back, and a ready labelling with no actor is read through the GitHub adapter in a test again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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
The Trusted account rule moves out of the GitHub adapter and into a domain
trustmodule. The module reads GitHub only through a four-readReadsinterface. What users see does not change.The four callers now call the module with
&GitHub::new():GitHubAndOrigin's ownReads::issue_trustforwards to the module.start_ticket.no_untrusted_edit_since.docs/code-navigation.mdpoints at the new owner.Seams under test:
trust's three checks, over an in-memoryReads.ghfake.Evidence
The integration tests that only varied the rule are replaced by inline unit tests at
src/trust.rs. These cover every case the issue lists:Integration tests kept or added:
The review's C1 finding came with a test:
an_untrusted_edit_is_found_before_a_later_edit_with_no_time.Before (first commit, edits parsed up front):
test an_untrusted_edit_is_found_before_a_later_edit_with_no_time ... FAILEDAfter (each edit read as the rule reaches it):
... okFinal:
cargo test: 50 test binaries with no failures, including 1,089 unit tests (2 ignored).cargo fmt --checkandcargo clippy --all-targetsare clean.Merge Danger
Door: two-way
The rule's verdicts, messages and
ghtraffic are unchanged, except that the trusted-login cache now lasts a whole check rather than one edit scan. This saves repeat membership reads, as the issue decided.Blast Radius: security-gate
If the move were wrong, an untrusted issue could start work, or trusted work could stop. The unit tests pin each verdict, and each caller keeps a wiring test.
Unaddressed findings
Standards
src/trust.rstests. Declined. The issue requires them: "The rule's order and laziness are kept … A login once found trusted is not looked up again within one check", and the unit-test list includes "no repeated membership read for the same login". The reads areghAPI calls, so they are part of the interface the tests check.Actionas a Mysterious Name. Declined. It is the issue's "each with an optional actor and a time", shared by labellings and edits. The doc comment atsrc/trust.rs(/// A ready-for-agent labelling or an edit of an issue: the account that made it, if GitHub still knows it, and when.) says what it holds. No GLOSSARY term fits better.trusted: Vec<(String, String)>keyed by repository. Declined. The reviewer rated it low priority. Keying by repository keeps the cache sound if a Ticket and its Spec were ever in different repositories, at the cost of one comparison.ready_labels_are_read_from_label_events_and_their_actors_trusted_by_membership), where how GitHub is read is the behaviour under test.The rest of finding 8 was addressed: a null-actor labelling is now read through the adapter, and the restored Spec run test sends an edit dated before the labelling through the adapter.
Spec
since = None, which onlyticket_trustuses when neither the Ticket nor its Spec has a trusted labelling, an edit whose time is missing now fails the check. Main never read times in that case. Declined. The issue'sReadsgives "the issue's edits of oneIssueText, each with an optional actor and a time", and GitHub's schema makeseditedAtandcreatedAtnon-null. The case the finding tested is fixed (see Evidence).Security
None. The Security review traced the moved rule in
src/trust.rsand the adapter reads insrc/github/trust.rsagainstmain. It found no boundary the change opens: the order of checks, the owner shortcut, how an unknown actor is handled, the per-repository cache of trusted logins, and failing closed on errors all matchmain.Security review outcome
No unaddressed introduced findings.
Review coverage
Both reviewers read all 14 changed files at
c05ed62, and no generated output was excluded. The fix commitab6fac9(written after the review) changessrc/trust.rs,src/github/trust.rs,tests/pickup_run.rsandtests/spec_run.rs. The review did not read that commit's changes.Closes #862
🤖 Generated with Claude Code
Built with claude · claude-opus-5-5 · medium