Skip to content

Keep live zero-byte objects during input pack collection - #686

Draft
ConnorBaker wants to merge 1 commit into
numtide:mainfrom
ConnorBaker:fix/retain-live-empty-input-objects
Draft

ConnorBaker wants to merge 1 commit into
numtide:mainfrom
ConnorBaker:fix/retain-live-empty-input-objects

Conversation

@ConnorBaker

Copy link
Copy Markdown
Collaborator

A local hash-pinned tarball containing one empty regular file exposed a mismatch on 0bf30820d. Before collection, an ordinary iets eval of builtins.hashFile "sha256" (input + "/empty") and a fresh --no-tracing-cache evaluation both returned SHA-256(empty). After iets cache gc --ttl 30, the warm command returned the same hash while the fresh process failed with “an object of this input is missing from the input store”. Both live tree indices survived. On a fresh input store the automatic sweep after the first fetch can also trigger this failure.

The collector summed live payload bytes to decide whether a pack held any live object. A zero-byte object contributes zero to that sum. Keep track of object membership separately and continue using payload sizes to decide when a partially live pack is worth compacting.

A previous sweep can have removed the final copy of the empty object. Collection can reconstruct it when a live index names the precise BLAKE3 ID of empty bytes and a complete, well-formed pack listing establishes its absence. Dry runs, incomplete listings, and listings with a malformed pack skip recovery. All ordinary read paths, including operational errors reported by #643, retain their existing behavior.

The tests cover a mixed pack whose only survivor is empty, the resulting all-live zero-byte pack, recovery with an unrelated missing ID, and public warm and fresh evaluations across GC. Independent process checks exercised real permission denial, an injected EIO during pack index reads, a malformed pack and recovery of a store produced by the old binary. The fix acts during collection, with no added work on a normal trace hit.

AI assistance: OpenAI Codex.

On the fix, fresh native and warm evaluation both returned the empty-file digest before and after the same managed collection. The input-store and pack unit suites passed 28 tests. The public fetchurl and cache hygiene suites passed all 16 tests.

@coderabbitai

coderabbitai Bot commented Nov 28, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant