apollo_infra_utils: resolve cargo_manifest_dir at runtime#14524
apollo_infra_utils: resolve cargo_manifest_dir at runtime#14524Yoni-Starkware wants to merge 1 commit into
Conversation
PR SummaryHigh Risk Overview Starknet OS & client-side proving are the main protocol shift: new OS / virtual OS / aggregator program hashes, PROOF1-only proof facts (drops PROOF0), a single allowed virtual OS program hash, StarknetOsConfig4 with Blake2s config and public-keys hashing (no Pedersen on those paths), and versioned constants / gateway max Sierra 1.9 plus SHA512 libfunc gating. Fixtures, allowed libfuncs, and integration proof expectations are updated accordingly. Consensus & batching: fixes inverted round ordering in Infra & tooling: CI: hybrid system test pins k3d v5.5.0, waits on local-path-provisioner deployment rollout, quotes trigger script args; cdk8s workflow runs port uniqueness pytest and a job that synths production overlays (mainnet / sepolia). Reviewed by Cursor Bugbot for commit b33523d. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Artifacts upload workflows: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cb6427c. Configure here.
`env!("CARGO_MANIFEST_DIR")` is baked in at compile time. With a shared `rustc-wrapper` cache
(sccache, default shared cache dir), an object compiled in one checkout is served to another, so in
a git worktree the macro returns a *different* checkout's path — making `expect_file!`/fixture
regeneration write to the wrong repository (a recurring footgun when regenerating fixtures from a
worktree).
Resolve `CARGO_MANIFEST_DIR` at runtime (Cargo and nextest set it for the test/build process),
falling back to the compile-time `env!` value when absent (e.g. binaries run outside Cargo, where
behavior is unchanged). Renamed `compile_time_cargo_manifest_dir!` → `cargo_manifest_dir!` since it
no longer resolves at compile time.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
cb6427c to
b33523d
Compare

Problem
compile_time_cargo_manifest_dir!()expands toenv!("CARGO_MANIFEST_DIR"), whichrustcbakes in at compile time. With a sharedrustc-wrappercache (sccache, default shared~/.cache/sccache), an object compiled in one checkout can be served to another. In a git worktree this makes the macro return a different checkout's manifest dir, soexpect_file!/ fixture-regeneration paths (program_hash.json, hint_coverage, cendepreconfirmed_block, …) read/write the wrong repository — the test passes locally against the wrong copy and the worktree's committed fixtures stay stale (then fail CI).This is a recurring footgun when regenerating fixtures from a worktree.
Fix
Resolve
CARGO_MANIFEST_DIRat runtime — Cargo and nextest set it in the test/build process environment, so it reflects the checkout that's actually executing — with a compile-timeenv!fallback for execution outside Cargo (e.g. deployed binaries; behavior there is unchanged).Renamed
compile_time_cargo_manifest_dir!→cargo_manifest_dir!since it no longer resolves at compile time. Pure mechanical rename across the 11 call sites; one array site incontracts.rsadjusted for theStringreturn type.Verification
cargo test -p apollo_infra_utilspasses (path_test exercises the runtime resolution). CI verifies the full build across the call sites.🤖 Generated with Claude Code