Repository navigation
feat(managed): decode ldstr user strings in member inspection - #2162
Conversation
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>
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
💡 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".
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>
|
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 |
There was a problem hiding this comment.
💡 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".
… 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>
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
@greptileai review |
|
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>
There was a problem hiding this comment.
💡 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".
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>
There was a problem hiding this comment.
💡 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".
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>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
There was a problem hiding this comment.
💡 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".
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>
|
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 For reference, this is what the rule reports on real assemblies, with only
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. |
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
There was a problem hiding this comment.
💡 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".
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>
There was a problem hiding this comment.
💡 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".
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>
There was a problem hiding this comment.
💡 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".
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>
There was a problem hiding this comment.
💡 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".
#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>
There was a problem hiding this comment.
💡 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".
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>
There was a problem hiding this comment.
💡 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".
| methods: readonly ManagedMethod[], | ||
| ): UserStringInventory => { | ||
| const budget = managedDecodeBudget(layout); | ||
| const scanned = methods.every(bodyFullyDecoded); |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
💡 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".
| ): UserStringInventory => { | ||
| const { methods } = parsed; | ||
| const budget = managedDecodeBudget(layout); | ||
| const scanned = parsed.issues.length === 0 && methods.every(bodyFullyDecoded); |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
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>
There was a problem hiding this comment.
💡 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".
| const bodyFullyDecoded = ({ body }: ManagedMethod): boolean => | ||
| body.status === "absent" || | ||
| (body.status === "present" && body.truncated_instructions === 0); |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
💡 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".
| ): UserStringInventory => ({ | ||
| state: issues.length === 0 && scanned ? "complete" : "partial", | ||
| literals: [...literals], | ||
| issues: [...uniqueManagedParseIssues(issues)], |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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>
|
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. |
|
Note 🤖 Claude Opus 5.5 responding on behalf of Nick This Static checks failure is |
|
Note 🤖 Claude Opus 5.5 responding on behalf of Nick The Test shard (6/6) failure is also from |
There was a problem hiding this comment.
💡 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 || |
There was a problem hiding this comment.
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 👍 / 👎.
Note
🤖 Claude Opus 5.5 responding on behalf of Nick
Summary
Fixes #2158.
inspect_managed_membersreported everyldstroperand as a bare0x70token, so an analyst could see that a method loads a literal but not which one. This adds a top-leveluser_stringsinventory with its own coverage:{ state, literals, issues }.literalsholds each distinctldstrtoken loaded by an inspected method body, with its#USfile offset and decoded value.Problem and expected behavior
Smallest trigger: any method containing
ldstr. Its anchor showsoperand_kind: "string"andoperand: "0x70...", and no REA output contains the literal.Expected:
normalized_il_sha256keep their build-local tokens.#USitem stays a visible fact inuser_strings.issues, withuser_strings.statepartial, and never makes member coverage partial.Change and scope
ManagedMetadataLayoutgains an optionaluserStringsstream (#US). Assemblies without literals may omit it, so it is not required.readMetadataUserStringdecodes one#USitem. 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 asinvalid-string. The empty entry at offset 0 (ldstr 0x70000000, zero length, no flag byte) reads as"", and any other item at offset 0 isinvalid-string. A length prefix wider than ECMA-335 II.23.2 assigns is reported as aninvalid-stringconformance 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 stayinvalid-blob. A terminal flag that differs from ECMA-335 II.24.2.4 is reported asinvalid-stringat 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 boundreserveStringuses.parseUserStrings(src/dotnet/ManagedUserStrings.ts) collects the distinct operands ofldstrinstructions (by opcode, so a malformedldtokenwith a0x70token 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 asmetadata.#US:<token>, and a missing stream is onemetadata.#USissue. Anldstroperand from another table isinvalid-heap-indexwhether or not#USexists, and only0x70tokens count toward the missing-stream issue.inspect_managed_membersMCP description, itstype_namesinput, and the CLI command and--typehelp name the decodedldstrliterals and say a type selection limits them to the selected types' method bodies.user_strings.issuesanduser_strings.state, never to the membercoverageormetadata.status, so the application graph's member facts and member comparisons are unaffected by literal conformance differences.user_strings.stateis 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--typeselection. This is judged by the method's owner, so an unreadable row outside the selection does not count, since onlyldstrinstructions in the inspected types matter.compare_managed_membersinspects 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 withappendManagedParseIssuesrather than spreading them intopush, so a very large issue list returns partial coverage instead of overflowing the stack.user_stringsis{ state, literals, issues },nullable().default(null)following theexported_typesprecedent, so older Evidence reads it as not examined.--type/type_namesrestricts user strings along with the methods. The limitation text says so.buildManagedPeFixturegains an optional rawuserStringHeap.fixtureUserStringHeaplays out well-formed items and returns their tokens. Without the option, fixture bytes are unchanged.Not included:
Contract and boundary impact
src/dotnetmetadata layout and heap reader. The member inspection projection adds one field.user_stringsoninspect_managed_members. No input changes.user_strings: null. Anchors andnormalized_il_sha256are unchanged, and a test asserts the digest is identical with and without#US.Evidence and regression coverage
Tests added or updated, all in
src/dotnet/ManagedMemberInspector.test.ts:normalized_il_sha256matches the same IL built without#US.#USstream gives partial user-string coverage with onemissing-streamissue for all tokens, while member coverage stays complete. The method is kept.resource-limitbefore they are collected.invalid-string, and an out-of-range index givesinvalid-heap-index. Readable literals remain.#US, and a two-byte length prefix starting on the last#USbyte, are both rejected as "User string leaves #US" beside a readable literal.0x70token behindldtokenis not collected.user_strings: null.Base reproduction: on
main, PEAK'sPeak.Quicksave(Unity MonoAssembly-CSharp.dll, 1.6 MB,--type Peak.Quicksave) shows 12ldstranchors and no literal text.User-visible CLI output, same command on this branch, with complete coverage:
A whole-assembly run on a 247 KB Unity
Assembly-CSharp.dllstayscompletewith 254 literals. Its JSON grows by about 0.2%.Remaining proof gaps: no real-provider lane applies. No
.NETSDK 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:
Validation performed
All runs used Node 24.18.0 and npm 11.16.0, per
.nvmrcandpackageManager.npm run check: passed, including architecture guards.npm run docs:check: passed.npm run test:focused --on all 26 managed test files acrosssrc/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.Assembly-CSharp.dllwith--type Peak.Quicksave: complete coverage, 12 user strings.Compatibility, safety, and release
Review checklist
type(scope): outcome.This branch merges
mainafter #2163 landed; user strings and edge-target naming run side by side, and every issue list is appended withappendManagedParseIssues.🤖 Generated with Claude Code