Skip to content

test(ida): align the multi-slice thinning fixture to its declared slices - #2703

Closed
kaoru0822-kitauji wants to merge 1 commit into
mainfrom
test/ida-thinning-aligned-slices
Closed

kaoru0822-kitauji wants to merge 1 commit into
mainfrom
test/ida-thinning-aligned-slices

Conversation

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

Problem

src/ida/IdaWorkspaceThinning.test.ts > copies exactly the selected slice when later slices follow it across read boundaries (from #2291) fails on main. That is one of the two red checks on every current PR, together with jscpd, which #2691 addresses.

Error: Cannot open artifact: FAT architecture 0 offset is not aligned to 2^14
 ❯ parseBinaryTarget src/application/BinaryTargetResolver.ts:192:11
 ❯ largeUniversalTarget src/ida/IdaWorkspaceThinning.test.ts:70:20

The fixture writes three FAT slices that each declare align = 14, but puts the first at offset 4096. Universal target resolution validates physical slice alignment (src/domain/apple/machoContainer.ts), so the fixture is rejected before IDA thinning runs. The product check is correct: a real FAT container can't place a slice there.

Fix

Only test data changes. The slices move to 16384, 32768 and 81920. The selected arm64 slice (32768–66232) still crosses the 64 KiB read boundary and is still followed by another slice, so the test still checks that no trailing bytes reach the private IDA input.

Validation

  • On current origin/main, npm run test:local -- src/ida/IdaWorkspaceThinning.test.ts gives 7 passed (was 1 failed, 6 passed).
  • format:check and check:fast pass.

🤖 Generated with Claude Code

`copies exactly the selected slice when later slices follow it across
read boundaries` (#2291) wrote a FAT container whose first slice starts
at 4096 while every architecture declares 2^14 alignment. Universal
target resolution validates physical slice alignment, so
parseBinaryTarget rejects the fixture ("FAT architecture 0 offset is not
aligned to 2^14") before IDA thinning runs, and the test fails on main.

Place the slices at 16384, 32768 and 81920. The selected arm64 slice
still crosses the 64 KiB read boundary with another slice after it, so
the test still checks that no trailing bytes are copied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T08:07:09.935662Z 72b0206 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Low impact] Test fixture data alignment corrected.

The PR appears safe to merge, with a non-blocking suggestion to preserve coverage for reads entirely after the selected slice.

Findings

  1. P2 Later reads lose test coverage ▶
Fix with agent prompt
### Issue 1
src/ida/IdaWorkspaceThinning.test.ts:129
The new fixture no longer tests a read that starts entirely after the selected slice. The slice ends at 66232 and the file ends at 115384, so both 64 KiB reads overlap the slice. That leaves the `end > start` guard in `copyInput` untested here. This guard prevents later bytes from being copied through a negative `subarray` bound.

Move the final slice to an aligned offset such as 131072 to keep that case covered.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Fixes the FAT fixture's offsets without changing production code.

  • The thinning fixture uses aligned slice offsets.

Reviews (1) · Last reviewed commit: "test(ida): align the multi-slice thinnin..." · Reviewed by Greptile

// slice still crosses the 64 KiB read boundary.
{ cpu: 0x01000007, offset: 16384, size: 8480 },
{ cpu: 0x0100000c, offset: 32768, size: 33464 },
{ cpu: 0x00000007, offset: 81920, size: 33464 },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Later reads lose test coverage

The new fixture no longer tests a read that starts entirely after the selected slice. The slice ends at 66232 and the file ends at 115384, so both 64 KiB reads overlap the slice. That leaves the end > start guard in copyInput untested here. This guard prevents later bytes from being copied through a negative subarray bound.

Move the final slice to an aligned offset such as 131072 to keep that case covered.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/ida/IdaWorkspaceThinning.test.ts
Line: 129

Comment:
**Later reads lose test coverage**

The new fixture no longer tests a read that starts entirely after the selected slice. The slice ends at 66232 and the file ends at 115384, so both 64 KiB reads overlap the slice. That leaves the `end > start` guard in `copyInput` untested here. This guard prevents later bytes from being copied through a negative `subarray` bound.

Move the final slice to an aligned offset such as 131072 to keep that case covered.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator Author

Superseded by a0317cf, which fixes the same IdaWorkspaceThinning fixture by declaring the 4 KiB slice's real alignment instead of moving the slices. Closing.

@kaoru0822-kitauji
kaoru0822-kitauji deleted the test/ida-thinning-aligned-slices branch October 13, 2026 08:24
@morluto morluto added area: tests Test suite and verification area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 2026
@morluto

morluto commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Thanks, @kaoru0822-kitauji, for spotting that the multi-slice fixture moved data instead of declaring the 4 KiB slice's actual alignment. Main now fixes the fixture metadata and keeps the thinning scenario intact (main).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior area: tests Test suite and verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants