Repository navigation
feat(snapshot): repository, actions, and rulesets read back - #143
Conversation
9beb462 to
6673eba
Compare
File size check0 over a hard cap (fails), 2 warning(s).
Split the file, wrap the line, shorten or exempt the comment, or list the path in 5 managed file(s) skipped; repo-platform owns them. |
9a6d86b to
15b7cc5
Compare
e295b26 to
f22528c
Compare
0ac317b to
2a92e5b
Compare
f22528c to
854be94
Compare
854be94 to
f404aa3
Compare
d8284c2 to
c2332ba
Compare
f404aa3 to
601ab1f
Compare
fd5c230 to
da2af61
Compare
601ab1f to
c6a2fcd
Compare
c6a2fcd to
88d2126
Compare
There was a problem hiding this comment.
🟡 Changes recommended
A denied cache-limit read currently discards another cache limit that was read successfully.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds snapshot read-back support for repository settings, Actions settings, and rulesets.
Changes:
- Implements section-specific snapshot projections and permission-denial notes.
- Adds round-trip, unit, and section-selection tests.
- Updates generated coverage documentation.
File summaries
| File | Description |
|---|---|
src/sections/repository/index.ts |
Implements repository snapshot projection. |
src/sections/repository/repository.test.ts |
Tests repository snapshot behavior. |
src/sections/repository/repository.docs.yml |
Documents repository snapshots. |
src/sections/actions/index.ts |
Implements Actions snapshot routing. |
src/sections/actions/actions.test.ts |
Tests Actions snapshot behavior. |
src/sections/actions/actions.docs.yml |
Documents Actions snapshots. |
src/sections/rulesets/index.ts |
Implements ruleset snapshots. |
src/sections/rulesets/rulesets.test.ts |
Tests ruleset snapshot behavior. |
src/sections/rulesets/rulesets.docs.yml |
Documents ruleset snapshots. |
src/sections/shared/snapshot-helpers.ts |
Adjusts shared helper visibility documentation. |
test/sections/snapshot-rows/repository.ts |
Adds repository round-trip fixture. |
test/sections/snapshot-rows/actions.ts |
Adds Actions round-trip fixture. |
test/sections/snapshot-rows/rulesets.ts |
Adds ruleset round-trip fixture. |
test/engine/snapshot.test.ts |
Updates supported-section expectations. |
test/scripts/changed-sections.test.ts |
Updates snapshot-helper fan-out expectations. |
COVERAGE.md |
Records the new snapshot coverage. |
Review details
- Files reviewed: 16/16 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
88d2126 to
4b4929d
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Ambiguous toggle denials can produce destructive false values, and partial ruleset snapshots can erase hidden bypass actors.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 16/16 changed files
- Comments generated: 2
- Review effort level: Balanced
4b4929d to
92f0eee
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Ruleset omissions can produce a contradictory rendered message claiming that no rulesets exist.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 16/16 changed files
- Comments generated: 1
- Review effort level: Balanced
92f0eee to
a8c58e0
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The snapshot implementations handle unsafe or unreadable state conservatively and are supported by focused unit and round-trip tests.
Review details
- Files reviewed: 16/16 changed files
- Comments generated: 0 new
- Review effort level: Balanced
a8c58e0 to
65e023b
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Cache policy denials currently produce incorrect permission-remediation guidance.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
src/sections/actions/index.ts:336
- An organization-managed cache limit is reported as a missing token grant. For example, when
GET /actions/cache/retention-limitreturns the documented policy 403, this emits "To fix, grant Administration write" even if that grant is already present and cannot override the policy. Add the org/enterprise-managed-policy caveat to both cache GET errors (for example via their endpoint denial hints) so the snapshot gives actionable advice.
- Files reviewed: 21/21 changed files
- Comments generated: 0 new
- Review effort level: Balanced
The three bespoke sections gain snapshot(): repository reads back the documented PATCH fields (an allowlist pinned to the octokit PATCH body type, since the passthrough slice cannot tell server fields apart; name and null fields are left out), topics, every readable toggle, and the two GraphQL keys, noting Git LFS, an owner-enforced toggle, and any denied sub-read; actions reads every endpoint back onto its key through the routing table (each routed destination now carries its own snapshot), with a denied sub-read a note naming the key and the allowlist read only under the selected policy; rulesets reads repository-owned rulesets back as keep entries, noting an inherited ruleset and an invisible bypass_actors instead of claiming an empty list. The round-trip harness fake now dispatches GraphQL onto the mock's GraphQL handlers, which the repository row (and the GraphQL-reading sections still to come) needs; the engine test's supported-section pins and the changed-sections fan-out canary follow the new snapshot() declarations and import edges.
… tests, and table the repository snapshot rules
…ep wrapper end to end
…out of the exception table, and order the allowlist outcomes by registry
5a81eef to
d5c7d7f
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Enabled automated security fixes return a 204/null response that the new snapshot path currently rejects.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 22/22 changed files
- Comments generated: 1
- Review effort level: Balanced
What this adds
A
mode: snapshotrun of the seeded mock repository now reads these three sections back (excerpt of the rendered file):bypass_actorsthe token cannot see is left out (kept undeclared) with a note, and two live rulesets under one name refuse the snapshot naming both.test/sections/snapshot-rows/, and each section's*-snapshot-roundtrip.ymlscenario runsmode: snapshotend to end, then feeds the written file back to a check run against the same seeded state (snapshot_converges: true), which must read clean.Proof
rulesets-snapshot-bypass-hidden, the read-grade token case that writes the empty keep wrapper; corpus pin 315 -> 323, since a snapshot scenario counts its settings and its expected snapshot), 13 section unit tests (denied sub-read notes, hidden bypass list, dropped server fields, unreadable GraphQL value, duplicate live names);bun run checkgreen (3213 tests);bun run test:e2e253/253; codex rubber-duck review converged over 6 rounds (two rebases onto feat(snapshot): branches and environments read back #147 and feat(snapshot): collaborators and teams read back #148 included).Technical details
Projection per section
has_discussions, withsecurity_and_analysisnarrowed to its PATCHable sub-keys; topics when any; 4 toggles;enable_sponsorships,issue_creation_policyname, null-valued fields, ids, urls, counts, owner, license, permissions,has_downloads,security_and_analysis.dependabot_security_updates(the automated-security-fixes toggle's state)ActionsConfigselected_actions_url,maximum_allowed_days, any key the slice does not namename,target,enforcement,conditions.ref_name,rules,bypass_actorswhen presentid,node_id,source,source_type,_links, timestamps,current_user_can_bypassDocumented round-trip exceptions (noted, not declared)
repository.enable_git_lfs: no read endpoint; noted on every snapshot.repository.enable_immutable_releasesunderenforced_by_owner: reads back as true with a note that it cannot be changed from the repository.repository.issue_creation_policyoutside the known vocabulary: left out with a note.actions.<key>the token cannot read (the OIDC template without the Actions permission, the private-repo fork policy on a public repository): left out with a note; a cache limit is noted on its own (actions.cache.<key>) so the sibling limit survives.actions.selected_actions: read only underallowed_actions: selected.rulesets[<name>].bypass_actorsabsent from the GET (no write access): the whole ruleset is left out with a note, since an entry without the key would clear the bypass list on the next full-payload update; when that leaves no entry at all, the section emits the empty keep wrapper rather than reading as "nothing exists".rejectLiveDuplicates), since plan() upserts by name.Recorded, not built
targetwould snapshot without it while normalizeRuleset defaultsbranch; no live GET omits it.Out-of-territory edits this change needed:
test/engine/snapshot.test.ts(supported-section pins),test/scripts/changed-sections.test.ts(fan-out canary for the three newsnapshot-helpers.tsimporters).Reviewer note (Copilot): report a finding only with a concrete input and the wrong output it produces.