aien-architecture-mv
Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.
Brought by drakestapleton
aien-architecture-mv / scripts / pipeline-proofs / 15-stale-ancestors.sh
| 1 | #!/usr/bin/env bash |
| 2 | # 15: one directory change marks exactly the right crumbs STALE: the changed directory's nearest crumb, |
| 3 | # every ancestor directory that holds a crumb, and the root (RFC-0003 section 3). Checked with `crumb status`. |
| 4 | here="$(cd "$(dirname "$0")" && pwd)"; . "$here/lib.sh" |
| 5 | proof_begin 15 "one change stales the directory, its crumbed ancestors and the root, nothing else" "${1:-}" |
| 6 | clone_repo "$TMP/a"; cd "$TMP/a" || exit 1 |
| 7 | L=$(leaf_crumb_dir .) || { echo "no leaf crumb directory with a tracked file" >&2; exit 1; } |
| 8 | F=$(tracked_file_in . "$L"); num "changed_file=$F" |
| 9 | check_eq "clone starts CURRENT" "$(stale_set .)" "" |
| 10 | printf '\n# proof 15 touch\n' >> "$F"; git add -- "$F" # D2: tracked working-tree content, staged |
| 11 | WANT=$(ancestors_with_crumbs . "$L") |
| 12 | measure status $CRUMB status . |
| 13 | GOT=$(stale_set .) |
| 14 | check_eq "STALE set is exactly the changed dir + crumbed ancestors + root" "$GOT" "$WANT" |
| 15 | num "stale=$(echo "$GOT" | wc -w)"; num "total=$(crumb_dirs . | wc -l)" |
| 16 | measure verify_stale $CRUMB verify .; check "verify exits 1 while stale" [ "$RC" -eq 1 ] |
| 17 | measure compile $CRUMB compile . |
| 18 | check_eq "compile rewrote exactly the stale set" "$(echo "$OUT" | awk '$1=="COMPILED"{print $2}' | sort | tr '\n' ' ' | sed 's/ $//')" "$WANT" |
| 19 | check_eq "nothing stale after compile" "$(stale_set .)" "" |
| 20 | proof_end |