[build] strip dependency debug info, add clean-stale, fix pre-push hook path bugs - #538
Merged
Conversation
…tale Add [profile.dev]/[profile.test] package."*" overrides (opt-level = 2, debug = 0) so third-party dependencies build without full debug symbols while workspace crates keep line-table debug info — this is the single biggest lever on target/ size in a workspace this large. Add `cargo xtask clean-stale [--dry-run] [--max-age-days N]`, wired into scripts/check-guardrails.sh and scripts/pre-push.sh, to prune stale target/*/incremental/ sessions. Scoped to incremental/ only: cargo bumps a dependency artifact's mtime solely when it recompiles it, so age-pruning deps/ or build/ would evict rarely-rebuilt but still-valid caches and force pointless relinks on the next build — incremental/ is the one directory where "old" reliably means "safe to discard."
…etic Both hook scripts computed PROJECT_ROOT as dirname(BASH_SOURCE)/.. — correct only when run as scripts/*.sh (one level under the repo root). Copied to .git/hooks/pre-push per AGENTS.md's own documented install instructions, dirname resolves to .git/hooks, so ".." lands on .git itself, and every git command the hook runs (starting with `git status --porcelain`) fails with "fatal: this operation must be run in a work tree" — silently disabling the guard for anyone who installs it as documented.
git invokes .git/hooks/pre-push as <hook> <remote-name> <remote-url>, with ref updates on stdin. The arg parser only recognized --phase/--allow-dirty and hard-errored on anything else, so a real `git push` failed immediately with "Unknown argument: origin" — the hook never got past its own CLI parsing to run a single check.
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
[profile.dev]/[profile.test]package."*"overrides (opt-level = 2, debug = 0) to strip dependency debug symbols while keeping line-table debug info for workspace crates — the single biggest lever ontarget/size in a workspace this large.cargo xtask clean-stale [--dry-run] [--max-age-days N], wired intoscripts/check-guardrails.shandscripts/pre-push.sh. Scoped totarget/*/incremental/only: cargo only bumps a dependency artifact's mtime when it recompiles it, so age-pruningdeps//build/would evict rarely-rebuilt but still-valid caches and force pointless relinks —incremental/is the one directory where "old" reliably means "safe to discard."cp scripts/check-guardrails.sh .git/hooks/pre-push):PROJECT_ROOTwas computed viadirname(BASH_SOURCE)/.., correct only when run asscripts/*.sh; copied to.git/hooks/pre-pushit resolved to.gitinstead of the repo root, so every git command in the hook failed with "fatal: this operation must be run in a work tree." Fixed viagit rev-parse --show-toplevel.pre-pushwith positional<remote-name> <remote-url>— so a realgit pushfailed immediately with "Unknown argument: origin" before running a single check.Test plan
cargo fmt --all -- --checkcargo clippy --all-targets --workspace— 0 warningscargo nextest run -p ahma_common -p ahma_mcp— 3356/3356 passedcargo nextest run --workspace --run-ignored all— 4691/4691 passedcargo deny check(full, not just advisories, per AGENTS.md — Cargo.toml touched) — advisories/bans/licenses/sources all ok.git/hooks/pre-pushand ran a realgit pushend-to-end to confirm both bugs are actually fixed, not just theoretically