|
| 1 | +#!/usr/bin/env bash |
| 2 | +# test.sh — drift-guard for selective git auto-tag (#85). |
| 3 | +# |
| 4 | +# #85 adds selective git-tag automation at two IDD milestones: |
| 5 | +# - idd-issue creates `idd-{N}-baseline` (main HEAD at issue-open = rollback anchor) |
| 6 | +# - idd-verify creates `idd-{N}-verified` on Aggregate PASS (review snapshot) |
| 7 | +# opt-out via config `auto_tag.enabled`, idempotent, graceful-skip on push failure. |
| 8 | +# |
| 9 | +# WHY A CONTENT DRIFT-GUARD: the tag behaviors live in prose SKILL.md files |
| 10 | +# (idd-issue Step 0/creation, idd-verify Aggregate-PASS branch) + a config schema |
| 11 | +# (config-protocol.md) — AI prompts, not executable code. The falsifiable |
| 12 | +# equivalent is asserting each file encodes the tag contract. The schema is |
| 13 | +# documented across files that MUST agree; the failure mode is DRIFT (rename a |
| 14 | +# format key in the schema, forget the SKILL that references it). Needles below |
| 15 | +# are distinctive to #85 (0-occurrence before the change), so each is a genuine |
| 16 | +# drift signal. |
| 17 | +# |
| 18 | +# Usage: bash test.sh (exit 0 = all pass, 1 = any fail) |
| 19 | + |
| 20 | +set -u |
| 21 | + |
| 22 | +HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 23 | +PLUGIN_ROOT="$HERE/../../.." |
| 24 | +PROTOCOL="$PLUGIN_ROOT/references/config-protocol.md" |
| 25 | +ISSUE="$PLUGIN_ROOT/skills/idd-issue/SKILL.md" |
| 26 | +VERIFY="$PLUGIN_ROOT/skills/idd-verify/SKILL.md" |
| 27 | +README="$PLUGIN_ROOT/README.md" |
| 28 | + |
| 29 | +HELPERS="$HERE/../../lib/assert-helpers.sh" |
| 30 | +[ -f "$HELPERS" ] || { echo "✗ missing $HELPERS — cannot run suite" >&2; exit 1; } |
| 31 | +. "$HELPERS" |
| 32 | + |
| 33 | +assert_file_exists "config-protocol.md exists" "$PROTOCOL" |
| 34 | +assert_file_exists "idd-issue SKILL.md exists" "$ISSUE" |
| 35 | +assert_file_exists "idd-verify SKILL.md exists" "$VERIFY" |
| 36 | +assert_file_exists "plugin README.md exists" "$README" |
| 37 | + |
| 38 | +# ── config-protocol.md: the auto_tag schema (source of truth) ── |
| 39 | +assert_output_grep "protocol: declares the auto_tag field section" "### \`auto_tag\` field" "$PROTOCOL" |
| 40 | +assert_output_grep "protocol: auto_tag config key" "auto_tag" "$PROTOCOL" |
| 41 | +assert_output_grep "protocol: enabled key (default-on / opt-out)" "enabled" "$PROTOCOL" |
| 42 | +assert_output_grep "protocol: baseline_format key" "baseline_format" "$PROTOCOL" |
| 43 | +assert_output_grep "protocol: verified_format key" "verified_format" "$PROTOCOL" |
| 44 | +assert_output_grep "protocol: push_remote key" "push_remote" "$PROTOCOL" |
| 45 | +assert_output_grep "protocol: baseline tag naming default" "idd-{N}-baseline" "$PROTOCOL" |
| 46 | +assert_output_grep "protocol: verified tag naming default" "idd-{N}-verified" "$PROTOCOL" |
| 47 | +# default-ON must be explicit + opt-out documented (user decision 2026-07-09) |
| 48 | +assert_output_grep "protocol: default-on documented" "default" "$PROTOCOL" |
| 49 | +assert_output_grep "protocol: opt-out documented" "enabled: false" "$PROTOCOL" |
| 50 | +# tag push is a repo-wide side effect — must be surfaced so default-on isn't a surprise |
| 51 | +assert_output_grep "protocol: push side-effect surfaced" "side effect" "$PROTOCOL" |
| 52 | + |
| 53 | +# ── idd-issue: baseline tag after issue creation ── |
| 54 | +assert_output_grep "idd-issue: tag_baseline bootstrap step" "tag_baseline" "$ISSUE" |
| 55 | +assert_output_grep "idd-issue: baseline tag naming" "idd-{N}-baseline" "$ISSUE" |
| 56 | +assert_output_grep "idd-issue: gated on auto_tag config" "auto_tag" "$ISSUE" |
| 57 | +assert_output_grep "idd-issue: idempotent (tag exists → skip)" "idempotent" "$ISSUE" |
| 58 | +assert_output_grep "idd-issue: graceful-skip on push failure" "graceful-skip" "$ISSUE" |
| 59 | +# never abort the workflow on tag failure (warn-continue discipline) |
| 60 | +assert_output_grep "idd-issue: tag failure never aborts" "never abort" "$ISSUE" |
| 61 | + |
| 62 | +# ── idd-verify: verified tag on Aggregate PASS ── |
| 63 | +assert_output_grep "idd-verify: tag_verified bootstrap step" "tag_verified" "$VERIFY" |
| 64 | +assert_output_grep "idd-verify: verified tag naming" "idd-{N}-verified" "$VERIFY" |
| 65 | +assert_output_grep "idd-verify: gated on auto_tag config" "auto_tag" "$VERIFY" |
| 66 | +assert_output_grep "idd-verify: fires on Aggregate PASS" "Aggregate PASS" "$VERIFY" |
| 67 | + |
| 68 | +# ── README: discoverability note ── |
| 69 | +assert_output_grep "README: auto-tag convention documented" "auto_tag" "$README" |
| 70 | +assert_output_grep "README: baseline/verified naming shown" "idd-{N}-baseline" "$README" |
| 71 | + |
| 72 | +print_summary "auto-tag (#85)" |
0 commit comments