checkwright 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +385 -19
- package/lib/common/digest.sh +18 -0
- package/lib/common/lock.sh +11 -0
- package/lib/common/recipe.sh +8 -11
- package/lib/doctor.sh +49 -0
- package/lib/init.sh +152 -29
- package/package.json +2 -2
- package/payload/artifact/targets.list +30 -0
- package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
- package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -0
- package/payload/canon-kit/README.md +1 -0
- package/payload/canon-kit/SPEC.md +279 -24
- package/payload/canon-kit/checks/check-comment-tier.sh +7 -2
- package/payload/canon-kit/checks/check-docs-link-convention.sh +11 -4
- package/payload/canon-kit/checks/check-payload-claim.sh +133 -0
- package/payload/canon-kit/checks/check-prose-enum.sh +1 -1
- package/payload/canon-kit/checks/check-spec-pointer.sh +9 -2
- package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +3 -0
- package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +26 -3
- package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/OUTSIDE.md +4 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/docs/index.md +3 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/OUTSIDE.md +4 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/methodology.md +8 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +94 -0
- package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +5 -3
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/README.md +15 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/expect.txt +2 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/install.md +19 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/posts/note.md +6 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.sh +8 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/payload-claims.sh +7 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/README.md +15 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/expect.txt +2 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/install.md +20 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/posts/note.md +6 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.sh +8 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/payload-claims.sh +7 -0
- package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +24 -1
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/widget.sh +1 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/widget.sh +1 -0
- package/payload/canon-kit/lib/spec.sh +22 -12
- package/payload/canon-kit/smoke/install.sh +20 -1
- package/payload/canon-kit/templates/SPEC-amendment.md +5 -1
- package/payload/context-kit/SPEC.md +25 -1
- package/payload/context-kit/lib/toolfloor.sh +1 -1
- package/payload/context-kit/smoke/install.sh +3 -1
- package/payload/delegation-kit/SPEC.md +383 -13
- package/payload/delegation-kit/bin/run-dispatch-guard-tests.sh +97 -0
- package/payload/delegation-kit/checks/check-gate-tamper.sh +1 -1
- package/payload/delegation-kit/lib/delegation.sh +1 -0
- package/payload/delegation-kit/smoke/install.sh +2 -1
- package/payload/delegation-kit/templates/agent-dispatch-guard.sh +61 -0
- package/payload/delegation-kit/templates/agent-execution.md +103 -12
- package/payload/delegation-kit/templates/delegation-config.sh +4 -0
- package/payload/delegation-kit/templates/dispatch-checklists.md +1 -1
- package/payload/delegation-kit/usage-tests/dispatch-guard-cases.tsv +30 -0
- package/payload/doctrine-kit/DOCTRINE.md +27 -0
- package/payload/doctrine-kit/README.md +5 -0
- package/payload/doctrine-kit/SPEC.md +62 -3
- package/payload/doctrine-kit/bin/install-doctrine.sh +84 -4
- package/payload/doctrine-kit/smoke/install.sh +77 -1
- package/payload/drift-kit/README.md +3 -2
- package/payload/drift-kit/SPEC.md +253 -20
- package/payload/drift-kit/bin/stage-economics.sh +157 -3
- package/payload/drift-kit/kpis/kpi-incident-recurrence.sh +42 -0
- package/payload/drift-kit/smoke/install.sh +155 -1
- package/payload/drift-kit/templates/economics.md +9 -0
- package/payload/drift-kit/templates/kpis.list +6 -1
- package/payload/evidence-kit/README.md +20 -6
- package/payload/evidence-kit/SPEC.md +355 -17
- package/payload/evidence-kit/bin/run-validate.sh +51 -9
- package/payload/evidence-kit/checks/check-battery-roster.sh +86 -0
- package/payload/evidence-kit/checks/check-producer-liveness.sh +34 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/args +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/runner.md +14 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.sh +7 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/args +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/runner.md +14 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.sh +7 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +68 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/args +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/run-validate.lock +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/good/args +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/good/expect.txt +2 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/good/run-validate.lock +1 -0
- package/payload/evidence-kit/gate-tests/producer-lock.test.sh +109 -0
- package/payload/evidence-kit/lib/evidence.sh +18 -0
- package/payload/evidence-kit/smoke/install.sh +17 -3
- package/payload/gate-sdk/README.md +4 -1
- package/payload/gate-sdk/SPEC.md +1949 -74
- package/payload/gate-sdk/bin/gen-pre-commit.sh +12 -2
- package/payload/gate-sdk/bin/run-consumer-smoke.sh +121 -1
- package/payload/gate-sdk/bin/run-gate-tests.sh +40 -9
- package/payload/gate-sdk/bin/run-gates.sh +31 -2
- package/payload/gate-sdk/bin/upgrade-smoke.sh +3 -3
- package/payload/gate-sdk/checks/check-action-gh-repo.gate +2 -0
- package/payload/gate-sdk/checks/check-action-pinning.gate +2 -0
- package/payload/gate-sdk/checks/check-action-run-shell.sh +3 -1
- package/payload/gate-sdk/checks/check-core-files.sh +27 -4
- package/payload/gate-sdk/checks/check-exec-bit.sh +20 -1
- package/payload/gate-sdk/checks/check-gate-binary-fresh.sh +106 -0
- package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +6 -7
- package/payload/gate-sdk/checks/check-gate-output.sh +9 -1
- package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +302 -0
- package/payload/gate-sdk/checks/check-graph.sh +4 -5
- package/payload/gate-sdk/checks/check-readme-roster.sh +5 -0
- package/payload/gate-sdk/checks/check-reads-couples.sh +70 -21
- package/payload/gate-sdk/checks/check-template-registry-parity.sh +81 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +16 -1
- package/payload/gate-sdk/gate-tests/check-core-files.test.sh +64 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/expect.txt +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/kitroot/checks/check-vendored.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/check-ported.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.sh +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gates.list +4 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stamp.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stub-bin +6 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/expect.txt +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/kitroot/checks/check-vendored.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/check-ported.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.sh +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gates.list +4 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stamp.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stub-bin +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +81 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +3 -1
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +3 -1
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/gates/check-sample.sh +3 -1
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-sample.sh +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/good/check-sample.sh +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/conservation.md +7 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +12 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/impl/gate.rs +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/kitroot/check-orphan.rs +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/publish.yml +15 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-alpha.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.gate +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-orphan.gate +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/stub-bin +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/targets.list +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/conservation.md +8 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +7 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/impl/gate.rs +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/kitroot/check-other.rs +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/publish.yml +15 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-alpha.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-ported.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/stub-bin +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/targets.list +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +123 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +139 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/templates/widgets.list +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-one.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-two.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/args +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/scripts/gate-sdk-config.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/templates/widgets.list +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-one.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-two.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/args +8 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/rules.list +5 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/table.tsv +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.sh +5 -0
- package/payload/gate-sdk/gate-tests/lib-declaration.test.sh +4 -4
- package/payload/gate-sdk/gate-tests/lib-gate.test.sh +41 -1
- package/payload/gate-sdk/gate-tests/run-gate-tests.test.sh +144 -0
- package/payload/gate-sdk/lib/consumer-smoke.sh +26 -1
- package/payload/gate-sdk/lib/gate.sh +75 -0
- package/payload/gate-sdk/lib/inject.sh +21 -1
- package/payload/gate-sdk/smoke/install.sh +19 -1
- package/payload/guard-kit/README.md +4 -3
- package/payload/guard-kit/SPEC.md +88 -10
- package/payload/guard-kit/bin/compare-settings-allow.sh +40 -7
- package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +64 -0
- package/payload/guard-kit/lib/guard.sh +1 -0
- package/payload/guard-kit/templates/close-triage.md +35 -7
- package/payload/guard-kit/templates/guard-config.sh +3 -0
- package/payload/lifecycle-kit/README.md +1 -0
- package/payload/lifecycle-kit/SPEC.md +575 -29
- package/payload/lifecycle-kit/bin/enter-stage.sh +13 -3
- package/payload/lifecycle-kit/bin/file-gap.sh +42 -1
- package/payload/lifecycle-kit/bin/file-survey.sh +50 -0
- package/payload/lifecycle-kit/checks/check-merge-attrs.sh +1 -1
- package/payload/lifecycle-kit/checks/check-skill-binding.sh +1 -1
- package/payload/lifecycle-kit/checks/check-survey-record.sh +102 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/.gitattributes +1 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/.gitattributes +1 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +1 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/expect.txt +4 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/record.md +18 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/record.md +13 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +84 -0
- package/payload/lifecycle-kit/gate-tests/file-gap-recurrence.test.sh +94 -0
- package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +102 -0
- package/payload/lifecycle-kit/lib/stages.sh +8 -2
- package/payload/lifecycle-kit/smoke/install.sh +17 -1
- package/payload/lifecycle-kit/templates/consult.md +73 -0
- package/payload/lifecycle-kit/templates/lead.md +103 -7
- package/payload/lifecycle-kit/templates/stages/align.md +12 -0
- package/payload/lifecycle-kit/templates/stages/build.md +8 -0
- package/payload/lifecycle-kit/templates/stages/close.md +25 -4
- package/payload/lifecycle-kit/templates/stages/scope.md +34 -0
- package/payload/lifecycle-kit/templates/stages/spec.md +8 -0
- package/payload/lifecycle-kit/templates/stages/validate.md +8 -0
- package/payload/queue-kit/README.md +4 -1
- package/payload/queue-kit/SPEC.md +230 -6
- package/payload/queue-kit/bin/queue-edges.sh +78 -0
- package/payload/queue-kit/checks/check-queue-entry-budget.sh +5 -3
- package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +5 -0
- package/payload/queue-kit/gate-tests/queue-edges.test.sh +130 -0
- package/payload/queue-kit/smoke/install.sh +4 -1
- package/payload/queue-kit/templates/TASK-QUEUE.md +3 -0
- package/payload/site-kit/SPEC.md +41 -27
- package/payload/site-kit/smoke/install.sh +9 -1
- package/payload/gate-sdk/checks/check-action-gh-repo.sh +0 -321
- package/payload/gate-sdk/checks/check-action-pinning.sh +0 -55
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Behavioral test of check-reads-couples' .gate arm — the consumption path and the two
|
|
3
|
+
# refusals that survive it. The one good/bad pair cannot hold this arm: the pair models
|
|
4
|
+
# exit 0 and exit 1 against a shell source, while this arm needs a binary to answer
|
|
5
|
+
# `--reads` and its refusals are exit 2 by the fail-closed contract. With no .gate member
|
|
6
|
+
# registered anywhere in the tree the arm has no live instance, so without this file it
|
|
7
|
+
# would be an untested branch rather than the counted zero the clean line reports.
|
|
8
|
+
#
|
|
9
|
+
# Run by run-gate-tests.sh (any <tests-dir>/*.test.sh; must exit 0).
|
|
10
|
+
set -uo pipefail
|
|
11
|
+
source "$(dirname "${BASH_SOURCE[0]}")/../lib/test-hermetic.sh"
|
|
12
|
+
|
|
13
|
+
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
14
|
+
GATE="$ROOT/gate-sdk/checks/check-reads-couples.sh"
|
|
15
|
+
REAL_BIN="$ROOT/native/target/release/checkwright-gates"
|
|
16
|
+
|
|
17
|
+
fails=0
|
|
18
|
+
cases=0
|
|
19
|
+
tmp="$(mktemp -d)"
|
|
20
|
+
trap 'rm -rf "$tmp"' EXIT
|
|
21
|
+
|
|
22
|
+
MANIFEST='# graph: couples=corpus/*.md dir=one valve=none tier=precommit'
|
|
23
|
+
|
|
24
|
+
# Writes a stub binary that answers `--reads` with the given lines and refuses anything
|
|
25
|
+
# else — the shape the real binary has for a subcommand it carries.
|
|
26
|
+
make_stub() {
|
|
27
|
+
local path="$1" r; shift
|
|
28
|
+
{
|
|
29
|
+
echo '#!/usr/bin/env bash'
|
|
30
|
+
echo '[[ "${1:-}" == --reads ]] || exit 2'
|
|
31
|
+
for r in "$@"; do printf "echo '%s'\n" "$r"; done
|
|
32
|
+
echo 'exit 0'
|
|
33
|
+
} > "$path"
|
|
34
|
+
chmod +x "$path"
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
# $1=label $2=want-rc $3=want-substring $4=binary-path (case dir prepared by the caller)
|
|
38
|
+
run_case() {
|
|
39
|
+
local label="$1" want="$2" substr="$3" bin="$4" out rc
|
|
40
|
+
cases=$((cases + 1))
|
|
41
|
+
out="$( cd "$tmp/$label" && GATE_SDK_NATIVE_BIN="$bin" "$GATE" sandbox.gate 2>&1 )"; rc=$?
|
|
42
|
+
if [[ "$rc" -ne "$want" ]]; then
|
|
43
|
+
echo " FAIL [$label]: want exit $want, got $rc -- $out"; fails=$((fails + 1)); return
|
|
44
|
+
fi
|
|
45
|
+
if [[ -n "$substr" ]] && ! grep -qF -- "$substr" <<<"$out"; then
|
|
46
|
+
echo " FAIL [$label]: exit $rc OK but output lacks '$substr': $out"; fails=$((fails + 1))
|
|
47
|
+
fi
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
# Builds a case dir holding a descriptor, a tracked corpus, and a stub reporting $3...
|
|
51
|
+
make_case() {
|
|
52
|
+
local label="$1" descriptor="$2"; shift 2
|
|
53
|
+
local dir="$tmp/$label"
|
|
54
|
+
mkdir -p "$dir/corpus/sub"
|
|
55
|
+
printf '%s\n' "$descriptor" > "$dir/sandbox.gate"
|
|
56
|
+
: > "$dir/corpus/top.md"
|
|
57
|
+
: > "$dir/corpus/sub/deep.md"
|
|
58
|
+
make_stub "$dir/stub-bin" "$@"
|
|
59
|
+
( cd "$dir" && git init -q . && git add -A ) >/dev/null 2>&1
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
# A — the reported root's tracked reads are covered. A couple naming both levels covers a
|
|
63
|
+
# recursive walk; this is the clean consumption path the refusal used to make unreachable.
|
|
64
|
+
make_case covered \
|
|
65
|
+
'# graph: couples=corpus/*.md,corpus/sub/*.md dir=one valve=none tier=precommit' corpus
|
|
66
|
+
run_case covered 0 '1 resolvable walk(s) covered' "$tmp/covered/stub-bin"
|
|
67
|
+
|
|
68
|
+
# B — the same reported root, a couple that stops one level short. Globs never cross '/',
|
|
69
|
+
# so the deeper tracked file is uncovered and the finding must name it.
|
|
70
|
+
make_case uncovered "$MANIFEST" corpus
|
|
71
|
+
run_case uncovered 1 "corpus/sub/deep.md" "$tmp/uncovered/stub-bin"
|
|
72
|
+
|
|
73
|
+
# C — a root the gate cannot bound statically. It is counted, never assumed empty: the
|
|
74
|
+
# clean line reports it in the same skip counter the shell arm's unresolvable roots use.
|
|
75
|
+
make_case unbounded "$MANIFEST" '?'
|
|
76
|
+
run_case unbounded 0 '1 undecidable walk(s) skipped-and-counted' "$tmp/unbounded/stub-bin"
|
|
77
|
+
|
|
78
|
+
# D — a descriptor claiming the removed opt-out. There is deliberately no descriptor-level
|
|
79
|
+
# exemption, so the uncovered read is still a finding: the line buys nothing.
|
|
80
|
+
make_case claimed_exemption \
|
|
81
|
+
"$MANIFEST
|
|
82
|
+
# reads-couples-exempt: the walks are covered elsewhere" corpus
|
|
83
|
+
run_case claimed_exemption 1 "corpus/sub/deep.md" "$tmp/claimed_exemption/stub-bin"
|
|
84
|
+
|
|
85
|
+
# E — surviving refusal one: a .gate member registered with no binary to ask. Exit 2, the
|
|
86
|
+
# same fail-closed shape check-gate-substrate-parity assertion B uses for this condition.
|
|
87
|
+
make_case no_binary "$MANIFEST" corpus
|
|
88
|
+
run_case no_binary 2 'absent' "$tmp/no_binary/nonexistent-bin"
|
|
89
|
+
|
|
90
|
+
# F — surviving refusal two: the binary is there but cannot answer for this member. A
|
|
91
|
+
# non-zero --reads must never read as "reads nothing".
|
|
92
|
+
make_case reads_fails "$MANIFEST" corpus
|
|
93
|
+
{ echo '#!/usr/bin/env bash'; echo 'echo "no such gate subcommand" >&2'; echo 'exit 3'; } \
|
|
94
|
+
> "$tmp/reads_fails/broken-bin"
|
|
95
|
+
chmod +x "$tmp/reads_fails/broken-bin"
|
|
96
|
+
run_case reads_fails 2 'exited 3' "$tmp/reads_fails/broken-bin"
|
|
97
|
+
|
|
98
|
+
# G — the shell arm is unaffected: a .sh source with a covered walk still analyzes, so a
|
|
99
|
+
# refusal above cannot be passing for a parse failure.
|
|
100
|
+
mkdir -p "$tmp/shell/corpus"
|
|
101
|
+
: > "$tmp/shell/corpus/a.md"
|
|
102
|
+
printf '%s\n' \
|
|
103
|
+
"$MANIFEST" \
|
|
104
|
+
'gate_find "corpus" -name '"'"'*.md'"'"' -type f' > "$tmp/shell/sandbox-gate.sh"
|
|
105
|
+
( cd "$tmp/shell" && git init -q . && git add -A ) >/dev/null 2>&1
|
|
106
|
+
cases=$((cases + 1))
|
|
107
|
+
out="$( cd "$tmp/shell" && "$GATE" sandbox-gate.sh 2>&1 )"; rc=$?
|
|
108
|
+
if [[ "$rc" -ne 0 ]]; then
|
|
109
|
+
echo " FAIL [shell-arm]: want exit 0, got $rc -- $out"; fails=$((fails + 1))
|
|
110
|
+
elif ! grep -qF -- 'READS-COUPLES: clean' <<<"$out"; then
|
|
111
|
+
echo " FAIL [shell-arm]: exit 0 but not clean: $out"; fails=$((fails + 1))
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
# H — the same consumption path against the *real* binary rather than a stub, so the
|
|
115
|
+
# reported grammar is the one the substrate actually emits. Skipped-and-named when the
|
|
116
|
+
# binary is absent: this file is hermetic and never builds, and a consumer tree has no
|
|
117
|
+
# crate to build from.
|
|
118
|
+
real_status="skipped (binary not built)"
|
|
119
|
+
if [[ -x "$REAL_BIN" ]]; then
|
|
120
|
+
mkdir -p "$tmp/real"
|
|
121
|
+
printf '%s\n' "$MANIFEST" > "$tmp/real/check-action-pinning.gate"
|
|
122
|
+
cases=$((cases + 1))
|
|
123
|
+
out="$( cd "$tmp/real" && GATE_SDK_NATIVE_BIN="$REAL_BIN" \
|
|
124
|
+
"$GATE" check-action-pinning.gate 2>&1 )"; rc=$?
|
|
125
|
+
real_status="run"
|
|
126
|
+
if [[ "$rc" -ne 0 ]]; then
|
|
127
|
+
echo " FAIL [real-binary]: want exit 0, got $rc -- $out"; fails=$((fails + 1))
|
|
128
|
+
elif ! grep -qF -- '1 undecidable walk(s) skipped-and-counted' <<<"$out"; then
|
|
129
|
+
echo " FAIL [real-binary]: exit 0 but the reported '?' was not counted: $out"
|
|
130
|
+
fails=$((fails + 1))
|
|
131
|
+
fi
|
|
132
|
+
fi
|
|
133
|
+
|
|
134
|
+
if [[ "$fails" -gt 0 ]]; then
|
|
135
|
+
echo "check-reads-couples.test.sh: $fails case(s) failed"
|
|
136
|
+
exit 1
|
|
137
|
+
fi
|
|
138
|
+
echo "check-reads-couples.test.sh: clean ($cases cases; real-binary case $real_status)"
|
|
139
|
+
exit 0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
alpha-kit/templates/widgets.list does not register shipped artifact: widget-two
|
package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/scripts/gate-sdk-config.sh
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# shellcheck shell=bash
|
|
2
|
+
# Fixture config: make the sandbox kit the kit root, so gate_kit_roots
|
|
3
|
+
# resolves to this case dir (auto-sourced by lib/gate.sh at cwd) rather than
|
|
4
|
+
# the real repo. See gate-sdk/SPEC.md §Layout and configuration.
|
|
5
|
+
GATE_SDK_KIT_DIRS="alpha-kit"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Anchor the sweep at this case dir: gate-sdk-config.sh (auto-sourced at cwd)
|
|
2
|
+
# names the synthetic kits via GATE_SDK_KIT_DIRS; their relative roots resolve
|
|
3
|
+
# against the positional root. alpha-kit is the in-population case — a .list
|
|
4
|
+
# template beside the directory whose artifacts it registers, in parity both
|
|
5
|
+
# ways. beta-kit carries the two structural exclusions: rules.list has no
|
|
6
|
+
# beta-kit/rules/ sibling (skipped-and-counted), and table.tsv is not a .list
|
|
7
|
+
# at all, so it never reaches the sibling test.
|
|
8
|
+
.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
clean (1 shipped registry template(s) in name-set parity with the sibling directory each registers; 1 .list template(s) with no such sibling skipped)
|
package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.sh
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# shellcheck shell=bash
|
|
2
|
+
# Fixture config: make the sandbox kits the kit roots, so gate_kit_roots
|
|
3
|
+
# resolves to this case dir (auto-sourced by lib/gate.sh at cwd) rather than
|
|
4
|
+
# the real repo. See gate-sdk/SPEC.md §Layout and configuration.
|
|
5
|
+
GATE_SDK_KIT_DIRS="alpha-kit beta-kit"
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
# Direct unit test of gate-sdk/lib/declaration.sh — the two container arms and
|
|
3
3
|
# the resolve/refuse trichotomy (gate-sdk/SPEC.md §lib/declaration.sh).
|
|
4
4
|
#
|
|
5
|
-
# Why a direct test:
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
5
|
+
# Why a direct test: bin/upgrade-smoke.sh's record-arm caller is a bin tool
|
|
6
|
+
# whose contract forgoes a good/bad pair, so this is that branch's runtime
|
|
7
|
+
# lock-in independent of scripts/check-tightened-gates-note-parity's own
|
|
8
|
+
# good/bad pair on the record arm (gate-sdk/SPEC.md §lib/declaration.sh). The
|
|
9
9
|
# markdown arm's callers do carry fixtures; its status-2 and empty-section arms
|
|
10
10
|
# are still checked here, being unreachable from a well-formed corpus.
|
|
11
11
|
#
|
|
@@ -70,9 +70,49 @@ got="$(gate_resolve check-one "$sandbox/a" "$sandbox/b")"
|
|
|
70
70
|
gate_resolve check-missing "$sandbox/a" "$sandbox/b" >/dev/null \
|
|
71
71
|
&& { echo " FAIL: gate_resolve found a nonexistent gate"; fails=$((fails + 1)); }
|
|
72
72
|
|
|
73
|
+
# --- declaration path vs invocation argv (the .gate dispatch seam) ------------
|
|
74
|
+
: >"$sandbox/b/check-ported.gate"
|
|
75
|
+
got="$(gate_resolve check-ported "$sandbox/a" "$sandbox/b")"
|
|
76
|
+
[[ "$got" == "$sandbox/b/check-ported.gate" ]] \
|
|
77
|
+
|| { echo " FAIL: gate_resolve did not find a .gate declaration (got '$got')"; fails=$((fails + 1)); }
|
|
78
|
+
|
|
79
|
+
# .sh beats .gate within a dir — the shadowing property the registry contract rests on
|
|
80
|
+
: >"$sandbox/b/check-both.sh"; : >"$sandbox/b/check-both.gate"
|
|
81
|
+
got="$(gate_resolve check-both "$sandbox/a" "$sandbox/b")"
|
|
82
|
+
[[ "$got" == "$sandbox/b/check-both.sh" ]] \
|
|
83
|
+
|| { echo " FAIL: gate_resolve let .gate win inside a dir (got '$got')"; fails=$((fails + 1)); }
|
|
84
|
+
|
|
85
|
+
# an earlier dir's .gate still beats a later dir's .sh — dir order is the outer loop
|
|
86
|
+
: >"$sandbox/a/check-order.gate"; : >"$sandbox/b/check-order.sh"
|
|
87
|
+
got="$(gate_resolve check-order "$sandbox/a" "$sandbox/b")"
|
|
88
|
+
[[ "$got" == "$sandbox/a/check-order.gate" ]] \
|
|
89
|
+
|| { echo " FAIL: gate_resolve broke consumer-first dir order (got '$got')"; fails=$((fails + 1)); }
|
|
90
|
+
|
|
91
|
+
# gate_command: a shell gate yields its one-element argv
|
|
92
|
+
got="$(gate_command check-one "$sandbox/a" "$sandbox/b" | paste -sd' ' -)"
|
|
93
|
+
[[ "$got" == "$sandbox/b/check-one.sh" ]] \
|
|
94
|
+
|| { echo " FAIL: gate_command shell argv was '$got'"; fails=$((fails + 1)); }
|
|
95
|
+
|
|
96
|
+
# gate_command: a .gate member yields <binary> <name> when the binary is executable
|
|
97
|
+
printf '#!/bin/sh\n' > "$sandbox/fakebin"; chmod +x "$sandbox/fakebin"
|
|
98
|
+
got="$(GATE_SDK_NATIVE_BIN="$sandbox/fakebin" gate_command check-ported "$sandbox/a" "$sandbox/b" | paste -sd' ' -)"
|
|
99
|
+
[[ "$got" == "$sandbox/fakebin check-ported" ]] \
|
|
100
|
+
|| { echo " FAIL: gate_command native argv was '$got'"; fails=$((fails + 1)); }
|
|
101
|
+
|
|
102
|
+
# fail-closed: an absent binary is exit 2, never a skip and never a pass
|
|
103
|
+
( GATE_SDK_NATIVE_BIN="$sandbox/nope" gate_command check-ported "$sandbox/a" "$sandbox/b" >/dev/null 2>&1 )
|
|
104
|
+
[[ "$?" -eq 2 ]] \
|
|
105
|
+
|| { echo " FAIL: gate_command did not exit 2 on an absent native binary"; fails=$((fails + 1)); }
|
|
106
|
+
|
|
107
|
+
# fail-closed: present but non-executable is the same harness error
|
|
108
|
+
: >"$sandbox/notexec"; chmod -x "$sandbox/notexec"
|
|
109
|
+
( GATE_SDK_NATIVE_BIN="$sandbox/notexec" gate_command check-ported "$sandbox/a" "$sandbox/b" >/dev/null 2>&1 )
|
|
110
|
+
[[ "$?" -eq 2 ]] \
|
|
111
|
+
|| { echo " FAIL: gate_command did not exit 2 on a non-executable native binary"; fails=$((fails + 1)); }
|
|
112
|
+
|
|
73
113
|
if [[ "$fails" -gt 0 ]]; then
|
|
74
114
|
echo "lib-gate.test: $fails assertion(s) failed"
|
|
75
115
|
exit 1
|
|
76
116
|
fi
|
|
77
|
-
echo "lib-gate.test: ok (fail_closed branches; gate_path_pruned; GATE_GREP_EXCLUDES; gate_find prune; registry + resolution)"
|
|
117
|
+
echo "lib-gate.test: ok (fail_closed branches; gate_path_pruned; GATE_GREP_EXCLUDES; gate_find prune; registry + resolution; .gate declaration/argv split + dispatch fail-closed)"
|
|
78
118
|
exit 0
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Direct unit test of gate-sdk/bin/run-gate-tests.sh's expect.txt semantics —
|
|
3
|
+
# every non-blank line of an expect file is a separate assertion, and a case
|
|
4
|
+
# fails when any one of them is absent. A fixture pair cannot cover this: the
|
|
5
|
+
# runner is a bin/ tool, never a gates.list member, so it owes no good/+bad/
|
|
6
|
+
# pair, and a pair here would sit outside check-gate-fixture-coverage's registry
|
|
7
|
+
# authority set and be audited by nothing.
|
|
8
|
+
#
|
|
9
|
+
# The self-invocation is bounded: each inner run is handed a scratch TESTS_DIR
|
|
10
|
+
# holding fixture dirs and no *.test.sh, so it runs pairs and returns. Do not
|
|
11
|
+
# let the scratch tree acquire one.
|
|
12
|
+
#
|
|
13
|
+
# Run by run-gate-tests.sh (any <tests-dir>/*.test.sh; must exit 0).
|
|
14
|
+
set -uo pipefail
|
|
15
|
+
source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
|
|
16
|
+
|
|
17
|
+
ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
|
|
18
|
+
RUN="$ROOT/gate-sdk/bin/run-gate-tests.sh"
|
|
19
|
+
[[ -x "$RUN" ]] || { echo "run-gate-tests.test: runner not found: $RUN"; exit 2; }
|
|
20
|
+
|
|
21
|
+
scratch="$(mktemp -d)"
|
|
22
|
+
trap 'rm -rf "$scratch"' EXIT
|
|
23
|
+
|
|
24
|
+
mkdir -p "$scratch/checks"
|
|
25
|
+
# The stub gate replays a case dir's own say/rc files, so each case dictates the
|
|
26
|
+
# output and exit status run_case sees.
|
|
27
|
+
{ printf '#!/usr/bin/env bash\n'
|
|
28
|
+
printf 'cat ./say\n'
|
|
29
|
+
printf 'exit "$(cat ./rc)"\n'
|
|
30
|
+
} > "$scratch/checks/stub-gate.sh"
|
|
31
|
+
chmod +x "$scratch/checks/stub-gate.sh"
|
|
32
|
+
|
|
33
|
+
# mk_tree <name> <good-say> <good-expect> <bad-say> <bad-expect>; an empty
|
|
34
|
+
# good-expect ships no good/expect.txt (the optional side of the asymmetry).
|
|
35
|
+
# Each say gets the output-contract line its exit code owes (§Output contract,
|
|
36
|
+
# asserted at runtime by run_case) appended, so these rows keep testing the
|
|
37
|
+
# expect.txt conjunction rather than doubling as output-contract cases.
|
|
38
|
+
mk_tree() {
|
|
39
|
+
local name="$1" good_say="$2" good_expect="$3" bad_say="$4" bad_expect="$5"
|
|
40
|
+
local dir="$scratch/$name/stub-gate"
|
|
41
|
+
mkdir -p "$dir/good" "$dir/bad"
|
|
42
|
+
printf '%s\nSTUB-GATE: clean (stub)\n' "$good_say" > "$dir/good/say"
|
|
43
|
+
printf '0\n' > "$dir/good/rc"
|
|
44
|
+
[[ -n "$good_expect" ]] && printf '%s\n' "$good_expect" > "$dir/good/expect.txt"
|
|
45
|
+
printf '%s\n help: stub remedy\n' "$bad_say" > "$dir/bad/say"
|
|
46
|
+
printf '1\n' > "$dir/bad/rc"
|
|
47
|
+
printf '%s\n' "$bad_expect" > "$dir/bad/expect.txt"
|
|
48
|
+
echo "$scratch/$name"
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
run_tree() { bash "$RUN" "$1" "$scratch/checks" 2>&1; }
|
|
52
|
+
|
|
53
|
+
fails=0
|
|
54
|
+
assert_has() { grep -qF -- "$2" <<<"$3" || { echo "FAIL [$1]: expected present: $2"; fails=$((fails + 1)); }; }
|
|
55
|
+
assert_absent() { grep -qF -- "$2" <<<"$3" && { echo "FAIL [$1]: expected absent: $2"; fails=$((fails + 1)); }; return 0; }
|
|
56
|
+
assert_rc() { [[ "$2" -eq "$3" ]] || { echo "FAIL [$1]: expected exit $3, got $2"; fails=$((fails + 1)); }; }
|
|
57
|
+
|
|
58
|
+
# Row 1 — the unit: two expect lines, the gate prints only the first. Under the
|
|
59
|
+
# disjunction this passed; the second line must now be reported missing.
|
|
60
|
+
t="$(mk_tree first-only 'good ok' '' 'alpha fired' $'alpha fired\nbeta fired')"
|
|
61
|
+
out="$(run_tree "$t")"; rc=$?
|
|
62
|
+
assert_rc first-only "$rc" 1
|
|
63
|
+
assert_has first-only 'missing: beta fired' "$out"
|
|
64
|
+
assert_absent first-only 'missing: alpha fired' "$out"
|
|
65
|
+
|
|
66
|
+
# Row 3 — the symmetric half: only the second line prints. A fix that checked
|
|
67
|
+
# just the first line would pass row 1 and leave the defect live here.
|
|
68
|
+
t="$(mk_tree second-only 'good ok' '' 'beta fired' $'alpha fired\nbeta fired')"
|
|
69
|
+
out="$(run_tree "$t")"; rc=$?
|
|
70
|
+
assert_rc second-only "$rc" 1
|
|
71
|
+
assert_has second-only 'missing: alpha fired' "$out"
|
|
72
|
+
assert_absent second-only 'missing: beta fired' "$out"
|
|
73
|
+
|
|
74
|
+
# Row 2 — both lines print: the conjunction is satisfied, order irrelevant (the
|
|
75
|
+
# gate prints them in the reverse of the expect file's order).
|
|
76
|
+
t="$(mk_tree both 'good ok' '' $'beta fired\nalpha fired' $'alpha fired\nbeta fired')"
|
|
77
|
+
out="$(run_tree "$t")"; rc=$?
|
|
78
|
+
assert_rc both "$rc" 0
|
|
79
|
+
assert_has both 'GATE-TESTS: clean' "$out"
|
|
80
|
+
|
|
81
|
+
# Row 4 — the single-line case is untouched: the tightening must not regress the
|
|
82
|
+
# shape nearly every tracked expect file uses.
|
|
83
|
+
t="$(mk_tree single 'good ok' '' 'alpha fired' 'alpha fired')"
|
|
84
|
+
out="$(run_tree "$t")"; rc=$?
|
|
85
|
+
assert_rc single "$rc" 0
|
|
86
|
+
assert_has single 'GATE-TESTS: clean' "$out"
|
|
87
|
+
|
|
88
|
+
# Row 5 — a blank line between two real ones asserts nothing: it is a separator,
|
|
89
|
+
# and reporting it as a pin would name an empty missing line.
|
|
90
|
+
t="$(mk_tree blank 'good ok' '' $'alpha fired\nbeta fired' $'alpha fired\n\nbeta fired')"
|
|
91
|
+
out="$(run_tree "$t")"; rc=$?
|
|
92
|
+
assert_rc blank "$rc" 0
|
|
93
|
+
assert_has blank 'GATE-TESTS: clean' "$out"
|
|
94
|
+
assert_absent blank 'missing: ' "$out"
|
|
95
|
+
|
|
96
|
+
# Row 6 — good/expect.txt reads identically: optional to supply, conjunctive
|
|
97
|
+
# once supplied.
|
|
98
|
+
t="$(mk_tree good-side 'gamma ok' $'gamma ok\ndelta ok' 'alpha fired' 'alpha fired')"
|
|
99
|
+
out="$(run_tree "$t")"; rc=$?
|
|
100
|
+
assert_rc good-side "$rc" 1
|
|
101
|
+
assert_has good-side 'missing: delta ok' "$out"
|
|
102
|
+
|
|
103
|
+
# Every missing line is named in one run: an author fixing one pin per re-run is
|
|
104
|
+
# the same under-assertion defect at a smaller scale.
|
|
105
|
+
t="$(mk_tree all-missing 'good ok' '' 'alpha fired' $'alpha fired\nbeta fired\ngamma fired')"
|
|
106
|
+
out="$(run_tree "$t")"; rc=$?
|
|
107
|
+
assert_rc all-missing "$rc" 1
|
|
108
|
+
assert_has all-missing 'missing: beta fired' "$out"
|
|
109
|
+
assert_has all-missing 'missing: gamma fired' "$out"
|
|
110
|
+
|
|
111
|
+
# The output contract, asserted at runtime rather than by grepping a gate's
|
|
112
|
+
# source (§Output contract). A clean case that satisfies every expect line but
|
|
113
|
+
# emits no canonical clean line is still a failure — this is the assertion that
|
|
114
|
+
# survives a gate's source becoming a compiled subcommand there is nothing to
|
|
115
|
+
# grep.
|
|
116
|
+
mk_no_clean_line() {
|
|
117
|
+
local dir="$scratch/no-clean/stub-gate"
|
|
118
|
+
mkdir -p "$dir/good" "$dir/bad"
|
|
119
|
+
printf 'gamma ok\n' > "$dir/good/say"; printf '0\n' > "$dir/good/rc"
|
|
120
|
+
printf 'gamma ok\n' > "$dir/good/expect.txt"
|
|
121
|
+
printf 'alpha fired\n help: stub remedy\n' > "$dir/bad/say"; printf '1\n' > "$dir/bad/rc"
|
|
122
|
+
printf 'alpha fired\n' > "$dir/bad/expect.txt"
|
|
123
|
+
echo "$scratch/no-clean"
|
|
124
|
+
}
|
|
125
|
+
out="$(run_tree "$(mk_no_clean_line)")"; rc=$?
|
|
126
|
+
assert_rc no-clean "$rc" 1
|
|
127
|
+
assert_has no-clean "emitted no '<NAME>: clean" "$out"
|
|
128
|
+
|
|
129
|
+
# The symmetric half: a violating case with no help: remedy line.
|
|
130
|
+
mk_no_help_line() {
|
|
131
|
+
local dir="$scratch/no-help/stub-gate"
|
|
132
|
+
mkdir -p "$dir/good" "$dir/bad"
|
|
133
|
+
printf 'STUB-GATE: clean (stub)\n' > "$dir/good/say"; printf '0\n' > "$dir/good/rc"
|
|
134
|
+
printf 'alpha fired\n' > "$dir/bad/say"; printf '1\n' > "$dir/bad/rc"
|
|
135
|
+
printf 'alpha fired\n' > "$dir/bad/expect.txt"
|
|
136
|
+
echo "$scratch/no-help"
|
|
137
|
+
}
|
|
138
|
+
out="$(run_tree "$(mk_no_help_line)")"; rc=$?
|
|
139
|
+
assert_rc no-help "$rc" 1
|
|
140
|
+
assert_has no-help "no 'help:' remedy line" "$out"
|
|
141
|
+
|
|
142
|
+
[[ "$fails" -eq 0 ]] || { echo "run-gate-tests.test: $fails assertion(s) failed"; exit 1; }
|
|
143
|
+
echo "run-gate-tests.test: clean (expect.txt is a per-line conjunction, order-independent, blanks inert, all missing lines named; the output contract is asserted at runtime on both cases)"
|
|
144
|
+
exit 0
|
|
@@ -1,13 +1,36 @@
|
|
|
1
1
|
# shellcheck shell=bash
|
|
2
2
|
# spec: gate-sdk/SPEC.md §Consumer smoke — the shared scratch-consumer builder both smoke harnesses vendor through (run-consumer-smoke.sh and context-kit/smoke/agents-md.sh)
|
|
3
3
|
|
|
4
|
+
# spec: gate-sdk/SPEC.md §Consumer smoke — csmoke_place_binary: the vendored kit roots' descriptor set decides whether the scratch consumer needs the gate binary, and the invoking repo's already-built artifact is what it receives. Derived, so a kit set with no ported gate asks for nothing.
|
|
5
|
+
csmoke_place_binary() {
|
|
6
|
+
local host bin descriptors=0 r
|
|
7
|
+
host="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
8
|
+
bin="$(gate_native_bin)"
|
|
9
|
+
|
|
10
|
+
shopt -s nullglob
|
|
11
|
+
for r in "$@"; do
|
|
12
|
+
for _ in "$r"/checks/*.gate; do descriptors=$((descriptors + 1)); done
|
|
13
|
+
done
|
|
14
|
+
shopt -u nullglob
|
|
15
|
+
[[ "$descriptors" -gt 0 ]] || return 0
|
|
16
|
+
|
|
17
|
+
[[ -x "$host/$bin" ]] || {
|
|
18
|
+
echo "csmoke: $descriptors vendored .gate descriptor(s) need the gate binary, but $host/$bin is absent or not executable" >&2
|
|
19
|
+
echo " help: build it — cargo build --release --manifest-path native/Cargo.toml — then re-run." >&2
|
|
20
|
+
return 2
|
|
21
|
+
}
|
|
22
|
+
mkdir -p "$SCRATCH/${bin%/*}" || return 2
|
|
23
|
+
cp "$host/$bin" "$SCRATCH/$bin" || return 2
|
|
24
|
+
}
|
|
25
|
+
|
|
4
26
|
# spec: gate-sdk/SPEC.md §Consumer smoke — csmoke_vendor_and_install: from the kit roots (gate-sdk first) sets SCRATCH + CSMOKE_INSTALLED; returns 2 on an environment failure; the caller owns cleanup and every post-baseline assertion
|
|
5
27
|
csmoke_vendor_and_install() {
|
|
6
28
|
local roots=("$@") r kit
|
|
7
29
|
SCRATCH="$(mktemp -d "${TMPDIR:-/tmp}/consumer-smoke.XXXXXX")" || return 2
|
|
8
30
|
|
|
9
31
|
git -C "$SCRATCH" init -q
|
|
10
|
-
|
|
32
|
+
# spec: gate-sdk/SPEC.md §Consumer smoke — the placed binary is ignored rather than tracked: the violation phase restores with `git clean -fd`, which spares ignored paths, so an artifact the tree needs across restores may not be untracked-and-visible
|
|
33
|
+
printf '.tmp/\n%s\n' "$(gate_native_bin)" > "$SCRATCH/.gitignore"
|
|
11
34
|
git -C "$SCRATCH" add -A
|
|
12
35
|
git -C "$SCRATCH" -c user.email=smoke@example.invalid -c user.name=smoke \
|
|
13
36
|
commit -q --allow-empty -m "seed"
|
|
@@ -16,6 +39,8 @@ csmoke_vendor_and_install() {
|
|
|
16
39
|
cp -R "$r" "$SCRATCH/$(basename "$r")"
|
|
17
40
|
done
|
|
18
41
|
|
|
42
|
+
csmoke_place_binary "${roots[@]}" || return 2
|
|
43
|
+
|
|
19
44
|
CSMOKE_INSTALLED=0
|
|
20
45
|
for r in "${roots[@]}"; do
|
|
21
46
|
kit="$(basename "$r")"
|
|
@@ -67,6 +67,7 @@ gates_list_members() {
|
|
|
67
67
|
grep -Ev '^[[:space:]]*(#|$)' "$1" || true
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
# spec: gate-sdk/SPEC.md §lib/gate.sh — resolve a gate name to its *declaration* path: the file whose text carries the `# graph:` manifest and the `# spec:`/`# assertion` directives. Dirs are tried consumer-first and `.sh` beats `.gate` within a dir, so a consumer shadowing a ported gate with its own shell script still wins. A dir carrying both spellings for one name is ambiguous dispatch, caught by check-gate-substrate-parity assertion A rather than silently ordered here.
|
|
70
71
|
gate_resolve() {
|
|
71
72
|
local g="$1" d
|
|
72
73
|
shift
|
|
@@ -75,10 +76,84 @@ gate_resolve() {
|
|
|
75
76
|
printf '%s\n' "$d/$g.sh"
|
|
76
77
|
return 0
|
|
77
78
|
fi
|
|
79
|
+
if [[ -f "$d/$g.gate" ]]; then
|
|
80
|
+
printf '%s\n' "$d/$g.gate"
|
|
81
|
+
return 0
|
|
82
|
+
fi
|
|
78
83
|
done
|
|
79
84
|
return 1
|
|
80
85
|
}
|
|
81
86
|
|
|
87
|
+
# spec: gate-sdk/SPEC.md §lib/gate.sh — resolve a gate name to its *invocation argv*, the execution counterpart of gate_resolve's declaration path: one element `<dir>/<name>.sh` for a shell gate, two elements `<binary> <name>` for a `.gate`-dispatched one. Emits one argv element per line. An absent or non-executable binary when a member dispatches to it is a harness error — exit 2, never a skip and never a pass (§Fail-closed contract): a skip would let the battery silently stop running a gate whenever a build is missing.
|
|
88
|
+
gate_command() {
|
|
89
|
+
local g="$1" d bin
|
|
90
|
+
shift
|
|
91
|
+
for d in "$@"; do
|
|
92
|
+
if [[ -f "$d/$g.sh" ]]; then
|
|
93
|
+
printf '%s\n' "$d/$g.sh"
|
|
94
|
+
return 0
|
|
95
|
+
fi
|
|
96
|
+
if [[ -f "$d/$g.gate" ]]; then
|
|
97
|
+
bin="$(gate_native_bin)"
|
|
98
|
+
if [[ ! -x "$bin" ]]; then
|
|
99
|
+
printf 'gate_command: %s dispatches to the native binary, but %s is ' "$g" "$bin" >&2
|
|
100
|
+
printf 'absent or not executable — the gate could not run; treating as ' >&2
|
|
101
|
+
printf 'failure (not clean). Build it: cargo build --release --manifest-path native/Cargo.toml\n' >&2
|
|
102
|
+
exit 2
|
|
103
|
+
fi
|
|
104
|
+
printf '%s\n%s\n' "$bin" "$g"
|
|
105
|
+
return 0
|
|
106
|
+
fi
|
|
107
|
+
done
|
|
108
|
+
return 1
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
# spec: gate-sdk/SPEC.md §Layout and configuration — the one home of GATE_SDK_NATIVE_BIN's default, so a knob default gains readers without gaining spellings
|
|
112
|
+
gate_native_bin() {
|
|
113
|
+
printf '%s\n' "${GATE_SDK_NATIVE_BIN:-native/target/release/checkwright-gates}"
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
# spec: gate-sdk/SPEC.md §Layout and configuration — the one home of GATE_SDK_NATIVE_CRATE's default, trailing slash stripped, so its three shell readers share a spelling rather than each carrying one
|
|
117
|
+
gate_native_crate() {
|
|
118
|
+
local crate="${GATE_SDK_NATIVE_CRATE:-native}"
|
|
119
|
+
printf '%s\n' "${crate%/}"
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
# spec: gate-sdk/SPEC.md §Layout and configuration — GATE_SDK_NATIVE_TARGETS_FILE, defaulted off GATE_SDK_NATIVE_CRATE so the crate's location keeps one owner
|
|
123
|
+
gate_native_targets_file() {
|
|
124
|
+
local crate
|
|
125
|
+
crate="$(gate_native_crate)"
|
|
126
|
+
printf '%s\n' "${GATE_SDK_NATIVE_TARGETS_FILE:-$crate/targets.list}"
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
# spec: gate-sdk/SPEC.md §check-gate-binary-fresh — the tree side of the source stamp: the same three git invocations native/build.rs bakes into the binary, so the comparison stays one algorithm rather than two implementations of one. Returns 1 emitting nothing when git cannot answer, so a caller fails closed rather than comparing against an empty string.
|
|
130
|
+
gate_native_source_stamp() {
|
|
131
|
+
local crate listing hashed stamp i
|
|
132
|
+
local -a paths=() hashes=()
|
|
133
|
+
crate="$(gate_native_crate)"
|
|
134
|
+
listing="$(git -C "$crate" ls-files 2>/dev/null)" || return 1
|
|
135
|
+
[[ -n "$listing" ]] || return 1
|
|
136
|
+
mapfile -t paths <<<"$listing"
|
|
137
|
+
hashed="$(git -C "$crate" hash-object -- "${paths[@]}" 2>/dev/null)" || return 1
|
|
138
|
+
mapfile -t hashes <<<"$hashed"
|
|
139
|
+
[[ ${#hashes[@]} -eq ${#paths[@]} ]] || return 1
|
|
140
|
+
local manifest=""
|
|
141
|
+
for ((i = 0; i < ${#paths[@]}; i++)); do
|
|
142
|
+
manifest+="${hashes[i]} ${paths[i]}"$'\n'
|
|
143
|
+
done
|
|
144
|
+
stamp="$(printf '%s' "$manifest" | git -C "$crate" hash-object --stdin 2>/dev/null)" || return 1
|
|
145
|
+
[[ -n "$stamp" ]] || return 1
|
|
146
|
+
printf '%s\n' "$stamp"
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
# spec: gate-sdk/SPEC.md §lib/gate.sh — the target roster's single reader; an absent roster returns 1 and emits nothing, so a caller tells "no roster declared" from "a roster declaring nothing" rather than reading both as no targets
|
|
150
|
+
gate_native_targets() {
|
|
151
|
+
local f
|
|
152
|
+
f="$(gate_native_targets_file)"
|
|
153
|
+
[[ -f "$f" ]] || return 1
|
|
154
|
+
gates_list_members "$f"
|
|
155
|
+
}
|
|
156
|
+
|
|
82
157
|
gate_kit_roots() {
|
|
83
158
|
local d kit
|
|
84
159
|
if [[ -n "${GATE_SDK_KIT_DIRS:-}" ]]; then
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# shellcheck shell=bash
|
|
2
|
-
# spec: gate-sdk/SPEC.md §lib/inject.sh — the marker-bounded
|
|
2
|
+
# spec: gate-sdk/SPEC.md §lib/inject.sh — the marker-bounded placement and retrieval shared by every kit's agent-file injector; block-content generation and any preservation rule over the retrieved content stay with the caller
|
|
3
3
|
|
|
4
4
|
# spec: gate-sdk/SPEC.md §lib/inject.sh — inject_marker_block <file> <begin> <end>; inner block content on stdin. Replaces the span between an existing marker pair (inclusive) or appends a fresh block when absent; a begin marker without its end is malformed (exit 2); the file must exist (exit 2). Echoes the action taken (appended|replaced).
|
|
5
5
|
inject_marker_block() {
|
|
@@ -33,3 +33,23 @@ inject_marker_block() {
|
|
|
33
33
|
printf '%s\n' "$action"
|
|
34
34
|
)
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
# spec: gate-sdk/SPEC.md §lib/inject.sh — read_marker_block <file> <begin> <end>; prints the existing block's inner content (markers exclusive) on stdout, nothing (exit 0) when the marker pair is absent; a begin marker without its end is malformed (exit 2), as is a missing file. What a caller preserves out of that content is the caller's rule, never this module's.
|
|
38
|
+
read_marker_block() {
|
|
39
|
+
(
|
|
40
|
+
set -euo pipefail
|
|
41
|
+
file="$1"; begin="$2"; end="$3"
|
|
42
|
+
[[ -f "$file" ]] \
|
|
43
|
+
|| { echo "read_marker_block: target file not found: $file" >&2; exit 2; }
|
|
44
|
+
|
|
45
|
+
grep -qF -- "$begin" "$file" || exit 0
|
|
46
|
+
grep -qF -- "$end" "$file" \
|
|
47
|
+
|| { echo "read_marker_block: begin marker present but end marker missing in $file — refusing to guess the block bounds" >&2; exit 2; }
|
|
48
|
+
|
|
49
|
+
awk -v b="$begin" -v e="$end" '
|
|
50
|
+
$0 == e { inblock = 0; next }
|
|
51
|
+
inblock { print }
|
|
52
|
+
$0 == b { inblock = 1 }
|
|
53
|
+
' "$file"
|
|
54
|
+
)
|
|
55
|
+
}
|
|
@@ -15,16 +15,34 @@ check-gate-fail-closed
|
|
|
15
15
|
check-gate-fixture-coverage
|
|
16
16
|
check-gate-exemption-tasks
|
|
17
17
|
check-gate-assertions
|
|
18
|
+
check-gate-substrate-parity
|
|
18
19
|
check-graph
|
|
19
20
|
check-commit-msg
|
|
20
21
|
check-tree-terms
|
|
22
|
+
check-assertion-strength
|
|
23
|
+
check-commit-subject
|
|
24
|
+
check-core-files
|
|
25
|
+
check-exec-bit
|
|
26
|
+
check-hook-exec-bit
|
|
27
|
+
check-identity
|
|
28
|
+
check-kit-enum
|
|
29
|
+
check-readme-roster
|
|
30
|
+
check-reads-couples
|
|
31
|
+
check-smoke-entry-guard
|
|
32
|
+
check-template-copy-parity
|
|
33
|
+
check-template-registry-parity
|
|
34
|
+
check-test-hermetic
|
|
35
|
+
check-workflow-tiering
|
|
21
36
|
EOF
|
|
22
37
|
|
|
38
|
+
# smoke-unregistered: check-root-tiering — its subject is the consumer-curated root manifest GATE_SDK_ROOT_ALLOWLIST (default scripts/root-allowlist.list), which no kit install can author: the vendored root set is per-adoption and gate-sdk installs first, before that set exists
|
|
39
|
+
# spec: gate-sdk/SPEC.md §Consumer smoke — check-gate-binary-fresh is deliberately NOT registered here and deliberately carries no declaration: its subject is the crate the binary was built from, GATE_SDK_NATIVE_CRATE is kept outside every kit root by design, so the probe derives the exemption every run and a written reason would be the inversion the accounting refuses
|
|
40
|
+
|
|
23
41
|
# spec: gate-sdk/SPEC.md §Consumer smoke — ship the tracked default pattern list; the local companion is absent, exercising the fresh-clone path
|
|
24
42
|
cp "$SDK/templates/msg-patterns.list" scripts/msg-patterns.list
|
|
25
43
|
|
|
26
44
|
bash "$SDK/bin/gen-pre-commit.sh" --write >/dev/null
|
|
27
|
-
bash "$SDK/checks/check-graph.sh" --emit >
|
|
45
|
+
bash "$SDK/checks/check-graph.sh" --emit > scripts/CHECK-GRAPH.html
|
|
28
46
|
|
|
29
47
|
# spec: gate-sdk/SPEC.md §run-gates — quiet green, loud red: green is one summary line, red prints verbatim, GATE_SDK_VERBOSE restores the banner roll
|
|
30
48
|
q="$PWD/.tmp/quiet-smoke"
|