Skip to content

fix(desktop): preserve Zip64 counts in exported ZIP views - #11759

Closed
ShuaixinHuang wants to merge 1 commit into
morluto:mainfrom
ShuaixinHuang:fix/desktop-zip64-view-count
Closed

ShuaixinHuang wants to merge 1 commit into
morluto:mainfrom
ShuaixinHuang:fix/desktop-zip64-view-count

Conversation

@ShuaixinHuang

@ShuaixinHuang ShuaixinHuang commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

An exported desktop environment reports a healthy ZIP as not a readable zip archive when its selected zip_entries exceeds 65,535. The bounded directory already has a Zip64 end record, but the Python reader also packs the full retained count into the classic end record's 16-bit fields. At 65,536 files, struct.pack overflows and the reader misclassifies its own framing failure as archive damage.

Reproduced with a ZIP independently written and read by Python's standard-library zipfile, on main 3676ec632bfbe4fde2f5303daa0d9261072ce04a. No related count-serialization PR was found. Existing #9173/#10618 address input Zip64 record location; this repair concerns the exported reader's generated decoder copy.

Change

Give bounded-directory framing one _zip_directory_tail owner. Preserve exact Zip64 counts, size, offset and locator coordinates; saturate the classic 16-bit count and 32-bit size/offset fields at their format-defined sentinels. The requested listing is preserved rather than capped at 65,535.

Keep directory selection, prepended-data offset handling, per-member/total-byte/ratio limits, integrity checks and archive ordering intact. Document raised listing policies. This changes existing offline desktop views without adding target execution or provider authority.

Executed validation

Linux, Node 24.22.1 / npm 11.9.0:

  • The unchanged reader fails the real 65,536-file producer witness with not a readable zip archive; the repaired reader preserves the complete listing.
  • 69 targeted tests across four files passed: seven count/offset cases, 25 existing ZIP parity/resource/integrity regressions, 36 exporter/renderer cases, and one public CLI export case.
  • A genuine 65,537-file archive qualifies selections of 1,000 / 65,535 / 65,536 / 65,537, exact first/last names, source counts, policy truncation and unchanged source bytes. Native bounded-directory selection agrees.
  • The public export-desktop-application --view-policy ... case executes the exact emitted Python reader and verifies its 65,536-file policy/listing. Its capture uses a small seed; the large archive represents later application state. The AgentEnv framework is not required or exercised.
  • Wide-offset wire cases inspect classic, Zip64 and locator fields around 0xffffffff, without allocating or claiming to read a 4 GiB archive.
  • Required build, npm run check:fast, normal commit/pre-push hooks and git diff --check passed. Scoped typed lint: four files, zero errors and zero warnings. All 3734 test/spec files are discovered exactly once.
  • npm run docs:check: six tasks and eight README consistency tests passed.

Large-count cases deliberately retain the existing one-byte member budget, so two-byte payloads remain explicitly unread while listing all selected identities. They qualify directory fidelity, not decompression of every large-archive member. Existing ZIP regressions separately exercise readable contents, CRC/size failures, Unicode names and resource ceilings. No timeout or heap allowance was raised. Native Windows/macOS, the complete monolithic suite and a live AgentEnv computer were not run. Hosted CI remains pending for the published head.

npm run test:focused -- src/domain/desktop/appExportPythonZipCount.test.ts tests/boundary/providers/desktopZipPython.test.ts
npm run test:focused -- src/domain/desktop/appExport.test.ts
npm run test:focused -- tests/boundary/cli/desktopZip64CountCli.test.ts

Author readiness

Human owner: @ShuaixinHuang

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

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-16T17:45:25.578665Z
We couldn’t complete this review. Comment @codex review to try again.
822d5dd 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issue was found.

Summary

Fixes exported Python ZIP views when the selected listing exceeds 65,535 files.

  • Exported desktop ZIP views keep listings above 65,535 entries.

Tests were inspected, not rerun. Remote supersession could not be checked because GitHub authentication was unavailable; local history showed no superseding change.

Reviews (1) · Last reviewed commit: "fix(desktop): preserve Zip64 counts in e..." · Reviewed by Greptile

Copy link
Copy Markdown
Contributor Author

@morluto Could you please review this PR when you have time? As the author, I am finding the ongoing work of keeping these pending branches synchronized and revalidated a substantial maintenance burden. The current head's CI has passed, there are no unresolved inline review threads, and the PR description records the evidence and remaining validation limits. If this change is outside the project's priorities or scope, a clear direction would also help me avoid further unnecessary maintenance. Thank you.

@morluto

morluto commented Nov 19, 2026

Copy link
Copy Markdown
Owner

The bounded exported ZIP directory now retains exact Zip64 counts beyond the classic limit in #12157. That PR includes parity coverage at and above the sentinel. Closing this superseded implementation.

@morluto morluto closed this Nov 19, 2026
@morluto morluto added bug Something isn't working area: runtime Process capture and runtime observation labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants