Repository navigation
Description
Problem
After #1178, fresh Astra schemas still contain 131 tables. Table count alone is not a design defect, but two Work persistence paths duplicate existing authoritative facts:
work_item_edgesreceives a full edge batch for every accepted graph revision; production graph readers already decodework_graph_revisions.edge_manifest_json. No production reader of the separate edge table was found. A revision can therefore write up to 1,024 unused duplicate rows.work_criteriacontains only criterion identity and creation time. New criteria atomically insert revision 1 intowork_criterion_revisions; the sole identity lookup can use that existing owner-scoped primary key.
Requested outcome
Remove redundant physical storage and writes while preserving canonical graph validation, immutable manifests, criterion identity uniqueness, owner isolation, proposal replay, CAS/rollback, and cross-branch concurrency. Remove obsolete schema registration, cleanup paths, metadata, physical-only conflict variants and assertions. Add focused behavioral coverage where the existing tests leave a gap.
No compatibility layer, new schema version, migration, or mutation of existing databases is requested. This changes fresh schema construction. Existing operation journals and sequence tables must be assessed by the actual external-effect and retention invariants, rather than merged just to reduce table count.
Evidence / validation plan
Source inspected at 73d9a9b37593de9875ace27fb7c58d9ba5a0c93e: Work repository, graph repository, criteria proposal repository, graph/criteria integration tests, schema inventory. Validate affected unit/static checks and fresh MatrixOne integration journeys including duplicate identity, rollback, owner isolation and concurrent winners. No physical IO or 1,000-session throughput claim is implied.
Expanded scope: eliminate whole low-value persistence chains
The initial two duplicate-table changes are insufficient for the requested systemic cleanup. Expand the same delivery to examine and retire redundant diagnostics and orphan product paths, with an explicit grouped disposition of the remaining schema.
Confirmed candidates:
- Prompt hash-diff diagnostics maintain a second request identity, relational per-chunk deltas, ancestor reconstruction, periodic checkpoints, and dedicated retention. Database writes are PromptAssembly trace-gated (production default off); planning CPU and Session/Run status diagnostic reads remain separate costs. Actual provider request receipts and measured token/cache facts already have independent owners. No Web consumer of the hash-diff status fields was found. Prefer removing this optional product chain, including API fields and SDK types, over replacing it with another persisted cache. Preserve real inference evidence and explicitly enabled full captures.
- The legacy data-versioning service exposes database-wide named snapshot creation and lineage wrappers, with no SDK/Web consumer found. Its named checkpoint table is not canonical Run checkpoint or Context recovery authority. Evaluate removing the entire route/service/table chain while retaining execution-local SQL snapshot/rollback helpers and canonical event lineage.
Validate public status/projection and ordinary execution after removal, real provider evidence/capture boundaries, owner isolation, concurrent cancellation/deletion, fresh schema and retained maintenance. No compatibility fields, new schema version or automatic old-database cleanup.
Accepted business-level simplification
Also retire the complete persisted Context-manifest diagnostic projection (two tables, per-attempt writer, latest-summary reads, artifact-only manifest counter and retention stage). Preserve canonical Context heads/nodes/pins/receipts, actual context-window admission and compaction, live Context assembly traces, Explain and CLI journal captures. Retain all six durable artifact-reference kinds and their transactional retention semantics.
Retire the optional Work-specific Git patch export/application/commit product (three tables, operation states, two recovery workers, twelve HTTP operations, SDK and Web review UI). This is an explicit product cut: ordinary authorized Git/Runner actions do not reproduce the former exact-reviewed transfer/commit guarantee. Preserve Work execution, criteria, graph proposals, subject invalidation, recovery points, and saved-progress capture/download. Existing Git worktree revision observation remains under workspace_observation with its original hash/lease/lock semantics.
Complete production DDL inventory: 131 -> 121 declarations for this PR, ten removed. Individual bootstrap boundaries initialize subsets. Record implementation, tests and docs separately; no new persistence, compatibility API, migration or schema marker. Fresh empty database/same-version deployment only; do not reconcile old snapshots or pending old Git operations. Remaining table count is a disposition, not proof all retained tables are necessary.
Validation includes real MatrixOne schema/bootstrap, canonical event collision/replay/rollback, retained artifact references/expiry/content/upload, cancellation and authority races, preserved Work recovery/deletion, real scripted-provider chat and actual SQL observation, and 100 distinct concurrent Session projections. This is correctness coverage, not a measured 1,000-session capacity claim.
Activity
[-]refactor(storage): remove redundant Work persistence projections[/-][+]refactor(storage): simplify redundant persistence and diagnostic paths[/+][-]refactor(storage): simplify redundant persistence and diagnostic paths[/-][+]refactor(storage): retire redundant persistence and low-value product chains[/+]