Pin the catalogue parser with a test, after it broke twice in silence - #150
Merged
Conversation
scripts/link-samples.mjs reads SAMPLES.md out of a checkout of another repository, and its row pattern has now stopped matching TWICE - first when the catalogue grew the `@docs` links under the keywords, then today when it grew the `" @summary` sentence in normal type above them. Both times the symptom was the bad kind. Not a red run: a WRONG ANSWER. Every page's declaration came back as `z2ui5_cl_smp_app_493` is not in the sample catalogue - renamed, deleted, or a typo which is precisely the sentence this check exists to say TRUTHFULLY. A parser that fails open like that is worse than one that throws. So the parser moves into scripts/lib/catalogue.mjs - link-samples resolves a checkout and rewrites pages at import time, which is why it could not be tested where it was - and test/catalogue.test.mjs pins one row of every shape the three sample repositories generate: title only, + keywords, + summary + keywords + docs, a row with no header of its own, and a block with a tag nobody here has seen. That last one failed when it was written, which is the point of writing it: the pattern accepted `<sub>` blocks and bare text and nothing else, so a future `<span>` would have taken the whole row down. A block is now `<br>` plus anything - this script reads the title, the class and the path, and what the other blocks say is the reader's business. The row shape is maintained in abap2UI5/samples, /samples-controls and /samples-stack, and read here and in abap2UI5/ai-mcp: a contract between five programs, of which this repository owns none. npm test 2 test(s), part of `npm run check` (CI) check:samples 152 samples, 39 pages, 109 links, up to date
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
scripts/link-samples.mjsreadsSAMPLES.mdout of a checkout of another repository, and its row pattern has now stopped matching twice — first when the catalogue grew the@docslinks under the keywords, then today when it grew the" @summarysentence in normal type above them.Both times the symptom was the bad kind. Not a red run — a wrong answer:
which is precisely the sentence this check exists to say truthfully. A parser that fails open like that is worse than one that throws.
What changes
The parser moves into
scripts/lib/catalogue.mjs—link-samplesresolves a checkout and rewrites pages at import time, which is why it could not be tested where it was — andtest/catalogue.test.mjspins one row of every shape the three sample repositories generate:**Basics I** — Hello World+ <sub>keywords</sub>+ summary + keywords + docs<br><span>…</span>That last one failed when it was written, which is the point of writing it: the pattern accepted
<sub>blocks and bare text and nothing else, so a future<span>would have taken the whole row down. A block is now<br>plus anything — this script reads the title, the class and the path, and what the other blocks say is the reader's business.The row shape is maintained in
abap2UI5/samples,/samples-controlsand/samples-stack, and read here and inabap2UI5/ai-mcp: a contract between five programs, of which this repository owns none.npm test(2 tests) now runs first innpm run check.Generated by Claude Code