Point the Validate REST descriptions at the real subject-format doc#1037
Point the Validate REST descriptions at the real subject-format doc#1037alistair3149 wants to merge 1 commit into
Conversation
`ValidateSubjectApi` and `ValidateSubjectUpdateApi` told API consumers that their `statements` shape "matches docs/SubjectFormat.md". No such file has ever existed, so the OpenAPI spec has been serving a dead reference. Their siblings `CreateSubjectApi` and `ReplaceSubjectApi` cite the same document and were corrected to `docs/api/subject-format.md` in #1034, which left two of the four subject-format citations pointing nowhere. Point both at `docs/api/subject-format.md`, and add `DocsPathReferencesTest` to guard the class of bug: it resolves every `docs/….md` path cited anywhere in `src/` against the docs tree and fails on any that does not exist. Seen failing on exactly the two offenders before the fix. Nothing else checked these strings, which is why a doc that never existed could be advertised in the public API spec indefinitely. Follows-up to #1035 > Result of a review of #1034 and #1035 requested by @alistair3149; this gap was found by the review > and confirmed against the dev stack, and the guard test was his call to include. > Context: the NeoWiki docs tree and the REST entry points. > <sub>Written by Claude Code, `Opus 4.8 (1M context)`</sub>
|
Two robustness limitations in 1. Relative
2. The pattern matches anywhere in a file, including URLs.
In practice the production-facing citations this test exists to guard — the OpenAPI param descriptions — are all written as root-relative
|
|
A note on a possible follow-up, separate from this PR's dead-path fix. Pointing these Known caveats if we go that way:
At MVP neither is a real concern: there's effectively one active version and the docs track the current code, so there's no meaningful drift; and a site outage is rare and would likely coincide with bigger problems anyway. Future options if these start to matter:
|
|
I lean slightly towards using external links instead of partial links, for the reasons above. However, that affects how the tests are implemented, so if we go that route then I don't think it makes sense to merge this and then rewrite it again. Otherwise, if everyone objects to external links (or if simply not worth more effort until somebody asks for it), then we can merge this already. |
ValidateSubjectApiandValidateSubjectUpdateApitell API consumers that theirstatementsshape "matches docs/SubjectFormat.md". No such file has ever existed — not before the docs reorganisation either — so the generated OpenAPI spec has been serving a dead reference. Their siblingsCreateSubjectApiandReplaceSubjectApicite the same document and were corrected todocs/api/subject-format.mdin #1034, which left two of the four subject-format citations pointing nowhere.Point both at
docs/api/subject-format.md, and addDocsPathReferencesTestto guard the class of bug: it resolves everydocs/….mdpath cited anywhere insrc/against the docs tree and fails on any that does not exist.Why a test for two strings
Nothing checked these strings, which is how a path that never existed could be advertised in the public API spec indefinitely. It also gives the reorganised docs a backstop:
RestApiDocsCoverageTestalready guards the endpoint table againstextension.json, but nothing guarded code-to-docs citations, and #1034 moved every doc in the tree.Worth noting for the record: #1035 states that "an exhaustive resolver over every
docs/…mdreference in all tracked file types confirms every target exists". These two references survived it — the resolver matched markdown and wikitext link syntax, not bare paths inside PHP string literals. The test added here is the version of that check that runs in CI.Verification
Run against the dev stack (MediaWiki container), not only CI:
DocsPathReferencesTestwas seen failing first, naming exactly the two offenders:OK (1 test, 274 assertions).ValidateSubjectApi,ValidateSubjectUpdateApi,CreateSubjectApi,ReplaceSubjectApi,RestApiDocsCoverage, andModuleSpecHandlerNeoWiki(the OpenAPI spec test, 465 assertions).make phpcsclean.make stanreports 5 errors, all insrc/Infrastructure/Rdf/HardfRdfStreamWriter.php(unresolvedhardfsymbols). That file is byte-identical to master, so they are pre-existing and unrelated to this change.