test: read the credentials isolation imports from the esbuild graph #45
Loading…
Reference in a new issue
No description provided.
Delete branch "test/wrapped-import-scan"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to #44 (summary-only claim 01M458MP2PD8H6ZQM3R1NWVR34): the credentials isolation tests now read imports from esbuild's metafile instead of a regex, so wrapped, bare and dynamic imports all count, and the importer test fails unless it sees
src/main.ts's import. It targetsmainwith no merge-order constraint, but whichever of this PR and #44 merges second conflicts insrc/credentials.test.ts: #44 still callsreadFileSync, which this PR drops from thenode:fsimport, and #46 adds a secondesbuildimport.🤖 Generated with Claude Code
Review
01M45PPWRHFZ0WAZD6ZMSKFZ15— head875c6a16fa058763fcce5b5b2593022965cb668eReview — j4k-oss/review-wrapper @
bbcbbdc9f6Scope: diff against base tree
6fc1cae5b0f0Status: dispatched — coverage complete (5/5 slots terminal)
Facts: current review-wide projection
Computed under:
Findings (0)
No findings survived.
Reviewed:
Other claims
Coverage
Coverage pass: 01M45PQ347RR4GCGJ42YKJZSB9
Accounting: complete
Slot health: healthy
@ -5,2 +5,3 @@const IMPORT_SPECIFIER = /(?:^|\n)\s*(?:import|export)[^\n]*?from\s+"(?<specifier>[^"]+)"/gu;// The gap before `from` crosses lines but not statements, so a wrapped import counts.const IMPORT_SPECIFIER = /(?:^|\n)\s*(?:import|export)\b[^;]*?\bfrom\s+"(?<specifier>[^"]+)"/gu;low — "imports only node: builtins" cannot see side-effect or dynamic imports, because IMPORT_SPECIFIER requires a
fromclauselens
test-trimming· armdefault· tally 1 valid / 0 invalid / 0 uncertainclaim
01M45ADFW9C9DGREXVVBFP565Wof review01M45A9VH96K648J2TW06EQQ8QFixed in
07baca3. The tests no longer scan source with a regex. They read the import graph from esbuild's metafile, which records every way one module loads another: wrapped and bare static imports, re-exports, and dynamic imports of a literal path. I checked it by addingimport "./review/api.ts";and thenawait import("./review/api.ts")tosrc/credentials.ts: "imports only node: builtins" failed both times and passed again once I reverted them.Round 1, review
01M45A9VH96K648J2TW06EQQ8Qof9b7961a, all five slots delivered. Both findings are fixed in07baca3, which reads imports from esbuild's metafile instead of a regex:01M45AD4SYSDWA3FZ4A93303E8(summary only): the importer test now assertstoStrictEqual(["src/main.ts"]), so main.ts's import is a positive control. Removing that import fromsrc/main.tsmakes the test fail.01M45ADFW9C9DGREXVVBFP565W: answered in thread #126358.test: count wrapped imports in the credentials isolation teststo test: read the credentials isolation imports from the esbuild graph@ -172,4 +191,4 @@}});it("is imported by no wrapper module other than src/main.ts", () => {low — Test name "is imported by no wrapper module other than src/main.ts" no longer matches its assertion, which now also requires src/main.ts to import credentials.ts
lens
writing-quality· armdefault· tally 1 valid / 0 invalid / 0 uncertainclaim
01M45BRYXYXD3CFKXYP142GWYDof review01M45BMA1MQ417JKE8C6S91G0STracked in #47, which is stacked on this PR. It renames the test to "is imported by src/main.ts and no other wrapper module", as you suggested. This is round 2 and the test still checks the right thing under its old name, so the rename goes in #47 instead of here.
Round 2, review
01M45BMA1MQ417JKE8C6S91G0Sof07baca3, all five slots delivered. Its one finding,01M45BRYXYXD3CFKXYP142GWYD(thread #126678, the test name that no longer matches its assertion), is tracked in #47, stacked on this PR.07baca3a27875c6a16fa