1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
# Canonical pre-push gate. Two gates, and they answer different questions:
#
# internal deps does every in-house `version` requirement in the tree still
# resolve against the crate it names? Runs in EVERY repo.
# test targets do this repo's test targets build? Runs where there is a
# root Cargo.toml to run one command in.
#
# DO NOT EDIT IN PLACE. The master is _private/infra/bootstrap/githooks/pre-push.
#
# Bypass for a work-in-progress push: git push --no-verify
#
# WHY THE FIRST GATE EXISTS. Every cross-repo dependency carries a `version`
# alongside its `git` URL, so cargo refuses a sibling it was not written against
# instead of compiling something surprising. That requirement is the protection
# and it is also the maintenance: bumping a library's minor breaks every consumer
# whose requirement excludes it, and CLAUDE.md's rule is that the bump and the
# forward fix are one pass. Nothing enforced the rule, so quasi went 0.11 -> 0.14
# over two evenings and MNW's server could not resolve at all for a day. The
# nightly sweep found it and a red cell in a grid is not the same as being told.
#
# This gate is that rule, mechanised, at the moment it is broken: the push that
# would leave a consumer unable to build is the push that is refused. It reads
# the WORKING COPIES in the tree, not the remotes, because `~/Code/.cargo/config.toml`
# redirects every one of these dependencies to the working copy -- so a local bump
# breaks a consumer's build here whether or not it has been pushed anywhere.
#
# `cargo check` and `cargo clippy` both compile only the lib and bin targets, so a
# break confined to `tests/` or a `#[cfg(test)]` module is clean under both and
# lands unnoticed (goingson's sqlx 0.9 upgrade shipped exactly that way).
# `--no-run` builds every test target without running them, which is the cheap
# half of the suite and enough to catch a compile break. Tests still run
# separately.
#
# `--workspace` is load-bearing wherever default-members is narrower than the
# workspace: goingson's is src-tauri alone, so a bare `cargo test --no-run` would
# skip core, db-sqlite, go-mcp and got.
ROOT=""
# See the canonical pre-commit: a hook run from an editor or a cron job does not
# get the profile's PATH, and a hook that cannot find cargo is worse than none.
# Refs arrive on stdin as "<local ref> <local sha> <remote ref> <remote sha>".
# A branch deletion has an all-zero local sha and no tree to push. Read once,
# ahead of both gates: stdin is not seekable and a second reader gets nothing.
pushing=0
while ; do
done
[ ||
# ── gate 1: internal dependency coherence ──────────────────────────────────
#
# Deliberately no cargo: this reads manifests and answers in well under a second,
# where `cargo metadata` on the server is tens of seconds and fails outright on
# exactly the state being detected.
CODE_ROOT=""
if [ && ; then
if ! ; then
fi
fi
# ── gate 2: test targets build ─────────────────────────────────────────────
#
# MNW and synckit have no root Cargo.toml by design (standalone crates, no root
# workspace), so there is no one command to run and they get gate 1 only.
[ ||
if ! ; then
fi