Repository navigation
refactor(storage): unify SQLite storage on synchronous actors - #6671
Conversation
Generated-by: OpenAI Codex
Generated-by: OpenAI Codex
There was a problem hiding this comment.
This is a scoped schema/test-compatibility finding at 6702684, not a completed review of the full 223-file storage refactor or its v1-to-v2 upgrade implications.
P2: migrate the sibling-package corruption fixture to the new content table. platform/event-log/migrations/0001_runtime.sql:334 replaces application_package_files.payload with content_id, but the unchanged historical_binary_bundle_export_round_trips_and_cancels_with_cleanup test still executes UPDATE application_package_files SET payload = X'00' ... at platform/host-runtime/src/application/management/tests.rs:698. Current-head CI 42221160744, rest-4 slice 1 job 127917318350, fails at line 704 with SQLite no such column: payload, before the remaining historical-package export/round-trip/cancellation checks can run.
I independently executed the complete real initial schemas from 4c2bb68 and this head in isolated SQLite databases, then ran the exact fixture UPDATE with bound IDs. It prepares/executes against the old schema and fails with the same missing-column error against the new schema, even without matching rows. The test file is byte-for-byte unchanged between those revisions; the new table has id, revision, path, content_id, where the old table had payload. Adapt the corruption to the contents row referenced by the sibling file and preserve the intended single-package isolation, historical round-trip and cancellation/cleanup assertions rather than removing them.
I read the affected schema delta and the test's shutdown/corrupt/reopen sequence, and checked the actual hosted failure. This is a confirmed PR-caused test integration failure. It does not demonstrate a production bundle corruption or prove that the intentionally breaking v2 storage format is otherwise safe. The inherited composer/permission-fixture failures in other jobs are separate. Full ownership/reclamation, checkpoint export after retirement, concurrency, performance and old-Root upgrade acceptance remain unreviewed here. No approval or merge performed.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
| revision TEXT NOT NULL, | ||
| path TEXT NOT NULL, | ||
| payload BLOB NOT NULL, | ||
| content_id INTEGER NOT NULL REFERENCES contents(id), |
There was a problem hiding this comment.
P2 — update the direct-SQL corruption test for this column change.
The unchanged application::management::tests::historical_binary_bundle_export_round_trips_and_cancels_with_cleanup still writes application_package_files.payload at management/tests.rs:698. Current CI job 127917318350 fails with no such column: payload before completing the export/round-trip/cancellation checks. The exact UPDATE succeeds against the old real initial schema and fails against this schema in an isolated SQLite reproduction. Corrupt the sibling’s referenced contents payload while preserving the existing assertions.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
Keep one durable writer with independent synchronous read owners, prepare immutable material outside transactions, and remove SQLx transaction lifecycle layers from runtime storage. Generated-by: OpenAI Codex
Keep the existing database marker, return one storage owner, remove strategy-bound test assertions, and restore upstream SQLx execution paths. Retain only SQLite dependency alignment and the measured client QPSG option. Generated-by: OpenAI Codex
Astro-Han
left a comment
There was a problem hiding this comment.
This is a limited follow-up at 4c72dd0 for the previous corrupt-package fixture finding and the current CI integration failure. It is not a complete review of the now 382-file synchronous SQLite actor/storage rewrite.
The previous UPDATE application_package_files SET payload = ... finding is fixed in the source. The fixture now inserts corrupt bytes into contents and updates only the selected package file's content_id, asserting exactly one changed row. I executed the complete current initial schema and those exact SQL statements against synthetic shared-content rows: the selected sibling file changed, while the wanted package and another file sharing the original content remained intact. I also read the retained reopen, package-read/export, cancellation and foreign-source assertions. This validates the SQL fixture; I have not run the full Rust test or actor/restart behavior myself.
P2: regenerate the published Rust dependency inventory after changing the dependency graph. Current-head CI 42244228620, tooling job 127984873491, fails with Rust dependency inventory is stale; run node scripts/rust/dependencies.mjs generate. This is supported by a concrete mismatch: Cargo.lock removes bindgen 0.73.2, including its libsqlite3-sys dependency edge, but the unchanged products/maka/cli/DEPENDENCIES.rust.tsv still lists [email protected]. I parsed the current lockfile and confirmed its only bindgen versions are 0.70.1 and 0.72.1. Regenerate and commit the inventory, then rerun the tooling check. This finding concerns the required dependency-inventory check; it does not establish a production database corruption or licensing violation.
The current branch merges into rust-preview 500d53b without conflicts in git merge-tree, but CI is not green. The architecture and upgrade contract have changed since the previous review, so the former v2 description must not be treated as the current design. I have not accepted partitioned-root conversion, storage ownership, actor shutdown/cancellation, durability, concurrency or performance for this rewrite. No approval or merge performed.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
| @@ -1077,23 +1077,6 @@ dependencies = [ | |||
| "syn 2.0.119", | |||
| ] | |||
|
|
|||
There was a problem hiding this comment.
P2 — update the dependency inventory with this lockfile change.
The lockfile removes bindgen 0.73.2, but products/maka/cli/DEPENDENCIES.rust.tsv still contains [email protected]. The actual current-head tooling job 127984873491 in CI 42244228620 fails the required inventory comparison. Run node scripts/rust/dependencies.mjs generate, commit the resulting inventory and rerun the check.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
Generated-by: OpenAI Codex
Verify that an intermediate head is followed by the latest commit rather than assuming the reader skips every intermediate revision. Generated-by: OpenAI Codex
Regenerate the dependency inventory after removing the unused SQLite worker code. Keep the test creator claim live through its durable release to avoid racing a newly accepted creator. Generated-by: OpenAI Codex
Astro-Han
left a comment
There was a problem hiding this comment.
This is a limited follow-up at 78c5336 for the dependency-inventory finding and the two subsequent test-support changes. I have not completed a review of all 384 files in the storage rewrite.
The previous inventory P2 is fixed: DEPENDENCIES.rust.tsv now removes [email protected], matching its removal from the lockfile. The actual required tooling job passes both on the final PR run 42256366984/job 128028892381 and on merged rust-preview 9c67d19, run 42258295851/job 128038161950. The overall runs have not completed; successful tooling does not imply successful full CI.
I read both follow-up commits after the merge of 500d53b. The application subscription test now accepts an intermediate committed third revision but still requires the fourth revision afterward, retaining foreign-deployment and future-revision rejection. The Bot's #[cfg(test)] release helper keeps its in-process creator claim until the durable release finishes and only clears a matching cached Session. The old 4c72dd0 run's native test did fail in this helper; I have not independently rerun that complete native test or the actor scheduling tests. These edits do not establish acceptance of all concurrency and cleanup behavior.
The linked migration gist has also changed: I read its current README and file inventory, which now explicitly provide a nine-database rust-preview Root to final-schema offline converter. The former statement that only an earlier single-database converter is supplied is no longer current. I have not audited or executed the converter; its detailed validation results remain the author's evidence. Complete migration, durability, ownership, cancellation and performance validation remains outside this follow-up. No approval or merge performed.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
Summary
Runtime storage splits one Root across nine databases, duplicates immutable material, and creates another database for each checkpoint inspection. Replace this with one owned SQLite database, shared immutable content, and frozen snapshot references.
rusqlite::Connectionhandles on native threads; public APIs remain asynchronous. Remove the event-log SQLx executor, nested runtime and asynchronous transaction-cleanup layers. Migrate settings storage and deployment consumers to the same connection API.contents, reclaimed when their last durable owner releases them.libsqlite3-sysdependency alignment and the client journal's measured QPSG option; all other SQLx execution code matches upstream 0.9.0.Storage layout and existing data
This branch has no storage compatibility guarantee. The implementation uses the current single-database layout directly, without a new “v2” format, an old-layout decoder or a runtime upgrade path. Keep the original database identity marker and validate the current schema checksum.
The offline migration tool converts the current
rust-previewnine-database Root directly to this PR's final schema. A trial build of this PR is not required. It merges durable authority and receipt rows, relocates event coordinates, rebuilds reachable context, deduplicates immutable material and rewrites checkpoint references through the real target exporter.Preparation holds the existing native Root/database leases and leaves source contents unchanged. Installation verifies source and staging fingerprints, backs up all nine databases and original checkpoint objects, publishes immutable objects first and atomically replaces the main database last. Root identity and configuration remain in place. The gist includes complete source/schema inputs, pinned offline Rust helpers, commands and rollback instructions; no migration helper is embedded in normal runtime startup. No local user database was changed.
The external session-bundle format remains unchanged. Imported raw tool values must reproduce their declared original bytes.
Verification
cargo test -p maka-event-log: 245 unit tests, 146 integration tests and both cross-process Root lease tests passed.cargo test -p maka-config: 1 unit test and 25 integration tests passed.-D warnings, rustfmt and diff checks passed.cargo build --locked -p maka-cli --bins --no-default-featuresand release storage examples built successfully.The offline migration was exercised against real databases produced by the current partitioned implementation, including model/tool history, an 8 MiB artifact, application packages and operation receipts, message queue commands, plugin data, idle and nested branches, an unstarted Preparing revision and normally deleted/garbage-collected copied history. After full preparation and installation, target APIs read all 23 live Sessions, validate two checkpoint exports and replay four original loads. Inherited semantic metadata and complete payload bytes match across all four source/idle/nested/Preparing views; large integer/decimal/Unicode tool JSON matches both typed values and serialized bytes. Held-Root installation and modified staging are rejected before the database switch. Unreachable deleted history retains its proofs without recreating collected content.
CI also exposed two existing test-helper races; their release/snapshot assumptions were corrected without changing production behavior or weakening the behavioral assertions. Dependency inventory was regenerated. The older PR run's CLI/desktop interaction failures were also present with the same assertions on base commit
500d53b46; those baseline failures are outside this storage change.Behavior tests cover accepted preparation after waiter/runtime loss, read cancellation and connection reuse, available-reader scheduling, shutdown of waiting readers, and migration atomicity/checksum rejection. Existing suites continue to cover bundle transfer, snapshot retention, content collection, authority and recovery.
Measurements
Release measurements of the actor implementation at
ff113192e, with the same benchmark source in both binaries, compared against the earlier single-database SQLx implementation at670268452. Each case runs 16 concurrent Sessions with concurrent catalog/history reads. Short and unique cases use 20 model/tool cycles per Session; long uses 200. Tool payloads are 64 KiB. Medians of three sequential, alternating runs:These are mixed application workloads, not isolated SQLite throughput. Catalog p95 improved in all three cases; history p95 improved in the repeated cases and changed from 2.77 to 3.22 ms in the unique case. Durability was unchanged. A larger page-cache experiment showed no stable benefit and was discarded.
A separate five-run create/reopen comparison with three 2 MiB inputs validated complete bodies, arbitrary windows, descriptors and exports: zero errors, identical fixture commitments and a 99,328-byte peak charged read window in both implementations. Raw commands, binary hashes and distributions were retained locally; temporary datasets and the baseline worktree were removed. The new
scripts/bench-runtime-concurrency.pyrecords matching fixture hashes and rejects failed/incomplete workloads.The remaining QPSG option was separately checked through real client Journal APIs with five alternating on/off runs on the local development build. Each run performed 20,000 draft/operation point reads, 3,000 recovery-list queries and 1,024 durable draft writes. Point reads and writes showed little difference; recovery queries improved from a 519.6 ms median to 381.1 ms (27%), with statement recompilations dropping from 3,000 to zero. The temporary probe was removed rather than added to the permanent test suite.
AI use
OpenAI Codex implemented and verified the refactor; GPT-6-Astra independently advised and reviewed. Commits include a
Generated-bytrailer.Checklist
Does this PR entail a change in behavior?