[PR #5312] [MERGED] fix(managed): retain type discovery after member limits #6874

Closed
opened 2026-11-01 21:43:42 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5312
Author: @eco-null
Created: 10/19/2026
Status: ✅ Merged
Merged: 10/22/2026
Merged by: @morluto

Base: main ← Head: codex/managed-type-discovery


📝 Commits (2)

  • 3cdce05 fix(managed): retain types after member limits
  • af3d464 fix(managed): reconcile recovery identity with the shared PE envelope

📊 Changes

12 files changed (+657 additions, -81 deletions)

View changed files

📝 docs/managed-code-analysis.md (+21 -2)
📝 src/domain/managed/managedArtifact.ts (+1 -1)
📝 src/domain/managed/managedMemberComparisonCoverage.ts (+1 -1)
📝 src/dotnet/ManagedDecodeBudget.ts (+14 -7)
📝 src/dotnet/ManagedMemberInspector.test.ts (+7 -5)
📝 src/dotnet/ManagedMemberInspector.ts (+85 -59)
➕ src/dotnet/ManagedMemberRecovery.ts (+70 -0)
➕ src/dotnet/ManagedMemberTypeInventory.test.ts (+208 -0)
📝 src/dotnet/ManagedMetadataInventory.ts (+21 -6)
➕ tests/acceptance/managedMemberRecovery.test.ts (+179 -0)
📝 tests/boundary/providers/managed/managedMemberComparison.test.ts (+32 -0)
➕ tests/fixtures/managedMemberCapacity.ts (+18 -0)

📄 Description

Summary

Fixes #5146. When member decoding exceeds capacity, inspect_managed_members now retains its admitted TypeDef inventory so callers can discover names and request a smaller selection through the existing CLI/MCP interfaces.

Problem and expected behavior

A file-backed method can exceed the 64 MiB decoding/representation budget after readable metadata has already established its types. Previously the top-level failure handler discarded those facts and returned unavailable coverage with no type names. Summary/paging could not help the caller choose type_names.

The result now preserves type names, tokens, member-list counts/ranges, nesting and name-identity uncertainty, module/MVID and artifact identity, with partial coverage and the originating capacity diagnostic. Undecoded member collections remain unknown.

Change and scope

  • Stage type admission before member, attribute/resource and derived-edge work; reuse the existing module identity owner.
  • Pre-admit a bounded recovery envelope using the same capacity owner. Its diagnostic reserves the longest safe byte-coordinate encoding; the full result consumes already-admitted type facts once.
  • Recover only the capacity owner's typed failure. Metadata/type-inventory admission failures still return unavailable coverage.
  • Preserve selection and unreadable-name limitations through both normal and recovery results. Comparisons keep omitted members unknown; retained pages preserve source coverage.

Contract and boundary impact

  • Semantic owner: managed metadata/member inspection and its existing decode budget.
  • Scope decision: not applicable; routine correction to execution-free static PE/CLI analysis.
  • CLI/MCP: existing arguments and JSON shapes; capacity-limited member inspection can return a useful partial result instead of an empty unavailable result. Null signature-resolution attestation also describes current unexamined signatures.
  • Evidence/provenance: artifact SHA-256, MVID, original type coordinates, uncertainty and capacity-failure location retained.
  • Target authority/cleanup: existing snapshot admission and cleanup; target assemblies are not loaded or executed.
  • Generated metadata/package: catalog descriptions regenerated and checked; ignored catalogs/build outputs are not committed.

Evidence and correctness

Original source: four new producer regressions failed; the metadata-refusal control passed. The compiled CLI/official SDK stdio regression also fails on unchanged base 7a0c47bfa4259af859779000bf8bc8aaf16b35bd, observing unavailable instead of partial coverage. Corrected source passes.

The public regression verifies CLI/MCP parity, advertised JSON Schema validation, type selection, and retained type/member pages after deleting the input file. Source controls include 2,042 types, oversized CIL/signatures, malformed metadata, cyclic nesting, unreadable selected names, and a type inventory that itself exceeds capacity. Both comparison directions leave omitted fields/methods unknown.

Validation performed

Windows x64, pinned Node 24.18.0/npm 11.16.0:

  • Managed producer/provider/comparison/graph/CLI/MCP selection: 493 passed in 29 files, 47.93s.
  • npm run check: passed (typecheck, build, lint, formatting, knip, module boundaries and architecture guards; existing repository lint warnings).
  • npm run docs:check, npm run jscpd, npm run scan:todos: passed.
  • npm run verify:managed: passed, 11 verification scenarios; optional operator-local/ILSpy qualification remains unavailable.
  • Commit and pre-push checks: passed.
Full local gate limitations

check:pr was interrupted after observing eight unrelated Windows failures. All eight were independently reproduced against unchanged base 7a0c47bfa4259af859779000bf8bc8aaf16b35bd: SQLite ENAMETOOLONG (1), OpenCode JSON/JSONC setup (1), Electron framework symlink permissions (1), JavaScript module runtime controls (2), package suffix runtime control (1), and linked-skill path assertions (2). This is not a full-suite pass.

The Python producer gate cannot complete on this Windows host: its native trace/mitmproxy tests require POSIX os.mkfifo/resource. No Linux/macOS execution is claimed.

Compatibility, safety, and release

No input/schema migration or new provider/authority. The resource budget remains 64 MiB; partial type discovery does not guarantee a selected type or assembly-wide references will fit. The commercial assembly from #5146 was unavailable; the evidence above uses authored PE/CLI files and the repository's managed conformance fixtures. CPU/peak-memory improvements are not claimed.

Merge follow-up at af3d46427: integrated main 15ec8e98d. Both early capacity recovery and completed member inspection now reuse main's shared PE artifact/module identity envelope; final metadata status still reflects all examined issues. On macOS arm64 with Node 24.18.0, the focused producer/provider/comparison/recovery/CLI/MCP batch passed 421 tests in 20 files. check:ci:fast passed all five tasks, docs:check passed, and verify:managed passed its 11 scenarios. Operator-local assemblies and ILSpy qualification remain unavailable; hosted checks are pending.

Author readiness

Human owner: @eco-null

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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/5312 **Author:** [@eco-null](https://github.com/eco-null) **Created:** 10/19/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `codex/managed-type-discovery` --- ### 📝 Commits (2) - [`3cdce05`](https://github.com/morluto/rea/commit/3cdce0598305f6c368b0d118751649092db43f4a) fix(managed): retain types after member limits - [`af3d464`](https://github.com/morluto/rea/commit/af3d46427c65261bc7ec318c4c27150ad9acd5a7) fix(managed): reconcile recovery identity with the shared PE envelope ### 📊 Changes **12 files changed** (+657 additions, -81 deletions) <details> <summary>View changed files</summary> 📝 `docs/managed-code-analysis.md` (+21 -2) 📝 `src/domain/managed/managedArtifact.ts` (+1 -1) 📝 `src/domain/managed/managedMemberComparisonCoverage.ts` (+1 -1) 📝 `src/dotnet/ManagedDecodeBudget.ts` (+14 -7) 📝 `src/dotnet/ManagedMemberInspector.test.ts` (+7 -5) 📝 `src/dotnet/ManagedMemberInspector.ts` (+85 -59) ➕ `src/dotnet/ManagedMemberRecovery.ts` (+70 -0) ➕ `src/dotnet/ManagedMemberTypeInventory.test.ts` (+208 -0) 📝 `src/dotnet/ManagedMetadataInventory.ts` (+21 -6) ➕ `tests/acceptance/managedMemberRecovery.test.ts` (+179 -0) 📝 `tests/boundary/providers/managed/managedMemberComparison.test.ts` (+32 -0) ➕ `tests/fixtures/managedMemberCapacity.ts` (+18 -0) </details> ### 📄 Description ## Summary Fixes #5146. When member decoding exceeds capacity, `inspect_managed_members` now retains its admitted TypeDef inventory so callers can discover names and request a smaller selection through the existing CLI/MCP interfaces. ## Problem and expected behavior A file-backed method can exceed the 64 MiB decoding/representation budget after readable metadata has already established its types. Previously the top-level failure handler discarded those facts and returned unavailable coverage with no type names. Summary/paging could not help the caller choose `type_names`. The result now preserves type names, tokens, member-list counts/ranges, nesting and name-identity uncertainty, module/MVID and artifact identity, with partial coverage and the originating capacity diagnostic. Undecoded member collections remain unknown. ## Change and scope - Stage type admission before member, attribute/resource and derived-edge work; reuse the existing module identity owner. - Pre-admit a bounded recovery envelope using the same capacity owner. Its diagnostic reserves the longest safe byte-coordinate encoding; the full result consumes already-admitted type facts once. - Recover only the capacity owner's typed failure. Metadata/type-inventory admission failures still return unavailable coverage. - Preserve selection and unreadable-name limitations through both normal and recovery results. Comparisons keep omitted members unknown; retained pages preserve source coverage. ## Contract and boundary impact - Semantic owner: managed metadata/member inspection and its existing decode budget. - Scope decision: not applicable; routine correction to execution-free static PE/CLI analysis. - CLI/MCP: existing arguments and JSON shapes; capacity-limited member inspection can return a useful partial result instead of an empty unavailable result. Null signature-resolution attestation also describes current unexamined signatures. - Evidence/provenance: artifact SHA-256, MVID, original type coordinates, uncertainty and capacity-failure location retained. - Target authority/cleanup: existing snapshot admission and cleanup; target assemblies are not loaded or executed. - Generated metadata/package: catalog descriptions regenerated and checked; ignored catalogs/build outputs are not committed. ## Evidence and correctness Original source: four new producer regressions failed; the metadata-refusal control passed. The compiled CLI/official SDK stdio regression also fails on unchanged base `7a0c47bfa4259af859779000bf8bc8aaf16b35bd`, observing unavailable instead of partial coverage. Corrected source passes. The public regression verifies CLI/MCP parity, advertised JSON Schema validation, type selection, and retained type/member pages after deleting the input file. Source controls include 2,042 types, oversized CIL/signatures, malformed metadata, cyclic nesting, unreadable selected names, and a type inventory that itself exceeds capacity. Both comparison directions leave omitted fields/methods unknown. ## Validation performed Windows x64, pinned Node 24.18.0/npm 11.16.0: - Managed producer/provider/comparison/graph/CLI/MCP selection: **493 passed in 29 files**, 47.93s. - `npm run check`: passed (typecheck, build, lint, formatting, knip, module boundaries and architecture guards; existing repository lint warnings). - `npm run docs:check`, `npm run jscpd`, `npm run scan:todos`: passed. - `npm run verify:managed`: passed, 11 verification scenarios; optional operator-local/ILSpy qualification remains unavailable. - Commit and pre-push checks: passed. <details> <summary>Full local gate limitations</summary> `check:pr` was interrupted after observing eight unrelated Windows failures. All eight were independently reproduced against unchanged base `7a0c47bfa4259af859779000bf8bc8aaf16b35bd`: SQLite ENAMETOOLONG (1), OpenCode JSON/JSONC setup (1), Electron framework symlink permissions (1), JavaScript module runtime controls (2), package suffix runtime control (1), and linked-skill path assertions (2). This is not a full-suite pass. The Python producer gate cannot complete on this Windows host: its native trace/mitmproxy tests require POSIX `os.mkfifo`/`resource`. No Linux/macOS execution is claimed. </details> ## Compatibility, safety, and release No input/schema migration or new provider/authority. The resource budget remains 64 MiB; partial type discovery does not guarantee a selected type or assembly-wide references will fit. The commercial assembly from #5146 was unavailable; the evidence above uses authored PE/CLI files and the repository's managed conformance fixtures. CPU/peak-memory improvements are not claimed. Merge follow-up at `af3d46427`: integrated main `15ec8e98d`. Both early capacity recovery and completed member inspection now reuse main's shared PE artifact/module identity envelope; final metadata status still reflects all examined issues. On macOS arm64 with Node 24.18.0, the focused producer/provider/comparison/recovery/CLI/MCP batch passed **421 tests in 20 files**. `check:ci:fast` passed all five tasks, `docs:check` passed, and `verify:managed` passed its 11 scenarios. Operator-local assemblies and ILSpy qualification remain unavailable; hosted checks are pending. ## Author readiness Human owner: @eco-null - [x] 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. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:43:42 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6874
No description provided.