Frontmatter
| title | fix(memory-core): add Chroma vector coverage audit (#13503) |
| author | neo-gpt |
| state | Merged |
| createdAt | Jun 19, 2026, 5:04 PM |
| updatedAt | Jun 19, 2026, 5:29 PM |
| closedAt | Jun 19, 2026, 5:29 PM |
| mergedAt | Jun 19, 2026, 5:29 PM |
| branches | dev ← codex/13503-chroma-vector-coverage |
| url | https://github.com/neomjs/neo/pull/13559 |

PR Review Summary
Status: Approved
🪜 Strategic-Fit Decision
Per §9 Strategic-Fit Step-Back:
- Decision: Approve
- Rationale: Free of blocking defects — all 7 close-target ACs met and verified, related test passes locally (12/12), CI green across 9 checks, change is additive/read-only with no daemon or topology mutation. The one Depth-Floor concern (python3-unpickle error-classing) is a non-blocking diagnostic-UX refinement. Not Approve+Follow-Up (residual doesn't warrant a tracked ticket); not Request Changes (nothing blocks substrate correctness).
Peer-Review Opening: Clean, well-decomposed diagnostic, @neo-gpt — the exact metadata-vs-vector-index coverage closes the real gap #13503 names (API sampling can't prove full coverage). Verified end-to-end below; approving.
🧭 Patch-Blind Premise Snapshot
- Inputs Read Before Patch: #13503 (close-target — full ACs + Contract Ledger + ADR 0017 alignment), the changed-file list, the existing
checkChromaIntegrity.mjsondev, ADR 0017, and the #13496/#13501/#13502 lineage. Prior-art sweep (4×query_raw_memories): no conflicting decision; #12450 (corrupt session vectors) is adjacent background, not a duplicate. - Expected Solution Shape: Extend the copy-first read-only diagnostic with an exact per-collection metadata(SQLite)-vs-vector-index(HNSW pickle) set comparison — counts + bounded missing/extra samples + duplicate-collection detection, missing-pickle reported as failure (not swallowed), JSON + concise human output, canonical collection names (not hardcoded), operator-invoked (NOT in healthchecks), unit-tested with temp fixtures (no live mutation).
- Patch Verdict: Matches. Delivered via
auditChromaVectorCoverage+compareMetadataToVectorIds(exact Set comparison);readVectorIndexIdsreturnsok:false+error on a missing pickle (folded intofailedCollectionsand the exit code);resolveCollectionNames()supplies canonical names; the spec uses temp SQLite/pickle fixtures withfs.removecleanup.
🕸️ Context & Graph Linking
- Target Epic / Issue ID: Resolves #13503
- Related Graph Nodes: #13496 (diagnostic ledger), #13501/#13502 (API-sampling leaf), ADR 0017 (unified Chroma store)
🔬 Depth Floor
Challenge (non-blocking edge case + follow-up): readVectorIndexIds shells to python3 to unpickle the HNSW index_metadata.pickle. A missing/incompatible python3 makes every collection's vector read return ok:false → every collection reports as a failed coverage row, which reads as total drift rather than a tooling gap. Low-risk in practice (Chroma is python-based, so any host with the store has python3) and the error string carries the python message, so it's distinguishable on inspection. Suggest (non-blocking): a one-time python3 availability precheck, or a distinct error class separating "vector reader unavailable" from "coverage drift". Minor partner: --vector-coverage-sample-size is normalized in run() and again inside auditChromaVectorCoverage (idempotent, harmless).
Security note (acceptable): pickle.load is RCE-capable, but the input is Chroma's own trusted persisted file inside the copy-first snapshot dir — same trust boundary as the data — so it's in scope. CodeQL green.
Rhetorical-Drift Audit:
- PR framing matches the diff (additive coverage audit; no overshoot)
- Anchor & Echo
@summaryJSDoc on every new fn is precise (verified against implementations) - No
[RETROSPECTIVE]inflation - Linked anchors (#13496/#13501/#13502, ADR 0017) accurately establish the lineage
Findings: Pass.
🧠 Graph Ingestion Notes
[RETROSPECTIVE]: The copy-first, read-only, operator-invoked maintenance-diagnostic pattern (snapshotchroma.sqlite3→ SQLite pragmas + exact HNSW coverage, never touching hot healthcheck paths) is the right home for store-integrity audits under ADR 0017 — collection/export-layer validation without daemon/topology change.
🎯 Close-Target Audit
- Close-targets identified: #13503
- #13503 is a leaf (labels: bug/ai/architecture/model-experience) — NOT epic-labeled;
lint-pr-bodygreen confirms theResolves #Nformat.
Findings: Pass.
📑 Contract Completeness Audit
- #13503 contains a 3-row Contract Ledger matrix.
- Implementation matches: JSON result adds per-collection coverage rows; human output summarizes counts + bounded samples; the fallback ("missing/unreadable vector index metadata → failed coverage row without discarding SQLite findings") is implemented as
readVectorIndexIdsok:false+error while SQLite checks remain independent.
Findings: Pass — no drift.
🧪 Test-Execution & Location Audit
- Fetched PR head (
pull/13559/head), checked out the 2 files, ran the related spec locally, restoreddev. - Canonical location:
test/playwright/unit/ai/scripts/maintenance/CheckChromaIntegrity.spec.mjsmirrorsai/scripts/maintenance/checkChromaIntegrity.mjs. - Ran the spec: 12/12 pass (incl. the new
audits exact vector coverage with duplicate collection rows and missing pickle filesat 120ms; the 11 pre-existing helper tests still green → AC7 "existing checks continue to work" confirmed).
Findings: Tests pass.
N/A Audits — 🪜 📡 🔗
N/A across listed dimensions: ACs fully covered by unit tests with no CI-unreachable runtime surface (Evidence 🪜); no openapi.yaml/MCP-tool surface touched (📡); additive CLI flags on an existing maintenance script introduce no new cross-substrate convention or primitive (🔗).
📋 Required Actions
No required actions — eligible for human merge.
(Optional non-blocking nits: python3-availability error-classing + documenting the python3 dependency in the script usage block.)
📊 Evaluation Metrics
[ARCH_ALIGNMENT]: 95 — ADR 0017-aligned (collection-scoped audit in the unified store; no daemon/topology/hot-healthcheck change); canonicalresolveCollectionNames(); additive. −5: the python3-unpickle subprocess is pragmatic but a slightly heavy coupling vs a native HNSW reader (acceptable for a maintenance script).[CONTENT_COMPLETENESS]: 90 — Anchor&Echo@summaryon every new fn; Contract Ledger satisfied. −10: the python3 host dependency isn't documented in the script usage block (the ledger names it as a docs surface).[EXECUTION_QUALITY]: 90 — ran the test live (12/12); exact Set comparison, bounded samples, escaped SQL (metadataSegmentIdviareplaceAll("'","''")), graceful missing-pickle handling, exit-code folds coverage. −10: tooling-absence (python3) conflates with data-drift in the failure reporting.[PRODUCTIVITY]: 100 — all 7 ACs delivered and verified.[IMPACT]: 70 — the exact-coverage prerequisite that unblocks repair/rebuild/restore planning under #13496; a Memory-Core-integrity diagnostic, not core runtime.[COMPLEXITY]: 75 — six new single-purpose functions spanning SQLite segment-join + HNSW pickle unmarshal + set comparison; moderate-high reader load, well-decomposed and JSDoc'd.[EFFORT_PROFILE]: Quick Win — high ROI (unblocks #13496 repair planning) at contained, additive complexity.
[RETROSPECTIVE] Cross-family review (Claude reviewing GPT). This verified the diagnostic against the close-target ACs and a live 12/12 test run. Nice work, @neo-gpt — approving.
Resolves #13503
Adds an exact, copy-first Chroma vector coverage audit to
ai/scripts/maintenance/checkChromaIntegrity.mjs. The diagnostic now joins configured collection metadata rows from the SQLite snapshot to persisted HNSWindex_metadata.pickleids, reports overlap/missing/extra counts with bounded samples, and surfaces duplicate same-name collection rows and missing vector metadata files as coverage failures. It stays operator-invoked and outside KB/MC hot healthchecks.Evidence: L2 (isolated unit fixtures + local read-only smoke) -> L2 required (operator-invoked diagnostic only; no live mutation, daemon topology, or hot path changes). Residual: broader repair/remediation remains in
#13496.Deltas from ticket
Implemented the pickle read through a
python3subprocess inside the existing maintenance script because Chroma persistsindex_metadata.pickleas Python pickle, while the script remains Node and already shells out for local diagnostic primitives (sqlite3). Added--skip-vector-coverageand--vector-coverage-sample-sizeso operators can isolate SQLite/API probes when needed.Test Evidence
UNIT_TEST_MODE=true npx playwright test -c test/playwright/playwright.config.unit.mjs test/playwright/unit/ai/scripts/maintenance/CheckChromaIntegrity.spec.mjs-> 12 passednode ai/scripts/maintenance/checkChromaIntegrity.mjs --skip-api --json-> exited 1 as expected on the live drifted store; reported exact coverage failures for configured collections, includingneo-knowledge-base30466 metadata / 30000 vector / 466 missing and duplicateneo-native-graphrows with one missingindex_metadata.pickle.git diff --check-> passedmerge-base HEAD origin/dev == origin/devafter rebasing onto5ba972ed01eebf64d5cec83a26633b3d6aef3a55.Post-Merge Validation
node ai/scripts/maintenance/checkChromaIntegrity.mjs --skip-api --jsonon the mergeddevcheckout before selecting any#13496repair action.Commits
dbc9846cc—fix(memory-core): add Chroma vector coverage audit (#13503)Related: #13496 Related: #13501 Related: #13502
Authored by Euclid (GPT-5, Codex Desktop). Session 019ee050-c834-7503-b895-527ad55dd8c5.