Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
71123bc
fix(maintenance): adopt missing audit tier safely
Sinity Aug 11, 2026
4320d32
fix(maintenance): bind audit adoption to published image
Sinity Aug 11, 2026
eceaf2f
fix(maintenance): recover audit adoption publication
Sinity Aug 11, 2026
dde32d3
fix(storage): anchor audit adoption receipts to archive
Sinity Aug 11, 2026
bb96384
fix(storage): preserve audit adoption continuity
Sinity Aug 11, 2026
a49d0d2
fix(storage): fail closed in audit adoption recovery
Sinity Aug 11, 2026
cbf7ca7
fix(maintenance): restore adopted audit tiers
Sinity Aug 11, 2026
f8686e4
fix(storage): harden adopted audit restoration
Sinity Aug 11, 2026
55f84c6
feat(storage): add replayable audit continuity
Sinity Aug 11, 2026
fc922aa
fix(storage): bind audit mutations to replayable authority
Sinity Aug 11, 2026
3152a21
fix(storage): complete replayable audit continuity
Sinity Aug 11, 2026
2567637
fix(storage): recover audit continuity failures
Sinity Aug 11, 2026
9ca0a2f
test(storage): type migration probe lookup
Sinity Aug 11, 2026
7cf3db3
fix: harden audit continuity recovery
Sinity Aug 12, 2026
4e2024a
fix: close audit operation recovery gaps
Sinity Aug 12, 2026
2b74cd1
fix(audit): close continuity recovery gaps
Sinity Aug 12, 2026
20d787c
fix(audit): close durable continuity crash windows
Sinity Aug 12, 2026
283e39d
fix(audit): close continuity recovery review findings
Sinity Aug 12, 2026
cf44ef5
fix(audit): parse spaced process identities
Sinity Aug 12, 2026
245e7dd
fix(audit): preserve unproven recovery ownership
Sinity Aug 12, 2026
1ef97f8
fix(audit): reject redirected authority paths
Sinity Aug 13, 2026
52b4e04
fix(audit): harden authority continuity routes
Sinity Aug 13, 2026
e749f07
fix(audit): preserve exact audit execution evidence
Sinity Aug 13, 2026
1a871a4
fix(audit): close durable continuity authority gaps
Sinity Aug 13, 2026
4724fd5
fix(audit): authenticate restore rebind retries
Sinity Aug 13, 2026
622aabf
fix(audit): preserve live WAL authority reads
Sinity Aug 13, 2026
1892491
fix(audit): preserve verified leaf diagnostics
Sinity Aug 13, 2026
51262f6
fix(audit): keep WAL mode across readers
Sinity Aug 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,15 @@ caller; it exists only as test infrastructure (`polylogue-enium`).
`TopologyEdgeStatus` = unresolved/resolved/repaired/**quarantined**
(cycle-break).

### The five tiers (durability is the axis)
### The six tiers (durability is the axis)

| Tier | durability | holds |
| --- | --- | --- |
| `source.db` | durable | raw acquired bytes (`raw_sessions`), artifact taxonomy, blob/GC substrate (`blob_refs`, `gc_generations`), hook events, sidecars |
| `index.db` | **rebuildable** | the whole parsed tree, FTS, `session_links`, cost tables, and all materialized insights |
| `embeddings.db` | rebuildable | `vec0` virtual table (Voyage 1024-dim), meta, status |
| `user.db` | **durable, irreplaceable** | unified `assertions`, settings/context receipts, immutable annotation schemas + batch provenance |
| `audit.db` | **durable, append-only authority** | mutation previews, authorizations, attempts, receipts, and continuity heads |
| `ops.db` | disposable | ingest cursors, attempts, `convergence_debt`, cursor-lag samples, daemon events, embed catch-up runs |

`user.db` is a **single unified `assertions` table** keyed by a closed
Expand Down Expand Up @@ -186,8 +187,8 @@ snapshot reference check) to bridge the acquire-blob → commit-row window.

Two evolution regimes, enforced by `devtools lab policy schema-versioning`:

- **Durable tiers** (`source.db`, `user.db`): explicit **additive** numbered SQL
migrations under `storage/sqlite/migrations/{source,user}/NNN_*.sql`, one
- **Durable tiers** (`source.db`, `user.db`, `audit.db`): explicit **additive** numbered SQL
migrations under `storage/sqlite/migrations/{source,user,audit}/NNN_*.sql`, one
`PRAGMA user_version` step at a time, behind a **verified backup manifest**.
Destructive durable changes need a copy-forward design + explicit consent.
- **Derived tiers** (`index.db`, `embeddings.db`): no migration *chain*, but not
Expand Down
11 changes: 11 additions & 0 deletions devtools/render_cli_output_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from devtools.command_catalog import control_plane_command
from devtools.render_support import write_if_changed
from polylogue.archive.query.metadata import terminal_query_cli_surfaces, terminal_query_source_list
from polylogue.cli.commands.maintenance._migrate_tier import MigrateTierResultPayload
from polylogue.operations.action_contracts import ActionAffordanceListPayload
from polylogue.surfaces.payloads import (
ArchiveDebtListPayload,
Expand Down Expand Up @@ -259,6 +260,16 @@ class CliOutputSchema:
"MCP action_affordances",
),
),
CliOutputSchema(
name="migrate-tier-result",
title="Migrate Tier Result",
description=(
"Result from `polylogue ops maintenance migrate-tier --output-format json`, including durable "
"adoption and restore receipt references."
),
model=MigrateTierResultPayload,
surfaces=("polylogue ops maintenance migrate-tier --output-format json",),
),
CliOutputSchema(
name="machine-error",
title="Machine Error Envelope",
Expand Down
1 change: 1 addition & 0 deletions devtools/validation_lane_catalog_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@
"mutate-clear-corrections",
"mutate-delete-session",
"mutate-session-excision",
"mutate-session-lifecycle-request",
"mutate-identity-reset",
),
tags=("contract", "mutation", "operation-executor"),
Expand Down
7 changes: 4 additions & 3 deletions devtools/verify_schema_upgrade_lane.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Polylogue has two schema-evolution regimes:

* Durable tiers (``source.db`` and ``user.db``) may use explicit additive SQL
* Durable tiers (``source.db``, ``user.db``, and ``audit.db``) may use explicit additive SQL
migrations with a backup gate.
* Derived/rebuildable tiers (``index.db`` and ``embeddings.db``) do not use
migration chains. They are rebuilt or blue-green replaced from durable source
Expand Down Expand Up @@ -86,7 +86,7 @@
ROOT = _get_root()
STORAGE_SQLITE_DIR = ROOT / "polylogue" / "storage" / "sqlite"
MIGRATIONS_DIR = STORAGE_SQLITE_DIR / "migrations"
ALLOWED_MIGRATION_TIERS = {"source", "user"}
ALLOWED_MIGRATION_TIERS = {"source", "user", "audit"}

# Upgrade-shaped helper name patterns. Matched against ``def <name>``
# at the top level of any module under ``polylogue/storage/sqlite/``.
Expand Down Expand Up @@ -345,7 +345,8 @@ def main(argv: list[str] | None = None) -> int:
helpers = _collect_upgrade_helpers()
invalid_migrations = _invalid_migration_paths()
durable_change_train_reports = {
tier.value: durable_change_train_policy_report(tier) for tier in (ArchiveTier.SOURCE, ArchiveTier.USER)
tier.value: durable_change_train_policy_report(tier)
for tier in (ArchiveTier.SOURCE, ArchiveTier.USER, ArchiveTier.AUDIT)
}
durable_migration_collisions = durable_migration_collision_report(_durable_migration_claims_on_disk())
delta_report = index_delta_declaration_report(INDEX_SCHEMA_VERSION)
Expand Down
1 change: 1 addition & 0 deletions docs/cli-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,7 @@ The schema files live under `docs/schemas/cli-output/`.
| `session-neighbor-candidate` | `SessionNeighborCandidatePayload` | `polylogue read --view neighbors --format json` |
| `mutation-result` | `MutationResultPayload` | `polylogue find <query> then delete --dry-run`<br>`polylogue find <query> then delete --yes`<br>`MCP mutation tools`<br>`daemon mutation endpoints` |
| `action-affordance-list` | `ActionAffordanceListPayload` | `polylogue config action-affordances`<br>`GET /api/action-affordances`<br>`MCP action_affordances` |
| `migrate-tier-result` | `MigrateTierResultPayload` | `polylogue ops maintenance migrate-tier --output-format json` |
| `machine-error` | `MachineErrorPayload` | `polylogue * --machine (error path)` |
| `machine-success` | `MachineSuccessPayload` | `polylogue * --machine (success path)` |
| `query-error` | `QueryErrorPayload` | `GET /api/sessions?query=... (error path)`<br>`daemon query/read error responses`<br>`MCP query/read error responses` |
13 changes: 7 additions & 6 deletions docs/internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ Polylogue has two schema-evolution regimes, keyed by tier durability.

- Tier version constants under `storage/sqlite/archive_tiers/` are the
authority. The canonical fresh schema is described directly by each tier DDL.
- **Durable tiers** (`source.db`, `user.db`) may use explicit additive
- **Durable tiers** (`source.db`, `user.db`, `audit.db`) may use explicit additive
migrations. Migration SQL lives under
`storage/sqlite/migrations/{source,user}/NNN_name.sql`, advances
`storage/sqlite/migrations/{source,user,audit}/NNN_name.sql`, advances
`PRAGMA user_version` one step at a time, and requires a verified backup
Comment thread
Sinity marked this conversation as resolved.
manifest containing the affected tier before it runs. Verification restores
the backup into scratch, checks every included SQLite tier and referenced
Expand Down Expand Up @@ -685,10 +685,11 @@ rebuilds or blue-green-replaces the tier from durable source/user evidence.
Files that are not configured archive paths are not classified or handled by
the archive runtime.

For **durable tiers** (`source.db`, `user.db`) the boundary is different, because
`user.db` holds irreplaceable human assertions that cannot be rebuilt from
source. These tiers use explicit *additive* numbered SQL migrations under
`storage/sqlite/migrations/{source,user}/NNN_*.sql`, applied one `PRAGMA
For **durable tiers** (`source.db`, `user.db`, `audit.db`) the boundary is different, because
`user.db` holds irreplaceable human assertions and `audit.db` holds immutable
mutation authority and receipt evidence; neither can be rebuilt from source.
These tiers use explicit *additive* numbered SQL migrations under
`storage/sqlite/migrations/{source,user,audit}/NNN_*.sql`, applied one `PRAGMA
Comment thread
coderabbitai[bot] marked this conversation as resolved.
user_version` step at a time by `migration_runner.py` behind a **verified backup
manifest** for the affected tier. Additive means `CREATE TABLE`/`CREATE INDEX`/
`ADD COLUMN`/bounded backfill; destructive durable-tier changes require a
Expand Down
4 changes: 2 additions & 2 deletions docs/maintenance.md
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,8 @@ polylogue ops diagnostics workload --json | jq .fts_trigger_state.all_present

If FTS remains non-ready after daemon convergence, the underlying issue is
structural (missing columns, corrupted index file, or a broken write path).
Stop the daemon, restore from backup or rebuild the affected index tier, and
open an issue with the probe output attached.
Stop the daemon, restore or rebuild the affected index tier, and open an issue
with the probe output attached.

### Inspecting a raw-authority census

Expand Down
8 changes: 8 additions & 0 deletions docs/plans/mutation-census.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ rows:
adapters:
- polylogue.cli.commands.excise.excise_command

- operation: mutate-session-lifecycle-request
spec_name: mutate-session-lifecycle-request
status: executor-routed
actuator: polylogue.operations.mutation_actuators.SessionLifecycleRequestActuator
surfaces: [cli]
adapters:
- polylogue.cli.commands.excise.excise_command (--mode mirror/primary)

- operation: mutate-identity-reset
spec_name: mutate-identity-reset
status: executor-routed
Expand Down
1 change: 1 addition & 0 deletions docs/schemas/cli-output/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ devtools render cli-output-schemas --check # CI sync check
| [`session-neighbor-candidate.schema.json`](./session-neighbor-candidate.schema.json) | `polylogue read --view neighbors --format json` | `SessionNeighborCandidatePayload` |
| [`mutation-result.schema.json`](./mutation-result.schema.json) | `polylogue find <query> then delete --dry-run`<br>`polylogue find <query> then delete --yes`<br>`MCP mutation tools`<br>`daemon mutation endpoints` | `MutationResultPayload` |
| [`action-affordance-list.schema.json`](./action-affordance-list.schema.json) | `polylogue config action-affordances`<br>`GET /api/action-affordances`<br>`MCP action_affordances` | `ActionAffordanceListPayload` |
| [`migrate-tier-result.schema.json`](./migrate-tier-result.schema.json) | `polylogue ops maintenance migrate-tier --output-format json` | `MigrateTierResultPayload` |
| [`machine-error.schema.json`](./machine-error.schema.json) | `polylogue * --machine (error path)` | `MachineErrorPayload` |
| [`machine-success.schema.json`](./machine-success.schema.json) | `polylogue * --machine (success path)` | `MachineSuccessPayload` |
| [`query-error.schema.json`](./query-error.schema.json) | `GET /api/sessions?query=... (error path)`<br>`daemon query/read error responses`<br>`MCP query/read error responses` | `QueryErrorPayload` |
Loading