[PR #1864] [CLOSED] fix(managed): project ExportedType forwarders in member inspection #4860

Closed
opened 2026-10-31 00:56:06 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1864
Author: @BaaRai
Created: 10/11/2026
Status: ❌ Closed

Base: main ← Head: fix/managed-exported-types


📝 Commits (2)

  • 5dc551b fix(managed): project ExportedType forwarders in member inspection
  • 3240104 fix(managed): retain ExportedType name columns and exact issue offsets

📊 Changes

8 files changed (+277 additions, -18 deletions)

View changed files

📝 docs/managed-code-analysis.md (+17 -0)
📝 src/contracts/managed/managedWorkflowExamples.ts (+1 -0)
📝 src/domain/managed/managedArtifact.ts (+14 -0)
📝 src/dotnet/ManagedMemberInspector.test.ts (+88 -0)
📝 src/dotnet/ManagedMemberInspector.ts (+5 -0)
📝 src/dotnet/ManagedMemberInspectorCore.ts (+2 -0)
📝 src/dotnet/ManagedMemberRows.ts (+70 -0)
📝 src/dotnet/ManagedPe.fixture.ts (+80 -18)

📄 Description

Summary

inspect_managed_members now projects the ExportedType metadata table (table 39) into an exported_types array. Facade assemblies such as System.Runtime.dll declare almost no TypeDef rows of their own; their entire usable surface lives in this table, which the member inspector never read. The result was a complete inspection with zero types and zero methods and no unknown or issue disclosing the omission - exactly the silent wrong-evidence shape this repo fails closed on.

Problem and expected behavior

On System.Runtime.dll (any .NET runtime), inspect-managed-artifact reports hundreds of ExportedType rows while inspect-managed-members reported one <Module> type, zero members, and coverage.state: "complete". Type forwarders are the normal shape of .NET Core facades, so agents reading the summary conclude the assembly provides nothing.

Expected: the table's rows are surfaced with their forwarding scope, and malformed rows degrade coverage instead of vanishing. This is #1812.

Change and scope

  • managedMemberInspectionSchema gains exported_types: per row, the token, flags, the forwarded type_def_id, the namespace-qualified full_name, and the implementation_token scope - an AssemblyRef for the type forwarders that make up facades, a File for multi-module assemblies, or a nested ExportedType.
  • parseExportedTypes in ManagedMemberRows.ts reads table 39 following the parseMemberRefs pattern; null or out-of-range implementation coded indexes push invalid-row issues, which flow into partial coverage like every other row-level defect.
  • ManagedMemberInspector wires the parser in (issues included); the unavailable projection and the catalog example gain empty exported_types.
  • The row layouts were already computed (ManagedMetadataRowSizes table 39, Implementation coded index over File/AssemblyRef/ExportedType) and inspect-managed-artifact already counted the rows; only the projection was missing, as #1812's hypothesis stated.
  • docs/managed-code-analysis.md documents the projection and the facade case.

Not included: no new tables, no provider or contract changes beyond the additive schema field; the generated catalogs regenerate at build.

Contract and boundary impact

Additive optional-free schema field on inspect_managed_members output (exported_types, empty for assemblies without the table). Existing consumers see no change on non-facade assemblies. The tool contract and examples regenerate from the schema.

Evidence and regression coverage

  • Unit: two new tests in ManagedMemberInspector.test.ts using an extended PE fixture builder (exportedTypes option with real ExportedType rows and Implementation coded indexes): forwarder projection with AssemblyRef scopes (tokens 0x2700000n, implementation 0x2300000n), flags and type_def_id retention, and the null-implementation invalid-row -> partial degradation. Full dotnet surface 95/95.
  • Real artifact, before this branch: inspect-managed-members System.Runtime.dll (installed .NET 8.0.10 facade) reported types: 1, methods: 0, exported_types: 0, coverage.complete. After: exported_types: 891 (matching the artifact's 891 ExportedType rows), each with namespace-qualified name and AssemblyRef implementation token, coverage complete - now honest, because every row is represented.
  • check:fast, docs:check, and the jscpd budget all pass.

🔄 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/1864 **Author:** [@BaaRai](https://github.com/BaaRai) **Created:** 10/11/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/managed-exported-types` --- ### 📝 Commits (2) - [`5dc551b`](https://github.com/morluto/rea/commit/5dc551b0de738bfdd5afb0f99f6c25e4ae40ac4a) fix(managed): project ExportedType forwarders in member inspection - [`3240104`](https://github.com/morluto/rea/commit/32401048f86a966e722025afb5b46382415b70e8) fix(managed): retain ExportedType name columns and exact issue offsets ### 📊 Changes **8 files changed** (+277 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `docs/managed-code-analysis.md` (+17 -0) 📝 `src/contracts/managed/managedWorkflowExamples.ts` (+1 -0) 📝 `src/domain/managed/managedArtifact.ts` (+14 -0) 📝 `src/dotnet/ManagedMemberInspector.test.ts` (+88 -0) 📝 `src/dotnet/ManagedMemberInspector.ts` (+5 -0) 📝 `src/dotnet/ManagedMemberInspectorCore.ts` (+2 -0) 📝 `src/dotnet/ManagedMemberRows.ts` (+70 -0) 📝 `src/dotnet/ManagedPe.fixture.ts` (+80 -18) </details> ### 📄 Description ## Summary `inspect_managed_members` now projects the `ExportedType` metadata table (table 39) into an `exported_types` array. Facade assemblies such as `System.Runtime.dll` declare almost no `TypeDef` rows of their own; their entire usable surface lives in this table, which the member inspector never read. The result was a `complete` inspection with zero types and zero methods and no unknown or issue disclosing the omission - exactly the silent wrong-evidence shape this repo fails closed on. ## Problem and expected behavior On `System.Runtime.dll` (any .NET runtime), `inspect-managed-artifact` reports hundreds of `ExportedType` rows while `inspect-managed-members` reported one `<Module>` type, zero members, and `coverage.state: "complete"`. Type forwarders are the normal shape of .NET Core facades, so agents reading the summary conclude the assembly provides nothing. Expected: the table's rows are surfaced with their forwarding scope, and malformed rows degrade coverage instead of vanishing. This is #1812. ## Change and scope - `managedMemberInspectionSchema` gains `exported_types`: per row, the token, flags, the forwarded `type_def_id`, the namespace-qualified `full_name`, and the `implementation_token` scope - an `AssemblyRef` for the type forwarders that make up facades, a `File` for multi-module assemblies, or a nested `ExportedType`. - `parseExportedTypes` in `ManagedMemberRows.ts` reads table 39 following the `parseMemberRefs` pattern; null or out-of-range implementation coded indexes push `invalid-row` issues, which flow into `partial` coverage like every other row-level defect. - `ManagedMemberInspector` wires the parser in (issues included); the unavailable projection and the catalog example gain empty `exported_types`. - The row layouts were already computed (`ManagedMetadataRowSizes` table 39, `Implementation` coded index over File/AssemblyRef/ExportedType) and `inspect-managed-artifact` already counted the rows; only the projection was missing, as #1812's hypothesis stated. - `docs/managed-code-analysis.md` documents the projection and the facade case. Not included: no new tables, no provider or contract changes beyond the additive schema field; the generated catalogs regenerate at build. ## Contract and boundary impact Additive optional-free schema field on `inspect_managed_members` output (`exported_types`, empty for assemblies without the table). Existing consumers see no change on non-facade assemblies. The tool contract and examples regenerate from the schema. ## Evidence and regression coverage - Unit: two new tests in `ManagedMemberInspector.test.ts` using an extended PE fixture builder (`exportedTypes` option with real `ExportedType` rows and `Implementation` coded indexes): forwarder projection with `AssemblyRef` scopes (tokens `0x2700000n`, implementation `0x2300000n`), flags and `type_def_id` retention, and the null-implementation `invalid-row` -> `partial` degradation. Full dotnet surface 95/95. - Real artifact, before this branch: `inspect-managed-members System.Runtime.dll` (installed .NET 8.0.10 facade) reported `types: 1, methods: 0, exported_types: 0`, `coverage.complete`. After: `exported_types: 891` (matching the artifact's 891 `ExportedType` rows), each with namespace-qualified name and `AssemblyRef` implementation token, coverage `complete` - now honest, because every row is represented. - `check:fast`, `docs:check`, and the jscpd budget all pass. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 00:56:06 +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#4860
No description provided.