[PR #4319] [CLOSED] fix(swift): retain uncertainty for substituted extension contexts #6167

Closed
opened 2026-10-31 01:12:23 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4319
Author: @maxazure
Created: 10/16/2026
Status: ❌ Closed

Base: main ← Head: fix/swift-unresolved-context-4296


📝 Commits (5)

  • 1ced7ca fix(swift): retain uncertainty for substituted extension contexts
  • ae43444 fix(swift): preserve decoded protocol witness contexts
  • 76ba31a fix(swift): decode grouped witness context identities
  • 49961c5 fix(swift): recognize extension contexts without validating witness tails
  • 55990ff fix(swift): preserve unresolved generic requirement contexts

📊 Changes

3 files changed (+524 additions, -3 deletions)

View changed files

➕ src/domain/swiftExtensionContext.test.ts (+96 -0)
📝 src/domain/swiftSymbolClassification.ts (+193 -3)
📝 tests/boundary/mcp/enhancedTools.swiftTypes.test.ts (+235 -0)

📄 Description

Summary

Fixes #4296. Keep unresolved same-module Swift extension contexts in other/unclassified rather than inheriting the preceding struct category.

Problem and expected behavior

_$s1M7WrapperVAASQRzlE4sameySbxF previously remained under structs after the literal decoder stopped at the module substitution. The tool promises to preserve undecoded categories as unknown. It must not infer an extension by scanning for E inside a name or signature.

Change and scope

The classifier tracks literal identifier and nominal substitutions, then examines substituted context boundaries with a bounded token reader. A supported extension boundary or unresolved generic requirement clears provisional nominal ownership; ordinary substituted member names, constructors, and witness/entity tails retain their baseline nominal classification.

The revision handles grouped substitutions and generic requirement boundaries, including standard type operands such as Hashable and Int, named nominal operands, and inverse requirements. It does not infer an extension by searching for an E character inside arbitrary text.

This is deliberately not a full Swift demangler. Complex generic operands and unsupported encodings are not fully decoded. The returned uncertainty is conservative; it does not claim to reconstruct the original declaration.

Contract and boundary impact

  • Semantic owner and earliest changed stage: classifySwiftSymbol, before category aggregation.
  • Contribution scope fit and linked maintainer decision: routine static-classification fix; additional scope decision not applicable.
  • CLI and MCP/tool-catalog contract: existing shape and filters; corrected category values and existing uncertainty limitation.
  • Provider, bridge, target-format, or platform compatibility: no provider/bridge changes; controlled provider names only.
  • Evidence, artifact, provenance, or reconstruction contract: retain names, addresses, aliases, and category_not_decoded; unknown aliases do not erase decoded facts.
  • Target selection, authority, upstream behavior, and cleanup details: unchanged.
  • Generated metadata, package, or installation impact: none.

Expected effects:

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

Evidence and regression coverage

  • Domain regressions cover substituted extension contexts, malformed and unsupported generic requirements, grouped references, bounded indexes, and substituted member-name controls.
  • Public MCP boundary regressions cover the reported Wrapper and Box spellings, Hashable/same-type requirements, category filtering with inline uncertainty, alias order, constructors, witnesses, literal members, metadata, legacy names, and a literal-module extension.
  • The controlled provider inventory contains 22 procedures: 12 structs, 1 extension, and 9 unknown. Unknown observations retain addresses, manglings, and category_not_decoded evidence, including under category filtering.
  • These are issue/review spellings and ABI-derived controls. No new Swift compilation, demangler invocation, or real Hopper/Ghidra run is claimed.

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

  • Focused validation for the current revision: 135 tests passed across classification, aggregation, and MCP boundary coverage.
  • npm run check passed with bounded local process/memory settings, including architecture guards.
  • Test discovery found 1,399 files exactly once.
  • The compiled-runtime controlled MCP check passed; the inventory and limitations are described above.
  • Current published head: 55990ffb53.
  • Upstream CI for this head: https://github.com/morluto/rea/actions/runs/39017101529
  • No new full local suite or real-provider lane is claimed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; callers see corrected uncertainty in existing fields.
  • Real Hopper/Ghidra, browser, or OS coverage: not run; this changes provider-independent domain classification.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new execution, mutation, network, or target authority.

Author readiness

Human owner: @maxazure

  • 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/4319 **Author:** [@maxazure](https://github.com/maxazure) **Created:** 10/16/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/swift-unresolved-context-4296` --- ### 📝 Commits (5) - [`1ced7ca`](https://github.com/morluto/rea/commit/1ced7ca819fde7f0ccbc7f3f5fc16ccd810ddf5a) fix(swift): retain uncertainty for substituted extension contexts - [`ae43444`](https://github.com/morluto/rea/commit/ae43444a5cdd44f6f3250b05ab0ff7ef9e589b88) fix(swift): preserve decoded protocol witness contexts - [`76ba31a`](https://github.com/morluto/rea/commit/76ba31a0eea0a5bf93c14ed7ad3d325afb49b381) fix(swift): decode grouped witness context identities - [`49961c5`](https://github.com/morluto/rea/commit/49961c554f6359d74f652ac03c2bd581459b0f53) fix(swift): recognize extension contexts without validating witness tails - [`55990ff`](https://github.com/morluto/rea/commit/55990ffb5356c6371972d8bc6e7bf88bac58cdb0) fix(swift): preserve unresolved generic requirement contexts ### 📊 Changes **3 files changed** (+524 additions, -3 deletions) <details> <summary>View changed files</summary> ➕ `src/domain/swiftExtensionContext.test.ts` (+96 -0) 📝 `src/domain/swiftSymbolClassification.ts` (+193 -3) 📝 `tests/boundary/mcp/enhancedTools.swiftTypes.test.ts` (+235 -0) </details> ### 📄 Description ## Summary Fixes #4296. Keep unresolved same-module Swift extension contexts in `other`/`unclassified` rather than inheriting the preceding struct category. ## Problem and expected behavior `_$s1M7WrapperVAASQRzlE4sameySbxF` previously remained under `structs` after the literal decoder stopped at the module substitution. The tool promises to preserve undecoded categories as unknown. It must not infer an extension by scanning for `E` inside a name or signature. ## Change and scope The classifier tracks literal identifier and nominal substitutions, then examines substituted context boundaries with a bounded token reader. A supported extension boundary or unresolved generic requirement clears provisional nominal ownership; ordinary substituted member names, constructors, and witness/entity tails retain their baseline nominal classification. The revision handles grouped substitutions and generic requirement boundaries, including standard type operands such as Hashable and Int, named nominal operands, and inverse requirements. It does not infer an extension by searching for an E character inside arbitrary text. This is deliberately not a full Swift demangler. Complex generic operands and unsupported encodings are not fully decoded. The returned uncertainty is conservative; it does not claim to reconstruct the original declaration. ## Contract and boundary impact - Semantic owner and earliest changed stage: `classifySwiftSymbol`, before category aggregation. - Contribution scope fit and linked maintainer decision: routine static-classification fix; additional scope decision not applicable. - CLI and MCP/tool-catalog contract: existing shape and filters; corrected category values and existing uncertainty limitation. - Provider, bridge, target-format, or platform compatibility: no provider/bridge changes; controlled provider names only. - Evidence, artifact, provenance, or reconstruction contract: retain names, addresses, aliases, and `category_not_decoded`; unknown aliases do not erase decoded facts. - Target selection, authority, upstream behavior, and cleanup details: unchanged. - Generated metadata, package, or installation impact: none. Expected effects: - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Domain regressions cover substituted extension contexts, malformed and unsupported generic requirements, grouped references, bounded indexes, and substituted member-name controls. - Public MCP boundary regressions cover the reported Wrapper and Box spellings, Hashable/same-type requirements, category filtering with inline uncertainty, alias order, constructors, witnesses, literal members, metadata, legacy names, and a literal-module extension. - The controlled provider inventory contains 22 procedures: 12 structs, 1 extension, and 9 unknown. Unknown observations retain addresses, manglings, and category_not_decoded evidence, including under category filtering. - These are issue/review spellings and ABI-derived controls. No new Swift compilation, demangler invocation, or real Hopper/Ghidra run is claimed. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - Focused validation for the current revision: 135 tests passed across classification, aggregation, and MCP boundary coverage. - npm run check passed with bounded local process/memory settings, including architecture guards. - Test discovery found 1,399 files exactly once. - The compiled-runtime controlled MCP check passed; the inventory and limitations are described above. - Current published head: 55990ffb5356c6371972d8bc6e7bf88bac58cdb0. - Upstream CI for this head: https://github.com/morluto/rea/actions/runs/39017101529 - No new full local suite or real-provider lane is claimed. ## Compatibility, safety, and release - Breaking changes or migration steps: none; callers see corrected uncertainty in existing fields. - Real Hopper/Ghidra, browser, or OS coverage: not run; this changes provider-independent domain classification. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no new execution, mutation, network, or target authority. ## Author readiness Human owner: @maxazure - [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-10-31 01:12:23 +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#6167
No description provided.