Skip to content

build(scripts): type-check the shared verifier run, fixture, cleanup and source loader - #11609

Merged
morluto merged 2 commits into
mainfrom
build/typecheck-verifier-libs
Nov 16, 2026
Merged

morluto merged 2 commits into
mainfrom
build/typecheck-verifier-libs

Conversation

@morluto

@morluto morluto commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fifth #11545 slice: typecheck now checks the shared verifier libraries scripts/lib/verifier-run.mjs, verifier-fixture.mjs, verifier-cleanup.mjs, verifier-source-loader.mjs and canonical-temporary-directory.mjs against src, 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:

  • build(scripts): type-check the managed PE and function dossier fixtures #11611: scripts/fixtures/managed/pe.mjs and function-dossier.mjs (68 errors). Option types come from pe.d.mts, and heap names are paired with their rows. Optional metadata tables are set on the row map, and bodyRva refuses an unplaced body. A comparison of 12 option sets showed the fixture bytes are unchanged. Validation: 7 test files and 352 tests passed.
  • build(scripts): type-check the managed conformance entry point and support #11612: scripts/verify/managed/{conformance,support,config}.mjs (34 errors), which completes the managed conformance closure. assert.ok narrows each Result, Evidence results are read through their owners' schemas, and the comparison check reads left?.token (a right-only method has left: null). The callback returns the report. Validation: node scripts/verify/managed/conformance.mjs exited 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-any parameters:

  • verifier-source-loader.mjs calls stripTypeScriptTypes(source, { mode: "transform", sourceMap: true }). Node.js 26.0.0 removed the transform and sourceMap options, and @types/node 26.6.4 (the repository's version) declares only mode: "strip". Owned src needs the transform: in strip-only mode, 384 of 4,501 src/scripts/lib TypeScript 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.
  • posixProcessSnapshot filtered null regex matches with a non-narrowing filter.
  • errorCode returned an untyped code that was then compared through includes.

Expected: the modules type-check against src. On a runtime without transform mode, the loader explains the pinned-runtime requirement, as it already does when registerHooks or stripTypeScriptTypes is missing.

Change and scope

  • All five modules have JSDoc types. Each of verifier-run, verifier-fixture, verifier-cleanup, verifier-source-loader and canonical-temporary-directory already has a hand-written .d.mts that 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:
    • The hooks are typed as ResolveHookSync/LoadHookSync.
    • supportedTransform probes the runtime's stripTypeScriptTypes once, with a parameter-property snippet in transform mode. The probe establishes the TransformTypeScript signature that the declared types lack: a cast through unknown, with a comment.
    • importVerifierSource refuses with the existing ".nvmrc" message when the probe fails.
    • errorCode returns only string codes.
  • verifier-run.mjs: the ps parser narrows with flatMap, and the buffers are typed.
  • verifier-fixture.mjs: the PrivateRuntimeRoot module that importVerifierSource returns is typed as that source module (a commented cast from the loader's Record<string, unknown>).
  • tests/boundary/process/verifierSourceLoading.test.ts: a new case simulates a runtime whose stripTypeScriptTypes rejects transform mode.
  • tsconfig.scripts.json: lists the five files.

Not included:

  • scripts/fixtures/managed/*, scripts/verify/managed/{conformance,support}.mjs, and the verify-real-ghidra-*/verify-real-hopper* consumers (next slices).
  • Development on Node.js 26. The source loader still needs a TypeScript transform, and Node.js 26 has none, so source-run verifiers stay limited to the pinned runtime, as the message already said.
  • Removing the duplicated .d.mts declarations. The main tsconfig.json has no allowJs, so tests need them, and nothing yet checks that a .mjs body matches its .d.mts.

Contract and boundary impact

  • Semantic owner and earliest changed stage: verification scripts and their source loader; no runtime src changes.
  • Contribution scope fit and linked maintainer decision: [Design] Type-check the JavaScript verification scripts that import domain modules #11545 (build/test tooling).
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: on a Node.js without TypeScript transform mode (26+), importVerifierSource now 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.mjs only imports typeScriptSourcePath, which does not probe.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details: none.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • node scripts/run-typescript.mjs --noEmit -p tsconfig.scripts.json reported 69 errors with the five files listed. It reports 0 after this change.
  • Probe on local runtimes: stripTypeScriptTypes(…, { mode: "transform", sourceMap: true }) transforms an enum on Node 22.22.2, 24.18.0, 24.22.1 and 25.1.0. The Node.js 26 module docs list "v26.0.0: Removed transform and sourceMap options". Node 26 was not run locally.
  • The new loader case failed against the previous loader: stderr named the eval line, not the ".nvmrc" message. It passes with this change.

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.
  • The same loader test against the previous loader: 1 failed (the new case), 5 passed.
  • npm run check:fast: passed (typecheck including tsconfig.scripts.json, lint, architecture guards).
  • npx oxfmt --check on the changed files: clean. Pre-commit and pre-push hooks passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none for supported runtimes.
  • Real Hopper/Ghidra, browser, or OS coverage: none.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-16T00:04:10.600325Z
We couldn’t complete this review. Comment @codex review to try again.
90ad806 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Base automatically changed from build/typecheck-evidence-scripts to main November 16, 2026 00:04
@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge.

Summary

This PR extends type-checking to shared verifier helpers, managed fixtures, and the managed conformance runner.

  • The source loader checks transform support before it starts an import.
  • Managed PE fixtures check their options and body placement.
  • Shared verifier helpers now type-check against their callers.
  • Managed conformance results are checked before reports are built.

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.
…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.
@morluto
morluto merged commit ad4f72d into main Nov 16, 2026
7 of 9 checks passed
@morluto
morluto deleted the build/typecheck-verifier-libs branch November 16, 2026 00:45
@morluto morluto added the area: build Build, CI, packaging, and publishing label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build Build, CI, packaging, and publishing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant