From b31d2b74a851dbfe9fd6897e229a49e115a6bf6f Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Sep 2026 15:23:34 +0000 Subject: [PATCH 1/3] fix(spec): render `@example` captions and drop `@category` on reference pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `renderFileDescription` emitted a module docblock's prose verbatim, so a JSDoc block tag written on a prose line reached the published page as literal tag text: 18 lines across 14 customer-facing reference pages. The verdict is per tag, on the payload rather than the spelling: - `@example CAPTION` (12 lines, 10 pages) captions the block directly beneath it, so it is REWRITTEN into that caption in bold — the shape `@see` beside it already had. - a bare `@example` (2 lines) has no payload, which is the `@module` case exactly, so it is DROPPED before classification alongside the `os:check` marker it sits against. - `@category Security` (4 lines, 4 pages) is dropped. Measured: one value on four pages, and no consumer anywhere in the repo — no typedoc, no api-extractor, no search index, no gate. Pins assert on the rendered fragment, never on the emitted `.mdx`: `check:docs` compares the artifact to the source and reproduced all 18 tag lines faithfully. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01G4138K1EG7kQ81FNba5Kp4 --- .../spec/scripts/file-description.test.ts | 236 +++++++++++++++++- packages/spec/scripts/lib/file-description.ts | 122 ++++++++- 2 files changed, 340 insertions(+), 18 deletions(-) diff --git a/packages/spec/scripts/file-description.test.ts b/packages/spec/scripts/file-description.test.ts index 69f30f6b239..4c22a3703ff 100644 --- a/packages/spec/scripts/file-description.test.ts +++ b/packages/spec/scripts/file-description.test.ts @@ -652,20 +652,19 @@ describe('renderFileDescription — #13796: the `@module` marker is machinery, n expect(out).toContain('@module'); }); - it('leaves every other block tag alone — the filter is `@module`, not `^@\\w+`', () => { - // Scope, pinned. `@example Basic field mapping` is the caption of the fence - // beneath it and `@category Security` is a classification: a blanket - // tag-line drop would take that prose off the page, which is the one thing - // this fix may not do. How a tag WITH content should render is a different - // question and not this one. + it('is still not a `^@\\w+` filter — the caption beside it survives as prose', () => { + // Scope, pinned, and REWRITTEN at #14455 — this case used to assert that + // `@example Basic field mapping` reached the page as literal tag text, + // which is the defect that card fixed. What #13796 owns is unchanged and is + // what is asserted here: its drop is scoped to its own tag, and the caption + // prose beside it is not collateral. That the caption now arrives BOLDED + // rather than raw is #14455's verdict, pinned in its own block below. const out = renderFileDescription( moduleBlock( '@module shared/mapping', '', 'Field mapping.', '', - '@category Security', - '', '@example Basic field mapping', '```ts', 'const m = 1;', @@ -674,8 +673,173 @@ describe('renderFileDescription — #13796: the `@module` marker is machinery, n ctx, ); expect(out).not.toContain('@module'); - expect(out).toContain('@category Security'); + expect(out).toContain('Basic field mapping'); + expect(out).toContain('const m = 1;'); + }); +}); + +/** + * #14455 — a block tag with a PAYLOAD is rewritten, not dropped. + * + * #13796 removed `@module` from the page and said, in its own scope note, that + * the two remaining tags were a different question because they carry prose a + * drop would take with them. This is that question answered: eighteen lines of + * literal `@example` / `@category` text across fourteen customer-facing + * reference pages, measured with the card's own repro + * (`grep -rn '^@example\|^@category' content/docs/references/`) — fourteen + * `@example` lines on ten pages and four `@category Security` lines on four + * more, unchanged from the count taken when the card was filed. + * + * The answer is per tag, and the axis is the payload rather than the spelling: + * + * - `@example CAPTION` (twelve lines) captions the block directly beneath it, + * so it is REWRITTEN into that caption in bold — the shape `@see` beside it + * already had. Why bold rather than a heading or an `Example:` label is on + * `EXAMPLE_CAPTION`. + * - `@example` bare (two lines, `studio/plugin` and `studio/object-designer`) + * has no payload at all, which is the `@module` case exactly, so it is + * DROPPED. + * - `@category Security` (four lines) carries a payload and is dropped anyway, + * the one verdict here that is a judgement rather than a mechanism. The + * measurement it rests on — four pages, one value, and no consumer anywhere + * in the repo — is on `CATEGORY_MARKER`, and it is what would have to change + * first. + * + * Asserted on the RENDERED fragment and never on the emitted `.mdx`, for the + * reason the rest of this file is: `check:docs` compares the artifact against + * the source and the artifact reproduced all eighteen tag lines faithfully, so + * it was green through every one of them. + */ +describe('renderFileDescription — #14455: a tag WITH a payload is rewritten, not dropped', () => { + const ctx = { fromCategory: 'shared', sourcePathToDocsRoute: () => null, sectionLevel: PAGE_SECTION_LEVEL }; + + const moduleBlock = (...body: string[]): string => + ['/**', ...body.map(l => (l === '' ? ' *' : ` * ${l}`)), ' */', '', "import { z } from 'zod';", ''].join('\n'); + + it('renders `@example CAPTION` as the caption of the fence beneath it', () => { + // `shared/mapping.zod.ts`, reduced — the page the card opened with. Both + // captions, because the source writes a RUN of them and a fix that only + // reached the first would still publish the second. + const out = renderFileDescription( + moduleBlock( + 'Base Field Mapping Protocol', + '', + '@example Basic field mapping', + '```typescript', + "const mapping = { source: 'a' };", + '```', + '', + '@example With a fallback for missing source values', + '```typescript', + "const mapping = { source: 'b' };", + '```', + ), + ctx, + ); + expect(out).not.toContain('@example'); + expect(out).toContain('**Basic field mapping**'); + expect(out).toContain('**With a fallback for missing source values**'); + // The caption sits on its own line directly above the fence it captions — + // a fenced block may interrupt a paragraph, so this is what a reader sees + // as a caption rather than as the first words of one. + expect(out).toContain('**Basic field mapping**\n```typescript'); + }); + + it('leaves the caption\'s own markdown intact', () => { + // `api/plugin-rest-api.zod.ts` writes an inline code span inside its + // caption. Wrapping the line in `**` must not disturb it: CommonMark parses + // the span first, and a `**` run closing against `)` is still right-flanking. + const out = renderFileDescription( + moduleBlock('@example Serving routes from a plugin (imperative `http.server` mount)', '```ts', 'x;', '```'), + ctx, + ); + expect(out).toContain('**Serving routes from a plugin (imperative `http.server` mount)**'); + }); + + it('still resolves a source path written inside a caption', () => { + // The rewrite runs BEFORE the link and code-span steps, so a caption is + // ordinary prose to every transform after it. Were it run last, a caption + // naming a neighbour would reach the page as bare text — the #6484 defect, + // re-acquired on one line. + const out = renderFileDescription( + moduleBlock('@example Mapping a mapping.zod.ts field', '```ts', 'x;', '```'), + { ...ctx, sourcePathToDocsRoute: () => '/docs/references/shared/mapping' }, + ); + expect(out).toContain('**Mapping a [mapping.zod.ts](/docs/references/shared/mapping) field**'); + }); + + it('drops a BARE `@example` — with no payload it is the `@module` case', () => { + // `studio/plugin.zod.ts` and `studio/object-designer.zod.ts`, the two + // sources that write it bare, and they write it directly above the + // `os:check` marker. Both lines are machinery and both come off, which is + // why this drop runs before classification alongside the marker's: the + // fence has to stay attached to the prose above it, not to a leftover line. + const out = renderFileDescription( + moduleBlock( + 'Studio Plugin Protocol', + '', + '@example', + '', + '```typescript', + "import { StudioPluginManifestSchema } from '@objectstack/spec/studio';", + '```', + ), + ctx, + ); + expect(out).not.toContain('@example'); + expect(out).not.toContain('os:check'); + expect(out).toContain('Studio Plugin Protocol\n\n```typescript'); + }); + + it('drops `@category VALUE`, and keeps the `@see` line it sits under', () => { + // All four sources write the pair in this order, so a drop that took the + // line above with it would be invisible in a fixture that omitted the + // `@see`. `See also:` is #13796-era behaviour and stays untouched. + const out = renderFileDescription( + moduleBlock( + 'Supplier Security Protocol', + '', + '@see https://www.iso.org/standard/27001', + '@category Security', + ), + ctx, + ); + expect(out).not.toContain('@category'); + // Asked of whole LINES: the header prose legitimately contains the word, so + // a substring test here would assert about `Supplier Security Protocol` + // rather than about the payload that was dropped. + expect(out.split('\n')).not.toContain('Security'); + expect(out).toContain('See also: https://www.iso.org/standard/27001'); + }); + + it('keeps both tags shown INSIDE a fence — there an author is illustrating the convention', () => { + // The prose-level condition, the same one #10924 and #13796 rest on. A + // rewrite by text alone would edit a header that documents the convention. + const out = renderFileDescription( + moduleBlock( + 'How a module header captions an example:', + '', + '```md', + '@example Basic field mapping', + '@category Security', + '```', + ), + ctx, + ); expect(out).toContain('@example Basic field mapping'); + expect(out).toContain('@category Security'); + }); + + it('keeps a mid-sentence mention and an indented one — only a line that OPENS with the tag is a tag', () => { + // Judged with the same UNTRIMMED test `MODULE_MARKER` uses, so prose about + // the tag survives and a list item that happens to start with one is not + // rewritten out from under its bullet. + const out = renderFileDescription( + moduleBlock('Write `@example Foo` to caption a block.', '', '- see @category for the retired spelling'), + ctx, + ); + expect(out).toContain('@example Foo'); + expect(out).toContain('@category'); }); }); @@ -1948,6 +2112,60 @@ describe('corpus — every rendered description is well-formed markdown', () => expect(offenders).toEqual([]); }); + it('never prints a literal `@example` or `@category` line on a page (#14455)', () => { + // The half that cannot rot, re-derived from the real `packages/spec/src` + // tree: eighteen such lines were published across fourteen pages, and a + // source that acquires either tag tomorrow cannot re-acquire the defect + // with it. An invariant (zero) rather than a count, for the reason the + // `@module` case beside it is one — a fifteenth captioned module is a good + // thing, not a regression. + // + // Read on the rendered fragment and not on the emitted `.mdx`, because + // `check:docs` reproduced all eighteen faithfully and was green through + // every one. + const offenders: string[] = []; + for (const { rel, out } of described) { + for (const line of withoutFences(out).split('\n')) { + if (/^@(?:example|category)\b/.test(line)) offenders.push(`${rel}: ${line.trim()}`); + } + } + expect(offenders).toEqual([]); + }); + + it('loses no caption to that — every `@example CAPTION` reaches its page (#14455)', () => { + // The other half, and the card's acceptance criterion: "no page loses + // non-tag prose". The drop and the rewrite are one line apart, so a fix + // that got the partition backwards would pass the assertion above by + // deleting exactly the prose this one requires. + // + // Re-derived from the SOURCES rather than from a fixture list: every + // prose-level `@example` line in a selected block that carries a payload + // must have that payload on the page, bolded. Captions holding a construct + // a later transform rewrites (a brace to escape, a `.zod.ts` to link) are + // counted but not string-matched — none exist today, and the count below is + // what stops that exemption from quietly swallowing the whole corpus. + const captions: string[] = []; + const offenders: string[] = []; + for (const file of zodFiles) { + const rel = path.relative(SRC_DIR, file); + const block = findModuleDocBlock(fs.readFileSync(file, 'utf-8')); + if (block === null) continue; + const ctx = { fromCategory: rel.split(path.sep)[0], sourcePathToDocsRoute, sectionLevel: PAGE_SECTION_LEVEL }; + const out = renderFileDescription(fs.readFileSync(file, 'utf-8'), ctx); + for (const line of withoutFences(block.split('\n').map(l => l.replace(/^\s*\*\s?/, '')).join('\n')).split('\n')) { + const caption = /^@example[ \t]+(\S.*?)[ \t]*$/.exec(line)?.[1]; + if (caption === undefined) continue; + captions.push(`${rel}: ${caption}`); + if (/[{}]|\.zod\.ts|\{@link/.test(caption)) continue; + if (!out.includes(`**${caption}**`)) offenders.push(`${rel}: ${caption}`); + } + } + expect(offenders).toEqual([]); + // Vacuity guard: the loop above is only evidence while the corpus still + // writes captions. Twelve at #14455, on ten pages. + expect(captions.length).toBeGreaterThan(9); + }); + it('keeps a description for every source that had one — #6134 selection is untouched', () => { // The rendering fix must not remove a page's opening paragraph; that is // #5059's acceptance criterion and it still binds. 185 sources carry a diff --git a/packages/spec/scripts/lib/file-description.ts b/packages/spec/scripts/lib/file-description.ts index 2464af9a0b7..73c6399981a 100644 --- a/packages/spec/scripts/lib/file-description.ts +++ b/packages/spec/scripts/lib/file-description.ts @@ -158,6 +158,19 @@ * expression and fail the docs build — the target dialect has one spelling for * a code block and this is it. * + * ## A block tag renders by whether it has a PAYLOAD (#13796, #14455) + * + * The sources are JSDoc, so their headers carry block tags, and every one of + * them used to reach the page as literal `@…` text — fourteen pages opening on + * `@module ui/sharing`, then eighteen more lines of `@example` and `@category` + * across fourteen others. What none of it needs is a `^@\w+` line filter, + * because the tags do not agree on what they are: a tag whose entire content is + * the tag is machinery and is DROPPED, while a tag carrying prose is REWRITTEN + * into that prose. The four verdicts and the measurement behind each live on + * the constants — `MODULE_MARKER`, `BARE_EXAMPLE` and `CATEGORY_MARKER` drop, + * `EXAMPLE_CAPTION` and `renderProse`'s `See also:` rewrite — and a fifth tag + * arriving on this surface is answered there, by which of the two it is. + * * ## Heading levels are the PAGE's, not the source file's (#12249) * * The second such place, and the same argument. A `.zod.ts` header is written @@ -485,14 +498,16 @@ const SKILL_EXAMPLE_MARKER = ''; * it is machinery, not content, and the one thing it says — the module's own * path — is what the page's route and title already say twice over. * - * SCOPE: this tag, deliberately, and NOT `^@\w+` at large. The two other block - * tags that reach a page carry a payload a reader needs — `@example Basic field - * mapping` is the caption of the fence beneath it, `@category Security` is a - * classification — so a line-drop would take that prose with them, and "no page - * loses non-tag prose" is this fix's acceptance criterion. `@see` shows the - * shape those two want instead: `renderProse` REWRITES it into `See also: …` - * rather than dropping it. `@module` is the one tag whose entire content is the - * marker, so it is the one tag a drop is right for. + * SCOPE: this tag, deliberately, and NOT `^@\w+` at large. Whether a block tag + * may be DROPPED is decided by whether it has a payload, and the tags that + * reach a page do not answer alike: `@module` and a bare `@example` are their + * own entire content, while `@example CAPTION` is the caption of the fence + * beneath it and `@see` is a cross-reference — both rewritten instead + * (`EXAMPLE_CAPTION`, and `renderProse`'s `See also: …`). A blanket line filter + * cannot express that difference; it would take the caption off the page and + * orphan its fence, and "no page loses non-tag prose" is this fix's acceptance + * criterion. `@category` is the one payload-carrying tag that still renders as + * nothing, and `CATEGORY_MARKER` carries the measurement that says why. * * Judged with the same UNTRIMMED `^@module\b` test `hasModuleMarker` selects * on, so the renderer drops exactly what the selector recognised — never a @@ -502,9 +517,57 @@ const SKILL_EXAMPLE_MARKER = ''; */ const MODULE_MARKER = /^@module\b/; +/** + * `@category ` — a payload the page does NOT show (#14455). + * + * The one tag here that carries content and is still dropped, so the reason is + * recorded rather than left to be re-derived. Measured over the whole repo when + * this landed: the tag is on four of the 190 described modules + * (`system/incident-response`, `system/security-context`, + * `system/supplier-security`, `system/training`), carries the identical value + * `Security` on all four, and NOTHING reads it — no typedoc or api-extractor + * (this repo runs neither), no search index, no gate. Four pages under a + * `system/` section, classified as the thing that section already says. + * + * That is not a taxonomy a page is failing to surface. The two coherent + * alternatives are to make the classification real across the whole corpus — + * an expansion nobody asked for — or to route it into page frontmatter, which + * publishes a field with no consumer, i.e. the declared-but-unenforced shape + * ADR-0049 exists to refuse. Dropping is the loud, non-expanding option. + * + * ⚠️ Dropped from the rendered PAGE, never from the source. `@category` is a + * legitimate source-level JSDoc tag and `packages/spec/src` goes on writing it; + * the day something actually reads it, this constant is what gets revisited — + * not the four docblocks. + */ +const CATEGORY_MARKER = /^@category\b/; + +/** + * `@example` with nothing after it — the `@module` case exactly (#14455). + * + * A tag whose entire content is the tag tells the reader nothing: the fence + * below it is visibly an example whether or not a line above announces one. + * Two module headers write it bare — `studio/plugin` and + * `studio/object-designer`, the same two whose `os:check` marker + * `SKILL_EXAMPLE_MARKER` exists for — and both published the literal text + * `@example` above their fence. + * + * `[ \t]*$` and not `\s*$`: `stripDocGutter` has already trimmed the line end, + * so anything surviving after the tag is a caption, and a caption is content + * `EXAMPLE_CAPTION` rewrites rather than machinery this drops. The two spellings + * partition the tag between them, with no line matching both and none matching + * neither. + */ +const BARE_EXAMPLE = /^@example[ \t]*$/; + /** A machinery line the rendered page must never show, whichever kind it is. */ function isMarkerLine(line: string): boolean { - return line.trim() === SKILL_EXAMPLE_MARKER || MODULE_MARKER.test(line); + return ( + line.trim() === SKILL_EXAMPLE_MARKER || + MODULE_MARKER.test(line) || + CATEGORY_MARKER.test(line) || + BARE_EXAMPLE.test(line) + ); } /** What a line is, which decides which transforms may touch it. */ @@ -701,6 +764,40 @@ function mapProse(text: string, kinds: ProseRun['kind'][], fn: (plain: string) = return tokenizeProse(text).map(run => (kinds.includes(run.kind) ? fn(run.text) : run.text)).join(''); } +/** + * `@example ` -> that caption, in bold, above the block it captions + * (#14455). + * + * A REWRITE and not a drop, which is the whole of what separates this tag from + * `MODULE_MARKER`: the payload is prose the reader needs. Twelve module headers + * write a caption over a fence — `@example Basic field mapping` on + * `shared/mapping`, `@example Overdue sweep (fires for POs up to 14 days past + * due)` on `automation/time-relative-trigger` — and a line-drop would delete + * that sentence and leave the fence beneath it unlabelled. `@see` beside it in + * `renderProse` already has this shape; this is the second tag to take it. + * + * **Bold, and not a heading.** The difference is structural, not cosmetic. + * `withHeadingsAtSectionLevel` has already renumbered the block by the time + * this runs, so a heading emitted here would take a level chosen blind of the + * page and would not move with the rest — on top of adding twelve entries to + * eight pages' tables of contents and putting a caption in reach of + * `check-docs-single-h1.mjs`. Strong emphasis cannot touch a page's heading + * structure at all, and a bold line over a fence is the caption idiom these + * sources were already reaching for. + * + * **Bold, and not `Example: `** — the literal parallel of `See also:`. + * `@see` needs its label because a bare URL says nothing about why it is on the + * page; a fenced block under a caption is already visibly an example, so the + * label only restates the fence (`Example: Endpoints`, `Example: Basic task`). + * + * Anchored at column 0 and matched per line, the same UNTRIMMED test + * `MODULE_MARKER` uses — never a mid-sentence mention, never an indented + * `@example` in a list item — and only ever shown prose, so an `@example` inside + * a fence stays as the author wrote it. Held global-safe by `String#replace`, + * which resets `lastIndex` around the call. + */ +const EXAMPLE_CAPTION = /^@example[ \t]+(\S.*)$/gm; + /** One run of consecutive prose lines, rendered to MDX. */ function renderProse(text: string, ctx: FileDescriptionContext): string { // ONE resolution rule for every position a path can be referenced from — the @@ -714,6 +811,13 @@ function renderProse(text: string, ctx: FileDescriptionContext): string { // A bare `@see ` tag renders as noise — turn it into prose. let out = text.replace(/^@see[ \t]+/gm, 'See also: '); + // …and the same for the other tag whose payload is content: the caption of + // the block beneath it becomes the caption, rather than reaching the page as + // the literal text `@example …` (#14455; see `EXAMPLE_CAPTION`). Run FIRST, + // so a caption naming a neighbour still gets the link and code-span + // treatment every other line of prose gets. + out = out.replace(EXAMPLE_CAPTION, '**$1**'); + // `{@link}` first, because this is the step that PRODUCES markdown links. out = mapProse(out, ['text'], s => s .replace(/\{@link\s+([^|]+?)\s*\|\s*([^}]+?)\s*\}/g, (_m, target: string, label: string) => From 6733bc35bba3f74ede5b731fa22bc4aa2068b915 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Sep 2026 15:30:53 +0000 Subject: [PATCH 2/3] docs(spec): regenerate reference pages for the tag-payload render fix 18 tag lines across 14 pages: 12 `@example CAPTION` become bold captions, 2 bare `@example` and 4 `@category Security` come off. The card's own repro (`grep -rn '^@example\|^@category' content/docs/references/`) now returns zero, and no other page in the 230-file regeneration moved. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01G4138K1EG7kQ81FNba5Kp4 --- content/docs/references/api/automation-api.mdx | 2 +- content/docs/references/api/documentation.mdx | 2 +- content/docs/references/api/odata.mdx | 4 ++-- content/docs/references/api/package-api.mdx | 2 +- content/docs/references/api/plugin-rest-api.mdx | 2 +- .../references/automation/time-relative-trigger.mdx | 6 +++--- content/docs/references/shared/mapping.mdx | 4 ++-- content/docs/references/studio/object-designer.mdx | 1 - content/docs/references/studio/plugin.mdx | 1 - content/docs/references/system/incident-response.mdx | 2 -- content/docs/references/system/security-context.mdx | 2 -- content/docs/references/system/supplier-security.mdx | 2 -- content/docs/references/system/training.mdx | 2 -- content/docs/references/system/worker.mdx | 2 +- packages/spec/scripts/file-description.test.ts | 11 +++++++++-- 15 files changed, 21 insertions(+), 24 deletions(-) diff --git a/content/docs/references/api/automation-api.mdx b/content/docs/references/api/automation-api.mdx index b91d99f8ed7..805cf08a2ea 100644 --- a/content/docs/references/api/automation-api.mdx +++ b/content/docs/references/api/automation-api.mdx @@ -12,7 +12,7 @@ triggering executions, and querying execution history. Base path: /api/automation -@example Endpoints +**Endpoints** GET /api/automation — List flows GET /api/automation/:name — Get flow POST /api/automation — Create flow diff --git a/content/docs/references/api/documentation.mdx b/content/docs/references/api/documentation.mdx index 36fa8932c65..944329b1359 100644 --- a/content/docs/references/api/documentation.mdx +++ b/content/docs/references/api/documentation.mdx @@ -22,7 +22,7 @@ Architecture Alignment: - Postman: API testing collections - Redoc: Documentation rendering -@example Documentation Config +**Documentation Config** ```typescript const docConfig: ApiDocumentationConfig = { enabled: true, diff --git a/content/docs/references/api/odata.mdx b/content/docs/references/api/odata.mdx index 0457b1843de..20ed87d9228 100644 --- a/content/docs/references/api/odata.mdx +++ b/content/docs/references/api/odata.mdx @@ -42,7 +42,7 @@ See also: https://www.odata.org/documentation/ See also: https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html -@example OData Query +**OData Query** ``` GET /api/odata/customers? $select=name,email& @@ -54,7 +54,7 @@ GET /api/odata/customers? $count=true ``` -@example Programmatic Use +**Programmatic Use** ```typescript const query: ODataQuery = { select: ['name', 'email'], diff --git a/content/docs/references/api/package-api.mdx b/content/docs/references/api/package-api.mdx index 5cc32e1223a..38c88015502 100644 --- a/content/docs/references/api/package-api.mdx +++ b/content/docs/references/api/package-api.mdx @@ -11,7 +11,7 @@ REST API endpoint schemas for package lifecycle management. Base path: /api/v1/packages -@example Endpoints +**Endpoints** POST /api/v1/packages/install — Install a package POST /api/v1/packages/upgrade — Upgrade a package POST /api/v1/packages/resolve-dependencies — Resolve dependencies diff --git a/content/docs/references/api/plugin-rest-api.mdx b/content/docs/references/api/plugin-rest-api.mdx index ac699564d0a..cb4f5a3f6ce 100644 --- a/content/docs/references/api/plugin-rest-api.mdx +++ b/content/docs/references/api/plugin-rest-api.mdx @@ -28,7 +28,7 @@ Architecture Alignment: - Microsoft Dynamics: Web API with entity operations - Strapi: Auto-generated REST endpoints from schemas -@example Serving routes from a plugin (imperative `http.server` mount) +**Serving routes from a plugin (imperative `http.server` mount)** ```typescript // Routes are mounted in CODE — resolve the `http.server` service from the // plugin context and register handlers on `kernel:ready` (the service is diff --git a/content/docs/references/automation/time-relative-trigger.mdx b/content/docs/references/automation/time-relative-trigger.mdx index 48fb2cdb71a..71ab4f17ff3 100644 --- a/content/docs/references/automation/time-relative-trigger.mdx +++ b/content/docs/references/automation/time-relative-trigger.mdx @@ -30,7 +30,7 @@ automation context (so `{record.}` interpolation and the start-node `condition` gate work exactly as they do for record-change flows). The descriptor is carried on the flow's start node as `config.timeRelative`. -@example T-minus renewal reminders (fires on the day a contract is 60/30/7 days out) +**T-minus renewal reminders (fires on the day a contract is 60/30/7 days out)** ```ts // flow start node config: { @@ -45,14 +45,14 @@ config: { } ``` -@example "Expiring soon" range (fires every day a document is within 30 days of expiry) +**"Expiring soon" range (fires every day a document is within 30 days of expiry)** ```ts config: { timeRelative: { object: 'hr_document', dateField: 'expires_on', withinDays: 30 }, } ``` -@example Overdue sweep (fires for POs up to 14 days past due) +**Overdue sweep (fires for POs up to 14 days past due)** ```ts config: { timeRelative: { object: 'purchase_order', dateField: 'due_date', withinDays: -14, filter: { status: 'open' } }, diff --git a/content/docs/references/shared/mapping.mdx b/content/docs/references/shared/mapping.mdx index cba9e4ef285..4a00cff5fba 100644 --- a/content/docs/references/shared/mapping.mdx +++ b/content/docs/references/shared/mapping.mdx @@ -18,7 +18,7 @@ ObjectStack for data synchronization. this base too, until the whole external-lookup family was retired in #8075 — ADR-0049, zero consumers.) -@example Basic field mapping +**Basic field mapping** ```typescript const mapping: FieldMapping = { source: 'external_user_id', @@ -26,7 +26,7 @@ const mapping: FieldMapping = { }; ``` -@example With a fallback for missing source values +**With a fallback for missing source values** ```typescript const mapping: FieldMapping = { source: 'user_name', diff --git a/content/docs/references/studio/object-designer.mdx b/content/docs/references/studio/object-designer.mdx index 9ff239dd52f..b58098ddb28 100644 --- a/content/docs/references/studio/object-designer.mdx +++ b/content/docs/references/studio/object-designer.mdx @@ -38,7 +38,6 @@ The Object Designer is composed of four interconnected panels: └─────────────────────────────────────────────────────────────────┘ ``` -@example ```typescript import { ObjectDesignerConfigSchema, diff --git a/content/docs/references/studio/plugin.mdx b/content/docs/references/studio/plugin.mdx index f13ea2933bc..ef19345b40e 100644 --- a/content/docs/references/studio/plugin.mdx +++ b/content/docs/references/studio/plugin.mdx @@ -35,7 +35,6 @@ Like VS Code extensions, Studio plugins have two layers: └─────────────────────────────────────────────────────────┘ ``` -@example ```typescript import { StudioPluginManifestSchema } from '@objectstack/spec/studio'; diff --git a/content/docs/references/system/incident-response.mdx b/content/docs/references/system/incident-response.mdx index 5054fbed4df..7030aa780cb 100644 --- a/content/docs/references/system/incident-response.mdx +++ b/content/docs/references/system/incident-response.mdx @@ -13,8 +13,6 @@ and notification matrices. See also: https://www.iso.org/standard/27001 -@category Security - **Source:** `packages/spec/src/system/incident-response.zod.ts` diff --git a/content/docs/references/system/security-context.mdx b/content/docs/references/system/security-context.mdx index c03dbd336f0..ee19b32005b 100644 --- a/content/docs/references/system/security-context.mdx +++ b/content/docs/references/system/security-context.mdx @@ -24,8 +24,6 @@ governance context. See also: https://www.iso.org/standard/27001 -@category Security - **Source:** `packages/spec/src/system/security-context.zod.ts` diff --git a/content/docs/references/system/supplier-security.mdx b/content/docs/references/system/supplier-security.mdx index 67a9752c4e2..c93d800bf18 100644 --- a/content/docs/references/system/supplier-security.mdx +++ b/content/docs/references/system/supplier-security.mdx @@ -12,8 +12,6 @@ risk assessment, security requirements, monitoring, and change control. See also: https://www.iso.org/standard/27001 -@category Security - **Source:** `packages/spec/src/system/supplier-security.zod.ts` diff --git a/content/docs/references/system/training.mdx b/content/docs/references/system/training.mdx index d8145cfe0b1..194bdb6f154 100644 --- a/content/docs/references/system/training.mdx +++ b/content/docs/references/system/training.mdx @@ -12,8 +12,6 @@ course definitions, completion tracking, and organizational training plans. See also: https://www.iso.org/standard/27001 -@category Security - **Source:** `packages/spec/src/system/training.zod.ts` diff --git a/content/docs/references/system/worker.mdx b/content/docs/references/system/worker.mdx index d431b0efa10..1bf7cd1c0d2 100644 --- a/content/docs/references/system/worker.mdx +++ b/content/docs/references/system/worker.mdx @@ -21,7 +21,7 @@ Features: - Dead letter queues - Task monitoring and logging -@example Basic task +**Basic task** ```typescript const task: Task = { id: 'task-123', diff --git a/packages/spec/scripts/file-description.test.ts b/packages/spec/scripts/file-description.test.ts index 4c22a3703ff..e4b297d3b63 100644 --- a/packages/spec/scripts/file-description.test.ts +++ b/packages/spec/scripts/file-description.test.ts @@ -561,10 +561,17 @@ describe('renderFileDescription — #10924: the os:check marker is machinery, no ); expect(out).not.toContain('os:check'); // The block it marked is the content — dropping the marker must not take - // the example with it, nor detach the fence from its `@example` tag. + // the example with it, and must not strand the fence behind a leftover + // line. expect(out).toContain('```ts'); expect(out).toContain('const x = 1;'); - expect(out).toContain('@example'); + expect(out).toContain('Studio plugin manifest.\n\n```ts'); + // The `@example` above the marker is gone too, and that is #14455's verdict + // rather than this one's: a tag with no payload is the `@module` case. This + // assertion used to require the opposite, which is what a fixture pinning a + // line the renderer no longer emits looks like — it kept passing precisely + // because the tag was still being published. + expect(out).not.toContain('@example'); }); it('keeps a marker shown INSIDE a fence — there it is an author illustrating the convention', () => { From add70ee408326ff4ebe580c873b7ecdfc6075a92 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Sep 2026 15:31:48 +0000 Subject: [PATCH 3/3] chore(changeset): reference-page block-tag payload render Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01G4138K1EG7kQ81FNba5Kp4 --- ...reference-page-block-tag-payload-render.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .changeset/reference-page-block-tag-payload-render.md diff --git a/.changeset/reference-page-block-tag-payload-render.md b/.changeset/reference-page-block-tag-payload-render.md new file mode 100644 index 00000000000..9ad26d1bddc --- /dev/null +++ b/.changeset/reference-page-block-tag-payload-render.md @@ -0,0 +1,34 @@ +--- +"@objectstack/spec": patch +--- + +Reference pages no longer print `@example` and `@category` tag lines as literal text. + +A module docblock is JSDoc, so its header carries block tags, and the reference-docs +renderer emitted a tag written on a prose line verbatim — 18 such lines reached 14 +customer-facing pages, as `@example Basic field mapping` above a code fence and +`@category Security` at the foot of four `system/` pages. `#13796` removed `@module` +from the page and left these two open, because a blanket `^@\w+` line filter would +have taken reader prose off the page and orphaned the fences below it. + +The verdict is per tag, and the axis is the payload rather than the spelling: + +- **`@example CAPTION` is REWRITTEN** into that caption, in bold, above the block it + captions — the shape `@see` already had (`See also: …`). 12 lines across 10 pages. + Bold rather than a heading because heading renumbering has already run by then, so + an emitted heading would carry a level chosen blind of the page, add entries to the + pages' tables of contents, and put a caption in reach of `check:docs-single-h1`. +- **A bare `@example` is DROPPED.** With no payload it is the `@module` case exactly, + and the fence beneath it is visibly an example without a line announcing one. 2 + lines (`studio/plugin`, `studio/object-designer`), both sitting against the + `check:skill-examples` opt-in marker that was already dropped there. +- **`@category VALUE` is DROPPED.** 4 lines, all reading `Security`, on four pages that + already sit under a `system/` section saying as much — and nothing in the repo reads + the tag: no typedoc or api-extractor (neither is used here), no search index, no + gate. Routing it into page frontmatter instead would publish a field with no + consumer. The tag stays in the source, where it is a legitimate JSDoc tag; only the + rendered page drops it. + +No schema behavior changes. The pins assert on the rendered fragment rather than on the +emitted `.mdx`, because `check:docs` compares the artifact against the source and +reproduced all 18 tag lines faithfully.