A snapshot: read at commit 707a04c7ce8 on 2026-10-18T00:06:01Z by majordomus 0.29.0. Nothing on this page is read again. See it live
test/cases/11_site_derivation.sh
An object of kind test
What it is
- URI
majordomus://test/test/cases/11_site_derivation.sh- Kind
test- Identity
test/cases/11_site_derivation.sh- Path
test/cases/11_site_derivation.sh- Provenance
- declared
- Media type
text/plain- As a capability
- test.test/cases/11_site_derivation.sh
Front matter
{}Content
# The critical regeneration test: change one canonical value; the derived data and content change with it.
. "$ROOT/test/lib.sh"
command -v jq >/dev/null || skip "jq absent"
fixture_repo "$T" AGENTS.md docs site/data/marketing.toml site/content-src test/cases
git -C "$T" add -A >/dev/null; git -C "$T" commit -qm fixture
"$T/scripts/generate-site-data" >/dev/null; cp -R "$T/site/data/generated" "$T/before"
# 1. version — whatever it is now, not a version written down here: pinning 0.1.0 meant the
# sed stopped matching at the first release and the mutation silently did nothing, so the
# assertion below compared the real version with 9.9.9 and failed on every run since.
# The fixture carries no crate, so the mutation is made where the shell tool reads the
# version: share/version.txt, the projection of the manifest and a declared input.
sed -i.bak -E 's/^version=.*/version=9.9.9/' "$T/share/version.txt"; rm -f "$T/share/version.txt.bak"
grep -q '^version=9.9.9$' "$T/share/version.txt" || { echo " the version mutation did not apply"; exit 1; }
[ "$("$T/bin/majordomus" version)" = "majordomus 9.9.9" ] || { echo " the tool does not print the mutated version"; exit 1; }
# 2. a profile description and effort
sed -i.bak 's/^description: .*/description: CHANGED DESCRIPTION/; s/^effort: low$/effort: max/' "$T/share/skeleton/profiles/routine.yaml"; rm -f "$T/share/skeleton/profiles/routine.yaml.bak"
# 3. a principle label (the title of the rule tagged principle in the standard package).
# The package is hash-pinned: its manifest carries the hash of every rule file and a hand
# edit is refused until the package is rewritten. Editing the rule and stopping there made
# every scenario that reads the rules fail, and the generator refused with eight of them
# named — which is the package integrity doctrine working, not this mutation failing. So
# re-pin, the way the maintainer of the package would.
sed -i.bak 's/^title: Sessions are workers, not memory$/title: Sessions are CHANGED PRINCIPLE/' "$T/share/standard/majordomus/rules/principle-01-sessions-are-workers.v1.md"; rm -f "$T/share/standard/majordomus/rules/principle-01-sessions-are-workers.v1.md.bak"
( cd "$T" && ./scripts/rules-package write >/dev/null ) || { echo " the rule package could not be re-pinned after the edit"; exit 1; }
# 4. a policy value
sed -i.bak 's/always_loaded_budget_lines: 150/always_loaded_budget_lines: 42/' "$T/share/skeleton/policy.yaml"; rm -f "$T/share/skeleton/policy.yaml.bak"
# 5. a claim status
python3 - "$T/docs/CLAIMS.yaml" <<'PY'
import sys; p=sys.argv[1]; s=open(p).read(); s=s.replace(" - id: init-refuses\n claim: Installing into a repository that already has an installation is refused"," - id: init-refuses\n claim: CHANGED CLAIM TEXT",1); open(p,'w').write(s)
PY
# 6. a docs heading
sed -i.bak 's/^# Concepts$/# Concepts CHANGED/' "$T/docs/CONCEPTS.md"; rm -f "$T/docs/CONCEPTS.md.bak"
expect_exit 0 "$T/scripts/generate-site-data"
G="$T/site/data/generated"
# Each derived value is named when it disagrees. A bare `[ ... ]` under `set -e` ends the
# case with no output at all, which is how "the version mutation stopped matching" read as
# an unexplained exit for as long as it did.
derived() { # <what> <want> <got>
[ "$3" = "$2" ] || { echo " $1: derived $3, and the canonical value was changed to $2"; exit 1; }
}
derived "project.json .version" "9.9.9" "$(jq -r .version "$G/project.json")"
derived "profiles.json routine.description" "CHANGED DESCRIPTION" \
"$(jq -r '.profiles[] | select(.slug=="routine") | .description' "$G/profiles.json")"
derived "profiles.json routine.effort" "max" \
"$(jq -r '.profiles[] | select(.slug=="routine") | .effort' "$G/profiles.json")"
jq -e '.principles | index("Sessions are CHANGED PRINCIPLE")' "$G/lifecycle.json" >/dev/null \
|| { echo " lifecycle.json principles does not carry the changed principle title"; exit 1; }
derived "policy.json context.always_loaded_budget_lines" "42" \
"$(jq -r .context.always_loaded_budget_lines "$G/policy.json")"
derived "capabilities.json claim init-refuses" "CHANGED CLAIM TEXT" \
"$(jq -r '.claims[] | select(.id=="init-refuses") | .claim' "$G/capabilities.json")"
expect_grep '^title = "Concepts CHANGED"' "$T/site/content/docs/concepts.md"
# the input hash moved, and the previous data is now reported stale
[ "$(jq -r .source_hash "$G/source.json")" != "$(jq -r .source_hash "$T/before/source.json")" ]
rm -rf "$G"; cp -R "$T/before" "$G"
expect_exit 10 "$T/scripts/generate-site-data" --check
expect_grep 'STALE'