From a744dc0ae2fe1c55ed8087eacc315d03b67f8399 Mon Sep 17 00:00:00 2001
From: Coding-Dev-Tools <274649000+Coding-Dev-Tools@users.noreply.github.com>
Date: Tue, 3 Nov 2026 00:44:29 -0500
Subject: [PATCH 1/7] fix(diagnostics): identify damaged databases instead of
blaming the key
A user-host report showed a forked receipt chain followed by the provider going unavailable with EncryptionError. Since 1.7.6 receipt damage is audit-only, but there was no supported way to see it outside the host log, and every encrypted-open failure was reported as a wrong key.
Extract receipt_chain_state/verify_receipt_chain so the install doctor verifies chains read-only through its own connection and reports damage with recovery guidance, bounded to 20k receipts and 25 scopes. Classify EncryptionError with stable codes; driver text is still never rendered because it can echo paths or the PRAGMA key.
Refresh the checksum-bound offline evidence artifact and its rendered SVG/PNG surfaces because tracked producer files changed.
Refs discussion #151.
Agent: opencode
---
BENCHMARKS.md | 12 +-
CHANGELOG.md | 9 +
README.md | 2 +-
docs/RECALL_RECOVERY.md | 48 ++
docs/SQLITE_DURABILITY.md | 6 +
...fixtures-receipt-diagnostics-20261103.json | 701 ++++++++++++++++++
...s-receipt-diagnostics-20261103.json.sha256 | 1 +
docs/images/context-efficiency.png | Bin 61488 -> 61516 bytes
docs/images/context-efficiency.svg | 4 +-
.../images/evidence-backed-agent-examples.png | Bin 273392 -> 273064 bytes
.../images/evidence-backed-agent-examples.svg | 4 +-
engraphis/backends/encrypted_db.py | 90 ++-
engraphis/core/store.py | 371 ++++-----
scripts/init.py | 139 +++-
tests/test_benchmark_evidence.py | 4 +-
tests/test_encryption_dependency.py | 66 ++
tests/test_init.py | 92 ++-
tests/test_receipts.py | 9 +-
18 files changed, 1349 insertions(+), 209 deletions(-)
create mode 100644 docs/benchmark-evidence/offline-fixtures-receipt-diagnostics-20261103.json
create mode 100644 docs/benchmark-evidence/offline-fixtures-receipt-diagnostics-20261103.json.sha256
diff --git a/BENCHMARKS.md b/BENCHMARKS.md
index 609810838..0716e972c 100644
--- a/BENCHMARKS.md
+++ b/BENCHMARKS.md
@@ -94,14 +94,14 @@ interpretation and do not count as additional benchmark-quality gains.
### Public numeric evidence registry
Every exact public aggregate retained below comes from the checked-in, public-safe
-[`offline-fixtures-automatic-browser-access-20261101.json`](docs/benchmark-evidence/offline-fixtures-automatic-browser-access-20261101.json) artifact. Its
+[`offline-fixtures-receipt-diagnostics-20261103.json`](docs/benchmark-evidence/offline-fixtures-receipt-diagnostics-20261103.json) artifact. Its
SHA-256 is
-`8df20fd0a97f20070ac26628e19b5ae1be653cd7aa9c7399d424cedf0e839a01`, also recorded in the
+`7679701565f8897a12bb9d7f65918d8faa1d694757957b8628ef635b640a9bed`, also recorded in the
adjacent `.sha256` file. The artifact contains no raw questions, answers, prompts, customer data,
or per-record content fingerprints.
The fixture-suite digest is
-`0179ada4cfffd827e2d1cf2cce1b5110862ac9a5cafbbf0db6dcd6e975e864ce`. The artifact defines
+`f7d8108881da709c157b627e21a0720dd83e63b450ec3f9dd4d7816b33884e56`. The artifact defines
the digest algorithm and records the SHA-256 of every suite and dataset file. Each evidence ID
also binds its exact command through `sha256(UTF-8 exact command)`:
@@ -134,7 +134,7 @@ retrieval-quality improvement. It does not qualify browser behavior, hosted serv
external models, or provider billing. The registered artifact was produced with:
```bash
-python -m scripts.export_offline_evidence --output docs/benchmark-evidence/offline-fixtures-automatic-browser-access-20261101.json
+python -m scripts.export_offline_evidence --output docs/benchmark-evidence/offline-fixtures-receipt-diagnostics-20261103.json
```
The earlier release-review predecessors,
@@ -203,13 +203,13 @@ grounded checks in separate panels; provider billing and MCP transport are not m
the SVG and matching PNG with:
```bash
-python scripts/render_benchmark_report.py --report docs/benchmark-evidence/offline-fixtures-automatic-browser-access-20261101.json --output docs/images/context-efficiency.svg --png-output docs/images/context-efficiency.png
+python scripts/render_benchmark_report.py --report docs/benchmark-evidence/offline-fixtures-receipt-diagnostics-20261103.json --output docs/images/context-efficiency.svg --png-output docs/images/context-efficiency.png
```
The companion examples are also generated from that artifact with:
```bash
-python -m scripts.render_benchmark_examples --report docs/benchmark-evidence/offline-fixtures-automatic-browser-access-20261101.json --output docs/images/evidence-backed-agent-examples.svg --png-output docs/images/evidence-backed-agent-examples.png
+python -m scripts.render_benchmark_examples --report docs/benchmark-evidence/offline-fixtures-receipt-diagnostics-20261103.json --output docs/images/evidence-backed-agent-examples.svg --png-output docs/images/evidence-backed-agent-examples.png
```
The historical-to-executable mapping is in
[`docs/BENCHMARK_CHANGE_COVERAGE.md`](docs/BENCHMARK_CHANGE_COVERAGE.md).
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4959df255..2ddff73f7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,15 @@ All notable changes to Engraphis are documented here. Format loosely follows
## [Unreleased]
+- Classify encrypted-database open failures (`database_damaged`, `database_busy`,
+ `database_unavailable`, `key_rejected`, `driver_missing`, and key-file codes) so a damaged or
+ locked SQLCipher file is no longer reported as a wrong key, and surface the exact condition in
+ `engraphis-init --check`.
+- Verify operation-receipt chains read-only in `engraphis-init --check` (bounded by workspaces and
+ receipts), so a forked, disconnected, or truncated ledger is visible to the operator with
+ recovery guidance while memory writes and recall continue with a content-free
+ `receipt_warning`.
+
- Browsers no longer enter a token. The dashboard opens automatically for any browser that
can reach it; the deployment's network reachability is the dashboard boundary. Session
issuance still requires the same-origin custom header and a published Host, and only an
diff --git a/README.md b/README.md
index ff315afe2..a0821d021 100644
--- a/README.md
+++ b/README.md
@@ -51,7 +51,7 @@ Connect a coding agent over MCP with the [agent setup guide](https://github.com/
The current registered artifact contains three deterministic offline fixture runs. It separates context size, retrieval quality, and grounded decision checks; these small fixtures do not establish general task performance.
-
+ Three offline fixtures separate context reduction, candidate and packed retrieval quality, and grounded behavior. The chart shows the artifact checksum prefix; see the benchmark guide for the full checksum and reproduction steps.