[PR #5569] [CLOSED] fix(apple): decode NIBArchive boolean value types with the correct polarity #6968

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5569
Author: @kaoru0822-kitauji
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: fix/nib-boolean-value-types


📝 Commits (1)

  • 26b65b8 fix(apple): decode NIBArchive boolean value types with the correct polarity

📊 Changes

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

View changed files

📝 src/artifacts/apple/NibArchive.fixture.ts (+1 -1)
📝 src/artifacts/apple/NibArchive.test.ts (+18 -0)
📝 src/artifacts/apple/NibArchive.ts (+4 -2)

📄 Description

What broke: decode-interface-builder decoded NIBArchive boolean value types with reversed polarity (type 4 as true, 5 as false), and the fixture encoder shared the error so round trips hid it (#5541).
Fix: the NIBArchive decoder maps type 4 to false and 5 to true; the fixture encoder follows the format, and a raw-tag test pins the bytes independently of the encoder.
Risk: low; boolean values in compiled nibs flip to their correct value; no schema change.

Summary

Fixes #5541. decode-interface-builder reversed every boolean stored in a compiled NIBArchive: NSControlContinuous and NSControlRefusesFirstResponder decoded as true when ibtool --export reports false, and the reverse. The decoder now reads value type 4 as false and 5 as true.

Problem and expected behavior

readValue in src/artifacts/apple/NibArchive.ts mapped type 4 → true and 5 → false. The issue's independent oracle (ibtool --export on two sources compiled with opposite values) shows the reverse. The test fixture encoder (NibArchive.fixture.ts) wrote true as 4, mirroring the decoder, so round-trip tests could not catch it.

Change and scope

  • Decoder: type 4 → false, type 5 → true. The skip path that treats both as zero-length is unchanged.
  • Fixture encoder: write true as 5 and false as 4.
  • New decoder test overwrites a one-byte value record's type byte with 4 and 5 and asserts false / true, independent of the fixture's boolean encoding.
  • No consumer in src/artifacts/apple/ interprets decoded NIB booleans, so no downstream compensation needed removal.

Contribution scope: ordinary fix within existing boundaries; maintainer scope decision not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: NIBArchive value decoding (src/artifacts/apple/NibArchive.ts).

  • Contribution scope fit and linked maintainer decision: ordinary fix; not applicable.

  • CLI and MCP/tool-catalog contract: no schema change; decoded boolean values in nibValues flip to their correct polarity.

  • Provider, bridge, target-format, or platform compatibility: NIBArchive (compiled AppKit/UIKit nibs) only; keyed-archive plists are unaffected.

  • Evidence, artifact, provenance, or reconstruction contract: corrects observed field values; identity and digests unchanged.

  • Target selection, authority, upstream behavior, and cleanup details: not applicable.

  • Generated metadata, package, or installation impact: none.

  • 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/artifacts/apple/NibArchive.test.ts adds a raw type-byte test; NibArchive.fixture.ts now encodes booleans with the format's polarity.

  • Base reproduction: with the decoder change stashed, the new test and the existing round-trip test fail (2 failed).

  • Remaining proof gaps: this host has Command Line Tools only (no ibtool), so the issue's compiled Main/Toggled ibtool --export comparison was not rerun here. The polarity relies on that recorded oracle.

  • 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:focused -- src/artifacts/apple/NibArchive.test.ts src/artifacts/apple/AppleAssetCatalogAnalysis.test.ts tests/boundary/filesystem/interfaceBuilderBundle.test.ts tests/acceptance/applications/nibFieldIdentity.test.ts tests/acceptance/applications/assetCatalogResourceKeys.test.ts: 68 passed, 1 skipped (Xcode-gated). These are all consumers of the NIB fixture encoder.
  • npm run test:focused -- src/artifacts/apple/NibArchive.test.ts with the decoder change stashed: 2 failed, 3 passed
  • npm run check:fast: passed

Compatibility, safety, and release

  • Breaking changes or migration steps: none; previously reported NIB booleans were inverted, and callers relying on them receive corrected values.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS (darwin) without Xcode; no provider involved.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new reads, processes or side effects.

Author readiness

Human owner: @kaoru0822-kitauji

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

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.

🤖 Generated with Claude Code


🔄 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/5569 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/nib-boolean-value-types` --- ### 📝 Commits (1) - [`26b65b8`](https://github.com/morluto/rea/commit/26b65b8008d67eeb4391e79bd701e2ea475c51c2) fix(apple): decode NIBArchive boolean value types with the correct polarity ### 📊 Changes **3 files changed** (+23 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/artifacts/apple/NibArchive.fixture.ts` (+1 -1) 📝 `src/artifacts/apple/NibArchive.test.ts` (+18 -0) 📝 `src/artifacts/apple/NibArchive.ts` (+4 -2) </details> ### 📄 Description **What broke:** `decode-interface-builder` decoded NIBArchive boolean value types with reversed polarity (type 4 as true, 5 as false), and the fixture encoder shared the error so round trips hid it (#5541). **Fix:** the NIBArchive decoder maps type 4 to false and 5 to true; the fixture encoder follows the format, and a raw-tag test pins the bytes independently of the encoder. **Risk:** low; boolean values in compiled nibs flip to their correct value; no schema change. ## Summary Fixes #5541. `decode-interface-builder` reversed every boolean stored in a compiled NIBArchive: `NSControlContinuous` and `NSControlRefusesFirstResponder` decoded as `true` when `ibtool --export` reports `false`, and the reverse. The decoder now reads value type 4 as `false` and 5 as `true`. ## Problem and expected behavior `readValue` in `src/artifacts/apple/NibArchive.ts` mapped type 4 → `true` and 5 → `false`. The issue's independent oracle (`ibtool --export` on two sources compiled with opposite values) shows the reverse. The test fixture encoder (`NibArchive.fixture.ts`) wrote `true` as 4, mirroring the decoder, so round-trip tests could not catch it. ## Change and scope - Decoder: type 4 → `false`, type 5 → `true`. The skip path that treats both as zero-length is unchanged. - Fixture encoder: write `true` as 5 and `false` as 4. - New decoder test overwrites a one-byte value record's type byte with 4 and 5 and asserts `false` / `true`, independent of the fixture's boolean encoding. - No consumer in `src/artifacts/apple/` interprets decoded NIB booleans, so no downstream compensation needed removal. Contribution scope: ordinary fix within existing boundaries; maintainer scope decision not applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: NIBArchive value decoding (`src/artifacts/apple/NibArchive.ts`). - Contribution scope fit and linked maintainer decision: ordinary fix; not applicable. - CLI and MCP/tool-catalog contract: no schema change; decoded boolean values in `nibValues` flip to their correct polarity. - Provider, bridge, target-format, or platform compatibility: NIBArchive (compiled AppKit/UIKit nibs) only; keyed-archive plists are unaffected. - Evidence, artifact, provenance, or reconstruction contract: corrects observed field values; identity and digests unchanged. - Target selection, authority, upstream behavior, and cleanup details: not applicable. - Generated metadata, package, or installation impact: none. - [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/artifacts/apple/NibArchive.test.ts` adds a raw type-byte test; `NibArchive.fixture.ts` now encodes booleans with the format's polarity. - Base reproduction: with the decoder change stashed, the new test and the existing round-trip test fail (2 failed). - Remaining proof gaps: this host has Command Line Tools only (no `ibtool`), so the issue's compiled Main/Toggled `ibtool --export` comparison was not rerun here. The polarity relies on that recorded oracle. - [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:focused -- src/artifacts/apple/NibArchive.test.ts src/artifacts/apple/AppleAssetCatalogAnalysis.test.ts tests/boundary/filesystem/interfaceBuilderBundle.test.ts tests/acceptance/applications/nibFieldIdentity.test.ts tests/acceptance/applications/assetCatalogResourceKeys.test.ts`: 68 passed, 1 skipped (Xcode-gated). These are all consumers of the NIB fixture encoder. - `npm run test:focused -- src/artifacts/apple/NibArchive.test.ts` with the decoder change stashed: 2 failed, 3 passed - `npm run check:fast`: passed ## Compatibility, safety, and release - Breaking changes or migration steps: none; previously reported NIB booleans were inverted, and callers relying on them receive corrected values. - Real Hopper/Ghidra, browser, or OS coverage: macOS (darwin) without Xcode; no provider involved. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no new reads, processes or side effects. ## Author readiness Human owner: @kaoru0822-kitauji - [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. ## 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. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:44: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#6968
No description provided.