Skip to content

feat(managed): decode ldstr user strings in member inspection - #2162

Merged
morluto merged 30 commits into
morluto:mainfrom
Nelglor:feat/managed-user-strings
Oct 13, 2026
Merged

morluto merged 30 commits into
morluto:mainfrom
Nelglor:feat/managed-user-strings

Conversation

@Nelglor

@Nelglor Nelglor commented Oct 12, 2026 •

Copy link
Copy Markdown

Note

🤖 Claude Opus 5.5 responding on behalf of Nick

Summary

Fixes #2158.

inspect_managed_members reported every ldstr operand as a bare 0x70 token, so an analyst could see that a method loads a literal but not which one. This adds a top-level user_strings inventory with its own coverage: { state, literals, issues }. literals holds each distinct ldstr token loaded by an inspected method body, with its #US file offset and decoded value.

Problem and expected behavior

Smallest trigger: any method containing ldstr. Its anchor shows operand_kind: "string" and operand: "0x70...", and no REA output contains the literal.

Expected:

  • The literal text is available inline.
  • Anchors and normalized_il_sha256 keep their build-local tokens.
  • A missing or malformed #US item stays a visible fact in user_strings.issues, with user_strings.state partial, and never makes member coverage partial.

Change and scope

  • Layout: ManagedMetadataLayout gains an optional userStrings stream (#US). Assemblies without literals may omit it, so it is not required.
  • Heap reader: readMetadataUserString decodes one #US item. It reads the compressed length, the UTF-16LE code units and the terminal flag byte, and rejects reserved or truncated length prefixes, even lengths, and items that leave the stream, each as invalid-string. The empty entry at offset 0 (ldstr 0x70000000, zero length, no flag byte) reads as "", and any other item at offset 0 is invalid-string. A length prefix wider than ECMA-335 II.23.2 assigns is reported as an invalid-string conformance issue beside the readable literal, like a differing terminal flag. The literal is admitted to the budget before its flag is scanned. The shared compressed-length reader takes the item it reads, so #Blob prefix failures stay invalid-blob. A terminal flag that differs from ECMA-335 II.24.2.4 is reported as invalid-string at the flag byte, and the readable literal is kept (morluto, d5b7b07). This is a conformance observation, not a runtime rejection: Mono-built framework assemblies differ from the spec on some literals. The retained value is charged to the representation budget at six JSON bytes per code unit, the same bound reserveString uses.
  • Inventory: parseUserStrings (src/dotnet/ManagedUserStrings.ts) collects the distinct operands of ldstr instructions (by opcode, so a malformed ldtoken with a 0x70 token is ignored) from the inspected bodies and decodes each once, in token order. Each token and each failure is charged to the decode budget before it is retained. A malformed item is reported against its token as metadata.#US:<token>, and a missing stream is one metadata.#US issue. An ldstr operand from another table is invalid-heap-index whether or not #US exists, and only 0x70 tokens count toward the missing-stream issue.
  • Discovery: the inspect_managed_members MCP description, its type_names input, and the CLI command and --type help name the decoded ldstr literals and say a type selection limits them to the selected types' method bodies.
  • Coverage: user strings own their coverage. #US issues go to user_strings.issues and user_strings.state, never to the member coverage or metadata.status, so the application graph's member facts and member comparisons are unaffected by literal conformance differences. user_strings.state is also partial when an inspected method's CIL was not fully decoded (the body reader reports instruction-scan completeness separately from exception-section validity) or a method that may belong to the inspected types was not inspected: an unreadable row, or a type whose name could not be read under a --type selection. This is judged by the method's owner, so an unreadable row outside the selection does not count, since only ldstr instructions in the inspected types matter.
  • Comparison: compare_managed_members inspects with user strings skipped, since it never reads literals, so a large literal cannot exhaust a comparison's decode budget. Its limitations state that literals are not compared. Inspection gathers producer issues with appendManagedParseIssues rather than spreading them into push, so a very large issue list returns partial coverage instead of overflowing the stack.
  • Schema: user_strings is { state, literals, issues }, nullable().default(null) following the exported_types precedent, so older Evidence reads it as not examined.
  • Selection: --type / type_names restricts user strings along with the methods. The limitation text says so.
  • Fixture: buildManagedPeFixture gains an optional raw userStringHeap. fixtureUserStringHeap lays out well-formed items and returns their tokens. Without the option, fixture bytes are unchanged.

Not included:

  • Inline values on anchors. That would repeat a literal at every use and change the anchor shape.
  • Changes to the normalized CIL digest.
  • String search across assemblies.
  • Budget changes.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/dotnet metadata layout and heap reader. The member inspection projection adds one field.
  • CLI and MCP/tool-catalog contract: additive output field user_strings on inspect_managed_members. No input changes.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: additive and nullable. Older Evidence parses with user_strings: null. Anchors and normalized_il_sha256 are unchanged, and a test asserts the digest is identical with and without #US.
  • Process execution, authorization, cleanup, or containment impact: none. Static parsing only.
  • Generated metadata, package, or installation impact: none committed. CI regenerates the catalog.

Evidence and regression coverage

  • Tests added or updated, all in src/dotnet/ManagedMemberInspector.test.ts:

    • Literals decode once each in token order: ASCII, non-BMP, and an unpaired surrogate. An unreferenced literal is excluded. Anchors keep tokens, and normalized_il_sha256 matches the same IL built without #US.
    • A missing #US stream gives partial user-string coverage with one missing-stream issue for all tokens, while member coverage stays complete. The method is kept.
    • With 1 KiB of budget left, 100 distinct tokens raise resource-limit before they are collected.
    • A malformed even-length item and a reserved length prefix give invalid-string, and an out-of-range index gives invalid-heap-index. Readable literals remain.
    • An odd length whose payload crosses the end of #US, and a two-byte length prefix starting on the last #US byte, are both rejected as "User string leaves #US" beside a readable literal.
    • A 0x70 token behind ldtoken is not collected.
    • Unavailable CLI metadata and legacy Evidence give user_strings: null.
  • Base reproduction: on main, PEAK's Peak.Quicksave (Unity Mono Assembly-CSharp.dll, 1.6 MB, --type Peak.Quicksave) shows 12 ldstr anchors and no literal text.

  • User-visible CLI output, same command on this branch, with complete coverage:

    0x7000e552  "Can't load save data because it doesn't exist."
    0x7000e5b0  "Saving game to app data folder as "
    0x7000e5f6  "Failed to create save file: {0}"
    ...
    0x7000e875  "quicksave.peak"
    

    A whole-assembly run on a 247 KB Unity Assembly-CSharp.dll stays complete with 254 literals. Its JSON grows by about 0.2%.

  • Remaining proof gaps: no real-provider lane applies. No .NET SDK compiler was used. Fixtures are source-built and the real assemblies above are third-party game binaries that are not committed.

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

All runs used Node 24.18.0 and npm 11.16.0, per .nvmrc and packageManager.

  • npm run check: passed, including architecture guards.
  • npm run docs:check: passed.
  • npm run test:focused -- on all 26 managed test files across src/dotnet, src/domain/managed, src/contracts/managed, tests/boundary/providers/managed, managed MCP, tool-schema validity, managed acceptance, managed application graph, and CLI JSON output: 307 passed.
  • Built CLI against PEAK Assembly-CSharp.dll with --type Peak.Quicksave: complete coverage, 12 user strings.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. The field is additive and nullable.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable. Linux x64 only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: literal values come from the caller's artifact and are returned like other metadata strings. Nothing is executed. The budget accounts for retained values.

Review checklist

  • This PR addresses a concrete problem or an agreed enhancement.
  • 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.

This branch merges main after #2163 landed; user strings and edge-target naming run side by side, and every issue list is appended with appendManagedParseIssues.

🤖 Generated with Claude Code

inspect_managed_members reported every ldstr operand as a bare 0x70 token,
so an analyst could see that a method loads a literal but not which one.
Answering "where is this path or key used" required a second tool.

Read the optional #US stream and add a top-level user_strings inventory:
each distinct token loaded by an inspected method body, once, in token
order, with its #US file offset and decoded UTF-16 value. Instruction
anchors and normalized CIL digests keep their build-local tokens. A missing
#US stream or malformed item is reported against its token as partial
coverage. Evidence recorded before this field reads user_strings as null.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 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 ✅ Completed 2026-10-13T19:03:42.846993Z 470cb0f New commits
ℹ️ 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 chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4e11582923

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/dotnet/ManagedMemberRows.ts Resolved
A malformed ldtoken can carry a 0x70 token, which the operand decoder
classifies as a string operand. Only ldstr loads a literal, so collect
user strings by opcode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Nelglor

Nelglor commented Oct 12, 2026

Copy link
Copy Markdown
Author

Note

🤖 Claude Opus 5.5 responding on behalf of Nick

Review findings are addressed in the latest commit, with replies on each thread. @codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7280a731cc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/dotnet/ManagedMemberRows.ts Resolved
Comment thread src/dotnet/ManagedMetadataHeaps.ts Resolved
Nelglor and others added 2 commits October 12, 2026 08:57
… them

Charge each distinct ldstr token to the decode budget before adding it to
the collection set, and admit each #US failure before retaining it. A
missing #US stream is now one stream-level issue rather than one per
token.

Document why the #US terminal flag is not validated: Mono and Roslyn
assemblies disagree with ECMA-335 II.24.2.4 and the runtime ignores it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g byte

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Nelglor

Nelglor commented Oct 12, 2026

Copy link
Copy Markdown
Author

Note

🤖 Claude Opus 5.5 responding on behalf of Nick

The budget finding is addressed in a8e513a, and the docs are updated in 2777308. The terminal-flag finding is declined with measurements in its thread. @codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 2777308037

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

@greptileai review

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5 Tier: plus

[Medium impact] The PR appears safe to merge; no new blocking issue was found.

Summary

Adds decoded ldstr literals to inspect_managed_members while keeping instruction tokens and CIL hashes unchanged.

  • Inspected methods now list the text of each string literal they load.
  • Member comparisons leave decoded string literals outside their results.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Managed PE bytes] --> B[Metadata layout]
  B --> C[Selected method bodies]
  C --> D[Anchors and CIL hashes]
  D --> E{Read user strings?}
  E -->|Inspection| F[Distinct ldstr tokens]
  F --> G[Checked #US reads]
  G --> H[Literals and separate issues]
  E -->|Comparison| I[user_strings is null]
  D --> J[Member facts and coverage]
  I --> K[Compare member facts only]
Loading

Reviews (24) · Last reviewed commit: "Merge branch 'main' into feat/managed-us..." · Reviewed by Greptile

An odd length whose payload crosses the end of #US, and a two-byte
length prefix that starts on the last #US byte, are both rejected as
"User string leaves #US" beside a readable literal. The test fails if
that bounds check is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6a62d30b2b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/dotnet/ManagedMetadataHeaps.ts Resolved
The compressed-length reader shared by #Blob and #US hard-coded
invalid-blob and "Metadata blob" for a reserved prefix, so a malformed
user string was published as a blob failure. The caller now names the
item it reads: #Blob keeps its code and message, and #US reports
invalid-string.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 57c64b755e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/dotnet/ManagedMemberInspector.ts Resolved
Comment thread src/dotnet/ManagedMetadataHeaps.ts Resolved
Nelglor and others added 2 commits October 13, 2026 07:21
inspectManagedMembersBytes gathered every producer's issues with
issues.push(...list), passing one argument per issue. A large malformed
input, such as hundreds of thousands of distinct bad ldstr operands or
MemberRef rows, overflows the stack with an untyped RangeError instead of
returning partial coverage. All six sites now use
appendManagedParseIssues, which appends one issue at a time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A two- or four-byte compressed-length prefix cut off by the end of the
artifact went through the generic range check and was reported as
invalid-row. The prefix reader now uses the item's own code for both
reserved and truncated prefixes: invalid-string for #US, invalid-blob for
#Blob. The unused generic range helper is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

Comment thread src/dotnet/ManagedMetadataHeaps.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d5b7b0704b

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/dotnet/ManagedPe.fixture.ts Resolved
d5b7b07 reports a #US terminal flag that differs from ECMA-335
II.24.2.4. The fixture heap always wrote 0, so its non-Latin-1 literals
now read as nonconforming. The fixture writes the spec flag, and a new
test flips one flag each way ("ok" set to 1, "it's" set to 0) and checks
that both literals remain beside one issue each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Nelglor

Nelglor commented Oct 13, 2026

Copy link
Copy Markdown
Author

Note

🤖 Claude Opus 5.5 responding on behalf of Nick

Thanks for d5b7b07. It supersedes my earlier reply on the terminal-flag thread.

One existing test failed with it. The fixture #US heap always wrote flag 0, so the Ünïcødé 𝄞 and lone-surrogate literals read as nonconforming. 67fc5a5 makes the fixture write the II.24.2.4 flag. It also adds a test that flips one flag each way, "ok" set to 1 and "it's" set to 0, and checks that both literals stay beside one invalid-string issue each. npm run check, docs:check, test discovery and the managed suite (307) pass.

For reference, this is what the rule reports on real assemblies, with only ldstr-loaded literals checked:

Assembly (selection) Loaded literals Flag issues
PEAK Assembly-CSharp (Peak.Quicksave) 12 0
Unity game Assembly-CSharp (whole) 254 0
Unity.InputSystem (whole) 1,454 0
Valheim (Player, ZNet) 443 0
Mono System.Xml (XmlReader) 58 3
Mono mscorlib (List`1, Array, String) 87 7

Roslyn-built game code stays complete, and Mono-built framework assemblies go partial wherever they load such a literal, which matches the new docs wording.

@greptile-apps

greptile-apps Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 67fc5a5143

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/dotnet/ManagedMemberRows.ts Resolved
With no #US stream, every collected ldstr operand was counted as a #US
reference and reported only as missing-stream, while the same non-0x70
operand got invalid-heap-index when the stream existed. parseUserStrings
now owns which operands are user-string tokens: any other operand is
invalid-heap-index either way, and only 0x70 tokens count toward the
missing-stream issue. The heap reader drops its duplicate kind check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 538fb83dc9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/dotnet/ManagedMetadataHeaps.ts Resolved
The offset-0 empty entry returned "" before the length-width check, so an
overlong empty entry such as 0x80 0x00 read as complete. The width issue
is now collected first and returned with the empty literal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1acd725436

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/dotnet/ManagedMemberInspector.ts Resolved
Comment thread src/dotnet/ManagedMetadataHeaps.ts Resolved
Nelglor and others added 2 commits October 13, 2026 15:41
The overlong-prefix issue was reserved before the fatal shape checks, so
an item that then failed, such as 0x80 0x00 away from offset 0, leaked
512 bytes of budget per token. The width issue is now built and admitted
only on paths that return the literal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
User-string issues, including terminal-flag and length-prefix
conformance differences, marked metadata.status partial, so
compare_managed_members turned one-sided methods and fields into unknown
even though every member row was examined. #US issues now make coverage
partial while metadata.status describes the member inventory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ea1ff234bc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/dotnet/ManagedMemberInspector.ts Resolved
Comment thread src/dotnet/ManagedMemberInspector.ts Resolved
#US issues entered the member coverage, so every consumer that reads it
as member coverage (application graph member facts, comparison status)
reported examined members as partial over a literal conformance
difference. user_strings is now { state, literals, issues }: #US issues
live there and never change the member coverage or metadata.status.
parseUserStrings returns that inventory directly.

compare_managed_members inspects with user strings skipped, since it
never reads literals, so a large literal cannot exhaust the decode budget
of a comparison. Its limitations state once that literals are not
compared, and the ExportedType limitations return to their main form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread src/dotnet/ManagedUserStrings.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ba4b9eabe

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/dotnet/ManagedUserStrings.ts Resolved
With user strings owning their coverage, an inspected method body that
was partial, malformed, or truncated no longer reached their state, so a
literal after the decode stopped was missing from a "complete" inventory.
parseUserStrings now marks the inventory partial unless every inspected
body was fully decoded, keeping the literals it did observe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5a7f329067

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/dotnet/ManagedUserStrings.ts Outdated
methods: readonly ManagedMethod[],
): UserStringInventory => {
const budget = managedDecodeBudget(layout);
const scanned = methods.every(bodyFullyDecoded);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Propagate omitted methods into user-string coverage

When an in-scope MethodDef row fails before methodBody runs (for example, the unreadable method-name path in parseMethods), that function records an issue but omits the method; this .every then sees only surviving methods, or an empty array, and inventory can publish user_strings.state: "complete" even though the omitted body may contain ldstr instructions. Fresh evidence after the earlier body-scan fix is that it only checks returned method bodies, so pass method-row/selection scan completeness into this facet and keep the literal inventory partial whenever an in-scope method was not produced.

AGENTS.md reference: AGENTS.md:L75-L75

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Claude Opus 5.5 responding on behalf of Nick

Fixed in 7452fa3. parseUserStrings now takes the whole parseMethods result ({ methods, issues }) instead of only the produced methods. The user-string inventory stays partial whenever a method row recorded an issue, as well as when an inspected body was not fully decoded. A failed row may be an in-scope body whose ldstr instructions were never scanned. The rule is deliberately conservative: an owner-lookup issue on a row that was still produced also makes it partial. It can over-report incompleteness, but it never claims a complete scan that wasn't established. The docs say so.

Test: "marks user strings partial when an inspected method row was not read" passes an omitted-row issue with no produced methods and expects { state: "partial", literals: [], issues: [] }. It fails on 5a7f329. A fixture-built workflow test isn't possible here, because the fixture has no option for a MethodDef row that fails to read. The scan-completeness tests have their own describe block, which keeps the user-string describes under the line limit. Typecheck, test discovery and the managed suite (372) pass, and real assemblies keep user_strings.state: complete.

A MethodDef row that failed before its body was read was recorded as an
issue and omitted, so its ldstr instructions were never scanned, yet the
user-string inventory could still read as complete. parseUserStrings now
takes the parseMethods result and stays partial whenever a method row
failed, as well as when an inspected body was not fully decoded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread src/dotnet/ManagedUserStrings.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7452fa38e1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/dotnet/ManagedUserStrings.ts Outdated
): UserStringInventory => {
const { methods } = parsed;
const budget = managedDecodeBudget(layout);
const scanned = parsed.issues.length === 0 && methods.every(bodyFullyDecoded);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep #US coverage partial for unreadable selected types

When type_names is used and a TypeDef name cannot be decoded, selectTypes deliberately leaves that requested name unmatched because the unreadable type may be the requested type, but parseMethods returns no selected row and no method-row issue; this expression therefore reports an empty user_strings inventory as complete even though that type's bodies and ldstr instructions were never examined. Fold selection/type-name uncertainty into scanned just as method-row failures are.

AGENTS.md reference: AGENTS.md:L75-L75

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Claude Opus 5.5 responding on behalf of Nick

Fixed in 9a7decd, in the owner of the scan facts. In parseMethods, a method whose declaring type's name is unreadable now counts as possibly selected. When a type_names selection skips it, the method adds to unscannedRows, and parseUserStrings keeps the inventory partial. An unreadable type with no methods has no bodies to miss, so it changes nothing. Without a selection every method is produced anyway. The docs list this case beside unreadable rows and partial bodies.

Test: the existing "does not treat a name as absent when a TypeDef name is unreadable" case corrupts Fixture.Program's name and selects it. It now also expects user_strings.state: partial, which fails on fd91f70. The managed suite (374) and the other gates pass, and real-assembly selections keep complete.

Nelglor and others added 2 commits October 13, 2026 16:32
Any parseMethods issue marked user strings partial, including an
unreadable name on a method outside the type selection, so a fully
scanned selection read as incomplete. parseMethods now reads each row's
owner first and reports unscannedRows: rows that produced no method while
their owner is selected or unknown. parseUserStrings uses that count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under a type_names selection, a type whose name could not be read may be
a requested type, but its methods were skipped without counting toward
unscannedRows, so an unexamined body left user strings complete. A
method whose owner's name is unreadable now counts as possibly selected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9a7decdb69

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/dotnet/ManagedUserStrings.ts Outdated
Comment on lines +26 to +28
const bodyFullyDecoded = ({ body }: ManagedMethod): boolean =>
body.status === "absent" ||
(body.status === "present" && body.truncated_instructions === 0);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Separate CIL scan coverage from exception-region validity

When a method's IL reaches its declared end but only exception-section parsing or range validation fails (for example, because of invalid clause flags), bodyStatus() in ManagedMethodBodyReader.ts still sets body.status to malformed; this predicate then makes user_strings.state partial even though every CIL instruction—and therefore every possible ldstr—was examined. Track instruction-scan completeness separately from aggregate body/EH validity so this facet does not report false uncertainty.

AGENTS.md reference: AGENTS.md:L75-L75

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Claude Opus 5.5 responding on behalf of Nick

Fixed in c1cfb4f, at the producer. body.status combines instruction decoding with exception-region validity, so ManagedMethodBodyReader.methodBody now also returns scanned. That flag is true when every CIL instruction decoded (no decode issue and nothing truncated), regardless of the exception section. It is also true when there is no CIL at all: an absent body, or a native or runtime implementation, can't hold an ldstr. parseMethods, the only caller, folds unscanned bodies and unproduced in-scope rows into one unscannedMethods count. parseUserStrings uses only that count, and the old body.status predicate is gone. The public body schema is unchanged.

Test: "keeps user strings complete when only the exception section is malformed" uses a fat body whose IL (ldstr "ok"; pop; ret) fully decodes before a 17-byte exception section with no whole clause. The body is malformed and user_strings is complete with "ok". It fails on 9a7decd. The earlier decode-failure test still gives partial. The managed suite (375), knip and the other gates pass, and real assemblies are unchanged. methodBody was already over the complexity and length limits on main, and grows by one complexity point and nine lines with the new flag.

body.status is malformed for an invalid exception section even when
every instruction decoded, so user strings read as partial although every
ldstr was examined. The body reader now reports whether its CIL was fully
scanned, independent of exception-region validity, and parseMethods folds
unscanned bodies and unproduced rows into one unscannedMethods count that
parseUserStrings uses instead of reinterpreting body.status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c1cfb4f50a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/dotnet/ManagedUserStrings.ts Outdated
): UserStringInventory => ({
state: issues.length === 0 && scanned ? "complete" : "partial",
literals: [...literals],
issues: [...uniqueManagedParseIssues(issues)],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid serializing every issue during deduplication

When a body contains about 125,000 distinct malformed ldstr operands, the admitted tokens and per-token failures can still fit the 64 MiB budget, but this call invokes uniqueManagedParseIssues, which simultaneously materializes an issues.map array, a JSON string for every issue, a Map, and the returned array without any transient admission. Fresh evidence after the per-token admission fix is that the current helper adds about 50 MB RSS (41 MB heap on Node 24) for 125,000 unique issues, so a bounded PE can exceed the parser's resource boundary or OOM before returning coverage; deduplicate incrementally or skip it here because operands were already uniqued.

AGENTS.md reference: AGENTS.md:L49-L50

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Claude Opus 5.5 responding on behalf of Nick

Fixed in 6cbeaf4. The user-string inventory no longer calls uniqueManagedParseIssues, because its issues are unique by construction. Each distinct ldstr token yields either one failure or conformance issues at different offsets (width at the item start, flag at the flag byte). Each foreign operand yields one invalid-heap-index, and a missing stream yields one issue. The inventory now returns the collected arrays directly, without copies.

Measured on Node 24.18 with the built helper: deduplicating 125,000 such issues took 113 ms and added 42 MB of heap and 46 MB of RSS. That work is now gone from this path. Typecheck, knip, metadata, architecture guards, docs:check and the managed suite (375) pass.

Remaining, and outside this PR: inspectManagedMembersBytes still passes the member coverage issues through the same helper on main. Member issues aren't unique by construction, so changing that needs an incremental, budgeted dedup rather than removal, which I'd do as a separate change.

The inventory passed its issues through uniqueManagedParseIssues, which
serializes every issue into an unbudgeted map: about 42 MB of heap and
113 ms for 125,000 issues on Node 24. The issues are unique by
construction (one failure or per-offset conformance issues per distinct
token, one missing-stream issue), so the inventory now returns them, and
its literals, without copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Source fixes and publication evidence for the review findings below. Tests and executable checks were skipped at the maintainer's request. Findings that still require a decision or execution evidence remain open.

review thread, review thread, review thread, review thread, review thread, review thread, review thread

Current live head 6cbeaf4 was source-inspected. The owner-level fixes are present in the live PR history; this pass did not add a workaround or claim exact CI reproduction. No tests/builds/checks/CI reruns.

@Nelglor

Nelglor commented Oct 13, 2026

Copy link
Copy Markdown
Author

Note

🤖 Claude Opus 5.5 responding on behalf of Nick

This Static checks failure is format:check on two files this PR doesn't touch: docs/readme/README_tr.md and scripts/lib/clean-linux-hopper-runtime.mjs. oxfmt --check . reports the same two files on main at ebaaa79. With current main merged in, 6cbeaf4 has no other format findings.

@Nelglor

Nelglor commented Oct 13, 2026

Copy link
Copy Markdown
Author

Note

🤖 Claude Opus 5.5 responding on behalf of Nick

The Test shard (6/6) failure is also from main. All 5 failing tests are in src/domain/reconstructionVerification.functionSources.test.ts (historical calls-only changes and old unchanged comparisons), and they fail the same way on main at ebaaa79 without this PR. That file was last changed in 688defc (#2223), and it has no managed or user-string dependency.

@morluto
morluto merged commit 2652570 into morluto:main Oct 13, 2026
3 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 470cb0fa75

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const declared = owner === undefined ? undefined : ranges[owner - 1];
const mayBeSelected =
selected === null ||
owner === undefined ||

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat zero owner rows as unscanned

When malformed TypeDef MethodList coordinates leave a MethodDef position unowned, memberDeclaringTypeRowLookup returns 0, not undefined. With type_names, this predicate then makes mayBeSelected false (declared is also undefined), so the row is skipped without increasing unscannedMethods and parseUserStrings can publish state: "complete" even though its body—and any ldstr—was never examined. Treat owner 0 as unresolved for scan coverage, or model that unresolved owner at the producing boundary.

AGENTS.md reference: AGENTS.md:L21-L21

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior area: server Server layer and tool wiring enhancement New feature or request P2: medium Medium priority issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Decode ldstr user strings in inspect_managed_members

2 participants