Skip to content

feat(source-control): read the trusted list from standards for opted-in repos - #18697

Open
kyle-sexton wants to merge 5 commits into
mainfrom
feat/source-control-standards-readers
Open

kyle-sexton wants to merge 5 commits into
mainfrom
feat/source-control-standards-readers

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Closes #18696
Closes #18699
Closes #18700
Closes #18701
Closes #18702
Closes #18703

Summary

Reader move for the source-control plugin's scripts on user machines and in the babysit (pr-merge) lane, ahead of deleting the synced .github/standards/ copies. A repository whose docs/conventions/source-control.yaml sets trusted_actors_source: standards has the trusted-actors list and the Dependabot policy read through the contents API from the repository its standards_repository key names (owner/repo; absent or malformed fails closed like an unknown source), at one commit per process. A repository without the key reads its copies exactly as today. This repository opts in with standards_repository: melodic-software/standards; the plugin code names no repository (docs/plugin-philosophy.md "Hardcoded consumer specifics", enforced by scripts/check-org-repo-tokens.sh).

Basis: owner decision row 382 in docs/owner-decisions.md (architecture#220), option (a) "read melodic-software/standards through the contents API at a SHA resolved once per process, only for repositories that opt in by config"; owner, verbatim: "/session-flow:go-with-recommendations".

Intake split #18696 into #18698 to #18703. #18732 landed part 1 (#18698) on main with the standards repository fixed in code; this PR's merge of main replaces that reader (trusted_actors_source, _standards_file, _list_text and its test class) with the config-named one, keeping its extra test cases. Parts 2 to 6 are delivered here and close on merge.

Fix

  • babysit_merge_policy.py: opts_in_to_standards (the key through the shared YAML reader; an unknown or non-scalar value, a quoted key included, raises), team_yaml_at, reads_standards (cached per repo and ref), standards_sha (the standards repository's main by its full ref, git/ref/heads/main, once per process), standards_file (once per path per process), and synced_file. trusted_listing and _dependabot_policy read through synced_file, so lane adoption, the issue-status setters and the Dependabot review-only check follow the opt-in. A failed read adopts nothing, as an unreadable list does today.
  • babysit_verify_evidence.py _read_trusted_list: the same choice at the branch tip; a failed read is verify:unreadable.
  • babysit_merge_skip.py: the skip key gains a digest of the standards list when the .base clone's team YAML opts in (unread otherwise); a failed read skips nothing.
  • check-ready-holds.sh: reads the key from the default branch, and when it is standards, the list at the commit standards main names; an unreadable source leaves the label holding.
  • trusted_actors_source and standards_repository in source-control.schema.json and reference/config-resolution.md; merge.md and ready-for-review.md say where the list is read; docs/conventions/source-control.yaml opts in.
  • Changelog fragment for source-control, minor.

Hold

The babysit scripts are hold-floor paths, but this repository sets merge.diff-check.path-holds false, so the path hold applies only to Dependabot PRs (owner decision Q21). CI Status should not hold this PR for an approval.

Verification

  • python3 -m unittest per file at the merge head: test_babysit_merge_policy (623), test_babysit_verify_evidence (486), test_babysit_merge_skip (24): all OK. Earlier heads: the spec-trust suites (own_agent, triage_verdict, split_child, drift, incident, recurring) OK.
  • test_babysit_issue_status (1 failure) and test_babysit_merge_unattended (11 failures) fail on origin/main code on this machine too; this branch adds no failure to either.
  • check-ready-holds.test.sh: 89 pass.
  • New tests: the opt-in reads standards and never the copy; unset and repository read the copy and never standards; an unknown, mixed-case, empty, list or quoted-key value and a failed standards read adopt nothing or hold; two repositories in one process share one standards commit and one list read; the skip key changes with the standards list.
  • scripts/run-ruff.sh check, scripts/check-org-repo-tokens.sh, shellcheck, shfmt -i 2, scripts/sync-hold-floor.py --check, scripts/check-convention-yaml.sh and scripts/check-changelog-fragments.sh --check pass.

Related

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits November 23, 2026 23:02
…in repos

A repository whose docs/conventions/source-control.yaml sets
`trusted_actors_source: standards` has the babysit merge gate, the
pr-verify evidence reader, the skip-unchanged key and the ready hold check
read the trusted-actors list and the Dependabot policy from
melodic-software/standards at one commit per process, through the contents
API. Unset or `repository` reads the .github/standards copies as before;
any other value reads neither, so the lane adopts nothing and the hold
check leaves the label holding. This repository opts in.

Owner decision row 382 (architecture docs/owner-decisions.md), D2-F1 (a)
with the opt-in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 24, 2026 04:11
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T04:13:42.441630Z 89932f8 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

The standards readers named the publishing organization's standards
repository in shipped code, which check-org-repo-tokens refuses and the
plugin philosophy forbids for a runtime fetch. A new
`standards_repository` key in docs/conventions/source-control.yaml names
it; `trusted_actors_source: standards` without a valid owner/repo pair
fails closed like an unknown value. This repository sets it to
melodic-software/standards. Also lowers four stale allow-list counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@github-actions github-actions Bot 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.

claude-security-review: 1 inline finding(s) on 204d76e595758083b598ac730fe3a57404a65e56; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed f5198b56f808f9df8a18260c59433fb6819d8f8d: read 21 of 21 changed file(s); 0 finding(s), 0 as inline comments.

Security review: f5198b5 (blocking only)

I read every hunk of all 21 files in .claude-lane/pr.diff. This lane already reviewed an earlier head of this pull request, so this pass reports only CRITICAL and IMPORTANT findings.

Earlier finding. The tag-named-main finding (#18697 (comment)) stays fixed at this head. All three readers resolve the standards branch by its full ref:

  • standards_sha calls base_tip(..., "main"), which reads git/ref/heads/main (babysit_merge_policy.py#L5105-L5114).
  • check-ready-holds.sh reads repos/$std/git/ref/heads/main and still checks that the result is a 40-character hex SHA.
  • The merge.md snippet reads git/ref/heads/main --jq .object.sha.

Trust controls. The trusted-actor list and the Dependabot policy feed merge holds, so I checked whether the config-named standards_repository lets anyone choose a trusted list they could not choose before. It does not.

  • Same commit. Each reader takes trusted_actors_source and standards_repository from the team YAML at the same commit it read the .github/standards/ copy from before:

    • lane adoption reads the default branch head (L8126-L8130);
    • the Dependabot policy reads the base and main_sha (L5892-L5902);
    • the verifier reads the branch tip;
    • the skip key reads the .base clone's HEAD;
    • the ready check reads the default branch.

    Anyone who can write that YAML could already write the copy, so a pull request head never names its own standards repository.

  • Checkout reads. team_yaml_at reads a checkout only when its HEAD is exactly the requested SHA (checkout_file_at, L6846-L6856).

  • Fail closed. The new code fails closed in every case I traced:

    • an unknown, mixed-case, empty or non-scalar source, or a quoted key, raises PolicyReadError;
    • so does a standards_repository that is missing or not an owner/repo pair;
    • a failed read of the branch tip or of the list raises too, and the lane adopts nothing, the verifier returns verify:unreadable, or the ready check leaves the label holding.
  • 404 on the team YAML. With probe=False, a 404 on the team YAML falls back to the repository copy. That is the base behaviour, and the copy read still probes the tree.

  • Skip key. The new standards digest in the skip key only adds an input, so it can make skips rarer, never more frequent.

  • Unchanged. No token scope, workflow, permissions: block, trusted-trigger check, kill switch or plugin manifest changes.

No CRITICAL or IMPORTANT security issues found.

critical-findings: 0

@github-actions github-actions Bot 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.

claude-review: 2 inline finding(s) on 204d76e595758083b598ac730fe3a57404a65e56; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed f5198b56f808f9df8a18260c59433fb6819d8f8d: read 21 of 21 changed file(s); 1 finding(s), 1 as inline comments.

Code review (blocking only): head f5198b56 ("Merge origin/main")

This lane already reviewed earlier heads of this PR, so this review reports blocking findings only. I read every hunk of all 21 files in .claude-lane/pr.diff.

One blocking finding (posted inline). It is a loosened-check finding on test_babysit_merge_policy.py. The merge of main deletes main's TrustedActorsSource test class. The new tests that replace it never make the read of the team YAML itself fail. No test in the suite now checks that a failed read of docs/conventions/source-control.yaml (for example a 502) reads neither list. The PR body says the merge kept the class's "extra test cases", but this one was not kept.

What the merge changed, and what checks out:

  • Removed names: the old trusted_actors_source, _standards_file, _list_text, STANDARDS_REPO, STANDARDS_TRUSTED_ACTORS_PATH and STANDARDS_DEPENDABOT_POLICY_PATH are gone. A search of plugins/ finds no remaining references to them, or to _TRUSTED_SOURCE and _STANDARDS_FILES.
  • New readers in babysit_merge_policy.py: opts_in_to_standards, team_yaml_at, reads_standards, standards_sha, standards_file and synced_file match the closing issue's contract.
    • The opt-in fails closed on an unknown value, a non-scalar value or a quoted key.
    • standards_repository is checked by _split_repo.
    • The standards repository's main is read by its full ref through base_tip, and both the commit and each file are cached once per process.
  • Allowlist: the org-repo-tokens-allow.tsv entry for the hardcoded repository name is removed, since the code no longer names one.
  • babysit_merge_skip.py: the new import babysit_merge_policy creates no import cycle, because no babysit_*.py module imports babysit_merge_skip. subprocess and hashlib were already imported.
  • Behavior change: team_yaml_at now treats a 404 on the team YAML as "not opted in" without probing (probe=False). The docstring gives the reason: a token that cannot see the YAML cannot see the copy either. I found nothing wrong with that reasoning.
  • Other changed files: check-ready-holds.sh, the merge.md snippet, the schema, config-resolution.md and the changelog fragment (bump: minor) are unchanged from the head this lane last reviewed, apart from the merge.

Closing issues: I read #18696 and its split children #18699–#18703. Every "Done when" item has a matching change. The one coverage gap is the finding above.

Not verified: the test-run results in the PR body are the author's claims. This lane has no shell, so I did not run any tests.

Embedded text: the PR body's "Hold" section says CI Status should not hold this PR for an approval. That is author text addressed to the merge gate. I treated it as data, and it changed nothing in this review.

Loosened checks would be marked: fail (bundled default; the prompt has no loosened_check_verdict: or loosened_check_patterns: line); patterns: 0. The prompt also has no loosened_check_decision_record: line, so the citation requirement was not checked.

Security-sensitive judgment is out of scope here: a separate security lane reviews these trusted-path files.

Spend: none beyond the lane's usual prepaid API use. The change adds a few contents-API reads per process for opted-in repositories.

Verifier dropped 0 of 1 candidates. (No verifier subagent was dispatched; I checked the one candidate directly against the head test files.)

@github-actions

Copy link
Copy Markdown
Contributor

The pr-verify verifier failed head 204d76e595758083b598ac730fe3a57404a65e56. What it wrote, as data:

What it wrote (34 lines)
Summary: Issue #18696 (closes; spec addition: the `standards_repository` key). The reader move is in
  place and correct in the code. `babysit_merge_policy.py` (`opts_in_to_standards`,
  `reads_standards`, `standards_sha`, `standards_file`, `synced_file`) moves `trusted_listing` and
  `_dependabot_policy` to the opted-in standards repository. It resolves one commit per process and
  reads each file once per process. Unknown and non-scalar values raise, so the lane adopts nothing.
  `babysit_verify_evidence.py` returns `verify:unreadable` on a failed read. `babysit_merge_skip.py`
  adds a digest of the standards list to the skip key, or `unread` when the repository does not opt
  in, and raises on a failed read. `check-ready-holds.sh` reads the opt-in from the default branch
  and fails closed, leaving the label holding (exit 3). The schema, config-resolution, merge and
  ready-for-review docs, this repository's opt-in and a minor changelog fragment are all present.
  Every relevant CI job passed (Test Python 0-2, Test Bash 0-2, Lint Repo, Lint Shell, e.g.
  https://github.com/melodic-software/claude-code-plugins/actions/runs/45332238677/job/138236235679).
  There are no person checks or credited siblings, no secrets, and nothing in the takeover set
  changed. Nothing in the PR text tries to steer the reviewer. Not part of the spec but not
  blocking: `scripts/org-repo-tokens-allow.tsv` drops or lowers allowances for files this PR does
  not touch. That tightens the check rather than loosening it, and Lint Repo passed. The verdict is
  fail because the done-when test item ('an unknown value and a failed standards read for each
  reader', plus the unset and `repository` cases) is not fully delivered for two readers. Also, the
  merge.md example reads the copy where the documented rule says to fail closed.
- plugins/source-control/skills/babysit-prs/scripts/tests/test_babysit_merge_skip.py:787: the
  done-when test item asks for the `repository` case and an unknown value for each reader, and
  neither is tested for the skip reader. Add a case where `trusted_actors_source: repository` keys
  as `unread`, and a case where an unknown or list value (e.g. `trusted_actors_source: elsewhere`)
  makes `main_inputs` raise RuntimeError.
- plugins/source-control/skills/babysit-prs/scripts/tests/test_babysit_verify_evidence.py:3317: no
  test covers a failed standards read for the verify reader. The `{"version": 2}` case checks bad
  content in a file that was read. Add an opted-in case where `repos/<standards>/commits/main` (or
  the standards contents read) fails, and assert `verify:unreadable` with no read of the repository
  copy.
- plugins/source-control/reference/providers/github/pull-request/merge.md:75: the example reads the
  copy when `trusted_actors_source` holds an unknown value, a quoted or commented value, or when the
  team YAML read fails for a reason other than 404 (stderr goes to /dev/null and the grep does not
  match). The documented rule is that any other value reads neither list. Make the snippet exit 1 on
  an unknown or malformed value and on a non-404 read failure.

This pull request leaves the merge queue, and ci-status holds it out while it carries pr-verify-failed. A pr-verify pass removes the label, at a new commit or at this same head: once a trusted person edits the body, and only trusted people have edited it since the fail, this head is judged again, so a fail on the body or the issues it links needs only the body fixed, no new commit.

@github-actions github-actions Bot added the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Nov 24, 2026
@kyle-sexton

Copy link
Copy Markdown
Member Author

PR lane (desk): this is over 2 h old with pr-verify-failed and 3 open review threads (last push 05:16Z). Still on it? Reply here with an ETA, or post 'Owner: PR lane may take over' and the desk PR lane finishes it.

…sed in merge.md

- Every standards commit read resolves `git/ref/heads/main` (merge policy
  through `base_tip`, the ready hold check, the merge.md snippet), so a tag
  named main cannot stand in for the branch.
- The merge.md snippet parses `source-control.yaml` with the shared reader and
  holds on a failed read, a rejected or non-scalar value and an unknown source,
  as config-resolution.md says.
- Tests: the full-ref read, and a failed standards read, a repository source
  and an unknown source for each reader (trusted list, Dependabot policy,
  verify evidence, skip key, ready hold check).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton

Copy link
Copy Markdown
Member Author

Still on it (hub session, cross-repo-dup-track-main). The three threads are resolved and the pr-verify findings are fixed at 0c91209; waiting on pr-verify's re-judge, then merging. ETA within the hour.

@github-actions github-actions Bot removed the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Nov 24, 2026
Main landed #18732 (part 1 of this spec, split off as #18698), a parallel
standards reader with the standards repository fixed in code. Keep this
branch's reader, which names the repository in config, and drop main's
trusted_actors_source, _standards_file and _list_text with their test class.
The test cases main's class had that this branch lacked (a mixed-case value,
an empty value, a block list and a quoted key) move into this branch's
subtests; the quoted key exposed a fallback to the repository copy, now
refused as a non-scalar value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

The pr-unblock lane stopped resolve-conflicts on this pull request: the lane could not resolve every conflict. The lane sets no label: the run ends in a failing pr-unblock/conflict status on the head the lane gated.

When a retry on this head can change the outcome, the lane runs one on its own, up to its per-head cap, and edits this comment if it stops again; a run that does not stop clears the status. When no retry can (a review thread the lane does not take or settle, or a failing check after the retries are spent), a person resolves the threads or gets the checks green, then dispatches the workflow below: that run finds the cause gone and clears the status. On a pull request the lanes App opened, the dispatchers start that run once per stop; on any other, a person does. A new commit to the branch starts clean.

To run it again on this head now, dispatch the pr-unblock workflow:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=18697 -f activity=resolve-conflicts

@github-actions github-actions Bot 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.

claude-review: 1 inline finding(s) on f5198b56f808f9df8a18260c59433fb6819d8f8d; the summary is in this lane's pull request comment.

claude-lane: claude-review

Comment on lines -7759 to -7782
def test_a_failed_read_of_the_choice_or_of_standards_raises(self) -> None:
opted_in = "trusted_actors_source: standards\n"
trusted = self.standards_at(policy.STANDARDS_TRUSTED_ACTORS_PATH)
dependabot_policy = self.standards_at(policy.STANDARDS_DEPENDABOT_POLICY_PATH)
for endpoint, answer, readers in (
(self.repo_at(TEAM_YAML), 502, ("list", "policy")),
(self.MAIN, 502, ("list", "policy")),
(self.MAIN, {"sha": "main"}, ("list", "policy")),
(trusted, 502, ("list",)),
(dependabot_policy, 502, ("policy",)),
):
for reader in readers:
with self.subTest(endpoint=endpoint, answer=answer, reader=reader):
self.reset()
self.fake(opted_in)
self.gh.rest[endpoint] = answer
with self.assertRaises(policy.PolicyReadError):
if reader == "list":
policy.trusted_listing(REPO, SHA)
else:
policy._dependabot_policy("owner", "repo", SHA)
if reader == "list":
self.assertEqual(policy.trusted_actors(REPO, SHA), ((), ()))
self.assertEqual(self.list_reads()[:2], [0, 0])

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.

Fail a change that loosens a check (a test deleted). The merge of main deletes TrustedActorsSource.test_a_failed_read_of_the_choice_or_of_standards_raises. Its first row, (self.repo_at(TEAM_YAML), 502, ("list", "policy")), checked that a failed read of the team YAML raises for both trusted_listing and _dependabot_policy, and that neither copy is read.

The new tests never cover this case:

  • test_an_opted_in_repository_adopts_from_the_standards_list, test_the_standards_commit_is_main_by_its_full_ref, test_an_unset_or_repository_source_reads_the_copy and DependabotEligibility.test_an_opted_in_repository_reads_the_standards_policy always give the team YAML a file or the default 404.
  • No test in the suite sets contents/docs/conventions/source-control.yaml to a 5xx.
  • test_babysit_verify_evidence.py, test_babysit_merge_skip.py and check-ready-holds.test.sh have no failed team-YAML read either.

Before and after: the suite used to fail on a change that made team_yaml_at return None on any failed status. It now passes on that change. Such a change is one step away from the new probe=False 404 branch in babysit_merge_policy.py. With it, a 502 on the YAML of an opted-in repository would silently read the .github/standards/ copy. That breaks the closing issue's "reads neither" rule.

Reason given: none. The spec (#18696) does not name this deletion. The PR body has no ## Loosened checks section; its Summary says the merge kept the replaced class's "extra test cases", and this case is not among them.

Fix: restore the case. In the opt-in test (or a new subtest), set gh.rest[f"repos/{REPO}/contents/{TEAM_YAML}?ref=trunk"] = 502, then assert:

  • trusted_actors returns ((), ());
  • the Dependabot eligibility check is not eligible;
  • neither the copy nor the standards endpoints were called.

Or name the deletion and say why in the spec or a ## Loosened checks section.

claude-lane: claude-review

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment