Artifact 5448d9a7371cac2f9e956cf60de64968a375df2fbb8cbcd740549957d5fb6bab:
- File
tools/gate.sh
— part of check-in
[1ed63201f4]
at
2026-11-18 03:02:04
on branch trunk
— suit curate apply turns the page's choices into config changes
suit curate apply FILE reads the choices file the curation page makes and prints a plan: which outfits and wears it edits, which wardrobes it checks in and in what order, and the links that will appear and disappear at each scope. Without --yes nothing changes. With --yes it edits each wardrobe's suit.conf and checks it in, with a comment such as "Curate: 3 kept, 1 limited, 12 retired". It does not place anything; the next run sees the config changed and applies.
- keep leaves a worn asset as it is. A loose asset, or one coming back from the attic, goes to the outfit kept.WARDROBE, worn at user scope. - limit moves the asset from its user outfits to personal.WARDROBE.SLUG, worn by [wear personal PROJECT], created or reused wherever it is. - retire removes the asset from every outfit of its wardrobe and adds it to attic.WARDROBE, which nothing wears. Apply refuses if a wear reaches an attic. - Removing one name from an outfit that lists `*` turns the `*` into an explicit list of the names it reached, minus that one, and the plan says so: names added to the store later are then not included by that outfit. No exclusion syntax was added.
Outfit names carry the wardrobe because outfit names are one set across wardrobes; a name too long for that is refused for its line. A wardrobe that defines a new outfit is checked in before any wardrobe whose wear names it, so a failure part-way leaves only an outfit nothing wears; a run that would need the opposite order is refused before anything changes.
Configs are edited as text: only the lines that must change are rewritten, and comments, blank lines, alignment, line endings and the order of everything else are kept. Every edited config must parse and the combined set must pass the merge check before anything is written. A wardrobe with local changes is refused, so the check-in holds the curation only. A failed check-in puts that wardrobe's file back.
A malformed line, a duplicate, a bad header or a path given as a project refuses the whole file, listing every problem. An unknown asset is warned about and skipped; a choice already true is silent.
A new suite, test/curate_apply.sh, with 376 cases, is part of the gate, and a new fuzz target covers the choices parser and the line editor.
3669 unit checks (was 2993), 625 shell cases, 1153 store cases, 985 placement cases, 378 project cases, 236 usage cases, 288 curate cases and 376 curate-apply cases, under clang, under gcc 16, with no user name set, and under a strict umask, in one run of make gate (44 minutes). 100% coverage in all 32 source files. No existing case was changed. (user: dmestas, size: 1757) [annotate] [blame] [check-ins using]
#!/bin/sh # The whole local gate, one run after another, stopping at the first failure: # rm -rf build/dev; make check CC=gcc-16 -> build/check-gcc.log # rm -rf build/dev; make all -> build/all.log # env -u USER -u LOGNAME make check -> build/check-nouser.log # (umask 027; make check) -> build/check-umask.log # The last two reuse the dev build that `make all` just made: same compiler, # same flags, so make finds nothing to rebuild. Then, for each run that # started, its exit status, its seconds and its summary lines. # usage: gate.sh (env: GATE_GCC, the second compiler; default gcc-16) set -u gcc=${GATE_GCC:-gcc-16} if ! command -v "$gcc" >/dev/null 2>&1; then echo "gate: $gcc is not installed; the first run needs it" >&2 exit 1 fi mkdir -p build done_runs= report() { for n in $done_runs; do printf '%s: exit %s, %ss\n' "$n" "$(cat "build/$n.rc")" "$(cat "build/$n.sec")" grep -E '^(unit: [0-9]+ checks|[a-z_]+\.sh: [0-9]+ cases), [0-9]+ failed$' "build/$n.log" | head -8 grep '^skip ' "build/$n.log" | sort -u | head -5 done } # run NAME COMMAND...: output to build/NAME.log, status to build/NAME.rc run() { n=$1; shift echo "gate: $n" start=$(date +%s) "$@" >"build/$n.log" 2>&1 echo $? >"build/$n.rc" echo $(($(date +%s) - start)) >"build/$n.sec" done_runs="$done_runs $n" [ "$(cat "build/$n.rc")" = 0 ] } run check-gcc sh -c "rm -rf build/dev; make check CC=$gcc" && run all sh -c 'rm -rf build/dev; make all' && run check-nouser env -u USER -u LOGNAME make check && run check-umask sh -c 'umask 027; make check' rc=$? report [ $rc = 0 ] && echo "gate: passed" || echo "gate: FAILED" >&2 exit $rc