Repository navigation
build(scripts): type-check the shared verifier run, fixture, cleanup and source loader - #11609
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
[Medium impact] The reviewed changes appear safe to merge. SummaryThis PR extends type-checking to shared verifier helpers, managed fixtures, and the managed conformance runner.
No actionable new issues were found. No previous review threads were supplied. This review used source inspection; no tests were run. Supersession could not be checked because GitHub access required authentication. Reviews (6) · Last reviewed commit: "build(scripts): type-check the managed P..." · Reviewed by Greptile |
…and source loader The five scripts/lib modules join tsconfig.scripts.json (69 errors). Named types come from their existing declaration files. The source loader probes the runtime's TypeScript transform once and refuses a Node.js without transform mode (Node.js 26 removed it) with the pinned-runtime message instead of failing on the first owned source file.
90ad806 to
26c9765
Compare
…es (#11611) * build(scripts): type-check the managed PE and function dossier fixtures pe.mjs and function-dossier.mjs join tsconfig.scripts.json (68 errors). Named option types come from pe.d.mts; heap names are paired with their rows instead of read back by index; optional metadata tables are added to the row map directly; a placed body's RVA is computed by bodyRva, which refuses an unplaced body. Fixture bytes are unchanged. * build(scripts): type-check the managed conformance entry point and support (#11612) conformance.mjs, support.mjs and config.mjs join tsconfig.scripts.json (34 errors), completing the managed conformance closure. Result checks narrow with assert.ok, Evidence results are read through their owners' schemas, the native function subject is an EvidenceSubjectTarget, the comparison check no longer dereferences a right-only method's null left side, and the fixture callback returns the report instead of assigning outer variables.
Summary
Fifth #11545 slice:
typechecknow checks the shared verifier librariesscripts/lib/verifier-run.mjs,verifier-fixture.mjs,verifier-cleanup.mjs,verifier-source-loader.mjsandcanonical-temporary-directory.mjsagainstsrc, which fixed 69 errors. The check also found that the source loader calls a TypeScript transform that Node.js 26 removed. The loader now refuses such a runtime with its pinned-runtime message. Based on main (slices 1-4 merged in #11579). Slices 6 (#11611) and 7 (#11612) were collapsed into this PR. Refs #11545.Collapsed slices:
scripts/fixtures/managed/pe.mjsandfunction-dossier.mjs(68 errors). Option types come frompe.d.mts, and heap names are paired with their rows. Optional metadata tables areseton the row map, andbodyRvarefuses an unplaced body. A comparison of 12 option sets showed the fixture bytes are unchanged. Validation: 7 test files and 352 tests passed.scripts/verify/managed/{conformance,support,config}.mjs(34 errors), which completes the managed conformance closure.assert.oknarrows eachResult, Evidence results are read through their owners' schemas, and the comparison check readsleft?.token(a right-only method hasleft: null). The callback returns the report. Validation:node scripts/verify/managed/conformance.mjsexited 0, and its report matched the report from before this change.Problem and expected behavior
Most verify scripts share these five modules, and they were unchecked. Besides implicit-
anyparameters:verifier-source-loader.mjscallsstripTypeScriptTypes(source, { mode: "transform", sourceMap: true }). Node.js 26.0.0 removed thetransformandsourceMapoptions, and@types/node26.6.4 (the repository's version) declares onlymode: "strip". Ownedsrcneeds the transform: in strip-only mode, 384 of 4,501src/scripts/libTypeScript files fail (parameter properties). The loader's runtime guard only checked that the function existed. On a runtime without transform mode, it registered hooks and then failed on the first owned file with an unrelated error.posixProcessSnapshotfilterednullregex matches with a non-narrowingfilter.errorCodereturned an untypedcodethat was then compared throughincludes.Expected: the modules type-check against
src. On a runtime without transform mode, the loader explains the pinned-runtime requirement, as it already does whenregisterHooksorstripTypeScriptTypesis missing.Change and scope
verifier-run,verifier-fixture,verifier-cleanup,verifier-source-loaderandcanonical-temporary-directoryalready has a hand-written.d.mtsthat TypeScript consumers (tests) import. The named types (VerifierRunStart,VerifierRun,VerifierProcessLineage,VerifierFixtureRoot) are taken from those declaration files rather than declared a second time.verifier-source-loader.mjs:ResolveHookSync/LoadHookSync.supportedTransformprobes the runtime'sstripTypeScriptTypesonce, with a parameter-property snippet in transform mode. The probe establishes theTransformTypeScriptsignature that the declared types lack: a cast throughunknown, with a comment.importVerifierSourcerefuses with the existing ".nvmrc" message when the probe fails.errorCodereturns only string codes.verifier-run.mjs: thepsparser narrows withflatMap, and the buffers are typed.verifier-fixture.mjs: thePrivateRuntimeRootmodule thatimportVerifierSourcereturns is typed as that source module (a commented cast from the loader'sRecord<string, unknown>).tests/boundary/process/verifierSourceLoading.test.ts: a new case simulates a runtime whosestripTypeScriptTypesrejects transform mode.tsconfig.scripts.json: lists the five files.Not included:
scripts/fixtures/managed/*,scripts/verify/managed/{conformance,support}.mjs, and theverify-real-ghidra-*/verify-real-hopper*consumers (next slices)..d.mtsdeclarations. The maintsconfig.jsonhas noallowJs, so tests need them, and nothing yet checks that a.mjsbody matches its.d.mts.Contract and boundary impact
srcchanges.importVerifierSourcenow refuses up front with the pinned-runtime message, instead of failing on the first owned source file. The Node 26 CI lane (sqlite-runtime.yml) does not load verifier source;scripts/run-exact-tests.mjsonly importstypeScriptSourcePath, which does not probe.Evidence and regression coverage
node scripts/run-typescript.mjs --noEmit -p tsconfig.scripts.jsonreported 69 errors with the five files listed. It reports 0 after this change.stripTypeScriptTypes(…, { mode: "transform", sourceMap: true })transforms anenumon Node 22.22.2, 24.18.0, 24.22.1 and 25.1.0. The Node.js 26 module docs list "v26.0.0: RemovedtransformandsourceMapoptions". Node 26 was not run locally.Validation performed
macOS (arm64), Node 24.22.1:
npm run test:focused -- tests/boundary/process/verifierSourceLoading.test.ts tests/boundary/process/verifierRun.test.ts tests/process-global/verifierRun.test.ts tests/process-global/verifierFixture.test.ts tests/boundary/process/providerVerifierCleanup.test.ts: 5 files, 30 tests passed.npm run check:fast: passed (typecheck includingtsconfig.scripts.json, lint, architecture guards).npx oxfmt --checkon the changed files: clean. Pre-commit and pre-push hooks passed.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.