Skip to content

Commit 2ae1667

Browse files
committed
test(cli): keep the new explain pins free of implicit any
`packages/cli/test/commands.test.ts` sits outside every tsc program in the repo (the TEST_DEBT ledger records the package), so nothing would have reported an implicit `any` in the pins added for #14782 — and an implicit `any` there silently stops the assertion from checking anything. Measured with an ad-hoc strict pass over the file: origin/main carries 15 errors (13 TS2835 from its extensionless relative imports, 2 TS7006 in the pre-existing ownership test). The first draft of the pins took that to 18. With a local `CatalogField` shape and a typed `Object.entries` cast it is back to exactly the baseline 15 — no new error, and no widening of what the pins actually assert. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
1 parent 37a3a28 commit 2ae1667

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

packages/cli/test/commands.test.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ describe('os explain — schema catalog accuracy', () => {
117117
// Parsing the sample against the real schema is the guard that cannot itself
118118
// drift — it re-derives the truth from the spec on every run, which is what
119119
// the hand-maintained catalog otherwise has no way to do.
120+
// The catalog's element shape, stated locally: `SchemaInfo` is not exported,
121+
// and these tests must stay honest even where `SCHEMAS` widens to `any`
122+
// (this file sits outside every tsc program — see the TEST_DEBT ledger — so
123+
// an implicit `any` here would silently stop checking anything).
124+
type CatalogField = { name: string; type: string };
125+
const flowFields = (kind: 'required' | 'optional'): CatalogField[] => SCHEMAS.flow[kind];
126+
120127
it('ships a flow example that actually parses as a Flow (#14782)', () => {
121128
// The catalog stores examples as authored source, so evaluate the literal.
122129
const literal = new Function(`return (${SCHEMAS.flow.example});`)() as unknown;
@@ -130,7 +137,7 @@ describe('os explain — schema catalog accuracy', () => {
130137
});
131138

132139
it('documents flow.type as the full FlowSchema type enum (#14782)', () => {
133-
const type = SCHEMAS.flow.required.find((f) => f.name === 'type');
140+
const type = flowFields('required').find((f) => f.name === 'type');
134141
expect(type, 'flow schema should document a `type` field').toBeDefined();
135142
const tokens = (type!.type.match(/'[^']+'|"[^"]+"/g) ?? []).map((t) => t.slice(1, -1));
136143
expect(new Set(tokens)).toEqual(
@@ -140,13 +147,14 @@ describe('os explain — schema catalog accuracy', () => {
140147

141148
it('teaches the acting user as {$User.Id}, and no catalog example revives $currentUser (#14782)', () => {
142149
expect(SCHEMAS.flow.example).toContain('{$User.Id}');
143-
for (const [key, info] of Object.entries(SCHEMAS)) {
150+
const entries = Object.entries(SCHEMAS) as Array<[string, { example: string }]>;
151+
for (const [key, info] of entries) {
144152
expect(info.example, `os explain ${key} example`).not.toContain('$currentUser');
145153
}
146154
});
147155

148156
it('never re-teaches `steps` / `trigger` as flow keys — both are aliases, not fields (#14782)', () => {
149-
const declared = [...SCHEMAS.flow.required, ...SCHEMAS.flow.optional].map((f) => f.name);
157+
const declared = [...flowFields('required'), ...flowFields('optional')].map((f) => f.name);
150158
expect(declared).not.toContain('steps');
151159
expect(declared).not.toContain('trigger');
152160
expect(declared).toContain('nodes');

0 commit comments

Comments
 (0)