Repository navigation
fix(desktop): retain ZIP contents with extended Zip64 records - #9173
wunianze666-netizen wants to merge 1 commit into
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The reviewed changes appear safe to merge. SummaryBoth desktop ZIP readers now follow the declared Zip64 record before trying the existing fixed-record fallback.
No actionable issues were found. Review was source-only; tests were not run. Checking whether another PR supersedes this one was blocked by missing GitHub authentication. Reviews (2) · Last reviewed commit: "fix(desktop): retain ZIP contents with e..." · Reviewed by Greptile |
|
TL;DR: On head 9d46ff2, all 20 tests in the changed test file passed on Node 22.23.4, 24.22.1 and 26.12.1. With the old source files put back, 5 of the 20 tests failed on each Node version. On the head, CI shows
The red run keeps the head's The same five tests failed on all three Node versions. All five are in
The PR changes 7 files against the merge base. One is the test file. The other six are CI on the head, read live with
The head is 118 commits behind main c78c8ae. Not run
Test setupCommandsnpm ci --offline
npm run test:prepare
xvfb-run -a npm run test:focused -- tests/boundary/providers/desktopZipPython.test.ts🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊 |
|
The declared Zip64 record span now takes precedence over the fixed-record fallback in the host and generated Python readers through #12157. Thanks for the extended-record regression. |
Summary
A valid Zip64 archive with an extensible end record can lose its entire desktop state view, or appear empty when extension bytes resemble another end record. Follow the locator's declared frame before the existing fixed-record fallback in both REA and the generated Python reader. This also lets an exported task grade the retained archive correctly.
Found independently through the production readers and a compiled CLI control. No issue was opened only to link the fix.
Problem and expected behavior
On frozen main
98c589e42019b4cc2c3c6aee1f6d2031e2de2441, a 218-byte authored archive containingsettings.jsonis readable by the unwrapped ZIP library, but both desktop readers returnnot a readable zip archive. The compiledinspect-desktop-application-statereports unreadable seed/end views;export-desktop-application --taskexits 1 because the captured end has no view. A fixed-size Zip64 control passes.The Zip64 end record has a 56-byte fixed header followed by optional opaque extension bytes. Both readers instead assumed the record began exactly 56 bytes before its locator. A record-looking tail inside an extension was consequently treated as the end record and silently reduced a nonempty archive to zero entries. Four regressions fail on the frozen production files: deferred/classic end fields, each with a short extension or a misleading tail.
PKWARE APPNOTE 4.3.14-4.3.15 defines the variable extensible sector, the size excluding the leading 12 bytes, and the locator's record offset. Unknown extension contents must not replace the located directory frame.
Change and scope
Read the fixed fields at the declared Zip64 offset when the complete record fits and ends at its locator. Keep 64-bit pointer/length checks exact before conversion or seeking. The extension stays opaque: no scan or allocation proportional to its length. Retain the existing fixed-record fallback when the declared pointer cannot be used. Reject undersized or overrun frames rather than selecting an unrelated signature.
Both the TypeScript directory owner and exported Python counterpart use the same framing rule; the downstream bounded-directory representation remains unchanged. Existing entry/byte/ratio limits, CRC checks, encryption/compression refusals and cleanup remain in place. The Python test driver now carries the generated program over UTF-8 stdin and preserves its separate JSON input, avoiding the Windows argument-length limit; it uses the installed
pythoncommand on Windows instead of a Storepython3alias. No production timeout or validation policy changes.Ordinary passive format correction within the existing desktop view/export boundary; a separate maintainer scope decision is not applicable.
Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.
Contract and boundary impact
zipDirectory.tsand generated_zip_end, before either bounded reader normalizes the directory. The fixed-size-only interpretation is replaced at those owners.docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions in.agents/skills/reverse-engineer-anything/and never commit build outputs): no catalog, package, version or dependency change in this PR.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
invalid_requestnaming the unreadable captured end.failing_on_seed: ["changed"]. The exact newly emitted stdlib reader/evaluator yields seed false / final true with archive bytes unchanged.For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.
For evidence-bearing changes:
Validation performed
Revision
9d46ff2216753c5993bbef53f013145025fbdcbc, parent/frozen main98c589e42019b4cc2c3c6aee1f6d2031e2de2441:node scripts/run-exact-tests.mjs run tests/boundary/providers/desktopZipPython.test.ts src/domain/desktop/appExport.test.ts: 36 passed across the full ZIP and export-producer suites. Four new cases were rechecked after the final test type-narrowing correction; not added to that total. The baseline filter gives 4 failed / 16 name-filtered, not platform skips.npm run build:cached: 3 successful tasks, 1 cached in the final build. Actual compiled state inspection and task export plus exact generated-helper execution pass as above; actual CLI-advertised args/options/globals validate with Ajv2020.npm run check:fast: 2 successful tasks, 0 cached. The first check caught a new raw-control fixture'sEntry/FileEntrynarrowing error; the explicit file guard corrected it without removing assertions.npm run docs:check: passed, including 9 README consistency cases.npm run verify:test-discovery: all 3,154 test files discovered exactly once. Touched formatting andgit diff --checkpass.check:fastran; the latter restored 2 matching cached results. Upstream CI for this new revision has not yet been qualified; no earlier head or sibling run is borrowed.Local source dependencies match the frozen lock, including its already-present GraphQL dependency; the shared older checkout's dependencies were not changed. This PR adds no dependency or package metadata.
Compatibility, safety, and release
Author readiness
Human owner: @wunianze666-netizen
Before merge
type(scope): outcome.