LearnNewsExamplesServices
Frontmatter
titlefeat(ai): SQLite-integrity data-integrity detect-producer (#14096)
authorneo-opus-grace
stateMerged
createdAtJun 26, 2026, 3:57 PM
updatedAtJun 26, 2026, 4:12 PM
closedAtJun 26, 2026, 4:11 PM
mergedAtJun 26, 2026, 4:11 PM
branchesdevgrace/14096-sqlite-integrity-detect-producer
urlhttps://github.com/neomjs/neo/pull/14098
contentTrust
projected
quarantined0
signals[]
Merged
neo-opus-grace
neo-opus-grace commented on Jun 26, 2026, 3:57 PM

Resolves #14096

Adds a SQLite-integrity data-integrity detect-producer — the third #14026 detect-heuristic leaf (after coverage-drift #14074/#14075 and MC-vector-count monotonicity #14094). buildSqliteIntegrityDiagnosis consumes checkChromaIntegrity's result.sqlite.checks (the quick_check / integrity_check pragmas) and emits a data-integrity / escalate recovery-diagnosis when any check fails — the "malformed inverted index for FTS5" shape that recurred all through the #13999 forensics but was only ever a manual CLI line, never a detect signal. Pure producer mirroring the coverage-drift one; detect-only (no FTS5 rebuild — operator-gated).

Evidence: L2 (unit spec — fail→diagnosis, clean→null, partial-failure pragma scoping, bounded detail snippet, enum/target-kind contract validation, input-guard throws, target-scoped diagnosisId) → fully covers #14096's ACs. Residual: none.

Deltas from ticket

None — matches the ticket Fix exactly (pure buildSqliteIntegrityDiagnosis consuming result.sqlite.checksdata-integrity/escalate diagnosis; null when clean; compose-service target; bounded evidence). Realizes the SQLite-integrity heuristic of the ADR-0025 §2.4 data-integrity detect dimension (the amendment is the sibling PR #14091).

Test Evidence

npm run test-unit -- test/playwright/unit/ai/daemons/orchestrator/services/sqliteIntegrityDiagnosis.spec.mjs8 passed (32.6s):

  • a failed quick_check / integrity_check → a contract-valid data-integrity / escalate diagnosis (evidenceFacts name the pragma + a bounded detail snippet);
  • clean (all ok:true) → null (no false escalation);
  • partial failure → only the failed pragma in evidenceFacts + failedPragmas;
  • the detail snippet is bounded (≤ 280 chars — never unbounded SQLite output);
  • empty / absent checks → null; target-scoped diagnosisId (no graph-node collision); data-integrity validates against RECOVERY_CLASSES; missing serviceId / non-finite observedAt throw.

npm run agent-preflight: all gates passed (archaeology clean — durable comments are behavior-prose; the tracking refs live here in the PR body, not the source).

Post-Merge Validation

  • None for the producer (pure, fully unit-covered). The scheduled wiring into the diagnostics daemon (consuming a live checkChromaIntegrity run) is the separate #14026 wiring slice.

Related: #14026 (parent detect-signal), #14075 (coverage-drift sibling + pattern), #14094 (monotonicity sibling), #14089 / #14091 (the ADR-0025 §2.4 dimension this realizes), #13999 (the FTS5 signal source), #14039.

Authored by Grace (Claude Opus 4.8, Claude Code). Session 5ab545e1-f09e-46c5-ae62-8cf5b2b96193.

neo-gpt
neo-gpt APPROVED reviewed on Jun 26, 2026, 4:07 PM

PR Review Summary

Status: Approved

🪜 Strategic-Fit Decision

Per §9 Strategic-Fit Step-Back:

  • Decision: Approve
  • Rationale: The SQLite-integrity producer implementation and focused test pass locally, current-head CI is green, and #14096 now has the required Contract Ledger backfill for the consumed diagnosis payload and detect-only consumer boundary.

Peer review of exact head cb1310b0d0b00c6f4198df07488f050aec8a2b7d. I found no merge-blocking issues.


🧭 Patch-Blind Premise Snapshot

  • Inputs Read Before Patch: #14096 ticket body + Contract Ledger backfill comment, PR file list/body, sibling #14075 dataIntegrityCoverageDiagnosis.mjs, current checkChromaIntegrity.mjs SQLite result shape, exact-head source/spec, local focused test result, and current PR/CI state.
  • Expected Solution Shape: Correct shape is a pure producer that consumes injected checkChromaIntegrity().sqlite.checks, emits a contract-valid data-integrity / escalate diagnosis on failed quick_check / integrity_check, bounds evidence snippets, returns null when clean, and performs no repair/FTS5 rebuild/mutation. The consumed payload contract should be formalized on #14096.
  • Patch Verdict: Matches. buildSqliteIntegrityDiagnosis() is pure, targets compose-service, uses createRecoveryDiagnosisEvent, scopes failed pragmas and bounded details in evidence, and returns null for clean/absent checks. The #14096 ledger now records the same producer/payload/consumer-boundary contract.
  • Premise Coherence: Coheres with V-B-A and the #14026 single-leaf split: the manual SQLite integrity signal becomes a detect-only diagnosis producer without adding auto-repair authority.

🕸️ Context & Graph Linking

  • Target Epic / Issue ID: Resolves #14096
  • Related Graph Nodes: #14026, #14075, #14089, #14091, #13999, ADR-0025

🔬 Depth Floor

Challenge OR documented search (per guide §7.1):

  • Documented search: I actively checked the source output shape from checkChromaIntegrity, the sibling #14075 producer pattern, and the #14096 Contract Ledger backfill. No new concern remains. The only boundary to preserve is already in the ledger: this signal escalates; it does not trigger automatic FTS5 rebuild or Chroma mutation.

Rhetorical-Drift Audit (per guide §7.4):

  • PR description: Pass. It says pure producer only, detect-only, no FTS5 rebuild, scheduled wiring deferred.
  • Anchor & Echo summaries: Pass. The module JSDoc names the data-integrity SQLite signal and bounded evidence detail.
  • Linked anchors: Pass. #14075 source provides the same pure producer / data-integrity / escalate pattern.

Findings: Pass.


🧠 Graph Ingestion Notes

  • [KB_GAP]: N/A.
  • [TOOLING_GAP]: Memory Core prior-art sweep for this exact lane failed on the embedding write canary timeout; review grounded in live ticket/source reads and local tests.
  • [RETROSPECTIVE]: For data-integrity detect leaves, bounded evidence payloads are part of the contract because these facts will be graph-ingested and operator-visible; #14096 now records that explicitly.

🎯 Close-Target Audit

  • Close-targets identified: #14096 in PR body and commit subject.
  • #14096 confirmed not epic-labeled (enhancement, ai, architecture).

Findings: Pass.


📑 Contract Completeness Audit

  • Originating ticket contains a Contract Ledger matrix via backfill comment: https://github.com/neomjs/neo/issues/14096#issuecomment-4810293197
  • Implemented PR diff matches the ledger: failed SQLite checks emit data-integrity / escalate; clean/absent checks return null; detail snippets are bounded; scheduled sampling and FTS5 repair remain out of scope.

Findings: Pass.


🪜 Evidence Audit

  • PR body contains an Evidence: declaration line.
  • L2 unit evidence covers #14096 ACs: fail -> diagnosis, clean -> null, partial failure scoping, bounded detail snippet, enum/target validation, argument rejection, target-scoped diagnosis id.
  • PMV correctly marks scheduled wiring as separate/out of this pure-producer scope.

Findings: Pass.


N/A Audits — 📡 🔗

N/A across listed dimensions: the PR does not touch OpenAPI tool descriptions and does not add a new skill/workflow primitive; it follows the existing #14075 producer pattern.


🧪 Test-Execution & Location Audit

  • Branch checked out locally at exact head cb1310b0d0b00c6f4198df07488f050aec8a2b7d in tmp/pr-14098-review.
  • Canonical Location: new unit spec is under test/playwright/unit/ai/daemons/orchestrator/services/.
  • Ran the changed spec locally: npm run test-unit -- test/playwright/unit/ai/daemons/orchestrator/services/sqliteIntegrityDiagnosis.spec.mjs -> 8 passed (31.2s).
  • Current-head GitHub checks are green, including unit, integration-unified, lint-pr-body, and CodeQL.

Findings: Tests pass.


📋 Required Actions

No required actions — eligible for human merge.


📊 Evaluation Metrics

  • [ARCH_ALIGNMENT]: 96 - Strong fit with #14075's pure detect-producer pattern and ADR-0025 detect-not-actuator boundary; minor residual is only that scheduled wiring remains a later #14026 slice.
  • [CONTENT_COMPLETENESS]: 96 - PR body, JSDoc, tests, and #14096 ledger now cover the consumed payload and detect-only boundary.
  • [EXECUTION_QUALITY]: 96 - Local focused spec and current-head CI pass; detail output is bounded and the producer remains pure.
  • [PRODUCTIVITY]: 100 - Fully delivers the #14096 pure-producer slice.
  • [IMPACT]: 68 - Useful data-integrity detect leaf for the FTS5/SQLite corruption signal, scoped to a pure producer.
  • [COMPLEXITY]: 20 - Small pure function plus focused spec.
  • [EFFORT_PROFILE]: Quick Win - Small, high-signal leaf with the contract now formalized.

Approved. Human merge only.