Skip to content

Commit 9f1efac

Browse files
cdeustclaude
andcommitted
docs(adr): correct what a headless section reaches in the compile stage (#587)
ADR-1070 and the CHANGELOG said `wiki_compile` rendered such a section with no title. The review of PR #588 demonstrated otherwise: core/draft_compiler.py skips a section with no heading, so the published Markdown drops it, while handlers/wiki_compile.py mirrors the draft's sections into wiki.pages.sections with no guard, leaving the prose under an empty key. The validation this PR adds is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Cz7A6goxVzfKL9NT7k4zDH
1 parent 4d6320f commit 9f1efac

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ adheres to [Semantic Versioning](https://semver.org/).
4545
`_validate_against_contract` checked the kind's required headings and each
4646
section's body, never a section's own heading, so for a kind with no required
4747
section a heading of `" "`, or a section with no heading key at all, was
48-
written to the draft and `wiki_compile` rendered it untitled. The nested
48+
written to the draft, where `wiki_compile` mirrors it into `wiki.pages.sections`
49+
under an empty key (the published Markdown drops it). The nested
4950
`required: [heading, body]` of the tool schema is documentation: the
5051
client-visible schema comes from the registered wrapper's signature. Both
5152
fields are now validated as non-blank text, and a number for either returns a

‎docs/adr/ADR-1070-a-draft-section-carries-a-heading-and-a-body-both-text.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ accepted
1616

1717
## Context
1818

19-
`_validate_against_contract` (`mcp_server/handlers/wiki_refine.py`) checked two things about the sections a caller submits: that every heading the kind requires is present, and that no body is blank. It never checked a section's own heading. For a kind that declares no required section, a section such as `{"heading": " ", "body": "real prose"}`, or `{}` itself, passed validation and was written to the draft, and `wiki_compile` then rendered a section with no title (issue #587).
19+
`_validate_against_contract` (`mcp_server/handlers/wiki_refine.py`) checked two things about the sections a caller submits: that every heading the kind requires is present, and that no body is blank. It never checked a section's own heading. For a kind that declares no required section, a section such as `{"heading": " ", "body": "real prose"}`, or `{}` itself, passed validation and was written to the draft (issue #587). The published Markdown drops such a section, since `core/draft_compiler.py` skips a section with no heading, but `handlers/wiki_compile.py` mirrors the draft's sections into `wiki.pages.sections` with no such guard, so the page row keeps the prose under an empty key.
2020

2121
The tool's `inputSchema` declares `required: [heading, body]` for a section, but the client-visible schema is derived from the registered wrapper's signature, `list[dict[str, Any]] | None`, and `_tool_meta.apply_param_docs` only merges descriptions into it. That nested `required` is therefore documentation, not enforcement, and a section missing its heading is a reachable client input. The review of PR #586 demonstrated both shapes end to end on a `note` draft.
2222

‎wiki/adr/cortex/1070-a-draft-section-carries-a-heading-and-a-body-both-text.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ accepted
1414

1515
## Context
1616

17-
`_validate_against_contract` (`mcp_server/handlers/wiki_refine.py`) checked two things about the sections a caller submits: that every heading the kind requires is present, and that no body is blank. It never checked a section's own heading. For a kind that declares no required section, a section such as `{"heading": " ", "body": "real prose"}`, or `{}` itself, passed validation and was written to the draft, and `wiki_compile` then rendered a section with no title (issue #587).
17+
`_validate_against_contract` (`mcp_server/handlers/wiki_refine.py`) checked two things about the sections a caller submits: that every heading the kind requires is present, and that no body is blank. It never checked a section's own heading. For a kind that declares no required section, a section such as `{"heading": " ", "body": "real prose"}`, or `{}` itself, passed validation and was written to the draft (issue #587). The published Markdown drops such a section, since `core/draft_compiler.py` skips a section with no heading, but `handlers/wiki_compile.py` mirrors the draft's sections into `wiki.pages.sections` with no such guard, so the page row keeps the prose under an empty key.
1818

1919
The tool's `inputSchema` declares `required: [heading, body]` for a section, but the client-visible schema is derived from the registered wrapper's signature, `list[dict[str, Any]] | None`, and `_tool_meta.apply_param_docs` only merges descriptions into it. That nested `required` is therefore documentation, not enforcement, and a section missing its heading is a reachable client input. The review of PR #586 demonstrated both shapes end to end on a `note` draft.
2020

0 commit comments

Comments
 (0)