[PR #4429] fix(native): isolate empty Swift conformance names #6237

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4429
Author: @HuXiangyu123
Created: 10/16/2026
Status: 🔄 Open

Base: main ← Head: fix/swift-conformance-empty-names


📝 Commits (1)

  • 9039a91 fix(native): isolate empty Swift conformance names

📊 Changes

2 files changed (+97 additions, -3 deletions)

View changed files

📝 src/native/AppleDispatchMetadata.test.ts (+93 -0)
📝 src/native/AppleSwiftDispatchFacets.ts (+4 -3)

📄 Description

Summary

Fixes #4368. An empty Swift conformance type or protocol name previously escaped per-entry recovery and caused whole-result validation to throw, preventing independently decoded metadata from being returned. Reject these names inside the conformance decoder before publishing the record or its witness slots. The existing located conformance_decode_failed issue now marks coverage partial while valid siblings survive.

Remove the unused swiftFailures accumulator; structured issues remain the single source of conformance failure diagnostics. The generic string reader and shared result schemas keep their existing semantics.

Evidence and validation

On baseline d72d856f58d4747c5eb4307426e80d20934e017c, the new byte-fixture regressions produced 2 failures / 44 passes: empty type and protocol names each raised ZodError at objcSwiftMetadataSchema.parse(result); the nonempty control passed. The self-authored Mach-O contains three conformances plus independent Objective-C metadata.

After the fix, on Linux x64 with pinned Node 24.18.0/npm 11.16.0:

  • npm run test:local -- src/native/AppleDispatchMetadata.test.ts src/native/AppleSwiftVtables.test.ts — 49/49 passed. Cases check earlier/later conformance retention, witness-slot owners, record provenance, Objective-C retention, and located partial coverage; the valid control retains all three records with complete conformance coverage.
  • npm run check — passed, including typecheck, format, lint/module boundaries, knip, metadata and architecture guards. Lint reported 0 errors and 1566 warnings. The first sandboxed attempt stopped at a lint child-process EPERM; the approved rerun completed.
  • npm run verify:test-discovery — all 1415 test files discovered exactly once.
  • git diff --check — passed.

Remote head: 9039a912084b0047609060f5cb1d7337fd39f276; fetched back and verified tree-identical to the locally tested commit. At submission, both GitHub CI and PR title workflows require maintainer approval and have not run. This is pending remote validation, not a CI pass.

Scope and limitations

Ordinary static-parser correctness fix within existing contribution boundaries; no advance maintainer scope decision is needed. No CLI/MCP schema, target selection, execution authority, dependency, installation, or generated metadata changes. Original source paths/digests and successfully decoded relative pointers remain available. Related class-vtable name handling in #4369 is a separate decoder and is not changed.

Executed coverage uses production byte decoding and schema validation, with synthetic local bytes and no mocked parser. macOS CLI/MCP and verify:apple-dispatch were not run: this host is Linux and lacks the macOS compiler/Foundation SDK required by that lane. No real Apple toolchain, Hopper/Ghidra, Windows, full-suite, prevalence, or performance claim is made. Dependencies were installed with lifecycle scripts disabled.

AI-assisted contribution; self-reviewed for parser ownership, affected coverage consumers, schema consistency and unrelated changes. Draft pending human review and applicable macOS validation.

Author readiness

Human owner: @HuXiangyu123

  • 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/4429 **Author:** [@HuXiangyu123](https://github.com/HuXiangyu123) **Created:** 10/16/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/swift-conformance-empty-names` --- ### 📝 Commits (1) - [`9039a91`](https://github.com/morluto/rea/commit/9039a912084b0047609060f5cb1d7337fd39f276) fix(native): isolate empty Swift conformance names ### 📊 Changes **2 files changed** (+97 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/native/AppleDispatchMetadata.test.ts` (+93 -0) 📝 `src/native/AppleSwiftDispatchFacets.ts` (+4 -3) </details> ### 📄 Description ## Summary Fixes #4368. An empty Swift conformance type or protocol name previously escaped per-entry recovery and caused whole-result validation to throw, preventing independently decoded metadata from being returned. Reject these names inside the conformance decoder before publishing the record or its witness slots. The existing located `conformance_decode_failed` issue now marks coverage partial while valid siblings survive. Remove the unused `swiftFailures` accumulator; structured issues remain the single source of conformance failure diagnostics. The generic string reader and shared result schemas keep their existing semantics. ## Evidence and validation On baseline `d72d856f58d4747c5eb4307426e80d20934e017c`, the new byte-fixture regressions produced **2 failures / 44 passes**: empty type and protocol names each raised `ZodError` at `objcSwiftMetadataSchema.parse(result)`; the nonempty control passed. The self-authored Mach-O contains three conformances plus independent Objective-C metadata. After the fix, on Linux x64 with pinned Node 24.18.0/npm 11.16.0: - `npm run test:local -- src/native/AppleDispatchMetadata.test.ts src/native/AppleSwiftVtables.test.ts` — **49/49 passed**. Cases check earlier/later conformance retention, witness-slot owners, record provenance, Objective-C retention, and located partial coverage; the valid control retains all three records with complete conformance coverage. - `npm run check` — passed, including typecheck, format, lint/module boundaries, knip, metadata and architecture guards. Lint reported 0 errors and 1566 warnings. The first sandboxed attempt stopped at a lint child-process `EPERM`; the approved rerun completed. - `npm run verify:test-discovery` — all 1415 test files discovered exactly once. - `git diff --check` — passed. Remote head: `9039a912084b0047609060f5cb1d7337fd39f276`; fetched back and verified tree-identical to the locally tested commit. At submission, both GitHub `CI` and `PR title` workflows require maintainer approval and have not run. This is pending remote validation, not a CI pass. ## Scope and limitations Ordinary static-parser correctness fix within existing contribution boundaries; no advance maintainer scope decision is needed. No CLI/MCP schema, target selection, execution authority, dependency, installation, or generated metadata changes. Original source paths/digests and successfully decoded relative pointers remain available. Related class-vtable name handling in #4369 is a separate decoder and is not changed. Executed coverage uses production byte decoding and schema validation, with synthetic local bytes and no mocked parser. **macOS CLI/MCP and `verify:apple-dispatch` were not run**: this host is Linux and lacks the macOS compiler/Foundation SDK required by that lane. No real Apple toolchain, Hopper/Ghidra, Windows, full-suite, prevalence, or performance claim is made. Dependencies were installed with lifecycle scripts disabled. AI-assisted contribution; self-reviewed for parser ownership, affected coverage consumers, schema consistency and unrelated changes. Draft pending human review and applicable macOS validation. ## Author readiness Human owner: @HuXiangyu123 - [ ] 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. - [ ] 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>
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#6237
No description provided.