Skip to content

feat(pages)!: refuse an empty pages mapping when the file is parsed - #548

Merged
Vivswan merged 2 commits into
mainfrom
feat/pages-empty-mapping-refused
Oct 12, 2026
Merged

Vivswan merged 2 commits into
mainfrom
feat/pages-empty-mapping-refused

Conversation

@Vivswan

@Vivswan Vivswan commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

Before

$ cat settings.yml
pages: {}
$ gsac check
pages: declared as an empty mapping, which configures nothing (the update endpoint rejects an empty body). Declare at least one field, use pages: null to disable the site, or remove the section
result: clean

After

$ gsac check
settings.yml has malformed section entries: pages: an empty mapping configures nothing; declare at least one field, declare pages: null to disable the site, or remove the section. Fix these values in the settings file ...
result: failed

How

  • The shape refuses it. A site mapping with no defined field adds the issue in the same rule that refuses the read-only fields; an undefined field counts as none, and unknown keys still pass through.
  • The published schema mirrors it with minProperties: 1, so an editor flags the line as it is written.
  • The plan-time branch goes. The planner now always sees at least one key.
  • A layer gains nothing from pages: {}. The fold merges keywise and validates each layer, so an empty placeholder never contributed a field.

Proof

  • Tests: the parse refusal, both validators agreeing on pages: {} and on a one-field mapping, and the pages suites; 428 across the touched suites.
  • Gate: bun run build:check matches every generated file; typecheck, biome, and knip green.
Technical details
  • A file carrying pages: {} ran with a note before and fails validation now; the v2-to-v3 guide records it under section 38 beside the other Pages refusals, and the summary table row names it.
  • The fuzz generator never emits an empty pages mapping, so the e2e oracle is unchanged.
  • Files: src/sections/pages/{schema.ts,index.ts}, test/sections/pages/{schema.test.ts,pages.test.ts}, test/published-schema.test.ts, docs/sections/pages.docs.yml, docs/reference/coverage.md (generated), docs/upgrading/v2-to-v3.md, docs/upgrading/v2-to-v3/refusals-repository.md.

BEGIN_COMMIT_OVERRIDE
feat(pages)!: refuse an empty pages mapping when the file is parsed

BREAKING CHANGE: pages: {} fails validation instead of running with a note; declare at least one field, declare pages: null to disable the site, or remove the section.
END_COMMIT_OVERRIDE

The update endpoint rejects an empty body, so pages: {} configured nothing; the planner noted it and the run went on. The shape now refuses it naming the three intents it could have meant, the published schema mirrors the refusal with minProperties, and the plan-time branch goes. The upgrade guide records it under the Pages refusal section.
Copilot AI balanced review requested due to automatic review settings October 12, 2026 00:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The empty-map check still admits mappings containing only undefined fields, allowing an empty API payload.

1 open finding
What changed in this PR

Moves empty Pages mapping rejection from planning to validation and the published schema.

Changes:

  • Rejects pages: {} during parsing and schema validation.
  • Removes the obsolete planner note.
  • Updates tests and migration documentation.
File Description
src/​sections/​pages/​schema.ts Adds empty-mapping validation.
src/​sections/​pages/​index.ts Removes plan-time handling.
test/​sections/​pages/​schema.test.ts Tests parse rejection.
test/​sections/​pages/​pages.test.ts Removes obsolete planner test.
test/​published-schema.test.ts Tests runtime/schema agreement.
docs/​sections/​pages.docs.yml Documents the refusal.
docs/​reference/​coverage.md Updates generated coverage documentation.
docs/​upgrading/​v2-to-v3.md Adds the breaking change summary.
docs/​upgrading/​v2-to-v3/​refusals-repository.md Documents migration guidance.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/sections/pages/schema.ts Resolved
Copilot AI balanced review requested due to automatic review settings October 12, 2026 00:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Runtime behavior, published schema, tests, and documentation consistently enforce the new refusal.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

@Vivswan
Vivswan marked this pull request as ready for review October 12, 2026 00:15
@Vivswan
Vivswan merged commit 9071aa0 into main Oct 12, 2026
31 checks passed
@Vivswan
Vivswan deleted the feat/pages-empty-mapping-refused branch October 12, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants