Skip to content

fix: make package archives deterministic - #4

Merged
sabraman merged 1 commit into
mainfrom
codex/deterministic-archives
May 15, 2026
Merged

fix: make package archives deterministic#4
sabraman merged 1 commit into
mainfrom
codex/deterministic-archives

Conversation

@sabraman

@sabraman sabraman commented May 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes SDK-built package archives deterministic by writing stable zip timestamps and file attributes. This keeps package SHA-256 values stable when the same package contents are rebuilt.

Validation

  • Built Dark Mode twice into separate temporary directories
  • Confirmed both archive SHA-256 values match
  • Validated all example manifests with the publish profile

Summary by CodeRabbit

  • Chores
    • Updated package build process to generate archives with deterministic and consistent metadata timestamps and file attributes.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

tools/build_package.py now uses the stat module and a ZIP_EPOCH constant to ensure deterministic zip archive metadata. File writing switches from archive.write() to manually constructing ZipInfo objects with fixed timestamps, ZIP_DEFLATED compression, and permissions extracted from source file modes.

Changes

Deterministic Zip Package Metadata

Layer / File(s) Summary
Archive configuration with deterministic timestamp
tools/build_package.py
stat module imported and ZIP_EPOCH constant defined to standardize archive entry timestamps.
Deterministic archive entry writing
tools/build_package.py
Archive entry creation replaces archive.write(path, rel) with ZipInfo construction that explicitly sets ZIP_EPOCH timestamp, ZIP_DEFLATED compression, and external_attr from source file permissions before writing via writestr().

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A timestamp trapped in time so true,
No more chaos when zip files renew.
Fixed epochs and deflated care—
Build. Rebuild. Results compare!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: make package archives deterministic' directly and concisely describes the main change: ensuring that package archives have stable, reproducible properties across rebuilds.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/deterministic-archives

Comment @coderabbitai help to get the list of available commands and usage tips.

@sabraman
sabraman merged commit 0fe63ed into main May 15, 2026
1 of 2 checks passed
@sabraman
sabraman deleted the codex/deterministic-archives branch May 15, 2026 23:00
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