Skip to content

refactor(storage): retire redundant state and optional product chains - #1182

Merged
XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
XuPeng-SH:refactor/work-state-simplification
Oct 31, 2026
Merged

XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
XuPeng-SH:refactor/work-state-simplification

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Capability assessment: Updated: retire optional cloud prompt hash-diff and persisted Context-manifest diagnostics, legacy database-versioning HTTP checkpoints/lineage, and Work Git patch export/application/commit in fresh same-version deployments. Update API, storage, Context, Work journey, baseline and coverage references; preserve canonical execution/recovery, live Context traces, actual provider receipts and saved progress.

Summary

Retire complete low-value persistence products and two duplicate Work representations. The complete production schema inventory falls from 131 to 121 declarations (individual bootstrap boundaries initialize subsets) with no replacement cache, storage path or worker:

  • Graph edges stay in the immutable graph manifest; criterion revision 1 owns identity and prevents reuse after removal.
  • Remove prompt hash-diff history, ancestor reconstruction/checkpoints, planning CPU, status queries and retention.
  • Remove persisted per-attempt Context manifests, synthetic budget/evidence projection, latest-summary queries and their diagnostic-only artifact counter.
  • Remove legacy named database snapshots and lineage HTTP service.
  • Remove Work Git patch export/application/commit, operation state machines, two recovery workers, twelve HTTP operations and SDK/Web review UI.

Run projection avoids two diagnostic reads; Session state avoids those two plus one/two latest-manifest reads. Work pages no longer issue two/three patch reads. Diagnostic writes were trace-gated and production defaults already disabled them; this does not claim every production exchange saves writes or quantify engine physical write amplification.

Related issue

Closes #1180

Change type

  • Refactor or performance improvement
  • Documentation
  • Test

User and compatibility impact

This is deliberate feature retirement, not a behavior-preserving cleanup. The retired diagnostic fields and products are unavailable; diagnostic-only artifact pins no longer extend custody. Work patch review/application/commit is removed. Ordinary authorized Git/Runner operations remain, but do not offer the removed exact-reviewed transfer/commit guarantee.

Fresh empty database and same-version deployment only. No compatibility shims, migrations, new schema marker, old-table cleanup or engine snapshot cleanup. Historical strict request-context payloads are not supported. Old Git workers must stop and old pending effects must be handled by the old deployment before handing a workspace to a new deployment.

Architecture and complexity delta

  • Canonical owners preserved: Context heads/nodes/pins/receipts, Run and transcript persistence, provider admission/settlement/actual wire receipts, invocation ledger, six generic durable artifact-reference kinds, upload/seal/content protocols, Work branches/criteria/graph proposals/checks/recovery/saved progress.
  • Existing implementations and callers searched across runtime, services, CLI, SDK, Web, tests and schema owners. Retained tables have a grouped disposition in data-and-storage.md; it is not proof that all remaining tables are permanently necessary.
  • Superseded product chains, schema/index/cleanup registrations, DTOs, client methods, UI and their self-only tests are removed together. Git worktree observation moves unchanged under the existing workspace_observation owner; shared executor/owner/model fields retain their real responsibilities under neutral names.
  • No parallel implementation is added.

Verification

  • Configured Clippy (-D warnings) over all targets of the eight changed Rust packages, including Runtime e2e/MOI features; Rust format, SDK/Web type checks and SDK build. Final complete-diff gpt-6.1-terra/max design and overall review found no unresolved material blocker; formatting and final Clippy exited 0. No claim of the whole named make check/test-offline targets.
  • Owner library units: 2,509 passed; workspace observation: 74 passed (including Git and subprocess lease coordination); CLI SSE: 117 passed; HTTP/Runtime contracts: 11 passed. SDK: 159; Web: 65; schema inventory: 45; capability matrix: all 24 references resolve.
  • Runtime full command: 5,719 passed, one failed, 101 ignored. The external local runner incorrectly enabled ASTRA_TEST_DB_IT for normal units, selecting the existing 10s test reconciliation timeout instead of 50ms. The failed capacity case passed in its intended environment; all 52 settlement-module tests subsequently passed with the DB flag unset. Do not interpret this as one successful whole-Runtime command. An additional pre-existing first-request fixture timeout led to moving Client/TLS construction outside the unchanged 1s provider-start window and reporting early caller errors; its exact earlier timing cause is unproven, and no production timeout changed.
  • Real loopback MatrixOne, fresh task-owned databases: 69 live cases passed, including fresh/repeated schema and absence of retired tables; event replay/collision/order/rollback; authority CAS/delete/late-writer and physical checkout cancellation; single physical provider-delivery winner; Work criteria/graph/branch retention/recovery/deletion/execution; all six durable artifact references and expiry, upload/seal/byte custody; authenticated expired-download 410 with summary 200 and owner/Session isolation; four-device Session flow; full product journey; frozen MOI consumer. Six additional MOI protocol tests passed.
  • 100 distinct Session projections passed concurrently with real SQL capture, correct Run/Session/status/usage and unchanged persisted totals. Nine real scripted-provider chat scenarios met the existing SQL budget (observed 17 cold / 19 warm / 18 with held control), and provider wait released Session locks.
  • No configured TSan runner on this stable-Rust/macOS setup. Real Git IPC coordination, MatrixOne transaction/CAS/cancellation/physical-attempt races and concurrent public reads provide the available concurrency checks; this is not a 1,000-Session capacity or physical write-amplification benchmark.
  • Synthetic databases were dropped; no remaining task-owned, fresh-schema, capture-probe or MOI test schemas. No production/user database was touched. CI is not awaited.

Final checklist

  • Tests exercise owning/public boundaries, retained behavior and unhappy paths.
  • Public/design documentation describes explicit feature loss and fresh deployment.
  • Final diff checked for secrets, generated files and unrelated changes.
  • Conventional Commit title.

@XuPeng-SH XuPeng-SH changed the title refactor(storage): remove redundant Work projections refactor(storage): retire redundant state and optional product chains Oct 30, 2026

@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.

Code-review verdict: approve for head 688c025ea112ee514858daa0fe6e34c8ac6537b4; no blocking correctness or design finding.

This is deliberate feature retirement for fresh, same-version deployments. The ownership changes are coherent: immutable graph manifests already own edges; retained criterion revision 1 and its owner/Work-scoped primary key fence identity reuse. Retired products are removed through schema/bootstrap/cleanup, routes, workers, DTOs, SDK and Web consumers rather than replaced with another projection or state machine. Canonical Context, durable provider receipts, invocation recovery, saved progress, authorization and generic artifact-reference custody retain their owners. The extracted Git observation/locking/hash/path core is unchanged. The lost Work exact-reviewed patch transfer/commit guarantee and diagnostic-only artifact pins are documented explicitly.

Performance assessment: no new application hot-path SQL or background worker. Run projection removes two diagnostic reads; Session state removes those plus the latest-manifest reads. Criterion admission keeps one indexed query against the retained revision authority. Trace-gated diagnostic writes and unconditional hash-diff planning disappear; production defaults already disabled the diagnostic writes, so this does not establish a per-turn physical-write multiplier or 1,000-Session capacity result.

Fresh verification for this review: 45 schema-inventory tests; 74 workspace-observation tests including real Git and cross-process coordination; five observation hash/classification unit tests; 18 real MatrixOne criteria/collision/schema cases, including concurrent CAS, identity reuse after set replacement, replay, owner isolation, rollback and idempotent fresh bootstrap. All ten retired tables were absent, and the task-owned database was dropped. SDK typecheck/build and 159 client/Work tests passed; 65 relevant Web tests and Web typechecking against this checkout's newly built SDK declarations passed. Formatting and diff whitespace checks passed. Worktree is clean. Earlier broader artifact/provider/HTTP/100-Session evidence was checked against the retained source: none of this PR's production files changed after its original delivery; the intervening changes to PR files are build-identity adjustments in two tests and documentation. Those earlier runs are not claimed as fresh executions here.

No existing PR discussion comments or review threads needed resolution at review start. No CI rerun/wait, source changes, or subagents. No whole-workspace gate, TSan, or 1,000-Session benchmark is claimed.

Submission note: GitHub rejected the APPROVE submission with HTTP 422 (Review Can not approve your own pull request), because the authenticated account and PR author are both XuPeng-SH. Recording the completed review as COMMENT; this is not a formal GitHub approval.

@XuPeng-SH
XuPeng-SH merged commit 1226b37 into matrixorigin:main Oct 31, 2026
@XuPeng-SH
XuPeng-SH deleted the refactor/work-state-simplification branch October 31, 2026 01:01
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 redundant persistence and low-value product chains

1 participant