Repository navigation
fix(import): calibrate the cost estimate so it stays an upper bound - #33
Merged
Merged
Conversation
The Mirror Action's first run paid 0.0781 DASH against a 0.0649 estimate. Per-write traces from clean imports (an identity nothing else was using) show the underestimate was in the index overhead of issues and PRs (measured 58-92M credits, charged 45M) and of git documents (55M charged for about 60-65M). Labels and reviews were over-charged. The CI run's extra gap came from another writer on the shared OWNER identity, visible as nonce collisions in its log. Collab documents now carry a per-kind overhead (issue/PR and release 90M, comment 52M, review and event 45M, label 35M). Git documents use 68M times the document count the helper reports (chunks, manifests and ref updates, including the browse index's chunks). A fresh traced import estimates 9.4% over its balance drop, the git part 1.5% over. RUST_LOG=forge_import::cost=debug logs each write's estimate against its measured balance drop, for recalibration. A regression test checks the estimate against the recorded run: 0-10% over in total, and for the collab and git parts separately. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Warning Review limit reachedNext included review available in 50 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR recalibrates forge-import's cost estimate so it is an upper bound again.
--max-spendand the confirmation prompt both rely on that.The Mirror Action's first live run (#31, run 36272329428) paid 0.0781 DASH against a 0.0649 estimate, so the estimate was 20% under.
Cause. I traced every write's estimate against its measured balance drop, using
RUST_LOG=forge_import::cost=debug(added here) and an identity nothing else was using:On a clean run the old figures balanced out to roughly 1.0 over the whole import, so they were not an upper bound. The CI run's larger gap also included another writer on the shared OWNER identity: its log shows nonce collisions ("another write by this identity took the nonce"), so its balance drop was not only the import's.
Fix.
CollabDocgives each document kind its own index overhead: issue/PR and release 90M, comment 52M, review and event 45M, label 35M.platformevent: chunks, manifests and ref updates, including the browse index's chunks). Before, the count was guessed from pack bytes and missed the index chunks.forge_import::costdebug logs each write's estimate and measured cost, so this can be recalibrated.Regression test.
budget::tests::estimates_cover_a_recorded_runholds the 35 recorded writes of a clean dash-faucet import: each collab write's kind, bytes and measured cost, and each push's helper price, document count and measured cost. It requires the estimate to be 0–10% over what was paid, for the whole run and for the collab and git parts separately.Verification
PastaPastaPasta/dash-fauceton moutai with the calibrated build estimated 0.068004 DASH and measured a 0.062419 DASH balance drop: 9.4% over (git part 1.5% over, after the final 66M → 68M bump).backports-validation-script1.09.cargo fmt --check,cargo clippy --workspace --all-targets -D warningsandcargo test --workspacepass.Gaps
🤖 Generated with Claude Code