Skip to content

Commit b33d995

Browse files
committed
test(spec): ui/action.zod.ts leaves the #13334 no-description list and is pinned on its module header
The #13334 corpus pin froze ui/action.zod.ts as describing nothing, because the codemod-wedged symbol comment it once opened with was removed. This PR's N4 gives that module a header written on purpose, above its imports, so the pin went red on the change it was meant to leave room for. The file leaves the list (seven remain, unchanged), and a new case pins its opening exactly, that only the licence line precedes the block, and that the import list follows it. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzgwLiKcfujYUug7sPs
1 parent 85b26c8 commit b33d995

1 file changed

Lines changed: 33 additions & 2 deletions

File tree

‎packages/spec/scripts/file-description.test.ts‎

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,28 +1796,59 @@ describe('corpus — no reference source donates a symbol comment to its page',
17961796
expect(openingOf('shared/mapping.zod.ts')).toBe('@module shared/mapping');
17971797
});
17981798

1799-
it('publishes no description for the eight modules whose opening was one schema\'s doc (#13334)', () => {
1799+
it('publishes no description for seven of the eight modules whose opening was one schema\'s doc (#13334)', () => {
18001800
// The corpus half of route ② — each of the eight had a symbol's comment
18011801
// wedged into its import list by the lazify codemod, published as the
18021802
// page's opening and as the module's skill-index pointer row. The comments
18031803
// moved back to the declarations they document (or to the family they
18041804
// head), so no block sits in the header zone documenting nothing: the page
18051805
// honestly prints no description. 宁可缺,不要错.
1806+
//
1807+
// The eighth, `ui/action.zod.ts`, has since been given a module header
1808+
// written on purpose (#34824 N4) — the case below pins it, so it leaves
1809+
// this list rather than being exempted from it.
18061810
const openingOf = (rel: string) =>
18071811
opening(findModuleDocBlock(fs.readFileSync(path.join(SRC_DIR, rel), 'utf-8')));
18081812
for (const rel of [
18091813
'ai/agent.zod.ts',
18101814
'data/datasource.zod.ts',
18111815
'data/hook.zod.ts',
18121816
'security/permission.zod.ts',
1813-
'ui/action.zod.ts',
18141817
'ui/app.zod.ts',
18151818
'ui/component.zod.ts',
18161819
'ui/page.zod.ts',
18171820
]) {
18181821
expect(openingOf(rel), rel).toBeNull();
18191822
}
18201823
});
1824+
1825+
it('opens `ui/action` with the module header written above its imports (#34824 N4)', () => {
1826+
// The one #13334 module that regained a description, and how: not a
1827+
// symbol's comment back in the import list, but a block in the header zone
1828+
// — after the licence line, before the first import — that describes the
1829+
// module. Pinned on three facts so neither a re-wedged symbol comment nor a
1830+
// header glued to a declaration can pass for it.
1831+
const rel = 'ui/action.zod.ts';
1832+
const source = fs.readFileSync(path.join(SRC_DIR, rel), 'utf-8');
1833+
const block = findModuleDocBlock(source);
1834+
1835+
// ① the opening, exactly — the page's first line and the skill-index row.
1836+
expect(opening(block)).toBe(
1837+
'Action protocol schemas — `ActionSchema`, the `action` metadata type, and the parts it is built from.',
1838+
);
1839+
1840+
// ② the selected block is the header zone's: nothing but the licence line
1841+
// and blanks precede it, and no import does.
1842+
const at = source.indexOf(`/**${block}*/`);
1843+
expect(at).toBeGreaterThan(-1);
1844+
const before = source.slice(0, at).split('\n').filter(l => l.trim() !== '');
1845+
expect(before).toEqual(['// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.']);
1846+
1847+
// ③ what follows it is the import list, not a declaration it could be
1848+
// documenting.
1849+
const after = source.slice(at + `/**${block}*/`.length).split('\n').find(l => l.trim() !== '');
1850+
expect(after).toMatch(/^import\b/);
1851+
});
18211852
});
18221853

18231854
/**

0 commit comments

Comments
 (0)