Repository navigation
fix(sections): send no empty Pages create, and keep the readable interaction limit in a snapshot - #595
Conversation
…raction limit in a snapshot Pages: a declaration with neither build_type nor source, against a repository without a site, planned a create with an empty body, which GitHub's create schema rejects, and then an update of a site that does not exist. The plan is now drift with no operation that names the fix, beside a note naming the 404's other reading. createBody() is the only mint of the create body, and its type has no empty form. interaction_limits snapshot: the creation-cap and bypass-list reads are write-gated, so a read-only Administration grant reads the limit and is denied both, and one denied read dropped the whole section. Each read now goes through readOrNote: under on-missing-permission: warn the denied key is left out with its note and the limit still reads back, and under fail the section fails as before. interaction_limits cap: the slice names include_drafts, which GitHub documents on the cap's GET and PATCH, so a snapshot keeps it. The key stays untyped: any value of it has always parsed through the open mapping and ridden the PATCH. The PATCH's 422 hint names it beside enabled.
File size check0 over a hard cap (fails), 6 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. |
Member shape check2 finding(s).
Add the blank lines, make the comment one line directly above the item, comment every field or none, or list the path in 4 generated file(s) skipped. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the Pages creation and interaction-limit snapshot changes.
No open issues 🎉
What changed in this PR
This PR fixes Pages creation and interaction-limit snapshots in the declarative repository settings action. It avoids invalid empty Pages requests and preserves readable settings when optional snapshot reads are denied.
Changes:
- Prevents Pages creation without
build_typeorsource, reporting drift and actionable notices instead. - Omits denied cap and bypass reads under the warn policy while retaining readable limits; preserves
include_draftsin snapshots without narrowing accepted input. - Adds regression coverage and updates section documentation and generated coverage notes.
| File | Description |
|---|---|
test/sections/pages/scenarios/pages-enable-needs-build-type-or-source.yml |
Verifies no writes and explanatory notices when creation fields are absent. |
test/sections/pages/pages.test.ts |
Tests missing-site plans with update-only declarations. |
test/sections/interaction_limits/snapshot-row.ts |
Adds include_drafts to snapshot expectations. |
test/sections/interaction_limits/scenarios/interaction-limits-snapshot-roundtrip.yml |
Extends round-trip coverage to include_drafts. |
test/sections/interaction_limits/scenarios/interaction-limits-snapshot-cap-denied-warn.yml |
Covers readable-limit snapshots with denied cap and bypass reads. |
test/sections/interaction_limits/interaction_limits.test.ts |
Tests selective omission under warn and failure under fail. |
src/sections/pages/index.ts |
Restricts creation bodies and handles missing creation fields without writes. |
src/sections/interaction_limits/schema.ts |
Names include_drafts for snapshot projection while preserving passthrough acceptance. |
src/sections/interaction_limits/index.ts |
Handles denied snapshot subreads individually and updates the cap validation hint. |
docs/sections/pages.docs.yml |
Documents creation requirements and no-write behavior. |
docs/sections/interaction_limits.docs.yml |
Documents permission-aware snapshots and include_drafts. |
docs/reference/coverage.md |
Regenerates coverage notes for both sections. |
Review effort: Balanced
Before
After
applied, both lines as noticeswarnpartial, section skippedsnapshot, limit writteninclude_draftsis named, not typed: a non-boolean still rides the PATCH, and typing it would newly refuse such a file.With no limit set and both reads denied, the snapshot still ends with the engine's
nothing exists on the repositoryline, untrue there as it already was onmainfor an inherited limit.How
createBody()alone mints the create body, whose type has no empty form.readOrNote.readOrNote, both in the repository.Proof
Technical details
main.src/sections/workflows/index.tsreports a declared workflow with no file the same way.pages: nullalready does.main.mainthe e2e runner's contract validator flags that create as[request-body]: (root) must match a schema in anyOf, and no scenario sent one.fail: a denied cap or bypass read still fails the section, asdocs/operate/snapshot.mdstates.NOTHING_TO_DECLAREinsrc/engine/snapshot.tsfollows any section that returns no value, and onmainit already follows the note for an inherited limit.include_draftsin the cap slice keeps it.include_draftsbesideenabled.readOrNotelives insrc/sections/shared/snapshot-helpers.ts, andrepository,actions, andenvironmentsalready use it.PlainTyped, so the untyped field is plain data in the PATCH body.include_draftsappears under the cap with its description and no type.interaction_limitssnapshot row and theinteraction-limits-snapshot-roundtripscenario now seed and expectinclude_drafts.pages-enable-needs-build-type-or-sourceandinteraction-limits-snapshot-cap-denied-warn.docs/sections/*.docs.ymlpages state the new behavior, anddocs/reference/coverage.mdis their regenerated region.bun capture.mts /repo scenario.yml [snapshot-path], the script below, once on a copy oforigin/mainand once on this branch.pages: {https_enforced: true}againstpages: nulllive, once in check mode and once in apply.interaction_limitsunderadministration: read,denial_style: 403, andon_missing_permission: warn.{enabled: true, max_open_pull_requests: 5, include_drafts: true}.apply sentlists the apply run's writes from the mock's request log, and the reads are left out.snapshot takentimestamp, the expiry note, and thesnapshot writtenline.src/sections/pages/index.ts,src/sections/interaction_limits/{index,schema}.ts,test/sections/pages/pages.test.ts,test/sections/interaction_limits/{interaction_limits.test,snapshot-row}.ts, the three scenario files,docs/sections/{pages,interaction_limits}.docs.yml,docs/reference/coverage.md.