Skip to content
This repository was archived by the owner on Oct 26, 2026. It is now read-only.

Commit e3a23eb

Browse files
committed
test(types): the closure walk looks for the parser tier to the end of the next sentence (objectui#10981)
The walk required "the parser tier's" within 80 characters after every "no … error or warning" phrasing. objectui#9256's `metric-card` refusal (PR #11020) names the parser tier correctly, but in the sentence after, to record why it stays silent in a widget slot. So the merge queue went red on a true text. The bound is now the end of the sentence after the phrasing. `MAX_WINDOW` only guards a text with no sentence end. Claude-Session: https://claude.ai/code/session_012UwY3ahMixEFkfTUxMVkYm Co-authored-by: Claude <noreply@anthropic.com>
1 parent f78eb96 commit e3a23eb

1 file changed

Lines changed: 39 additions & 5 deletions

File tree

‎packages/types/src/__tests__/silence-clause-parser-tier-closure-10981.test.ts‎

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@
4646
* refusal with its code and path first, on the TS face read off the member's
4747
* docblock. Then the closure walk: over every non-test `.ts` file of this
4848
* package's `src`, no joined text still pairs "no error" with "no warning",
49-
* and every "no … error or warning" phrasing is followed by the parser tier's
50-
* clause. The rest of each string is NOT pinned; the sites' own pins read it.
49+
* and every "no … error or warning" phrasing names the parser tier in its own
50+
* sentence or the next one. The rest of each string is NOT pinned; the sites'
51+
* own pins read it.
5152
*/
5253

5354
import { describe, it, expect } from 'vitest';
@@ -200,6 +201,38 @@ describe('objectui#10981 — the closure walk over this package\'s `src`', () =>
200201
const COMBINED = /\bno (?:[\w-]+ )?errors? (?:or|nor|and) (?:[\w-]+ )?warnings?\b/gi;
201202
const PARSER_TIER = "the parser tier's";
202203

204+
/**
205+
* Where the parser tier has to be named: anywhere from the phrasing to the
206+
* end of the sentence AFTER the one it sits in.
207+
*
208+
* The phrasing speaks for the render tier only, so the text must go on to say
209+
* what the parser tier did. The family writes that in one of two places. Most
210+
* sites keep it in the same sentence ("…; only the parser tier's
211+
* `unknown-prop` warning noticed it"). A site where the parser tier is
212+
* genuinely silent gives it the next sentence, because it has a reason to
213+
* record: objectui#9256's `metric-card` refusal says that "in a widget slot
214+
* nothing else noticed it either: the parser tier's `not-a-container` warning
215+
* (objectui#9910) walks `children`, never `widgets`". A fixed character count
216+
* after the match is not that rule. It was 80 here, and it failed the
217+
* `metric-card` text, which names the parser tier correctly but a little
218+
* further on. Any count is too short for some honest sentence and long
219+
* enough to reach an unrelated one somewhere else.
220+
*
221+
* A sentence ends at `.`, `!` or `?` followed by whitespace, the end of the
222+
* text, or a closing quote (a zod string ends in `.'`). So the dots in
223+
* `zod/form.zod.ts` or `.describe()` end nothing. `MAX_WINDOW` does not set
224+
* the rule. It only stops a text with no sentence end from reaching the rest
225+
* of its file.
226+
*/
227+
const MAX_WINDOW = 600;
228+
const windowAfter = (t: string, from: number): string => {
229+
const end = /[.!?](?=['"`]?(?:\s|$))/g;
230+
end.lastIndex = from;
231+
const own = end.exec(t);
232+
const next = own ? end.exec(t) : null;
233+
return t.slice(from, Math.min(next ? next.index + 1 : t.length, from + MAX_WINDOW));
234+
};
235+
203236
it('the walk reaches the four sites and both earlier waves (non-vacuity, by name rather than by count)', () => {
204237
const names = files.map((f) => f.slice(SRC.length + 1));
205238
for (const f of ['base.ts', 'data-display.ts', 'zod/form.zod.ts', 'zod/objectql.zod.ts']) expect(names).toContain(f);
@@ -213,11 +246,12 @@ describe('objectui#10981 — the closure walk over this package\'s `src`', () =>
213246
expect(hits).toEqual([]);
214247
});
215248

216-
it('every "no … error or warning" phrasing names the parser tier right after it', () => {
249+
it('every "no … error or warning" phrasing names the parser tier in the same or the next sentence', () => {
217250
const bare = texts.flatMap(([f, t]) =>
218251
[...t.matchAll(COMBINED)]
219-
.filter((m) => !t.slice(m.index, (m.index ?? 0) + m[0].length + 80).includes(PARSER_TIER))
220-
.map((m) => `${f}: «${t.slice(m.index, (m.index ?? 0) + m[0].length + 80)}»`),
252+
.map((m) => windowAfter(t, m.index ?? 0))
253+
.filter((w) => !w.includes(PARSER_TIER))
254+
.map((w) => `${f}: «${w}»`),
221255
);
222256
expect(bare).toEqual([]);
223257
});

0 commit comments

Comments
 (0)