Visitar URL original
fix(cli): build without git metadata by 0xAndoroid · Pull Request #2338 · a16z/jolt · GitHub
Skip to content

fix(cli): build without git metadata - #2338

Merged
0xAndoroid merged 1 commit into
mainfrom
fix-cli-build-without-git
Nov 6, 2026
Merged

0xAndoroid merged 1 commit into
mainfrom
fix-cli-build-without-git

Conversation

@0xAndoroid

@0xAndoroid 0xAndoroid commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The jolt command-line tool now builds from a source tree that has no usable git repository, such as a git archive export or a worktree mounted into a container. In such a tree, jolt --version prints unknown in place of the commit hash and date.

Before this change, cargo install --path . --locked failed in such a tree with:

src/main.rs:109:9: error: environment variable `GIT_SHORT_HASH` not defined at compile time
src/main.rs:111:9: error: environment variable `GIT_DATE` not defined at compile time

The cause is a mismatch between the build script and the binary. src/main.rs builds its version string with env!("GIT_SHORT_HASH") and env!("GIT_DATE"), so both variables must be set at compile time. The build script build.rs sets them from git log -1, but it returned without setting anything when .git was missing or git log failed. A worktree mounted into a container hits the second case: its .git is a file that points to a directory outside the mount, so git log fails.

Changes

  • build.rs falls back to the value unknown for the short hash and the date when it cannot read commit information, and emits both variables through one code path. A field added to the commit information later must be given a fallback value, or the build script fails to compile.
  • build.rs no longer reads the full commit hash or emits GIT_HASH. No code in the repository reads that variable.

src/main.rs is unchanged.

Testing

These checks ran on Linux with Rust 1.95.0:

  • A git archive export of main at 3942fe6 fails to build with the error above.
  • A git archive export of this branch builds, and jolt --version prints jolt 0.1.0 (unknown unknown). The same holds when .git is a file pointing to a missing directory.
  • In a normal checkout, jolt --version prints the same bytes before and after the change at the same commit, for example jolt 0.1.0 (3942fe614 2026-11-06).
  • The reviewer compiled this branch's build.rs and ran it in a normal checkout and in four cases without usable git information: no .git, a .git file pointing to a missing directory, a repository with no commits, and git missing from PATH. The normal checkout emitted the commit's short hash and date; the four other cases emitted unknown.
  • cargo clippy -p jolt --all-targets -- -D warnings passes with --features host and with --features host,zk, and cargo fmt --check passes.

No automated test is added. The repository's test policy does not require one for a low-impact build fix, and the compiler already forces the fallback to supply every field of the commit information. The manual checks above exercise each path that reaches the fallback.

Security Considerations

None. The change affects only the version string of the command-line tool. It does not touch the prover, the verifier, proofs or guest programs.

Breaking Changes

None. Cargo set GIT_HASH only while compiling the jolt package's own crates, and none of them read it.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

📏 PR diff

Note

Actual code changed: 12 lines

🟢 +5 added    🔴 −7 removed

Tests, docs, fixtures, and helper scripts excluded.

Category 🟢 Added 🔴 Removed
⌨️ Actual code +5 −7
🧪 Tests 0 0
📚 Docs 0 0
📦 Fixtures 0 0
🔧 Helper scripts 0 0
Total diff +5 −7

Every changed line is classified once.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Verifier classifier: risk-2

Head 48a5ccbaf4cd141c6ef690c176a46df5226e64a6

The sole change affects build-time Git metadata. In both revisions, its only consumers are the CLI version string, not verifier acceptance.

Risk: risk-2

  • build.rs: risk-2 — Removes unused GIT_HASH metadata and supplies unknown short-hash/date defaults when Git information is unavailable. This changes CLI build/version behavior but cannot reach proof verification.

gpt-6.1-sol, reasoning effort xhigh

@0xandoroid-ai-agent

Copy link
Copy Markdown

This pull request #2338 has been reviewed at commit 48a5ccb using skill reviewer and model Claude Opus 5.5 with xhigh reasoning effort, and no issues were found.

@github-actions github-actions Bot added merge-eligible AI merge gate review policy satisfied for the current head risk-2 Prover or other non-verifier code; dependency bumps outside the verifier closure labels Nov 6, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AI merge gate approves 48a5ccbaf4cd141c6ef690c176a46df5226e64a6. Review attested by 0xandoroid-ai-agent: An authorized comment attests a clean review of the current head 48a5ccbaf4cd141c6ef690c176a46df5226e64a6, so the gate approves it.

@0xAndoroid 0xAndoroid added the pika-keep-healed Pika auto-heals this PR: merges main on conflict, fixes failing CI (never force-pushes) label Nov 6, 2026
@0xAndoroid
0xAndoroid merged commit 46ef0e6 into main Nov 6, 2026
49 checks passed
@github-actions github-actions Bot removed the merge-eligible AI merge gate review policy satisfied for the current head label Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pika-keep-healed Pika auto-heals this PR: merges main on conflict, fixes failing CI (never force-pushes) risk-2 Prover or other non-verifier code; dependency bumps outside the verifier closure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant