Files
Pavlo RatushnyiandClaude Sonnet 5.5 4ca30c9e1c ci: build and test what ships (check-local --product, Product workflow, coverage gate) and repair the red checks
The existing workflows never built the `leleka` binary (crates/deploy) or ran the tests of leleka-deploy, leleka-memory,
leleka-runtime-client, leleka-runtime or leleka-cuda-driver (docs/ci-audit.md). New: scripts/check-local.sh --product and
.github/workflows/product.yml (default-member build, release build of the six shipped binaries, cargo check of the CUDA-feature
crates, tests, rustfmt/Clippy), scripts/check-ci-coverage.py + scripts/ci-coverage.json (fail when a workspace member has no CI
coverage entry), scripts/ci/nvidia-smi (hermetic stand-in for the deploy end-to-end tests).

Repairs found by running every step: check-local --fast failed on rustfmt in leleka-backend-api/leleka-context and on Clippy
type_complexity in leleka-tokenizer (formatting and a local type alias only); `cargo test -p leleka-cuda-driver` does not compile without
its cuda-driver feature (script now passes it); the desktop.yml hardware smoke step had no --bin (six binaries, no default-run);
the stale 8192 context assertion in crates/deploy/tests/e2e.rs (the laptop profile is 262144 since 621d35276); five trivial Clippy
lints in leleka-memory and leleka-deploy; the literal_port drift guard (red since the 2026-10-25 upstream sync) is reported as debt;
control-plane Clippy no longer lints its path dependencies; the sampler host-shim script works under Git Bash; worktree.sh creates
worktrees with core.autocrlf=false and .gitattributes marks the sealed PTX -text (a CRLF checkout makes the binary refuse to start).
No kernel, engine numeric or runtime behaviour is changed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 23:32:24 +01:00

57 lines
2.5 KiB
Bash

#!/usr/bin/env bash
# Git worktrees of this repository live inside the main repository's .git directory (.git/wt/<name>), so ~/work stays one folder per project.
#
# scripts/dev/worktree.sh new <name> [<branch> [<start-point>]] create .git/wt/<name> on a new or existing branch
# scripts/dev/worktree.sh list every worktree with its state: dirty / merged into <base>
# scripts/dev/worktree.sh clean [--base <branch>] [--yes] remove the worktrees that are clean and merged into <base>
#
# `clean` never deletes work: a worktree with uncommitted changes is skipped, and removing one only deletes its directory, never its branch.
# Build outputs (target/) inside a removed worktree go with it; they are regenerable.
set -euo pipefail
main=$(cd "$(git rev-parse --git-common-dir)/.." && pwd)
wt_root="$main/.git/wt"
base=claude/port-gpu-bringup
cmd=${1:-list}
shift || true
case "$cmd" in
new)
name=${1:?usage: worktree.sh new <name> [<branch> [<start-point>]]}
branch=${2:-claude/$name}
start=${3:-HEAD}
mkdir -p "$wt_root"
if git show-ref --verify --quiet "refs/heads/$branch"; then
git -c core.autocrlf=false worktree add "$wt_root/$name" "$branch"
else
# core.autocrlf=false: with a global autocrlf=true (Windows Git) the checkout would turn the sealed PTX and the scripts into CRLF
git -c core.autocrlf=false worktree add -b "$branch" "$wt_root/$name" "$start"
fi
echo "worktree: $wt_root/$name ($branch)"
;;
list | clean)
yes=0
while [ $# -gt 0 ]; do
case "$1" in
--base) base=$2; shift 2 ;;
--yes) yes=1; shift ;;
*) echo "unknown argument: $1" >&2; exit 2 ;;
esac
done
git worktree list --porcelain | awk '/^worktree /{n++; w=$2} n>1 && /^branch /{print w" "$2} n>1 && /^detached/{print w" DETACHED"}' | while read -r w b; do
dirty=$(git -C "$w" status --porcelain 2>/dev/null | grep -vc '^$' || true)
if [ "$b" = DETACHED ]; then merged=detached; else git merge-base --is-ancestor "${b#refs/heads/}" "$base" 2>/dev/null && merged=merged || merged=unmerged; fi
echo "$w ${b#refs/heads/} dirty=$dirty $merged"
if [ "$cmd" = clean ] && [ "$dirty" = 0 ] && { [ "$merged" = merged ] || [ "$merged" = detached ]; }; then
if [ "$yes" = 1 ]; then git worktree remove "$w" && echo " removed"; else echo " would remove (pass --yes)"; fi
fi
done
git worktree prune
;;
*)
echo "usage: worktree.sh new|list|clean" >&2
exit 2
;;
esac