Skip to content

fix(desktop): recognize empty ZIP state views - #9336

Closed
wunianze666-netizen wants to merge 1 commit into
morluto:mainfrom
wunianze666-netizen:codex/recognize-empty-desktop-zip-views
Closed

wunianze666-netizen wants to merge 1 commit into
morluto:mainfrom
wunianze666-netizen:codex/recognize-empty-desktop-zip-views

Conversation

@wunianze666-netizen

@wunianze666-netizen wunianze666-netizen commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Keep empty ZIP files readable in desktop state views and exported task verifiers. The ZIP reader already supports them, but format detection calls them binary, so a task asking the user to remove every archive entry cannot be exported. This is an independently reproduced defect; no separate issue is linked.

Problem and expected behavior

The unchanged ZIP reader accepts a standard 22-byte empty ZIP as {entries: [], entry_count: 0, truncated: false}. On frozen main 2ac85788271f8650da0b46d680a41c06e197cde2, state detection and exported Python _view nevertheless return binary/no view. PKWARE APPNOTE §4.3.1 defines an EOCD-only file as an empty ZIP.

An authored capture changes one nonempty archive to this empty archive. The actual compiled state CLI reports [zip, binary]; export-desktop-application --task exits 1 with invalid_request. After this fix the same capture reports [zip, zip], exports successfully, and its exact generated reader/verifier grades seed false and final true. The nonempty seed view and source archive bytes are preserved; the exported task reports failing_on_seed: ["empty"].

Change and scope

Expose the existing ZIP signature byte patterns as canonical data, preserving the general recognizer's behavior. Desktop detection reuses that owner; generated Python byte prefixes come from the same list. Non-local signatures require at least the format's 22-byte EOCD minimum, preserving the existing six-byte truncated-header binary control. The ZIP readers still decide directory validity and existing storage support.

The generated _is_zip predicate serves both files and entries. Empty nested archives retain format zip with the existing viewless-archive refusal, without recursive reading. Existing local-header recognition, decoder limits and extraction policy remain. This is an ordinary passive-format correction; a separate maintainer scope decision is not applicable. No unmerged Zip64 locator or filename implementation is included.

Contract and boundary impact

  • Semantic owner and earliest changed stage: desktop format detection; the common ZIP signature representation also generates the Python spelling. Native entry projection and generated file/entry readers consume these facts.
  • Contribution scope fit and linked maintainer decision: existing ZIP view and explicit bundle export; not applicable.
  • CLI and MCP/tool-catalog contract: no schema or command changes. Existing zip values now represent empty archives rather than binary/no view. This verification covers the CLI operations, not a new named MCP qualification.
  • Provider, bridge, target-format, or platform compatibility: classic/Zip64 empty archives on Windows Node/Python; existing ZIP readers perform validation.
  • Evidence, artifact, provenance, or reconstruction contract: source digests/bytes and the nonempty seed view stay exact; zero entries are a complete observed view. Damaged end records retain unreadable outcomes.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): passive retained-file reads and the existing caller-selected bundle publication; no program execution or nested extraction is added.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none; owning guide/spec/plan descriptions are synchronized.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • 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: 7 new regressions covering classic/commented and both Zip64 count spellings, nested refusal, nonempty-to-empty grading and damaged/truncated records. All 7 fail on frozen production for the expected detection/verdict assertions; all 7 pass after the fix. Existing assertions are retained.
  • Base reproduction or other evidence: clean frozen-main build restored 3 matching cached tasks; candidate build completed 3 tasks with 1 cache hit and actual compilation. This is not a claim that the baseline recompiled in this run.
  • User-visible CLI/MCP output (if applicable): same actual compiled capture workflow changes export exit 1 to 0; exact generated standard-library reader/evaluator gives [false, true], with canonical task id and unchanged source bytes.
  • Remaining proof gaps: authored capture and archive fixtures, not a live GUI capture, AgentEnv import/deployment/skill loading, real application interaction or complete Windows package. Generated helpers/evaluator execute after removing framework imports and the app class; this is their scope.

For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.

For evidence-bearing changes:

  • 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

  • node scripts/run-exact-tests.mjs run tests/boundary/providers/desktopEmptyZip.test.ts src/domain/desktop/stateFormats.test.ts src/artifacts/artifactFormats.test.ts src/application/desktop/DesktopArchiveTask.test.ts — 39 passed, no skips or name filtering; includes all 7 new regressions.
  • npm run build:cached — baseline 3 successful / 3 cached; candidate 3 successful / 1 cached, actual compilation.
  • Actual compiled state inspection and task export, followed by the exact generated Python reader/verifier — corrected classification/export and seed/final outcomes above. Archive bytes unchanged.
  • Actual CLI args/options/globals Ajv2020 validation, advertisement comparison and actual state-output schema validation — passed; CLI advertisement JSON unchanged.
  • npm run check:ci:fast, npm run docs:check, npm run verify:test-discovery, git diff --check — passed; discovery checks registration rather than executing the whole corpus. Repository lint warnings remain.
  • npm run knip — passed. The frozen base includes accepted #9332, which registers the standalone verifier and repairs #9295; no unmerged repair was copied. Full local npm run check was not rerun, so its later architecture/production-Knip/typed-lint chain is not claimed verified here.

Windows, Node 24.22.1 and Python 3.11. No performance, token or process-memory improvement is claimed. CI run 42456211901, attempt 1, for current head 263b25bd34bc644600a8957f5c1a01b8d0ba49fc completed successfully (metadata read). Raw logs and the actual integration checkout were not audited; this adds no per-test or platform qualification beyond the local evidence above.

Compatibility, safety, and release

  • Breaking changes or migration steps: empty archives now get the existing ZIP view; nested empty archives get the same refusal as nonempty nested archives. No migration for valid nonempty files.
  • Real Hopper/Ghidra, browser, or OS coverage: local CLI and generated standard-library parsing only; no live provider or deployment qualification.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: existing bounded readers and output publication, with no new decoder, extraction, target execution, permission or resource setting.

Author readiness

Human owner: @wunianze666-netizen

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T06:52:28.872326Z 263b25b 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 Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

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

Summary

Empty classic and Zip64 archives now receive the existing ZIP view in desktop state inspection and exported Python.

  • Desktop views and exported task checks now recognize empty ZIP archives.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  S[Shared ZIP signatures] --> N[Native format detection]
  S --> P[Generated Python detection]
  N --> F[File or archive entry]
  P --> F
  F -->|File| R[Existing bounded ZIP reader]
  F -->|Nested archive| E[Keep format; refuse view]
  R -->|Readable| V[ZIP view, including zero entries]
  R -->|Unreadable| U[Keep error; no view]
Loading

Reviews (3) · Last reviewed commit: "fix(desktop): recognize empty ZIP state ..." · Reviewed by Greptile

@morluto

morluto commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Empty ZIP state views landed in #12157 via #12163, including host and generated verifier coverage. Thanks for the original fix.

@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