Fix bunny-api-spec=unknown in --version after iter-32 crate move#38
Conversation
After iter-32 moved the binary into crates/hoppy-cli/, build.rs was still looking for ./specs relative to the package directory, but specs/ lives at the workspace root. The spec-date lookup silently failed and hoppy --version reported "bunny-api-spec=unknown". Resolve specs/ via CARGO_MANIFEST_DIR/../../specs so the lookup works regardless of the cwd cargo was invoked from. Verified locally: hoppy 0.3.0 (sha=5de03da, bunny-api-spec=2026-05-05) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
Fixes a regression in hoppy --version where the embedded bunny API spec date became unknown after the CLI crate moved under crates/hoppy-cli/, by resolving the specs/ directory relative to CARGO_MANIFEST_DIR (workspace-root-relative).
Changes:
- Resolve
specs/via a workspace-relative path derived fromCARGO_MANIFEST_DIR. - Update the build script to pass the computed specs path into
newest_spec_mtime(). - Only emit
cargo:rerun-if-changedforspecs/when the directory exists (avoids missing-input issues in tarball/crates.io builds).
| // Re-run when HEAD moves (only emit when the file actually exists, so | ||
| // crates.io / tarball builds don't trip "missing rerun-if-changed input"). | ||
| if Path::new(".git/HEAD").exists() { | ||
| println!("cargo:rerun-if-changed=.git/HEAD"); | ||
| } |
Summary
Iter-32 moved the binary into
crates/hoppy-cli/butbuild.rswas stillresolving
specs/relative to the package directory.specs/lives atthe workspace root, so the lookup silently fell back to
unknownandhoppy --versionregressed to:```
hoppy 0.3.0 (sha=5de03da, bunny-api-spec=unknown)
```
Fix: resolve the specs directory via `CARGO_MANIFEST_DIR/../../specs`
so it works regardless of the cwd cargo was invoked from. Verified:
```
hoppy 0.3.0 (sha=5de03da, bunny-api-spec=2026-05-05)
```
Test plan
🤖 Generated with Claude Code