Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-architecture-mv/blob/main/scripts/pipeline-proofs/14-fixed-point.sh # aien-architecture-mv Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-architecture-mv / scripts / pipeline-proofs / 14-fixed-point.sh` 28 lines ยท 2112 bytes Raw Blame History 1 #!/usr/bin/env bash 2 # 14: fixed point. A second compile changes nothing: "0 rewritten", `git status --porcelain` empty, 3 # and every .crumb byte-for-byte as before. Checked at HEAD (crumbs already CURRENT) and from nothing. 4 here="$(cd "$(dirname "$0")" && pwd)"; . "$here/lib.sh" 5 proof_begin 14 "fixed point: the second compile rewrites nothing" "${1:-}" 6 clone_repo "$TMP/a"; cd "$TMP/a" || exit 1 7 rewritten() { echo "$1" | tail -1 | sed -n 's/.*crumbs, \([0-9]*\) rewritten.*/\1/p'; } 8 crumb_sum() { git ls-files '*.crumb' '**/.crumb' | sort | xargs cat | sha256sum | cut -c1-16; } 9 10 # (a) at HEAD: the committed crumbs are already what compile would write 11 measure compile_at_head $CRUMB compile .; note "$(echo "$OUT" | tail -1)" 12 check_eq "compile at HEAD rewrites 0" "$(rewritten "$OUT")" 0 13 check_eq "git status --porcelain is empty after compile at HEAD" "$(git status --porcelain | wc -l)" 0 14 15 # (b) from nothing: strip, compile once (n rewritten), compile again (0 rewritten, bytes unchanged) 16 for c in $(git ls-files '*.crumb' '**/.crumb'); do jq 'del(.extensions.generated)' "$c" > "$c.tmp" && mv "$c.tmp" "$c"; done 17 measure compile_1_from_nothing $CRUMB compile .; N1=$(rewritten "$OUT"); num "first_compile_rewritten=$N1" 18 check_eq "first compile regenerated every crumb" "$N1" "$(crumb_dirs . | wc -l)" 19 S1=$(crumb_sum); P1=$(git status --porcelain | sort | sha256sum | cut -c1-16) 20 measure compile_2 $CRUMB compile .; N2=$(rewritten "$OUT"); num "second_compile_rewritten=$N2" 21 check_eq "second compile rewrites 0" "$N2" 0 22 check_eq "second compile leaves every .crumb byte-identical" "$(crumb_sum)" "$S1" 23 check_eq "second compile leaves git status unchanged" "$(git status --porcelain | sort | sha256sum | cut -c1-16)" "$P1" 24 git add -A && git commit -q -m "crumb compile (proof 14)" 25 measure compile_3_after_commit $CRUMB compile .; check_eq "compile after committing rewrites 0" "$(rewritten "$OUT")" 0 26 check_eq "git status --porcelain empty after the crumb commit + compile" "$(git status --porcelain | wc -l)" 0 27 measure verify $CRUMB verify .; check "verify OK at the fixed point" [ "$RC" -eq 0 ] 28 proof_end