interplane.Get Omega
Read in your language

aien-architecture-mv

Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.

Brought by drakestapleton

branch main Branches Tags History

aien-architecture-mv / scripts / pipeline-proofs / 15-stale-ancestors.sh

20 lines · 1321 bytes Raw Blame History
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`.
4here="$(cd "$(dirname "$0")" && pwd)"; . "$here/lib.sh"
5proof_begin 15 "one change stales the directory, its crumbed ancestors and the root, nothing else" "${1:-}"
6clone_repo "$TMP/a"; cd "$TMP/a" || exit 1
7L=$(leaf_crumb_dir .) || { echo "no leaf crumb directory with a tracked file" >&2; exit 1; }
8F=$(tracked_file_in . "$L"); num "changed_file=$F"
9check_eq "clone starts CURRENT" "$(stale_set .)" ""
10printf '\n# proof 15 touch\n' >> "$F"; git add -- "$F" # D2: tracked working-tree content, staged
11WANT=$(ancestors_with_crumbs . "$L")
12measure status $CRUMB status .
13GOT=$(stale_set .)
14check_eq "STALE set is exactly the changed dir + crumbed ancestors + root" "$GOT" "$WANT"
15num "stale=$(echo "$GOT" | wc -w)"; num "total=$(crumb_dirs . | wc -l)"
16measure verify_stale $CRUMB verify .; check "verify exits 1 while stale" [ "$RC" -eq 1 ]
17measure compile $CRUMB compile .
18check_eq "compile rewrote exactly the stale set" "$(echo "$OUT" | awk '$1=="COMPILED"{print $2}' | sort | tr '\n' ' ' | sed 's/ $//')" "$WANT"
19check_eq "nothing stale after compile" "$(stale_set .)" ""
20proof_end