feat: adopt local SQLite engineering memory and quality gates
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
binary=${1:?Usage: native-sqlite-smoke.sh /absolute/package/ai-engineering}
|
||||
source_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)
|
||||
fixture=$(mktemp -d "${TMPDIR:-/tmp}/aie-sqlite-smoke.XXXXXXXX")
|
||||
trap 'rm -rf "$fixture"' EXIT
|
||||
mkdir "$fixture/local"
|
||||
cd "$fixture/local"
|
||||
run() { PATH="$fixture/no-tools" "$binary" "$@"; }
|
||||
run init --name 'Local memory' > init.yaml
|
||||
test -f .ai-engineering/aie.db
|
||||
grep -q '/.ai-engineering/' .gitignore
|
||||
printf 'Source evaluated by the fixture\n' > source.txt
|
||||
run work create 'Deliver' --goal 'Preserve quality' --acceptance 'Observed check' \
|
||||
--mode EXPLORATORY --human-approved --choice-reason 'Explicit synthetic human choice' --author fixture-owner > work.yaml
|
||||
run discussion add WRK-0001 --text 'Investigação — preservar contexto' --author fixture-owner > note.yaml
|
||||
run work request-decision WRK-0001 --by fixture-owner --reason 'Exploration ended in this fixture' --human-approved > request.yaml
|
||||
run decision draft WRK-0001 --title 'Approach' --context 'Observed facts' --approach 'Small change' --rationale 'Bounded' > decision.yaml
|
||||
run decision accept WRK-0001 DEC-0001 --by fixture-owner --reason 'Reviewed fixture DEC' --human-approved > accepted.yaml
|
||||
run plan create WRK-0001 --title 'Deliver' --decision DEC-0001 > plan.yaml
|
||||
run plan step add WRK-0001 PLN-0001 --title 'Check result' > step.yaml
|
||||
run gate configure quality --title 'Project quality' --procedure 'Review source.txt' --input source.txt --require-evidence --by fixture-owner > gate.yaml
|
||||
run artifact add WRK-0001 --file source.txt --purpose 'Temporary evaluated input' > evidence.yaml
|
||||
run plan step status WRK-0001 PLN-0001 TSK-0001 COMPLETED --by fixture --reason 'Observed synthetic result' --evidence ART-0001 > finished-step.yaml
|
||||
run work show WRK-0001 --format json > pending.json
|
||||
if grep -q '"status" : "COMPLETED"' pending.json; then echo 'Pending gate did not block delivery' >&2; exit 1; fi
|
||||
test -f .ai-engineering/works/WRK-0001-deliver/artifacts/evidence/ART-0001/payload
|
||||
run gate status WRK-0001 --format json > gate-status.json
|
||||
fingerprint=$(python3 -c 'import json; print(json.load(open("gate-status.json"))[0]["evaluatedHash"])')
|
||||
run gate record WRK-0001 project/quality --expect "$fingerprint" --invocation 'Review source.txt' \
|
||||
--outcome PASS --summary 'Synthetic observed evaluation' --evidence ART-0001 --by fixture --observed > result.yaml
|
||||
run work context WRK-0001 --format json > context.json
|
||||
grep -q '"status" : "COMPLETED"' context.json
|
||||
grep -q 'DISCARDED' context.json
|
||||
test ! -f .ai-engineering/works/WRK-0001-deliver/work.md
|
||||
test ! -f .ai-engineering/works/WRK-0001-deliver/artifacts/evidence/ART-0001/payload
|
||||
test -f source.txt
|
||||
run project validate > validation.yaml
|
||||
run work reopen WRK-0001 --by fixture-owner --reason 'New observation' > reopened.yaml
|
||||
if run gate record WRK-0001 project/quality --expect "$fingerprint" --invocation 'Review source.txt' \
|
||||
--outcome PASS --summary 'Invalid retired reuse' --evidence ART-0001 --by fixture --observed > retired-error.txt 2>&1; then
|
||||
echo 'Retired input unexpectedly accepted' >&2; exit 1
|
||||
fi
|
||||
mkdir "$fixture/legacy"
|
||||
cd "$fixture/legacy"
|
||||
run init --storage legacy --name 'Migration fixture' > init.yaml
|
||||
run work create 'Delivered baseline' > work.yaml
|
||||
cp -R "$source_root/src/test/resources/compatibility/baseline-v1/.ai-engineering/." .ai-engineering/
|
||||
run storage migrate --format json > preview.json
|
||||
fingerprint=$(python3 -c 'import json; print(json.load(open("preview.json"))["fingerprint"])')
|
||||
run storage migrate --apply --expect "$fingerprint" --format json > migrated.json
|
||||
run project validate > validation.yaml
|
||||
run work context WRK-0001 --format json > context.json
|
||||
grep -q '72d5803add0b8714d7dc4bf7e63ad55cc3259df910aa8b03790657eac4c2bd02' context.json
|
||||
run storage migrate --apply --expect "$fingerprint" --format json > repeated.json
|
||||
grep -q 'APPLIED' repeated.json
|
||||
echo 'Native SQLite lifecycle, gates and legacy migration smoke passed.'
|
||||
Reference in New Issue
Block a user