[PR #3294] [MERGED] fix(apple): order projection paths by Unicode code point #5707

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3294
Author: @Sriram-PR
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @morluto

Base: main ← Head: fix/apple-projection-code-point-order


📝 Commits (1)

  • 99125b9 fix(apple): order projection paths by Unicode code point

📊 Changes

6 files changed (+35 additions, -20 deletions)

View changed files

📝 src/domain/android/androidApplication.ts (+3 -3)
📝 src/domain/apple/appleApplication.test.ts (+26 -0)
📝 src/domain/apple/appleApplication.ts (+2 -5)
📝 src/domain/apple/appleBundleAnatomy.ts (+1 -3)
📝 src/domain/harmony/harmonyApplication.ts (+3 -3)
📝 src/domain/mobileApplicationGraphProjection.ts (+0 -6)

📄 Description

Summary

project-apple-application-graph sorted application_roots, bundles[].path and symlinks with JS </>, which compare UTF-16 code units rather than code points. A name containing U+10000 (surrogate pair starting at 0xD800) therefore sorted before one containing U+FFFD, the reverse of the code point order the inventory already uses and that compareProjectionStrings documents.

Fixes #3177

Problem and expected behavior

Smallest trigger: two app roots A\u{10000}.app and A\ufffd.app. Code point order puts U+FFFD (65533) before U+10000 (65536); the projection returned them the other way round. BMP-only names were unaffected, since code unit and code point order agree there.

Change and scope

  • compareProjectionStrings (in mobileApplicationGraphProjection.ts) is removed. Its callers in the Apple, Android and Harmony projections now use the existing compareUnicodeCodePoints from unicodeCodePointOrder.ts, so there is a single owner for this ordering.
  • The private compare in appleBundleAnatomy.ts, used for roots, bundles and platforms, had the same code unit comparison and now uses compareUnicodeCodePoints too.
  • Android and Harmony only sort evidence ids and runtime family names with it, which are ASCII, so their output doesn't change.

Contribution scope: ordinary fix within existing boundaries; no scope decision needed.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/domain/unicodeCodePointOrder.ts (unchanged) becomes the only comparator for these projection arrays; change is in the domain projection stage.
  • Contribution scope fit and linked maintainer decision: not applicable (bug fix, #3177).
  • CLI and MCP/tool-catalog contract: no schema change. Array order changes only when names contain characters above U+FFFF mixed with BMP characters at or above U+E000.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: projection_id changes for affected inputs because the ordered payload changes; it stays deterministic.
  • Target selection, authority, upstream behavior, and cleanup details: not applicable.
  • Generated metadata, package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • 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

  • Tests added or updated: src/domain/apple/appleApplication.test.ts, a parameterized test with the astral/BMP pair from the issue and a BMP-only control. It checks application_roots, bundles[].path and symlinks.
  • Base reproduction: on the base revision the new astral case fails with expected [ 'A\ud800\udc00.app', 'A\ufffd.app' ] to deeply equal [ 'A\ufffd.app', 'A\ud800\udc00.app' ]; the BMP control passes.
  • User-visible CLI output: the issue's recipe (extended with a U+E000 root) through inspect-artifact and project-apple-application-graph now returns:
    application_roots: ["A\ue000.app", "A\ufffd.app", "A\ud800\udc00.app"]
    bundle_paths:      ["A\ue000.app", "A\ufffd.app", "A\ud800\udc00.app"]
    symlinks: [".../A\ue000.app/Contents/Resources/link", ".../A\ufffd.app/...", ".../A\ud800\udc00.app/..."]
    coverage: {"status":"complete-within-inventory","inventory_complete":true}
    
  • Remaining proof gaps: ran on Linux x64 only (the projection is pure domain code, no provider involved).

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

  • npm run test:local -- src/domain/apple/appleApplication.test.ts — 19 passed (new astral case fails on the base revision)
  • npm run test:local on the Apple, Android, Harmony and projection domain tests — 6 files, 126 passed
  • npm run test:focused on the boundary/acceptance tests touching these projections (tests/boundary/filesystem/{appleApplication,android/application,harmony/application}.test.ts, tests/acceptance/applications/mobileFrameworkConventions.test.ts, tests/boundary/cli/jsonInputStatus.test.ts, plus ArtifactOccurrenceIdentity.test.ts) — 7 files, 92 passed
  • npm run check:fast — typecheck and lint passed
  • oxfmt --check on changed files — clean
  • CLI repro from the issue after npm run build:cached — output above

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; Linux x64, Node 24.18.0.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none; comparator change only.

Author readiness

Human owner: @Sriram-PR

  • 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 the current revision ready for maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 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/3294 **Author:** [@Sriram-PR](https://github.com/Sriram-PR) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/apple-projection-code-point-order` --- ### 📝 Commits (1) - [`99125b9`](https://github.com/morluto/rea/commit/99125b92d0a39c1573e2a9035c46e02a677d5ef4) fix(apple): order projection paths by Unicode code point ### 📊 Changes **6 files changed** (+35 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/android/androidApplication.ts` (+3 -3) 📝 `src/domain/apple/appleApplication.test.ts` (+26 -0) 📝 `src/domain/apple/appleApplication.ts` (+2 -5) 📝 `src/domain/apple/appleBundleAnatomy.ts` (+1 -3) 📝 `src/domain/harmony/harmonyApplication.ts` (+3 -3) 📝 `src/domain/mobileApplicationGraphProjection.ts` (+0 -6) </details> ### 📄 Description ## Summary `project-apple-application-graph` sorted `application_roots`, `bundles[].path` and `symlinks` with JS `<`/`>`, which compare UTF-16 code units rather than code points. A name containing U+10000 (surrogate pair starting at 0xD800) therefore sorted before one containing U+FFFD, the reverse of the code point order the inventory already uses and that `compareProjectionStrings` documents. Fixes #3177 ## Problem and expected behavior Smallest trigger: two app roots `A\u{10000}.app` and `A\ufffd.app`. Code point order puts U+FFFD (65533) before U+10000 (65536); the projection returned them the other way round. BMP-only names were unaffected, since code unit and code point order agree there. ## Change and scope - `compareProjectionStrings` (in `mobileApplicationGraphProjection.ts`) is removed. Its callers in the Apple, Android and Harmony projections now use the existing `compareUnicodeCodePoints` from `unicodeCodePointOrder.ts`, so there is a single owner for this ordering. - The private `compare` in `appleBundleAnatomy.ts`, used for roots, bundles and platforms, had the same code unit comparison and now uses `compareUnicodeCodePoints` too. - Android and Harmony only sort evidence ids and runtime family names with it, which are ASCII, so their output doesn't change. Contribution scope: ordinary fix within existing boundaries; no scope decision needed. ## Contract and boundary impact - Semantic owner and earliest changed stage: `src/domain/unicodeCodePointOrder.ts` (unchanged) becomes the only comparator for these projection arrays; change is in the domain projection stage. - Contribution scope fit and linked maintainer decision: not applicable (bug fix, #3177). - CLI and MCP/tool-catalog contract: no schema change. Array order changes only when names contain characters above U+FFFF mixed with BMP characters at or above U+E000. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: `projection_id` changes for affected inputs because the ordered payload changes; it stays deterministic. - Target selection, authority, upstream behavior, and cleanup details: not applicable. - Generated metadata, package, or installation impact: none. Expected effects (check known effects; use documentation-only on its own). Unchecked items do not establish absence; leave uncertainties visible. - [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 - Tests added or updated: `src/domain/apple/appleApplication.test.ts`, a parameterized test with the astral/BMP pair from the issue and a BMP-only control. It checks `application_roots`, `bundles[].path` and `symlinks`. - Base reproduction: on the base revision the new astral case fails with `expected [ 'A\ud800\udc00.app', 'A\ufffd.app' ] to deeply equal [ 'A\ufffd.app', 'A\ud800\udc00.app' ]`; the BMP control passes. - User-visible CLI output: the issue's recipe (extended with a U+E000 root) through `inspect-artifact` and `project-apple-application-graph` now returns: ``` application_roots: ["A\ue000.app", "A\ufffd.app", "A\ud800\udc00.app"] bundle_paths: ["A\ue000.app", "A\ufffd.app", "A\ud800\udc00.app"] symlinks: [".../A\ue000.app/Contents/Resources/link", ".../A\ufffd.app/...", ".../A\ud800\udc00.app/..."] coverage: {"status":"complete-within-inventory","inventory_complete":true} ``` - Remaining proof gaps: ran on Linux x64 only (the projection is pure domain code, no provider involved). 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 - `npm run test:local -- src/domain/apple/appleApplication.test.ts` — 19 passed (new astral case fails on the base revision) - `npm run test:local` on the Apple, Android, Harmony and projection domain tests — 6 files, 126 passed - `npm run test:focused` on the boundary/acceptance tests touching these projections (`tests/boundary/filesystem/{appleApplication,android/application,harmony/application}.test.ts`, `tests/acceptance/applications/mobileFrameworkConventions.test.ts`, `tests/boundary/cli/jsonInputStatus.test.ts`, plus `ArtifactOccurrenceIdentity.test.ts`) — 7 files, 92 passed - `npm run check:fast` — typecheck and lint passed - `oxfmt --check` on changed files — clean - CLI repro from the issue after `npm run build:cached` — output above ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: not applicable; Linux x64, Node 24.18.0. - Package or release metadata impact: none. - Security, privacy, process, or containment review: none; comparator change only. ## Author readiness Human owner: @Sriram-PR - [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 the current revision ready for maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:08:49 +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#5707
No description provided.