#!/usr/bin/env bash # The C2a format gate: a reader from before element ids must refuse what C2a writes, and a store the 1.0.60 writer made must # open alike at 2.0.1 and at the tree under test. Each old revision is a resolved SHA with its tag beside it, because the # verification clone holds ancestors, not tags; an environment variable overrides each. # # C# OLD_READER_REV_CSHARP b8fc5eb0 cultlib-unity-v2.0.1 # TypeScript, OLD_READER_REV_LEAF 02cf04b5 cultcache-rs-v0.3.1 (the whole-store writer fix; no cultcache-ts tag carries it) # Python, Rust # 1.0.60 writer OLD_WRITER_REV 45c2f400 cultlib-unity-v1.0.60 # # old-reader-refusal.sh stage csharp|typescript|python|rust|writer # Run in a CultLib clone. Commits the old revision plus the C2a-written vectors and that runtime's probes onto a scratch # ref and prints its SHA. The tree at that SHA is the old code with extra tests ("writer" is the 1.0.60 writer). # old-reader-refusal.sh probe csharp|typescript|python|rust|writer # Run at the root of a staged tree, with the runtime's toolchain on PATH. Exit status zero means every probe passed; the # refusal messages are printed. # old-reader-refusal.sh gate csharp|typescript|python|rust # Run in a CultLib clone at the revision under test: stage, then probe. For csharp, C2aGateWriter first writes the live # v3 and v5 stores into $GATE_OUT (default /tmp/gate) and the 2.0.1 probes read them beside the committed vectors; the # 1.0.60 writer then writes a ref-list store there, 2.0.1 and the tree under test both open it, write the same documents # back and reread the file, and their REFLIST-SUMMARY lines (records by schema id, the list's items in order, the Items # slot's catalog entry, warnings, header) must be identical. # # Every stage asserts how many cases it PASSED, so a probe that was renamed out of its filter or a leaf test that was skipped # fails the gate by name ('-count') instead of passing with nothing run; a C# result that is not Passed (an [Ignore]d # case is NotExecuted) fails '-notpassed' and Python's skipped/expected-failure forms fail 'python-notpassed'. The expected counts are the constants below; # each is confirmed against the probe's source: C#, the Passed results in the TRX the run wrote (by class); Rust, the sum of 'N passed'; # Python, 'Ran N tests'; TypeScript, node's 'pass N'. Each stage also counts the refusal lines it printed (EXPECT_REFUSED_*). set -euo pipefail here="tests/vectors/document-variants-c2a" self="$(cd "$(dirname "$0")" && pwd)/$(basename "$0")" OLD_READER_REV_CSHARP="${OLD_READER_REV_CSHARP:-b8fc5eb0}" # cultlib-unity-v2.0.1 OLD_READER_REV_LEAF="${OLD_READER_REV_LEAF:-02cf04b5}" # cultcache-rs-v0.3.1 OLD_WRITER_REV="${OLD_WRITER_REV:-45c2f400}" # cultlib-unity-v1.0.60 EXPECT_C2A_WRITER=2 # C2aGateWriter: C2aStamps..., TheCommittedVectorsAreWhatC2aWrites EXPECT_READER_GATE=10 # OldReaderGateProbe: five TestCaseSource tests, each over the committed and the live store EXPECT_READER_REFLIST=1 # OldReaderRefListProbe EXPECT_OLD_WRITER=1 # OldWriterRefListProbe EXPECT_HEAD_REFLIST=1 # RefListDriftTests.A_1_0_60_Written_Store_Opens_Like_2_0_1 EXPECT_RUST=3 # tests/old_reader_v3.rs EXPECT_PYTHON=4 # test_old_reader_v3.py EXPECT_TYPESCRIPT=3 # old-reader-v3.test.ts # Refusals each stage must PRINT: every probe writes one 'OLD-READER refused