beads/scripts/conformance.sh
Test User 6fd9dbda7d refactor(storage)!: remove the SQLite backend and dialect
Extend #4847's rollback to the last alternative backend: bd now ships a
single storage engine (Dolt, embedded and server mode).

- Delete internal/storage/{sqlite,sqlitedialect} and the packages the
  removal orphans: sqlkit (sole importer was the sqlite store),
  unsupportedgen (sole go:generate consumer), the NonCommitGraphBackend
  marker and its two dead consumer checks, and the domain-db parity test
  that used sqlite as its harness. Drop modernc.org/sqlite from go.mod
  and regenerate the nix vendorHash.
- Tombstone backend="sqlite" exactly like postgres/mysql: recognized in
  metadata (never silently aliased to a fresh Dolt DB), rejected before
  any open with its own rationale and the export -> re-init -> import
  guidance. The fail-closed guarantee now also covers never creating the
  beads.db file the removed backend would have provisioned.
- bd init: --backend=sqlite reaches removed-backend guidance;
  --sqlite-path becomes a hidden parser tombstone like the pg/mysql
  flags; help text and supported-backend enumerations say Dolt only.
- Doctor: sqlite workspaces fail closed like the other tombstones; the
  modern sqlite stub payloads are gone. The legacy pre-Dolt surface
  (artifact scans, migration validation, migrate-sqlite-to-current.sh,
  the migration-test harness) is untouched; genuine pre-Dolt workspaces
  carry no backend field and never hit the tombstone.
- Conformance: drop the sqlite profile; the CLI differential runner
  idles (skip, not fail) until another backend profile is registered,
  and the export/import round-trip keeps running against the embedded
  Dolt reference. Tier-1 oracle legs are unchanged.

Backend selection has never shipped in a release (v1.1.0 predates it),
so released workflows are unaffected and the pinned CLI docs already
describe the resulting behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 02:43:56 +00:00

48 lines
2.3 KiB
Bash
Executable file

#!/usr/bin/env bash
#
# Single conformance entrypoint. CI runs this verbatim; run it locally the same way:
#
# ./scripts/conformance.sh
#
# Two tiers exercise the storage conformance contract: the in-process storage
# corpus against the embedded-Dolt oracle, then the real-binary CLI corpus.
#
set -euo pipefail
cd "$(dirname "$0")/.."
TAGS="gms_pure_go"
# assert_conformance_passed LOGFILE LABEL
# Fail the gate unless the top-level TestConformance in LOGFILE ran and PASSED. The
# checks MUST anchor to column-0 result lines: `go test -v` indents subtest results, and
# RunAll legitimately skips backend-inapplicable subtests (e.g. Claim concurrency on the
# single-writer embedded-Dolt reference), so an unanchored `--- SKIP: TestConformance`
# grep would match an indented subtest and false-fail the gate even though the top-level
# suite passed. Deletes LOGFILE either way.
assert_conformance_passed() {
local log="$1" label="$2"
if grep -qE '^--- SKIP: TestConformance' "$log" || ! grep -qE '^--- PASS: TestConformance' "$log"; then
rm -f "$log"
echo "FATAL: $label conformance (top-level TestConformance) skipped or did not run; storage-parity gate is not enforced" >&2
exit 1
fi
rm -f "$log"
}
echo "==> Tier 1: in-process store conformance + wedge gates"
# The embedded-Dolt backend runs the full backend-agnostic suite (conformance.RunAll) as
# the reference oracle any future backend is compared against. BEADS_TEST_EMBEDDED_DOLT=1
# is REQUIRED, not optional: without it that suite self-skips
# (internal/storage/embeddeddolt/conformance_test.go), which would let this whole
# storage-parity gate report success while never running the oracle. Run it with -v and
# fail loudly if the top-level TestConformance skips or reports no pass, so the gate can
# never go green on a silent skip.
# (assert_conformance_passed explains why the skip/pass checks anchor to column-0 lines.)
embedded_dolt_log="$(mktemp)"
BEADS_TEST_EMBEDDED_DOLT=1 CGO_ENABLED=1 go test -tags "$TAGS" -v \
./internal/storage/embeddeddolt/ -run TestConformance | tee "$embedded_dolt_log"
assert_conformance_passed "$embedded_dolt_log" "embedded-Dolt reference (need BEADS_TEST_EMBEDDED_DOLT=1)"
echo "==> Tier 2: end-to-end 'bd init' + CLI conformance (reference round-trip)"
CGO_ENABLED=1 go test -tags "$TAGS e2e" ./test/conformance/
echo "==> conformance OK"