Skip to content

Commit a3f79a5

Browse files
committed
fix(ui): teach the gates the retired node-visibility spellings
Three ui gates still spelled the retired keys and went red on CI: - turbo.objectui.json: `packages/sdui-parser/src/retired-visibility-dialects.ts` joins the `build` inputs, so turbo re-hashes the sdui-parser build when that file moves (scripts/__tests__/turbo-build-inputs.test.ts). - scripts/check-skill-examples.mjs: the `json` marked-fence floor drops 70 -> 69 with its reason beside the row — the "Data-dependent" fence in skills/objectui/guides/schema-expressions.md taught `visibleOn` and was deleted to stay under the guide's token ceiling. - scripts/check-doc-expression-carriage.mjs and its test: the control fixtures and the sabotage keys spell `visibleWhen`, the surviving conditional-visibility predicate; the VISIBILITY_* pin reads three show / hide keys and four condition channels (`disabled` stands alone now that `disabledOn` is retired). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E5XcbmSeZTDGm5zCYkC9XV
1 parent 1ef5c48 commit a3f79a5

4 files changed

Lines changed: 25 additions & 14 deletions

File tree

‎ui/scripts/__tests__/check-doc-expression-carriage.test.ts‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,17 @@ describe('check-doc-expression-carriage: the evaluated-channel universe is deriv
8484
return [...literal!.matchAll(/'([^']+)'/g)].map((m) => m[1]);
8585
};
8686
const visibility = [...declared('VISIBILITY_SHOW_KEYS'), ...declared('VISIBILITY_HIDE_KEYS')];
87-
// Five: the page component's `visibility` leg was retired (objectui#12654).
88-
expect(visibility.length).toBe(5);
87+
// Three: the page component's `visibility` leg was retired (objectui#12654),
88+
// then the `visibleOn` / `hiddenOn` spellings (objectstack#25926, ADR-0089):
89+
// `visibleWhen` and `visible` show, `hidden` hides.
90+
expect(visibility.length).toBe(3);
8991
for (const key of visibility) expect(channels.conditions).toContain(key);
90-
// The enablement pair is not in either array — it routes through
92+
// The enablement key is not in either array — it routes through
9193
// `evaluateEnablementPredicate`, which is why the gate reads call sites at all.
94+
// `disabledOn` was retired with the pair above, so `disabled` stands alone.
9295
expect(channels.conditions).toContain('disabled');
93-
expect(channels.conditions).toContain('disabledOn');
94-
expect(channels.conditions.length).toBe(7);
96+
expect(channels.conditions).not.toContain('disabledOn');
97+
expect(channels.conditions.length).toBe(4);
9598
});
9699

97100
it('refuses to census against a guessed universe when the renderer is missing', () => {
@@ -105,7 +108,7 @@ describe('check-doc-expression-carriage: the evaluated-channel universe is deriv
105108
fs.mkdirSync(path.join(fake, path.dirname(RENDERER_SOURCE)), { recursive: true });
106109
fs.writeFileSync(
107110
path.join(fake, RENDERER_SOURCE),
108-
'// no evaluate call sites at all, only prose naming visibleOn and properties\n',
111+
'// no evaluate call sites at all, only prose naming visibleWhen and properties\n',
109112
);
110113
expect(() => deriveChannels(fake)).toThrow(/matched nothing/);
111114
fs.rmSync(fake, { recursive: true, force: true });
@@ -142,7 +145,7 @@ describe('check-doc-expression-carriage: the controls can see, and can fail', ()
142145
it('fails when a carried channel is dropped and the clean node starts reporting', async () => {
143146
const carriage = await loadCarriage();
144147
const real = deriveChannels(ROOT);
145-
const crippled = { ...real, all: real.all.filter((key) => key !== 'visibleOn') };
148+
const crippled = { ...real, all: real.all.filter((key) => key !== 'visibleWhen') };
146149
const controls = runControls({ channels: crippled, carriage });
147150
expect(controls.failures.join('\n')).toMatch(/negative control/);
148151
});
@@ -559,7 +562,7 @@ describe('check-doc-expression-carriage: the census on a fixture tree', () => {
559562
'{',
560563
' "type": "card",',
561564
' "title": "${item.name}",',
562-
' "visibleOn": "${item.active}"',
565+
' "visibleWhen": "${item.active}"',
563566
'}',
564567
'```',
565568
'',
@@ -774,7 +777,7 @@ describe('check-doc-expression-carriage: the real tree, and the posture', () =>
774777
const real = deriveChannels(ROOT);
775778
const honest = analyze(ROOT, { channels: real, carriage });
776779

777-
for (const key of ['visibleOn', 'content']) {
780+
for (const key of ['visibleWhen', 'content']) {
778781
const crippled = { ...real, all: real.all.filter((k: string) => k !== key) };
779782
const sabotaged = analyze(ROOT, { channels: crippled, carriage });
780783
expect(

‎ui/scripts/check-doc-expression-carriage.mjs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@
8484
* `content` leg), `isConfigBag(newSchema.<key>)` (the `properties`
8585
* and `props` bags), and
8686
* `evaluate{Visibility,Enablement}Predicate(newSchema.<key>, …)`
87-
* (the eight condition keys). Read from `run`-shaped call sites,
87+
* (the four condition keys). Read from `run`-shaped call sites,
8888
* never from the surrounding comments: that file's prose names
89-
* `visibleOn`, `disabled` and the bags many times over, and a scan
89+
* `visibleWhen`, `disabled` and the bags many times over, and a scan
9090
* of the raw text would be describing its own docblocks.
9191
*
9292
* A node's carried set is the union of the two, and a node whose `type` has no
@@ -1045,15 +1045,15 @@ export const CONTROL_FIXTURES = {
10451045
"type": "badge",
10461046
"text": "\${status}",
10471047
"variant": "\${status === 'active' ? 'success' : 'warning'}",
1048-
"visibleOn": "\${status !== null}"
1048+
"visibleWhen": "\${status !== null}"
10491049
}`,
10501050
negative: `{
10511051
"type": "card",
10521052
"title": "\${item.name}",
10531053
"description": "\${item.role}",
10541054
"content": "\${greeting}",
10551055
"properties": { "className": "\${theme.card}" },
1056-
"visibleOn": "\${item.active}"
1056+
"visibleWhen": "\${item.active}"
10571057
}`,
10581058
/**
10591059
* The DIALECT controls (objectui#8334). The positive fixture is the shape the

‎ui/scripts/check-skill-examples.mjs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,14 @@ export const MARKED_FLOOR = new Map([
542542
// json/jsonc fences in the corpus now parses under its own tag and carries
543543
// the marker. Raising the number is the ADD direction this list documents:
544544
// the population measured 39 marked / 46 parsing before, 70 / 70 after.
545-
['json', 70],
545+
// 70 -> 69 (objectstack#25926): the "Data-dependent" `json` fence in
546+
// `skills/objectui/guides/schema-expressions.md` was DELETED, not unmarked.
547+
// It taught `visibleOn`, which that card retires (ADR-0089: `visibleWhen` is
548+
// the one conditional-visibility predicate), and the guide's token ceiling
549+
// (scripts/check-skills-token-ratchet.mjs) left no room to keep a second
550+
// example beside the rewritten one that now teaches `visibleWhen`. The fence
551+
// was green at deletion; nothing here routes around a red.
552+
['json', 69],
546553
]);
547554

548555
/**

‎ui/turbo.objectui.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"$TURBO_ROOT$/packages/sdui-parser/src/input-type.ts",
3030
"$TURBO_ROOT$/packages/sdui-parser/src/parse.ts",
3131
"$TURBO_ROOT$/packages/sdui-parser/src/provenance.ts",
32+
"$TURBO_ROOT$/packages/sdui-parser/src/retired-visibility-dialects.ts",
3233
"$TURBO_ROOT$/packages/sdui-parser/src/types.ts",
3334
"$TURBO_ROOT$/packages/sdui-parser/src/validate.ts"
3435
]

0 commit comments

Comments
 (0)