Skip to content

Commit 8efe206

Browse files
thymikeeclaude
andcommitted
chore(gates): drop the dynamic-import binding residue no rule reads
R76's classification table was its only reader; since #3430 collapsed R76 to a ban, ImportEdge.bindingResidue and the residue capture behind it are computed and pinned but never consumed. Destructured dynamic-import symbols are still captured. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent e155fbf commit 8efe206

7 files changed

Lines changed: 9 additions & 30 deletions

File tree

‎scripts/layering/commands-schema-boundary.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ function importEdge(
1616
dynamic: false,
1717
typeOnly: false,
1818
symbols: [],
19-
bindingResidue: false,
2019
fromZone: targetDagZone(file),
2120
toZone: targetDagZone(target),
2221
...overrides,

‎scripts/layering/daemon-client-entry.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ function clientEdge(
2020
dynamic: kind === 'dynamic',
2121
typeOnly: kind === 'type',
2222
symbols: [],
23-
bindingResidue: false,
2423
fromZone: targetDagZone(file),
2524
toZone: targetDagZone(target),
2625
};

‎scripts/layering/daemon-modularity.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ function importEdge(file: string, target: string): ResolvedImportEdge {
2020
dynamic: false,
2121
typeOnly: true,
2222
symbols: [],
23-
bindingResidue: false,
2423
fromZone: targetDagZone(file),
2524
toZone: targetDagZone(target),
2625
};

‎scripts/layering/layering-ast.ts‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,12 @@ function unwrapImportInit(node: unknown): Record<string, unknown> | null {
6969
export type DestructuredDynamicImport = Readonly<{
7070
/** Export names captured from static (non-computed) property keys. */
7171
symbols: readonly string[];
72-
/** True when the pattern also holds a rest element or a computed key: the import surface is wider than `symbols`. */
73-
residue: boolean;
7472
}>;
7573

7674
/**
7775
* Bindings captured by destructuring a dynamic import
7876
* (`const { a, b: local } = await import('...')` captures `a` and `b`), keyed by the import
79-
* expression's source offset. A rest element or a computed key is a binding the scanner cannot
80-
* name and is reported as residue, never dropped: it exposes exports beyond `symbols`.
77+
* expression's source offset. A rest element or a computed key names no export and is skipped.
8178
* Namespace-form and bare dynamic imports capture nothing.
8279
*/
8380
export function destructuredDynamicImportBindings(
@@ -102,27 +99,22 @@ export function destructuredDynamicImportBindings(
10299
(id as Record<string, unknown>).type === 'ObjectPattern'
103100
) {
104101
const symbols: string[] = [];
105-
let residue = false;
106102
const properties = (id as Record<string, unknown>).properties;
107-
if (!Array.isArray(properties)) {
108-
residue = true;
109-
} else {
103+
if (Array.isArray(properties)) {
110104
for (const property of properties) {
111105
if (
112106
property === null ||
113107
typeof property !== 'object' ||
114108
(property as Record<string, unknown>).type !== 'Property' ||
115109
(property as Record<string, unknown>).computed === true
116110
) {
117-
residue = true;
118111
continue;
119112
}
120113
const name = propertyName((property as Record<string, unknown>).key);
121114
if (name) symbols.push(name);
122-
else residue = true;
123115
}
124116
}
125-
captures.set(init.start, { symbols, residue });
117+
captures.set(init.start, { symbols });
126118
}
127119
}
128120
for (const child of Object.values(record)) visit(child);

‎scripts/layering/model.test.ts‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@ test('parseImports detects multiline dynamic imports', () => {
292292
typeOnly: false,
293293
line: 1,
294294
symbols: [],
295-
bindingResidue: false,
296295
},
297296
]);
298297
});
@@ -307,7 +306,6 @@ test('parseImports resolves constant-template dynamic imports', () => {
307306
typeOnly: false,
308307
line: 1,
309308
symbols: [],
310-
bindingResidue: false,
311309
},
312310
]);
313311
});
@@ -324,13 +322,13 @@ test('parseImports captures destructured named bindings of dynamic imports, keye
324322
);
325323

326324
assert.deepEqual(
327-
edges.map(({ spec, symbols, bindingResidue }) => ({ spec, symbols, bindingResidue })),
325+
edges.map(({ spec, symbols }) => ({ spec, symbols })),
328326
[
329-
{ spec: './dyn.ts', symbols: ['a', 'b'], bindingResidue: false },
330-
{ spec: './dyn.ts', symbols: [], bindingResidue: false },
331-
{ spec: './dyn.ts', symbols: [], bindingResidue: false },
332-
{ spec: './dyn.ts', symbols: ['a'], bindingResidue: true },
333-
{ spec: './dyn.ts', symbols: [], bindingResidue: true },
327+
{ spec: './dyn.ts', symbols: ['a', 'b'] },
328+
{ spec: './dyn.ts', symbols: [] },
329+
{ spec: './dyn.ts', symbols: [] },
330+
{ spec: './dyn.ts', symbols: ['a'] },
331+
{ spec: './dyn.ts', symbols: [] },
334332
],
335333
);
336334
});

‎scripts/layering/model.ts‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ export type ImportEdge = {
2020
* dynamic imports that do not destructure named bindings.
2121
*/
2222
symbols: readonly string[];
23-
/**
24-
* True when a dynamic-import destructure holds a binding the scanner cannot name (a rest element
25-
* or a computed key); `symbols` then does not enumerate the full imported surface.
26-
*/
27-
bindingResidue: boolean;
2823
};
2924

3025
export type ResolvedImportEdge = ImportEdge & {
@@ -221,7 +216,6 @@ function staticImportEdge(
221216
typeOnly,
222217
line: sourceLine(source, start),
223218
symbols,
224-
bindingResidue: false,
225219
};
226220
}
227221

@@ -249,7 +243,6 @@ export function parseImports(source: string): ImportEdge[] {
249243
typeOnly: false,
250244
line: sourceLine(source, start),
251245
symbols: capture ? [...capture.symbols] : [],
252-
bindingResidue: capture?.residue ?? false,
253246
},
254247
});
255248
return;

‎scripts/layering/zone-policy.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ function edge(file: string, fromZone: string, toZone: string, kind: Kind = {}) {
1919
dynamic: kind.dynamic ?? false,
2020
typeOnly: kind.typeOnly ?? false,
2121
symbols: [],
22-
bindingResidue: false,
2322
},
2423
};
2524
}

0 commit comments

Comments
 (0)