build: refuse to package from a branch that is behind main
Everyone branches off main and builds from their own branch. A branch that is behind main still builds and installs perfectly — it just packages a binary missing whatever landed on main meanwhile, and `rpm -U --force` overwrites the good one with it. Nothing reports an error; the release succeeds and the feature simply vanishes from the installed CLI. That is what happened today: a build from a stale checkout replaced /usr/bin/mcpctl with one that has no `statusline` command at all, months after the status line landed on main (`mcpctl statusline` -> "unknown command"). `check-main-sync.sh` fetches main, compares, and fails before any work happens, listing the commits the branch is missing and the merge that fixes it. Sourced by build-rpm.sh and build-deb.sh — both are run standalone, so neither can rely on the other having checked. A hard failure rather than a warning: a warning scrolls past in a build log, and the whole point is to stop before the artifact exists. MCPCTL_ALLOW_BEHIND_MAIN=1 is the escape hatch for a deliberate old-tree build; MCPCTL_BASE_BRANCH retargets the comparison. Offline it degrades to the last fetched origin/main, then a local main, saying which it used; outside a git checkout it skips. Verified: passes on this branch (up to date with main); against a synthetic ref one commit ahead, build-rpm.sh aborts with exit 1 before ensure_build_deps and before any compilation; the escape hatch bypasses it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019wUmrfkVQR6CKcYKxENq7k
This commit is contained in:
@@ -884,6 +884,24 @@ All pushed to `mysources.co.uk/michal/` registry.
|
||||
source .env && bash scripts/release.sh
|
||||
```
|
||||
|
||||
**The build refuses to run from a branch that is behind `main`.** Everyone
|
||||
branches off main, so a stale branch still builds and installs cleanly — it just
|
||||
ships a binary missing whatever landed on main meanwhile, and `rpm -U --force`
|
||||
overwrites the good one with it. That happened on 2026-08-10: a build from a
|
||||
stale checkout replaced `/usr/bin/mcpctl` with one that had no `statusline`
|
||||
command, months after the status line landed. `scripts/check-main-sync.sh`
|
||||
(sourced by `build-rpm.sh` and `build-deb.sh`) fetches `main`, compares, and
|
||||
fails before any work happens, listing the commits you are missing.
|
||||
|
||||
```bash
|
||||
git merge main # the fix
|
||||
MCPCTL_ALLOW_BEHIND_MAIN=1 bash scripts/release.sh # deliberate old-tree build
|
||||
MCPCTL_BASE_BRANCH=release-2.x bash scripts/build-rpm.sh # compare to another branch
|
||||
```
|
||||
|
||||
Offline it falls back to the last fetched `origin/main`, then to a local `main`,
|
||||
and says which it used; outside a git checkout it skips entirely.
|
||||
|
||||
Installs via nfpm:
|
||||
- `/usr/bin/mcpctl` — CLI binary (bun compiled)
|
||||
- `/usr/bin/mcpctl-local` — Local proxy binary (bun compiled)
|
||||
|
||||
Reference in New Issue
Block a user