Skip to content

refactor(storage): retire low-value persistence paths - #1178

Merged
XuPeng-SH merged 1 commit into
matrixorigin:mainfrom
XuPeng-SH:refactor/retire-db-csl
Oct 30, 2026
Merged

XuPeng-SH merged 1 commit into
matrixorigin:mainfrom
XuPeng-SH:refactor/retire-db-csl

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Collaborator

Capability assessment: Updated: Server Session hydration requires canonical Context; metadata Sandbox and Marketplace metrics APIs are retired. CLI local recovery, execution isolation and active skill behavior remain supported. References: docs/reference/capabilities.md, docs/design/data-and-storage.md, docs/design/skills-and-tools.md.

Summary

Remove five persistence paths with no production writer, redundant ownership, or little current product value. Fresh schema inventory drops from 136 to 131 tables, removing 61 columns and 14 non-primary index definitions. Server resume now validates canonical Context before activation instead of hydrating an obsolete checkpoint projection first.

Retired table Removed owner/path
conversation_log Unconstructed DB CSL backend, metadata plumbing, direct SQLx feature, empty CI shard and pressure probe
session_checkpoints Cloud checkpoint hydration/listing/pull and local/cloud reconciliation; retain explicit CLI local restore and Run checkpoint custody
skill_selection_events Post-loop query-copy/selection projection, fixed-success label, version enrichment and detached transaction
infra_sandbox_metadata Metadata-only Sandbox CRUD and name-prefix database-snapshot alias
skill_metrics Marketplace report aggregation, global statistics and ranked search

A real resume/delete QA race also exposed a shared Session-service classification error: durable deletion admission returned 500. The existing typed fence state now returns 404 in both activation paths, without changing SQL or locking order. Missing post-commit Session reads also return 404. The SDK resume return type now matches hydration rather than inventing Session header fields.

Related issue

Closes #1177. Related to #1124; this does not resolve its remaining wide-row/index/write-amplification scope.

Change type

  • Refactor or performance improvement
  • Bug fix
  • Documentation
  • Test
  • Build, CI, or maintenance

User and compatibility impact

Intentional product cuts: /sandbox CRUD, /data-versioning/sandbox/{name}/checkpoint, /marketplace/quality-report, /marketplace/stats/{skill_name} and /marketplace/search return 404. Skill registry/install/personal evaluation, runtime skill-quality feedback, ordinary data versioning and real execution isolation remain.

Full and continuation Session resume require owner-scoped canonical Context. Missing state returns 404 without activation; corrupt/foreign state fails closed. Cloud checkpoint-only fallback is removed. SDK resumeSession returns canonical hydration, with optional omitted fields represented accurately.

Fresh databases only: no schema version bump, migration, backfill, compatibility read, physical old-table cleanup or mixed-version deployment support is introduced. Existing tables and historical rows are untouched; retired Session tables are removed from the deletion catalog. Historical retention/deletion transitions are outside this change. In particular, old skill-selection rows can contain queries. This PR performs no deployment or existing-database operation.

Architecture and complexity delta

  • Canonical owner changed or extended: Server Context coordinator owns resumable conversation; shared Session service owns activation/deletion error classification. CLI local recovery remains explicit.
  • Existing implementations and callers searched: service/router/state builders, shared turn contracts, CLI/SDK/Web consumers, schema/deletion inventory, frozen-consumer fixtures and current supported CLI source.
  • Superseded code, states, tables, shims, or self-only tests removed: complete retired backend/service/writer chains, obsolete decoders/reconciliation, schema/index checks and feature-specific tests; orphan instrumentation and pressure commands.
  • If parallel implementations remain, their boundary and retirement condition: CLI files are selected local recovery; Server canonical Context is cloud recovery. Run checkpoints retain their separate execution-custody responsibility. No replacement table, state machine or cache is added.

Verification

  • Rust: 278 selected library tests passed across astra-core, astra-turn-core, astra-services, astra-cli and astra-runtime (cargo nextest run --locked --lib with history/CSL/restore/lifecycle/versioning/provider/post-loop filters, two test threads).
  • Offline HTTP/admin/router/observer contracts: 81 unchanged passes plus the three corrected skill fixture reruns; 84 reconciled checks, not one final 84-test invocation. Existing skill fixtures now supply the required explicit allow_skills; original outcome/observer assertions and inference counts remain.
  • SDK: npm run typecheck and npm test -- src/__tests__/client.test.ts: 86 passed, including a server-shaped hydration response with omitted permission_mode.
  • Real disposable MatrixOne: fresh/idempotent/interrupted schema bootstrap and shape; owner-isolated summaries/workspace hints; retained event/decision/install pagination; owner/non-owner deletion; concurrent late-writer fence; directory; ordinary data versioning. Fifteen service tests passed.
  • Live HTTP: canonical missing/corrupt/foreign state fails without activation; both full and continuation resume race deletion on separate Sessions; product journey checks retired endpoints return 404 and retained APIs work. All passed.
  • Deterministic concurrency: both activation APIs queued after the owner read against pending/completed deletion (four cases), existing writable/no-op/foreign-owner controls, and the retained Decision writer's five delete/error/cancellation outcomes plus independent identity progress all passed. The post-commit read window and every materialization/delete schedule are not claimed as exhaustively proven.
  • SQL capture includes run drain and successful detached observer completion. Nine ordinary/read-only scenarios passed at 17,17,17,17,17,19,19,18,18 statements. Selected-skill and missing-skill cases passed at 20 and 18 statements, with zero retired-projection queries and real results in the next model request.
  • Native frozen MOI consumer journey and framing/admission controls: cargo test --locked -p astra-runtime --features moi-compat-tests --test moi_fresh_astra -- --include-ignored --test-threads=1: seven passed. Linux/amd64 historical executables were not run on this macOS ARM host; no external-client compatibility claim is made for the removed APIs.
  • SCA: five affected packages with configured all-target clippy (--locked --all-targets --features astra-runtime/e2e-hooks -- -D warnings), final runtime delta clippy, cargo fmt --all -- --check and git diff --check passed. Schema inventory 47; fresh-database harness 13 passed/two existing opt-in skips; unchanged CI/probe tests 17/5 and the public zero-measurement rejection control are reused.
  • Race instrumentation was not run: stable Rust has no repository-configured instrumented runner, and the standalone nightly prerequisite rejected an uninstrumented-std ABI. The real DB concurrency/cancellation checks above are the supported behavioral alternative; this is not a TSan pass.
  • gpt-6.1-terra with max produced the design and final overall review; all material findings are resolved. Final reviewed dirty-diff SHA-256: ed7e789e0576b0bfd5c487af9dfbfd126666f7d193a9c52922626f1898186fd3. Validation: macOS ARM, Rust 1.97.0, Node 24.10.0, localhost MatrixOne and scripted providers with per-process synthetic keys. No live provider or production database was used.

CI is pending; this PR does not wait for or claim CI results.

SQL implications: a completed selected-skill loop removes the old four statements plus BEGIN/COMMIT (source-derived); no-selected-skill turns already skipped that hook. Full Server hydration removes legacy reads and the checkpoint aggregate subquery. Removed feature costs are not ordinary-chat savings. No measured engine write-amplification or 1000-session capacity claim is made.

Final checklist

  • I added or updated tests at the layer that owns the behavior.
  • I updated public and design documentation for contract changes.
  • I checked the final diff for sensitive and generated content.
  • The PR title follows the repository's Conventional Commit format.

Use canonical Context for Server Session hydration and keep CLI recovery explicitly local. Remove DB CSL, cloud Session checkpoints, skill-selection projection, metadata Sandbox CRUD and Marketplace metrics with their schema and wiring. Classify deletion-fence activation rejection as 404 using the existing typed owner.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep review of 6dad5ea against d0511d5.

Verdict: no blocking regression found; recommend approval for the explicitly fresh-database/product-cut scope. This is a COMMENT review because the authenticated account is also the PR author, not a formal self-approval.

Design and ownership

  • Server continuation stays with the existing owner-scoped Context coordinator. The handler validates/materializes canonical state before activation; it does not introduce a replacement checkpoint table, reconciliation state machine, or local-filesystem fallback.
  • CLI file CSL/local recovery and Run checkpoint custody are separate, justified responsibilities and remain wired. Removing the unused database CSL backend does not remove those implementations.
  • The skill-selection projection removal follows through contracts, writer/transaction, runtime wiring, schema, deletion inventory and feature-only tests. Actual selection, activation, tool results, quality tracking and observer dispatch remain. Selected-skill telemetry still has CLI consumers, so deleting that state merely because the SQL writer disappeared would be incorrect.
  • Sandbox metadata CRUD and Marketplace metrics/ranked search are intentional public product cuts, not behavior-preserving refactoring. Their router/service/schema paths are removed together; ordinary versioning and skill registry/install remain.
  • The activation fix reuses the typed lifecycle fence and preserves lock order/cancellation-safe connection ownership. The added pending/completed-deletion tests exercise both existing activation APIs rather than adding a second lifecycle implementation.

Complexity and tests
The aggregate +960/-6920 is not the basis for approval. Counting file categories and inline Rust cfg(test) sections gives implementation/config +260/-3163, tests +628/-3531, docs +60/-39, and remaining build/scripts/fixtures +12/-186. The new behavior tests check public routing, real next-provider skill results, owner isolation, missing/corrupt canonical state and deterministic fence ordering. The two whole-HTTP resume/delete races do not exhaustively establish every materialization/delete interleaving; the PR correctly does not claim that.

Independent verification in this review

  • SDK typecheck passed; complete SDK suite: 503 passed, 13 skipped. The focused client suite separately passed 86 tests.
  • Schema inventory: 47 passed; CI parallelism contracts: 17 passed; cleanup-pressure wrapper: 5 passed.
  • Fresh-database harness contracts: 13 passed in a selected rerun. The complete 15-test invocation had two environment errors because Unix sockets were prohibited; these are not product failures or successful tests. An elevated attempt could not start due to environment setup. No local Rust compiler/server/MatrixOne journey was run here.
  • Read actual exact-head CI logs, not only green badges: online integration 298/298 (including ordinary SQL budget, selected/missing skill SQL capture, and the stream/context/restore journey); online services 478/478 (including activation_rechecks_pending_and_completed_delete_after_owner_read); frozen fresh-Astra consumer 7/7. The regression harness log records 18/18 cases with deepseek-v4.1-flash. These are independently inspected CI executions, not local runs performed by this review.
  • Exact-head check list had no failed or pending checks at review time. git diff --check passed and the review checkout is unchanged.

Comment resolution
There were no pre-existing PR conversation comments or inline review threads, and #1177 had no comments, at both initial and final reads. Therefore there is no outstanding GitHub review thread to mark resolved. Private/off-platform review discussions are not evidence I can certify from this PR.

Non-blocking cleanup
The two audit_cloud_sync skill documents under .agent/skills and .claude/skills still instruct readers to inspect session_checkpoints and HybridRestoreService and reconcile local/cloud checkpoints. Refresh those operational instructions to the canonical Context + explicit CLI-local boundaries so future audits do not follow retired paths.

Scope limits: no upgrade/mixed-version or historical-data cleanup guarantee, no measured engine write-amplification/capacity claim, and no exhaustive race-instrumentation claim. None is required by the stated fresh-system scope.

@XuPeng-SH
XuPeng-SH merged commit 31a5f8b into matrixorigin:main Oct 30, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(storage): retire low-value persistence paths and redundant restore hydration

1 participant