[PR #5260] [CLOSED] fix(apple): avoid truncation flag for empty catalogs #6843

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5260
Author: @prayaggaikwad96
Created: 10/19/2026
Status: ❌ Closed

Base: main ← Head: fix/apple-empty-catalog-truncation


📝 Commits (6)

  • f99e6b5 fix(apple): avoid truncation flag for empty catalogs
  • 47437a9 test(apple): cover empty catalog pagination
  • cfd1959 style(apple): format pagination regression test
  • 8c4a14b test(apple): cover empty catalog pagination offsets
  • 3daf886 test(apple): cover reported empty offset and pagination flag
  • b818293 test(apple): cover catalogs with zero records

📊 Changes

2 files changed (+34 additions, -1 deletions)

View changed files

📝 src/domain/apple/appleAssetCatalog.test.ts (+33 -0)
📝 src/domain/apple/appleAssetCatalog.ts (+1 -1)

📄 Description

Summary

Fixes #5111.

An empty Apple asset-catalog inventory could report truncated: true for a positive offset despite containing zero records and returning next_offset: null. This incorrectly suggested that records had been omitted.

Problem and expected behavior

The prior projection calculated truncated as input.offset > 0 || next < all.length. Because input.offset > 0 can be true when all.length === 0, empty inventories were incorrectly marked truncated.

Empty inventories should return truncated: false for any valid non-negative offset while preserving the requested offset, total_records: 0, an empty records array, and next_offset: null. Non-empty pagination behavior should remain unchanged.

Change and scope

  • Gate the truncation calculation on all.length > 0.
  • Add parameterized regression cases for empty inventories at offsets 0, 1, and 5.
  • Assert the requested offset, zero total records, empty records, null next offset, and false truncation flag.
  • Preserve explicit coverage for truncation on non-empty pages when earlier records are excluded by the requested offset.

This is a focused fix to the existing Apple asset-catalog projection and its unit test. It introduces no new provider, capability, target execution, injection, mutation, or protection-recovery behavior.

Contract and boundary impact

  • Semantic owner and earliest changed stage: Apple asset-catalog result projection, specifically the truncated field in projectAppleAssetCatalogPage.
  • Contribution scope fit and linked maintainer decision: Existing-domain bug fix limited to projection and tests; no new capability or provider scope is introduced.
  • CLI and MCP/tool-catalog contract: No schema or tool-catalog changes. The corrected boolean affects the erroneous empty-inventory/positive-offset result.
  • Provider, bridge, target-format, or platform compatibility: No provider or platform behavior changes.
  • Evidence, artifact, provenance, or reconstruction contract: Corrects the completeness signal; does not add, remove, or transform records.
  • Target selection, authority, upstream behavior, and cleanup: No changes to target selection or runtime interaction.
  • Generated metadata, package, or installation impact: None; generated catalogs, package metadata, and installation files are not changed.

Evidence and regression coverage

  • Tests added or updated: Parameterized unit tests cover empty inventories at offsets 0, 1, and 5 and assert all relevant response fields. Existing non-empty pagination coverage now explicitly asserts truncation on the non-empty final page with an earlier-record offset.
  • Base reproduction or other evidence: Issue #5111 reports a paired source-workflow reproduction on a synthetic macOS app: offset 0 returned truncated: false, while offset 1 returned truncated: true, both with zero records and next_offset: null.
  • User-visible CLI/MCP output: The issue report did not exercise CLI/MCP transport or an installed package; this PR makes no claim about those paths.
  • Remaining proof gaps: The relevant Vitest suite has not been run locally. GitHub Actions runs are awaiting approval, so CI has not yet verified the branch.

Validation performed

  • Local Vitest suite: Not run. Attempting to clone the PR branch in this environment failed because github.com could not be resolved.
  • GitHub Actions: Latest retrieved runs report action_required; a maintainer must approve the required workflows before their results can be evaluated.

Compatibility, safety, and release

  • Breaking changes or migration steps: None expected; response schema is unchanged.
  • Real Hopper/Ghidra, browser, or OS coverage: Not applicable to this projection-only fix.
  • Package or release metadata impact: None.
  • Security, privacy, process, or containment review: No new runtime access or target interaction is introduced.

Author readiness

Human owner: @prayaggaikwad96

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

Fixes #5111


🔄 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/5260 **Author:** [@prayaggaikwad96](https://github.com/prayaggaikwad96) **Created:** 10/19/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/apple-empty-catalog-truncation` --- ### 📝 Commits (6) - [`f99e6b5`](https://github.com/morluto/rea/commit/f99e6b5af7abd421c760fc3e28df7a185ca75e10) fix(apple): avoid truncation flag for empty catalogs - [`47437a9`](https://github.com/morluto/rea/commit/47437a9883d8559a5d3fe34cdead18f854c2b02b) test(apple): cover empty catalog pagination - [`cfd1959`](https://github.com/morluto/rea/commit/cfd19593b2d24f917bcb7d4466d23309bb8c755b) style(apple): format pagination regression test - [`8c4a14b`](https://github.com/morluto/rea/commit/8c4a14b3ad13a4e0ab697f0b9f027f9e63653f94) test(apple): cover empty catalog pagination offsets - [`3daf886`](https://github.com/morluto/rea/commit/3daf8867e2ffe497d36559353d30b99ad40f9411) test(apple): cover reported empty offset and pagination flag - [`b818293`](https://github.com/morluto/rea/commit/b8182930bc7c992a38ddb0ae60bd58eb53f70300) test(apple): cover catalogs with zero records ### 📊 Changes **2 files changed** (+34 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/apple/appleAssetCatalog.test.ts` (+33 -0) 📝 `src/domain/apple/appleAssetCatalog.ts` (+1 -1) </details> ### 📄 Description ## Summary Fixes #5111. An empty Apple asset-catalog inventory could report `truncated: true` for a positive offset despite containing zero records and returning `next_offset: null`. This incorrectly suggested that records had been omitted. ## Problem and expected behavior The prior projection calculated `truncated` as `input.offset > 0 || next < all.length`. Because `input.offset > 0` can be true when `all.length === 0`, empty inventories were incorrectly marked truncated. Empty inventories should return `truncated: false` for any valid non-negative offset while preserving the requested offset, `total_records: 0`, an empty `records` array, and `next_offset: null`. Non-empty pagination behavior should remain unchanged. ## Change and scope - Gate the truncation calculation on `all.length > 0`. - Add parameterized regression cases for empty inventories at offsets 0, 1, and 5. - Assert the requested offset, zero total records, empty records, null next offset, and false truncation flag. - Preserve explicit coverage for truncation on non-empty pages when earlier records are excluded by the requested offset. This is a focused fix to the existing Apple asset-catalog projection and its unit test. It introduces no new provider, capability, target execution, injection, mutation, or protection-recovery behavior. ## Contract and boundary impact - **Semantic owner and earliest changed stage:** Apple asset-catalog result projection, specifically the `truncated` field in `projectAppleAssetCatalogPage`. - **Contribution scope fit and linked maintainer decision:** Existing-domain bug fix limited to projection and tests; no new capability or provider scope is introduced. - **CLI and MCP/tool-catalog contract:** No schema or tool-catalog changes. The corrected boolean affects the erroneous empty-inventory/positive-offset result. - **Provider, bridge, target-format, or platform compatibility:** No provider or platform behavior changes. - **Evidence, artifact, provenance, or reconstruction contract:** Corrects the completeness signal; does not add, remove, or transform records. - **Target selection, authority, upstream behavior, and cleanup:** No changes to target selection or runtime interaction. - **Generated metadata, package, or installation impact:** None; generated catalogs, package metadata, and installation files are not changed. ## Evidence and regression coverage - **Tests added or updated:** Parameterized unit tests cover empty inventories at offsets 0, 1, and 5 and assert all relevant response fields. Existing non-empty pagination coverage now explicitly asserts truncation on the non-empty final page with an earlier-record offset. - **Base reproduction or other evidence:** Issue #5111 reports a paired source-workflow reproduction on a synthetic macOS app: offset 0 returned `truncated: false`, while offset 1 returned `truncated: true`, both with zero records and `next_offset: null`. - **User-visible CLI/MCP output:** The issue report did not exercise CLI/MCP transport or an installed package; this PR makes no claim about those paths. - **Remaining proof gaps:** The relevant Vitest suite has not been run locally. GitHub Actions runs are awaiting approval, so CI has not yet verified the branch. ## Validation performed - **Local Vitest suite:** Not run. Attempting to clone the PR branch in this environment failed because `github.com` could not be resolved. - **GitHub Actions:** Latest retrieved runs report `action_required`; a maintainer must approve the required workflows before their results can be evaluated. ## Compatibility, safety, and release - **Breaking changes or migration steps:** None expected; response schema is unchanged. - **Real Hopper/Ghidra, browser, or OS coverage:** Not applicable to this projection-only fix. - **Package or release metadata impact:** None. - **Security, privacy, process, or containment review:** No new runtime access or target interaction is introduced. ## Author readiness <!-- These three declarations are intentionally left for the human author to review and complete, as required by the repository's PR template. --> Human owner: @prayaggaikwad96 - [ ] 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. Fixes #5111 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:43:27 +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#6843
No description provided.