Skip to content

fix(managed): report member signature issues at artifact offsets - #7879

Merged
morluto merged 1 commit into
morluto:mainfrom
Plastic-time:claude/fix-managed-signature-offsets
Oct 29, 2026
Merged

morluto merged 1 commit into
morluto:mainfrom
Plastic-time:claude/fix-managed-signature-offsets

Conversation

@Plastic-time

@Plastic-time Plastic-time commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #7385.

inspect-managed-members reported an invalid operand in a Field, MethodDef or MemberRef signature at its offset inside the signature blob, while the equivalent StandAloneSig (local variable) issue in the same coverage.issues array used the artifact file offset. On the issue's fixture the field issue said offset: 2 (a DOS-header byte) instead of 1229.

Problem and expected behavior

Fixture from the issue: fieldSignature = 06 12 07 (FIELD, CLASS, TypeDefOrRefOrSpec 0x07 whose tag 3 is undefined per ECMA-335 II.23.2.8) and a LocalVarSig 07 01 12 07 with the same operand. On base e79ad6ca the compiled CLI prints:

{"state":"partial","issues":[
  {"code":"invalid-row","scope":"Field:0x04000001.signature","offset":2,"detail":"TypeDefOrRefOrSpec operand 0x7 is invalid: coded index tag 3 is not defined"},
  {"code":"invalid-row","scope":"metadata.StandAloneSig:0x11000001.signature","offset":1238,"detail":"TypeDefOrRefOrSpec operand 0x7 is invalid: coded index tag 3 is not defined"}]}

The convention is artifact file offsets: CHANGELOG ("Metadata errors report artifact file offsets") and readLocalSignatureFacts, which already adds the blob's artifact base. metadataSignature forwarded the decoder's blob-relative offset unchanged, and its only caller, budgetedSignature, never had the blob's position.

Change and scope

  • ManagedMemberInspectorCore.ts: one helper, artifactSignatureIssue, translates a decoder issue into artifact coordinates. readLocalSignatureFacts now uses it instead of its inline copy, and metadataSignature takes a required blobOffset and applies it to every issue it receives from the decoder. So both signature paths share one owner for the translation.
  • ManagedMemberRows.ts: budgetedSignature receives the artifact buffer it read the blob from and passes blob.byteOffset - artifact.byteOffset, the same derivation ManagedMethodBodyReader uses for local signatures. The Field, MemberRef and MethodDef call sites pass it.

Not changed: the separate Expected field signature; decoded method issue keeps offset: null, since it describes the whole blob rather than a byte. Scopes, details, decoded signatures and coverage state are unchanged.

Follow the contribution scope.
Ordinary fix within existing boundaries; a maintainer scope decision is not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: metadataSignature, the metadata-owned signature decoder in src/dotnet/ManagedMemberInspectorCore.ts. Consumer: budgetedSignature in src/dotnet/ManagedMemberRows.ts.
  • Contribution scope fit and linked maintainer decision: routine fix; not applicable.
  • CLI and MCP/tool-catalog contract: no schema change. coverage.issues[].offset for Field/MethodDef/MemberRef signature issues changes from blob-relative to artifact file offset.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: corrects a provenance coordinate; no fact is added or removed.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

All evidence below was executed.

  • Tests added: three cases in src/dotnet/ManagedMemberInspector.test.ts, next to the existing local-signature offset cases. Each builds a fixture whose Field, MethodDef or MemberRef signature ends in CLASS 0x07. The test finds the blob's artifact offset through the production row cursor and readMetadataBlob, checks that the byte there is 0x07, and requires the exact issue (code, scope, offset, detail) in coverage.issues.

  • Base reproduction: with only the new tests on e79ad6ca, the file had 3 failures / 191 passes. Received offsets were 2, 4, 4; expected 1221, 1226, 1230. Scopes and details already matched.

  • User-visible CLI output after the fix, same fixture as above:

    {"state":"partial","issues":[
      {"code":"invalid-row","scope":"Field:0x04000001.signature","offset":1229,"detail":"TypeDefOrRefOrSpec operand 0x7 is invalid: coded index tag 3 is not defined"},
      {"code":"invalid-row","scope":"metadata.StandAloneSig:0x11000001.signature","offset":1238,"detail":"TypeDefOrRefOrSpec operand 0x7 is invalid: coded index tag 3 is not defined"}]}

    The fixture's bytes at 1226..1229 are 03 06 12 07 (length prefix, FIELD, CLASS, operand), so 1229 is the invalid operand.

  • Remaining proof gaps: Windows only; synthetic fixtures only, no real compiler output with a malformed signature. MCP was exercised only through the existing managed MCP suites. Hosted CI is pending.

For boundary fixes: this is a metadata blob parser boundary; the new cases sit beside the existing StandAloneSig offset regressions.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

Windows 11 x64 (10.0.26200), Node 24.22.1, npm 11.19.1, base e79ad6ca. The Windows native addon and manifest came from the [email protected] tarball, as CONTRIBUTING describes.

  • npm run test:focused -- src/dotnet/ManagedMemberInspector.test.ts: base 3 failed / 191 passed; with the fix 194/194 passed.
  • npm run test:focused -- with every src/dotnet/*.test.ts file plus managedCliOutput, managedMetadataDelta, managedMemberSummaryCli and managedStaticProvider: 556/556 passed across 20 files.
  • npm run test:focused -- with managedMemberComparisonCli, managedMcp, managedMemberSummaryMcp, managedMemberComparison and managedMemberComparisonFromMetadata: 141/141 passed.
  • Compiled node scripts/rea.mjs inspect-managed-members both-signatures.dll --json on the issue fixture, base and fixed builds: output shown above.
  • npm run check:fast: typecheck and lint 2/2 passed. npx oxfmt --check on the changed files: passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Only the offset value of affected signature issues changes.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; Windows only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new execution, network access or file writes.

Author readiness

Human owner: @Plastic-time

  • 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.

Field, MethodDef and MemberRef signature issues reported the invalid operand's offset inside its blob, while local signature issues in the same coverage array used artifact file offsets. Translate both through one helper that adds the blob's artifact base.

Fixes morluto#7385
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-28T18:02:54.758977Z
We couldn’t complete this review. Comment @codex review to try again.
c5ab10f 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.

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The changed code appears safe to merge; no actionable issues were found.

Summary

Corrects member-signature error locations by translating blob-relative offsets into artifact file offsets.

  • Malformed member signatures point to the right file byte.

No actionable issues or security concerns were found in the changed paths. Tests were not run during this review. Whether another PR supersedes this one could not be checked because GitHub authentication was unavailable.

Reviews (1) · Last reviewed commit: "fix(managed): report member signature is..." · Reviewed by Greptile

@morluto
morluto merged commit 30936d7 into morluto:main Oct 29, 2026
41 of 47 checks passed
@morluto morluto added area: evidence Evidence, artifacts, and reconstruction bug Something isn't working labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: evidence Evidence, artifacts, and reconstruction bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Managed field signature diagnostics report blob-relative offsets as file offsets

2 participants