From 5c12d9bb79b4c2ad70c7e6095db9b08e1f25a165 Mon Sep 17 00:00:00 2001 From: mptyl Date: Sat, 8 Aug 2026 21:22:51 +0200 Subject: [PATCH] test: align semantic index doc verifier --- .../task-11-report.md | 30 +++++++++++++++++ scripts/test-verify-workspace-install-docs.sh | 33 ++++++++++++++++++- scripts/verify-workspace-install-docs.sh | 12 +++++-- 3 files changed, 71 insertions(+), 4 deletions(-) diff --git a/.superpowers/sdd/2026-08-08-internal-qdrant-ollama/task-11-report.md b/.superpowers/sdd/2026-08-08-internal-qdrant-ollama/task-11-report.md index 38ad3124..b9c381de 100644 --- a/.superpowers/sdd/2026-08-08-internal-qdrant-ollama/task-11-report.md +++ b/.superpowers/sdd/2026-08-08-internal-qdrant-ollama/task-11-report.md @@ -115,6 +115,36 @@ Evidence: git diff --check ``` +## Fix round 4/5 — 2026-08-08 + +Addressed reviewer finding: + +- Eliminated semantic-index verifier/test contract drift by extracting the production + semantic-index ownership row matcher into `semantic_index_relationship_spec` and reusing it in + the fixture-level paraphrase, omission, and scattered-token checks. +- Kept the relationship constrained to one structured Markdown table row via + `verify_markdown_table_relationships`; the scattered-token fixture still removes the row and + appends the same words outside the table, where it must be rejected. +- Added a direct regression that copies the repository docs into an isolated root, applies the + accepted paraphrase “A workspace keeps exactly one Qdrant collection reserved for itself”, and + runs that root's actual `scripts/verify-workspace-install-docs.sh --fixtures-only` instead of a + separate temporary spec. + +Observed RED before the fix: + +```text +production verifier rejected the accepted semantic-index paraphrase +local workspace manual: missing relationship in 'Semantic index ownership contract': {'scope': 'workspace semantic index', 'ownership rule': '(each|one|single).*(workspace).*(single|one).*(Qdrant).*(collection)|(each workspace reserves a single qdrant collection)', 'isolation rule': 'schema.*evidence.*memory.*(one|that).*(collection).*(kind|payload)'} +``` + +Evidence: + +```sh +./scripts/test-verify-workspace-install-docs.sh +./scripts/verify-workspace-install-docs.sh --fixtures-only +git diff --check +``` + Observed RED during this round: ```text diff --git a/scripts/test-verify-workspace-install-docs.sh b/scripts/test-verify-workspace-install-docs.sh index 9430229e..9177479c 100755 --- a/scripts/test-verify-workspace-install-docs.sh +++ b/scripts/test-verify-workspace-install-docs.sh @@ -234,9 +234,40 @@ text = text.replace( ) path.write_text(text) PY -semantic_index_spec='{"rows":[{"scope":"workspace semantic index","ownership rule":"(each|one|single|exactly one).*(workspace).*(single|one|exactly one).*(Qdrant).*(collection)|(workspace keeps exactly one qdrant collection reserved for itself)","isolation rule":"schema.*evidence.*memory.*(one|that).*(collection).*(kind|payload)|schema.*evidence.*memory.*together.*collection.*(kind|payload)"}]}' +semantic_index_spec="$(semantic_index_relationship_spec)" verify_markdown_table_relationships "$local_manual_paraphrase" "local manual paraphrase" "Semantic index ownership contract" "$semantic_index_spec" >/dev/null +production_paraphrase_root="$negative_root/production-paraphrase-root" +mkdir -p "$production_paraphrase_root" +rsync -a \ + --exclude '.git' \ + --exclude '.pytest_cache' \ + --exclude 'node_modules' \ + --exclude 'backend/node_modules' \ + --exclude 'frontend/node_modules' \ + --exclude 'harness/.venv' \ + "$root/" "$production_paraphrase_root/" +python3 - "$production_paraphrase_root/docs/install/local-workspace-registry.md" <<'PY' +import pathlib, sys +path = pathlib.Path(sys.argv[1]) +text = path.read_text() +text = text.replace( + "| Workspace semantic index | Each workspace reserves a single Qdrant collection. | Schema, Evidence, and Memory stay in that one collection and remain isolated by payload `kind`. |", + "| Workspace semantic index | A workspace keeps exactly one Qdrant collection reserved for itself. | Schema, Evidence, and Memory remain together in that collection and are still separated by payload `kind`. |", +) +path.write_text(text) +PY +set +e +"$production_paraphrase_root/scripts/verify-workspace-install-docs.sh" --fixtures-only \ + >"$workspace_output" 2>&1 +workspace_status=$? +set -e +if [[ $workspace_status -ne 0 ]]; then + echo "production verifier rejected the accepted semantic-index paraphrase" >&2 + cat "$workspace_output" >&2 + exit 1 +fi + local_manual_missing="$negative_root/local-manual-missing.md" cp "$root/docs/install/local-workspace-registry.md" "$local_manual_missing" python3 - "$local_manual_missing" <<'PY' diff --git a/scripts/verify-workspace-install-docs.sh b/scripts/verify-workspace-install-docs.sh index 6fc3e80a..0abd9c1c 100755 --- a/scripts/verify-workspace-install-docs.sh +++ b/scripts/verify-workspace-install-docs.sh @@ -155,6 +155,14 @@ for row_spec in spec["rows"]: PY } +semantic_index_relationship_spec() { + cat <<'JSON' +{"rows":[ + {"scope":"workspace semantic index","ownership rule":"(each|one|single|exactly one).*(workspace).*(single|one|exactly one).*(Qdrant).*(collection)|(workspace keeps exactly one qdrant collection reserved for itself)","isolation rule":"schema.*evidence.*memory.*(one|that).*(collection).*(kind|payload)|schema.*evidence.*memory.*together.*collection.*(kind|payload)"} +]} +JSON +} + verify_compose_internal_semantic_contract() { python3 - "$root/compose.yaml" <<'PY' import sys, yaml, pathlib @@ -308,9 +316,7 @@ verify_internal_semantic_infrastructure_docs() { {"component":"^Qdrant$","ownership":"^Internal$","operator contract":"internal|Compose|qdrant-data"}, {"component":"^Ollama embedding$","ownership":"^Internal$","operator contract":"internal|Compose|qwen3-embedding:0\\.6b"} ]}' - semantic_index_spec='{"rows":[ - {"scope":"workspace semantic index","ownership rule":"(each|one|single).*(workspace).*(single|one).*(Qdrant).*(collection)|(each workspace reserves a single qdrant collection)","isolation rule":"schema.*evidence.*memory.*(one|that).*(collection).*(kind|payload)"} - ]}' + semantic_index_spec="$(semantic_index_relationship_spec)" compact_spec='{"rows":[ {"componente":"^DWH$","ownership":"^Esterno$","contratto operativo":"endpoint.*estern"}, {"componente":"^LLM$","ownership":"^Esterno$","contratto operativo":"esterna|esterno"},