Skip to content

build(scripts): type-check the managed PE and function dossier fixtures - #11611

Merged
morluto merged 2 commits into
build/typecheck-verifier-libsfrom
build/typecheck-managed-fixtures
Nov 16, 2026
Merged

morluto merged 2 commits into
build/typecheck-verifier-libsfrom
build/typecheck-managed-fixtures

Conversation

@morluto

@morluto morluto commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Summary

Sixth #11545 slice: typecheck now checks the managed fixture builders scripts/fixtures/managed/pe.mjs and function-dossier.mjs against src, which fixed 68 errors. The fixture bytes are unchanged. Stacked on #11609. Refs #11545.

Problem and expected behavior

The managed conformance run and seven test files build their PE/CLI fixtures with pe.mjs. Besides implicit-any parameters, the checker found gaps:

  • Heap indexes were read back by position (fieldNames[index], stringsForMethods[index]) and could be undefined under noUncheckedIndexedAccess.
  • The RVA of a method without one was computed from layout.methodOffsets[index] - 0x0200. That offset can be null (a method with RVA zero), so a bad layout would produce NaN silently.
  • The optional metadata tables were spread into the Map constructor as conditional arrays, which the checker cannot type as [table, rows] pairs.

Change and scope

  • pe.mjs:
    • ManagedPeFixtureOptions and ManagedPeFixtureMethod come from the existing pe.d.mts, which tests import.
    • Field and method names are paired with their rows when they are added to the string heap. Heap order is the same.
    • The optional constant, module-ref and impl-map tables are set on the row map. The stream orders tables by number, not by insertion order.
    • bodyRva computes a placed body's RVA and refuses an unplaced one.
    • The image builder pairs each method with its offset.
  • function-dossier.mjs: one parameter type.
  • tsconfig.scripts.json: lists both files.

Not included: scripts/verify/managed/{conformance,support}.mjs (next slice), and the verify-real-ghidra-*/verify-real-hopper* consumers.

Contract and boundary impact

  • Semantic owner and earliest changed stage: source-owned test fixtures; 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: none.
  • Evidence, artifact, provenance, or reconstruction contract: none. The fixture bytes are identical.
  • 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 68 errors with the two files listed. It reports 0 after this change.
  • A local byte comparison (scratch script, not committed) built fixtures with the previous and new pe.mjs for 12 option sets. The sets were: default, empty, P/Invoke, constants, mixed methods with RVA 0 and an explicit RVA, fields, ReadyToRun x64, ARM64 with references, framework with an alternate MVID, corrupt signature with an extra valid-mask bit, every single-method option, and the native fixture. All 12 matched.

Validation performed

macOS (arm64), Node 24.22.1:

  • The byte comparison above: 12 cases, 0 differences.
  • npm run test:focused -- src/dotnet/ManagedPeFixtureLayout.test.ts src/dotnet/ManagedFieldConstantsBudget.test.ts src/dotnet/ManagedFieldConstants.test.ts src/dotnet/ManagedMemberInspector.test.ts tests/boundary/providers/managed/managedFieldConstantsComparison.test.ts tests/boundary/providers/managed/managedMemberComparisonFromMetadata.test.ts tests/boundary/process/managedManifestAdmission.test.ts: 7 files, 352 tests 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.
  • Not run: tests/boundary/mcp/managedFieldConstantsMcp.test.ts and tests/boundary/filesystem/ciCodeqlScope.test.ts, which also import the fixture. With identical bytes, they are not expected to change.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • 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:06:48.203025Z
We couldn’t complete this review. Comment @codex review to try again.
57a9a0d 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.

@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; no blocking issues were found.

Summary

Adds type checking for the managed fixtures and conformance scripts.

  • The scripts check now covers managed fixture building.
  • Managed conformance scripts now keep report data tied to checked fixture inputs.

Reviews (2) · Last reviewed commit: "build(scripts): type-check the managed c..." · Reviewed by Greptile

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.
…pport (#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 fc8c43d into build/typecheck-verifier-libs Nov 16, 2026
1 check passed
@morluto
morluto deleted the build/typecheck-managed-fixtures branch November 16, 2026 00:15
morluto added a commit that referenced this pull request Nov 16, 2026
…and source loader (#11609)

* build(scripts): type-check the shared verifier run, fixture, cleanup 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.

* build(scripts): type-check the managed PE and function dossier fixtures (#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 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