From d4818c8cc33b8b11204377ff3cc65c6c9ee1425e Mon Sep 17 00:00:00 2001 From: mptyl Date: Tue, 25 Aug 2026 02:43:01 +0200 Subject: [PATCH] docs(evidence): narrow owner gate baseline --- PROJECT_STATE.md | 10 ++-- docs/testing/evidence-restructuring-manual.md | 56 +++++++++++++------ .../test_evidence_restructuring_fixture.py | 17 ++++++ 3 files changed, 63 insertions(+), 20 deletions(-) diff --git a/PROJECT_STATE.md b/PROJECT_STATE.md index 3917a5e8..83a592d9 100644 --- a/PROJECT_STATE.md +++ b/PROJECT_STATE.md @@ -7,10 +7,12 @@ known pytest deprecation warning**. The probe used only a `mktemp` workspace, confirmed the ThothII worktree status was unchanged, and did not read or write an external PSD authoring path. - **Read-only owner-gate package:** authorized inspection of the clean PSD repository at - `47516f85b4db4a67cfa8a86cea4cb2e7b98c5813` recorded the exact 36-source inventory and the - legacy `psd-clinical` Qdrant baseline (163 schema tables, 2,275 schema columns, 2 memory, 1 - solved question) in `docs/testing/evidence-restructuring-manual.md`. The before/after Git - status remained clean; no secret was read and no external repository mutation occurred. + `47516f85b4db4a67cfa8a86cea4cb2e7b98c5813` recorded 35 moveable source documents plus the + retained `evidence/README.md` (36 current evidence files total), and the legacy `psd-clinical` + Qdrant baseline (163 schema tables, 2,275 schema columns, 2 memory, 1 solved question) in + `docs/testing/evidence-restructuring-manual.md`. The counts and representative IDs now come + only from exact filtered counts and three-ID, no-payload/no-vector scrolls. The before/after + Git status remained clean; no secret was read and no external repository mutation occurred. - **Scope boundary:** the real Pi call, PSD migration, Git review, authoritative pre/post vector inspection, activation, and human walkthrough remain **PENDING in issue #47** until the owner authorizes the migration window and exact target branch. No PSD migration is represented by diff --git a/docs/testing/evidence-restructuring-manual.md b/docs/testing/evidence-restructuring-manual.md index 0442069e..54ec3368 100644 --- a/docs/testing/evidence-restructuring-manual.md +++ b/docs/testing/evidence-restructuring-manual.md @@ -34,14 +34,17 @@ Read-only snapshot collected 2026-08-25: `47516f85b4db4a67cfa8a86cea4cb2e7b98c5813`. - proposed PSD branch name: `codex/evidence-restructuring-psd` (proposal only; no external branch has been created); -- rollback command for the owner to use only if the later authorized migration must be - undone: +- rollback command for the owner to use only if a later authorized migration must be + undone. It restores the PSD worktree to this pre-migration commit and was not run by + this task: ```bash git -C /Users/mp/projects/tht-workspace-psd reset --hard 47516f85b4db4a67cfa8a86cea4cb2e7b98c5813 ``` -- exact source inventory (36 files; `evidence/README.md` is not a source): +- exact migration inventory: **35 moveable source documents** listed below, plus the + retained `psd-clinical/evidence/README.md` (36 current evidence files total). The + README is not a source document and must remain at `psd-clinical/evidence/README.md`: ```text psd-clinical/evidence/00-glossario/coorti-universi-pazienti.md @@ -81,9 +84,12 @@ Read-only snapshot collected 2026-08-25: psd-clinical/evidence/50-metadati-normalizzazione/normalizzazione-device-cied.md ``` -The read-only Qdrant observation for the `psd-clinical` collection on the legacy PSD -bind `127.0.0.1:6333` was 163 `schema_table`, 2,275 `schema_column`, 2 `memory`, and -1 `solved_question` point. Representative IDs are: +The earlier full-payload scroll is out-of-scope and is not evidence for this package; +it must not be repeated. The replacement read-only baseline for the `psd-clinical` +collection on the legacy PSD bind `127.0.0.1:6333` used exact filtered counts and +three-ID filtered scrolls only, with `with_payload:false` and `with_vector:false`. +It observed 163 `schema_table`, 2,275 `schema_column`, 2 `memory`, and 1 +`solved_question` point. Representative IDs are: | Kind | Sample IDs | | --- | --- | @@ -94,20 +100,36 @@ bind `127.0.0.1:6333` was 163 `schema_table`, 2,275 `schema_column`, 2 `memory`, `tht ... workspace vector inspect --json` was attempted read-only but was blocked by the local maintenance image's missing production `auth.yaml` / `AUTH_MODE=upstream`. -The counts above therefore come from the Qdrant read-only scroll endpoint and must be +The narrow Qdrant baseline is a provisional owner-gate observation and must be repeated through the successful `vector inspect` command immediately before the future authorized preprocessing action. No secret was read to bypass that guard. ### Reproducible no-write record -The inspection used only these read operations; `git status --porcelain` was empty both -before and after, and `git diff --quiet` succeeded after: +The replacement inspection used only these read operations; `git status --porcelain` +was empty both before and after, and `git diff --quiet` succeeded after. Each Qdrant +count request carries only the `record_kind` filter and `exact:true`; each scroll +request returns at most three point IDs, never payloads or vectors: ```bash git -C /Users/mp/projects/tht-workspace-psd rev-parse HEAD git -C /Users/mp/projects/tht-workspace-psd status --porcelain git -C /Users/mp/projects/tht-workspace-psd ls-tree -r --name-only HEAD -- psd-clinical/evidence -node -e 'fetch("http://127.0.0.1:6333/collections/psd-clinical/points/scroll", {method:"POST", headers:{"content-type":"application/json"}, body:JSON.stringify({limit:4096,with_payload:true,with_vector:false})}).then(r => r.json()).then(x => console.log(x.result.points.length))' +node <<'NODE' +const endpoint = "http://127.0.0.1:6333/collections/psd-clinical/points"; +const kinds = ["schema_table", "schema_column", "memory", "solved_question"]; +const post = (path, body) => fetch(endpoint + path, { + method: "POST", headers: {"content-type": "application/json"}, body: JSON.stringify(body), +}).then((response) => response.json()); +for (const kind of kinds) { + const filter = {must: [{key: "record_kind", match: {value: kind}}]}; + const count = await post("/count", {filter, exact: true}); + const sample = await post("/scroll", { + filter, limit: 3, with_payload: false, with_vector: false, + }); + console.log(kind, count.result.count, sample.result.points.map((point) => point.id)); +} +NODE git -C /Users/mp/projects/tht-workspace-psd diff --quiet ``` @@ -120,12 +142,14 @@ external mutations and manual acceptance. Record a separate PASS/FAIL and evidence for each item; never substitute an automated test for a human Git review. -1. **Authoring and Git review.** In the authorized PSD clone, move only the approved - 36 source paths to `evidence/source/`, run `tht evidence prepare`, verify exactly - one no-tool/no-session Pi call per changed source, inspect the Git diff, correct - every `review_item`, run `tht evidence validate`, and obtain the normal human Git - review. Confirm source renames/reclassifications retain IDs, semantic splits receive - new IDs, IDs use `evidence:`, and no orphan is deleted automatically. +1. **Authoring and Git review.** In the authorized PSD clone, move exactly those 35 + listed source documents to `evidence/source/`; retain + `psd-clinical/evidence/README.md` at its current path. Run `tht evidence prepare`, + verify exactly one no-tool/no-session Pi call per changed source, inspect the Git + diff, correct every `review_item`, run `tht evidence validate`, and obtain the + normal human Git review. Confirm source renames/reclassifications retain IDs, + semantic splits receive new IDs, IDs use `evidence:`, and no orphan is deleted + automatically. 2. **Additive BM25 schema upgrade.** Before preprocessing, run vector inspect and save configuration, counts, and IDs. Run `workspace preprocess evidence`; verify the unnamed dense vector remains and only `bm25` with IDF is added. Do not accept a diff --git a/harness/tests/test_evidence_restructuring_fixture.py b/harness/tests/test_evidence_restructuring_fixture.py index 6816a6e2..052f7f4d 100644 --- a/harness/tests/test_evidence_restructuring_fixture.py +++ b/harness/tests/test_evidence_restructuring_fixture.py @@ -21,3 +21,20 @@ def test_acceptance_runner_includes_the_integrated_candidate_publication_gate(): runner = Path(__file__).parents[2] / "scripts" / "evidence-restructuring-acceptance.sh" assert "test_evidence_candidate_publication.py" in runner.read_text(encoding="utf-8") + + +def test_owner_gate_manual_records_the_narrow_inventory_and_qdrant_baseline_protocol(): + manual = Path(__file__).parents[2] / "docs" / "testing" / "evidence-restructuring-manual.md" + + text = manual.read_text(encoding="utf-8") + normalized = " ".join(text.split()) + + assert "35 moveable source documents" in text + assert "retained `psd-clinical/evidence/README.md`" in text + inventory = text.split("README is not a source document and must remain", 1)[1] + inventory = inventory.split("```text", 1)[1].split("```", 1)[0] + assert sum(line.strip().endswith(".md") for line in inventory.splitlines()) == 35 + assert "move exactly those 35 listed source documents" in normalized + assert "with_payload:false" in text + assert "with_payload:true" not in text + assert "must be repeated through the successful `vector inspect` command" in normalized