#!/usr/bin/env bash # # adr-076 domain-activation invariants — behavioural test for the two-path domain # activation gate in install/ontoref-global (_dispatch_domain). # # Asserts, against the SOURCE wrapper (not the installed copy): # T1 bond path — a bond-only consumer (carrier, NO manifest) activates. # T2 refusal — a bare project (no manifest, no carrier) is refused. # T3 additive Hard — a repo_kind-matching project activates IDENTICALLY with # and without a carrier present (constraint # `bond-path-is-purely-additive`: the carrier never alters # an outcome the repo_kind path already granted). # T4 bond rescues — a manifest whose repo_kind does NOT match is refused # without a carrier, and activates WITH one. # # "Activated" = the dispatch passed the gate and proceeded to run the domain's # commands.nu; the gate's refusal line is absent. The command itself may then # fail on its own logic (the fixtures are not real rustelo sites) — that failure # is BEYOND the gate and is exactly what proves the gate let it through. set -euo pipefail cd "$(dirname "$0")/.." WRAPPER="install/ontoref-global" DOMAIN="rustelo" # a real installed domain with repo_kinds.txt = RusteloApp REFUSAL="not available for this project" # ── locate a data dir (ONTOREF_ROOT) so domains/ + dispatcher resolve ───────── DD="" for candidate in "$HOME/Library/Application Support/ontoref" "$HOME/.local/share/ontoref"; do if [[ -d "$candidate/domains/$DOMAIN" ]]; then DD="$candidate"; break; fi done if [[ -z "$DD" ]]; then echo "bond-dispatch-test: no installed data dir with domains/$DOMAIN — run 'just install-daemon' first" >&2 exit 3 fi echo "== adr-076 domain-activation invariants ==" echo " wrapper=$WRAPPER data_dir=$DD domain=$DOMAIN" echo TMP="$(mktemp -d)" trap 'rm -rf "$TMP"' EXIT PASS=0 FAIL=0 # Run the source wrapper against a project root; echo combined output. run_dispatch() { local root="$1" ONTOREF_ROOT="$DD" ONTOREF_PROJECT_ROOT="$root" bash "$WRAPPER" "$DOMAIN" routes 2>&1 || true } # assert_activated