Repository navigation
refactor(sections)!: one helper per repeated concept; the snapshot notes teams and collaborators leave out use the shared template - #212
Conversation
… the check-drift scenarios pin the public-key GET as never issued
…e; the one-caller email note is inlined
File size check0 over a hard cap (fails), 8 warning(s).
Split the file, wrap the line, shorten or exempt the comment, or list the path in 4 managed file(s) skipped; repo-platform owns them. |
There was a problem hiding this comment.
🟢 Approval recommended
The shared rendering changes preserve intended behavior and are covered by updated unit, snapshot, and e2e expectations.
Pull request overview
Centralizes repeated section diagnostics while documenting the resulting breaking message changes.
Changes:
- Adds shared helpers for missing resources, unreadable secrets, role snapshots, and organization-owner probes.
- Standardizes snapshot and drift messages across affected sections.
- Updates unit tests, e2e scenarios, and generated documentation.
File summaries
| File | Description |
|---|---|
test/sections/snapshot-rows/teams.ts |
Updates team snapshot note. |
test/sections/snapshot-rows/collaborators.ts |
Updates collaborator snapshot notes. |
test/scripts/changed-sections.test.ts |
Adds org-owner fan-out coverage. |
test/engine/snapshot.test.ts |
Updates personal-account expectation. |
test/e2e/scenarios/snapshot-unsupported-and-denied.yml |
Wraps scenario description. |
test/e2e/scenarios/snapshot-dir-multi-repo.yml |
Wraps scenario description. |
test/e2e/scenarios/multi-contents-denied.yml |
Wraps expected output. |
src/sections/workflows/scenarios/workflows-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/webhooks/scenarios/webhooks-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/teams/teams.test.ts |
Updates standardized note assertions. |
src/sections/teams/teams.docs.yml |
Updates snapshot terminology. |
src/sections/teams/scenarios/teams-snapshot-roundtrip.yml |
Updates scenario prose and output. |
src/sections/teams/index.ts |
Uses shared owner, role, and snapshot helpers. |
src/sections/shared/variables-engine.ts |
Uses shared missing-drift rendering. |
src/sections/shared/snapshot-helpers.ts |
Adds unreadable-secret note helper. |
src/sections/shared/secrets-engine.ts |
Uses shared missing-drift rendering. |
src/sections/shared/roles.ts |
Adds shared role snapshot handling. |
src/sections/shared/repo-secrets.ts |
Uses unreadable-secret note helper. |
src/sections/shared/org-owner.ts |
Adds shared organization-owner probe handling. |
src/sections/shared/list-section.ts |
Uses shared drift and secret-note helpers. |
src/sections/secret_scanning_custom_patterns/scenarios/secret-scanning-custom-patterns-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/secret_scanning_custom_patterns/index.ts |
Uses shared value and missing drift helpers. |
src/sections/rulesets/scenarios/rulesets-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/rulesets/scenarios/rulesets-snapshot-bypass-hidden.yml |
Wraps scenario description. |
src/sections/repository/scenarios/repository-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/repository/index.ts |
Uses shared value and verification notes. |
src/sections/pages/scenarios/pages-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/milestones/scenarios/milestones-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/labels/scenarios/labels-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/interaction_limits/scenarios/interaction-limits-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/interaction_limits/interaction_limits.test.ts |
Updates verification-note assertion. |
src/sections/interaction_limits/interaction_limits.docs.yml |
Updates snapshot terminology. |
src/sections/interaction_limits/index.ts |
Uses shared verification and omission helpers. |
src/sections/environments/snapshot.ts |
Uses unreadable-secret note helper. |
src/sections/environments/protection-rules.ts |
Uses shared missing-drift rendering. |
src/sections/environments/index.ts |
Uses shared missing-drift rendering. |
src/sections/environments/branch-policies.ts |
Uses shared missing-drift rendering. |
src/sections/deploy_keys/scenarios/deploy-keys-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/dependabot_secrets/scenarios/dependabot-secrets-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/dependabot_secrets/scenarios/dependabot-secrets-check-drift.yml |
Verifies check mode skips key reads. |
src/sections/dependabot_secrets/dependabot_secrets.docs.yml |
Documents apply-time key reads. |
src/sections/custom_properties/scenarios/custom-properties-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/custom_properties/scenarios/custom-properties-personal-account.yml |
Updates personal-account output. |
src/sections/custom_properties/index.ts |
Uses shared owner and value helpers. |
src/sections/custom_properties/custom_properties.test.ts |
Updates personal-account assertion. |
src/sections/contract/module.ts |
Adds shared missing-drift helper. |
src/sections/collaborators/scenarios/collaborators-snapshot-roundtrip.yml |
Updates snapshot-note outputs. |
src/sections/collaborators/scenarios/collaborators-snapshot-expired-invitation.yml |
Updates expired-invitation note. |
src/sections/collaborators/index.ts |
Uses shared role and omission helpers. |
src/sections/collaborators/collaborators.test.ts |
Updates standardized note assertions. |
src/sections/collaborators/collaborators.docs.yml |
Updates snapshot terminology. |
src/sections/codespaces_secrets/scenarios/codespaces-secrets-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/codespaces_secrets/scenarios/codespaces-secrets-check-drift.yml |
Verifies check mode skips key reads. |
src/sections/codespaces_secrets/codespaces_secrets.docs.yml |
Documents apply-time key reads. |
src/sections/code_scanning_default_setup/scenarios/code-scanning-default-setup-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/code_quality_setup/scenarios/code-quality-setup-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/branches/scenarios/branches-missing-branch-no-contents-apply-warn-fails.yml |
Wraps expected error output. |
src/sections/branches/scenarios/branches-missing-branch-no-contents-apply-fails.yml |
Wraps expected error output. |
src/sections/autolinks/scenarios/autolinks-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/agents_variables/scenarios/agents-variables-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/agents_secrets/scenarios/agents-secrets-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/agents_secrets/scenarios/agents-secrets-check-drift.yml |
Verifies check mode skips key reads. |
src/sections/agents_secrets/agents_secrets.docs.yml |
Documents apply-time key reads. |
src/sections/actions/scenarios/actions-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/actions_variables/scenarios/actions-variables-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/actions_secrets/scenarios/actions-secrets-snapshot-roundtrip.yml |
Wraps scenario description. |
src/sections/actions_secrets/scenarios/actions-secrets-check-drift.yml |
Verifies check mode skips key reads. |
src/sections/actions_secrets/actions_secrets.docs.yml |
Documents apply-time key reads. |
docs/upgrading/v2-to-v3.md |
Documents breaking wording changes. |
docs/reference/sections.md |
Updates generated section reference. |
docs/reference/secrets-and-vaults.md |
Documents apply-time sealing-key reads. |
COVERAGE.md |
Updates coverage and behavior documentation. |
Review details
- Files reviewed: 72/72 changed files
- Comments generated: 0
- Review effort level: Balanced (auto)
Note
Copilot is running an experiment and ran this review at Balanced.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟢 Approval recommended
The shared helpers preserve existing behavior where required, and intentional output changes are comprehensively tested and documented.
Review details
- Files reviewed: 72/72 changed files
- Comments generated: 0 new
- Review effort level: Balanced (auto)
Note
Copilot is running an experiment and ran this review at Balanced.
Before / after
What changed
Every repeated line in
src/sectionsrenders through one helper: the missing-drift line, the unreadable-secret note, the role no declaration plans as, the personal-account probe, and the cannot-verify, left-out, and field-drift templates on the sites #202 had not reached (three field-drift lines whose suffixes do not fit the four-argumentvalueDriftstay bespoke: the OIDC claim-key order note in actions/index.ts, the subsetDiff delta with recreate remedies in list-section.ts, and the workflow state line with its raw annotation in workflows/index.ts; the contract-tightening task decides their shape); the four bespoke sections say in their header why they are not onlistSection.Behavior changes
Each has a row in docs/upgrading/v2-to-v3.md section 13 (the section number may shift if another break lands first):
<label>: left out of the snapshot - <reason>; the email invitation is labelledcollaborators[invitation <id>].interaction_limits.expiryand the repository toggles GitHub cannot read back use the cannot-verify template.teamsorcustom_propertiesreads<section>: owner "o" is a personal account, not an organization, so this section does not apply(the plan adds the skip suffix).Proof
bun run checkclean),bun run test:e2e260/260 afterbun .github/scripts/trim-openapi.ts; the harness below classifies every main-vs-head difference (0 unclassified).missingDrift+12 (module.ts) retires 7 one-line literals, but its 8 call sites format over 2-3 lines each: about +6 net. Kept for one spelling of a line nine sites render.unreadableSecretNote+8 retires 3 literals of 1-2 lines each: about +3 net. Same reason.readBackPermission+27 (roles.ts) retires the two copies of the role rule (collaborators 9 lines, teams 6): about +12 net, 12 of the added lines its doc comment. The one place the throw-versus-note decision lives.ORG_PROBE+personalAccountNote+33 (org-owner.ts) retire two 6-line probe decls, two personal-account templates, and four probe branches: about -2 in the two sections, +33 in the new file. The one wording for the owner probe both sections declare.cannotVerifyNote,leftOutOfSnapshot,valueDriftconversions (existing helpers): +40 across interaction_limits, repository, teams, collaborators, secret_scanning, environments, and the engines, every one a literal becoming a formatted call.The count measures formatting, not text. Three sources make the whole of the growth: the two new files (+60 outside their doc comments), 29 lines of doc comments, and the import-block reflow (+42 -11 = +31, one name per line once a block passes the formatter's width); the section bodies themselves are -13. The owner keeps every helper shared and the headers; the remaining candidate is doc-comment lines that restate the code, folded as a new commit if the gate names any.
Technical details
Base: main at 5dfc10a (#207).
Helpers and their callers
missingDrift(contract/module.ts)where: "enabled on the environment", ownaction), secret_scanning, list-section, the secrets and variables enginesunreadableSecretNote(shared/snapshot-helpers.ts)readBackPermission(shared/roles.ts)ORG_PROBE,personalAccountNote(shared/org-owner.ts)primaryRead: { notFound: "absent" }; teams' list is its primary read)cannotVerifyNote(existing)leftOutOfSnapshot(existing)valueDrift(existing)Harness (main at 5dfc10a vs this head, same inputs, same matrix as #202): 9268 leaves compared, 24 differing, 0 unclassified; all 24 are the left-out phrase on teams and collaborators snapshot notes. interaction_limits and repository sit outside the harness matrix; their unit tests pin the two cannot-verify lines and the drift lines.
Line accounting (production src = src/** minus *.test.ts, mock.ts, scenarios, docs.yml; against main at 5dfc10a):
src/sections/collaborators/index.tssrc/sections/teams/index.tssrc/sections/environments/snapshot.tssrc/sections/shared/repo-secrets.ts,shared/secrets-engine.ts,shared/variables-engine.tssrc/sections/custom_properties/index.tssrc/sections/secret_scanning_custom_patterns/index.tssrc/sections/environments/index.tssrc/sections/environments/branch-policies.tssrc/sections/shared/list-section.tssrc/sections/environments/protection-rules.ts,interaction_limits/index.ts,shared/snapshot-helpers.tssrc/sections/contract/module.tsmissingDrift)src/sections/repository/index.tsvalueDriftcalls and onecannotVerifyNote, each over several lines)src/sections/shared/roles.tsreadBackPermission)src/sections/shared/org-owner.tsORG_PROBE,personalAccountNote)The conversions replace one-line template literals (many over 150 characters) with formatted calls, so the line count rises; the two new files carry the two concepts that had no home (the role rule, the owner probe), and 34 of the added lines are their doc comments. The owner refused the trims that would un-share a helper (keeping only
ORG_PROBEshared, two local copies of the role rule) and keeps the header sentences; doc-comment lines that restate the code are the one remaining candidate, folded as a new commit if the gate names any.Small fixes on the way: cd8b835
style(scenarios): fold descriptions over the 256 capfolds every scenario line over 256 columns into a>-block (30 lines: 27 descriptions, the three named in the #202 integration review among them, and three longstdout_containsitems in the branches and multi-contents-denied scenarios); no yml width gate exists, and none is added here. The four repo-family check-drift scenarios pinGET .../secrets/public-keyundernever:, so check-mode purity is pinned at the e2e level too; the four secrets docs.yml cells and coverage notes say the key is read at apply, and docs/reference/secrets-and-vaults.md says so in one sentence. custom-properties-personal-account pins the new note text. Three docs.yml phrasings ("noted, not declared") read "left out with a note".Codex rubber-duck review: round 1 (the fold and helpers commits): 0 blocking, 2 non-blocking (
personalAccountNotetookprobe: object; collaborators kept a one-calleremailInvitationNote), both folded as faa7fad. Round 2 (the secrets docs commit and the fold): 0/1 (three docs.yml lines over 100 columns), wrapped as a fourth commit. Round 3 (the wrap): 0/0. Lead gate review at 58d36de: 0 blocking, 5 non-blocking, folded as the sixth commit (org-owner.ts keeps one doc comment) and these body edits (the three bespokevalueDriftsurvivors named, the import reflow named as a growth source).Out-of-territory edits: test/scripts/changed-sections.test.ts pins the new shared file's fan-out (
org-owner.ts-> custom_properties, teams), the same one-line pin #202 was granted for list-section.ts.Recorded, not built: a yml width gate for the scenario corpus.
BEGIN_COMMIT_OVERRIDE
refactor(sections)!: one helper per repeated concept; the snapshot notes teams and collaborators leave out use the shared template
BREAKING CHANGE: the teams, collaborators, and inherited interaction-limit snapshot notes read
<label>: left out of the snapshot - <reason>; the interaction_limits.expiry and repository toggle notes use the cannot-verify template; a personal account under teams or custom_properties reads one note (docs/upgrading/v2-to-v3.md section 13).END_COMMIT_OVERRIDE