Make the gate structural, and correct what it tells an agent
CI / rust-headless (push) Successful in 6m38s
CI / rust-ui (push) Failing after 6m20s

Three gates in this repository were decorative, and each was discovered by
being wrong rather than by failing.

A crate directory in neither members nor exclude is silently not built, which
is how lumbridge-devices shipped 1,127 lines that had never compiled.
scripts/workspace-guard.sh refuses that state, and asserts the gpui source
and version out of Cargo.lock rather than the manifest, because a manifest
states an intent while the lockfile states what would actually be compiled --
and a caret requirement accepts a version nobody reviewed. It needs no
compiler, so it runs first and in the headless job, which unlike the UI job
is not continue-on-error and can therefore actually fail a push.

deny.toml's source policy had never been executed: ci.sh ran `check
licenses` alone, and `check sources` failed immediately on the rev-pinned
buzz-sdk. The permitted Git sources are now named one by one and the check
runs, so a fourth is a decision rather than an accident.

cargo-deny and cargo-nextest being absent was a warning that let a run report
green having skipped the licence gate DISTRIBUTION.md depends on. Under
LUMBRIDGE_CI_STRICT=1 a missing tool now fails; locally it stays a warning so
a contributor is not blocked.

skills/lumbridge-development/SKILL.md told every agent that GPUI and Floem
live in spikes/ and that no framework may be selected until both pass the
hard gates. Decision 0017 settled that a month ago in the opposite direction.
The entry point an agent is meant to read was the least accurate document in
the repository.

Decision 0023 records where the GPUI dependency actually goes. Published gpui
has not been released since 2025-10-22, Zed's main still declares 0.2.2 with
no bump pending, the platform backends moved to crates that inherit
publish = false, gpui's own x11 and wayland features are now empty markers,
and 0.2.2 has no accesskit dependency at all -- so "published now, migrate
later" was never available. The adapter 0017 promised was never written and
the call sites grew from few to 147 against 20 identities, so the adapter is
written first, on 0.2.2, before the dependency moves.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SPYebLiN2w4TqnHUYGdECq
This commit is contained in:
Metal Agent
2026-09-01 12:51:25 -07:00
co-authored by Claude Opus 5
parent 28e455f968
commit 9a29e8e335
7 changed files with 337 additions and 20 deletions
+80
View File
@@ -0,0 +1,80 @@
#!/usr/bin/env bash
# Structural gates that need no compiler, so they run first and finish instantly.
#
# Both of these exist because the repository has already been wrong in exactly
# these two ways, and in both cases the mistake was invisible: the build stayed
# green while the code was not being built.
#
# scripts/workspace-guard.sh
set -euo pipefail
root="$(cd "$(dirname "$0")/.." && pwd)"
cd "$root"
status=0
# ---------------------------------------------------------------------------
# 1. Every crate is a member or is explicitly excluded.
#
# A crate directory named in neither list is not a build error. Cargo simply
# never looks at it: no lints, no tests, no compilation. lumbridge-devices sat
# that way with 1,127 lines, 19 tests that had never run, and a `mod` statement
# pointing at a file that did not exist. Decision 0017 records the same failure
# a month earlier with the GPUI shell in `spikes/`. Neither was caught by a
# human reading a diff, so it is caught here instead.
members="$(sed -n '/^members = \[/,/^]/p' Cargo.toml)"
excludes="$(sed -n '/^exclude = \[/,/^]/p' Cargo.toml)"
# A single-line `exclude = [...]` does not match the range above; catch it too.
excludes="$excludes$(grep -E '^exclude = \[.*\]' Cargo.toml || true)"
while IFS= read -r manifest; do
dir="$(dirname "$manifest")"
dir="${dir#./}"
# A crate carrying its own [workspace] table is deliberately independent.
if grep -qE '^\[workspace\]' "$manifest"; then
continue
fi
if printf '%s' "$members" | grep -qF "\"$dir\""; then
continue
fi
if printf '%s' "$excludes" | grep -qF "\"$dir\""; then
continue
fi
echo "workspace-guard: $dir/Cargo.toml is in neither workspace.members nor workspace.exclude." >&2
echo " Cargo will never build it, lint it, or run its tests. See AGENTS.md." >&2
status=1
done < <(find apps crates tools -mindepth 2 -maxdepth 2 -name Cargo.toml 2>/dev/null | sort)
# ---------------------------------------------------------------------------
# 2. The GPUI dependency is the one the decision record chose.
#
# Checked against Cargo.lock rather than the manifest, because the manifest
# states an intent and the lockfile states what would actually be compiled --
# and a caret requirement in the manifest silently accepts a version nobody
# decided on. Asserted in the fast headless job so it gates every push, and not
# in the UI job, which is `continue-on-error` and therefore cannot fail one.
#
# Changing this line means writing a decision record. See AGENTS.md,
# "Dependencies that are not an agent's decision".
expected_gpui_source='registry+https://github.com/rust-lang/crates.io-index'
expected_gpui_version='0.2.2'
gpui_block="$(awk '/^name = "gpui"$/{found=1} found{print} found&&/^$/{exit}' Cargo.lock)"
if [ -z "$gpui_block" ]; then
echo "workspace-guard: no gpui package in Cargo.lock; the shell cannot build." >&2
status=1
else
actual_version="$(printf '%s' "$gpui_block" | sed -n 's/^version = "\(.*\)"$/\1/p')"
actual_source="$(printf '%s' "$gpui_block" | sed -n 's/^source = "\(.*\)"$/\1/p')"
if [ "$actual_version" != "$expected_gpui_version" ] || [ "$actual_source" != "$expected_gpui_source" ]; then
echo "workspace-guard: the gpui dependency is not the one the decision record chose." >&2
echo " expected $expected_gpui_version from $expected_gpui_source" >&2
echo " found $actual_version from $actual_source" >&2
echo " A bump is a decision record, not a commit. See AGENTS.md." >&2
status=1
fi
fi
if [ "$status" = 0 ]; then
echo "workspace-guard: crate membership and the pinned UI dependency are as recorded."
fi
exit "$status"