Add cellular checkpoint persistence calls
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 40s
Foundation / checks (ecs) (push) Successful in 1m56s
Foundation / checks (postgres) (push) Failing after 49s
Foundation / checks (tsan) (push) Failing after 32s
Foundation / checks (network) (push) Failing after 3m0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (client) (push) Canceled after 4m23s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 40s
Foundation / checks (ecs) (push) Successful in 1m56s
Foundation / checks (postgres) (push) Failing after 49s
Foundation / checks (tsan) (push) Failing after 32s
Foundation / checks (network) (push) Failing after 3m0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (client) (push) Canceled after 4m23s
This commit is contained in:
@@ -216,6 +216,12 @@ scoped change before starting the next segment.
|
||||
Migration-chain, privilege-audit, and parser tests are added. PostgreSQL CI is
|
||||
pending; the C++ writer, full process recovery, and RegionSessions v7 enablement
|
||||
remain open.
|
||||
- 11.3d-6b: the persistence API now has separately named cellular publish and
|
||||
ambiguous-commit resolution calls. Both pass canonical action bytes to the
|
||||
profile-4 SQL wrappers and validate the returned receipt/status using the
|
||||
existing store error contract. Focused PostgreSQL adapter tests cover malformed
|
||||
calls; CI execution is pending. Payload preparation, replay validation, and a
|
||||
cellular region host remain open.
|
||||
|
||||
## Exit boundary
|
||||
|
||||
|
||||
@@ -6214,3 +6214,16 @@ PostgreSQL migration and integration tests were not run locally because `psql` i
|
||||
not installed in this Windows environment; Linux/PostgreSQL CI qualification
|
||||
remains pending. The C++ writer, replay verification, crash/restart process tests,
|
||||
and RegionSessions v7 enablement remain open.
|
||||
## 2026-10-10 — M11.3d-6b cellular PostgreSQL adapter (CI pending)
|
||||
|
||||
Added `publish_cellular_checkpoint` and `resolve_cellular_region_commit` to the
|
||||
region persistence interface. They call only the profile-4 SQL wrappers, preserve
|
||||
their exact manifest/decision/action bytes, classify SQL failures through the
|
||||
existing lease-store contract, and parse the normal durable receipt or resolution
|
||||
status. The PostgreSQL adapter integration test now verifies malformed calls are
|
||||
rejected as invalid requests.
|
||||
|
||||
`git diff --check` passes. The adapter and PostgreSQL integration tests have not
|
||||
run locally; this Windows environment lacks the PostgreSQL build/runtime needed
|
||||
for `EVO_BUILD_POSTGRES`, so CI is required. No cellular host calls these methods
|
||||
yet.
|
||||
|
||||
@@ -76,6 +76,14 @@ publish_region_checkpoint(Postgres& db, std::span<const std::uint8_t> manifest,
|
||||
std::span<const std::uint8_t> decisions,
|
||||
std::span<const std::uint8_t> actions, std::chrono::milliseconds timeout);
|
||||
|
||||
// Schema v20, ADR-0112: profile-4 checkpoints use a distinct publisher so the
|
||||
// canonical cellular action block is bound to the checkpoint and durable result rows.
|
||||
[[nodiscard]] std::expected<RegionHead, LeaseStoreFailure>
|
||||
publish_cellular_checkpoint(Postgres& db, std::span<const std::uint8_t> manifest,
|
||||
std::span<const std::uint8_t> decisions,
|
||||
std::span<const std::uint8_t> actions,
|
||||
std::chrono::milliseconds timeout);
|
||||
|
||||
enum class Resolution : std::uint8_t {
|
||||
committed, // Exact bytes are durable; receipt holds the head. Grants no authority.
|
||||
absent, // Not committed now; proves nothing about a request still in flight.
|
||||
@@ -96,6 +104,14 @@ resolve_region_commit(Postgres& db, RegionKey key, const Uuid& commit,
|
||||
std::span<const std::uint8_t> manifest,
|
||||
std::span<const std::uint8_t> decisions,
|
||||
std::span<const std::uint8_t> actions, std::chrono::milliseconds timeout);
|
||||
|
||||
// Schema v20 resolution also compares the immutable profile-4 cellular action block.
|
||||
[[nodiscard]] std::expected<ResolvedCommit, LeaseStoreFailure>
|
||||
resolve_cellular_region_commit(Postgres& db, RegionKey key, const Uuid& commit,
|
||||
std::span<const std::uint8_t> manifest,
|
||||
std::span<const std::uint8_t> decisions,
|
||||
std::span<const std::uint8_t> actions,
|
||||
std::chrono::milliseconds timeout);
|
||||
// The committed record of an account's action in the lease's world (schema v11), under the
|
||||
// caller's exact lease. Nothing when the action was never committed.
|
||||
struct CommittedAction {
|
||||
|
||||
@@ -336,6 +336,22 @@ publish_region_checkpoint(Postgres& db, std::span<const std::uint8_t> manifest,
|
||||
return *head;
|
||||
}
|
||||
|
||||
std::expected<RegionHead, LeaseStoreFailure>
|
||||
publish_cellular_checkpoint(Postgres& db, std::span<const std::uint8_t> manifest,
|
||||
std::span<const std::uint8_t> decisions,
|
||||
std::span<const std::uint8_t> actions, milliseconds timeout) {
|
||||
const std::array<std::string, 3> p{bytea(manifest), bytea(decisions), bytea(actions)};
|
||||
auto rows = db.query(
|
||||
"SELECT * FROM evolution.publish_cellular_checkpoint($1::bytea, $2::bytea, $3::bytea)",
|
||||
p, timeout);
|
||||
if (!rows)
|
||||
return std::unexpected{classify(rows.error())};
|
||||
auto head = parse_head(*rows);
|
||||
if (!head)
|
||||
return std::unexpected{malformed(true)};
|
||||
return *head;
|
||||
}
|
||||
|
||||
std::expected<ResolvedCommit, LeaseStoreFailure>
|
||||
resolve_region_commit(Postgres& db, RegionKey key, const Uuid& commit,
|
||||
std::span<const std::uint8_t> manifest,
|
||||
@@ -367,6 +383,35 @@ resolve_region_commit(Postgres& db, RegionKey key, const Uuid& commit,
|
||||
return ResolvedCommit{Resolution::committed, *head};
|
||||
}
|
||||
|
||||
std::expected<ResolvedCommit, LeaseStoreFailure>
|
||||
resolve_cellular_region_commit(Postgres& db, RegionKey key, const Uuid& commit,
|
||||
std::span<const std::uint8_t> manifest,
|
||||
std::span<const std::uint8_t> decisions,
|
||||
std::span<const std::uint8_t> actions, milliseconds timeout) {
|
||||
const std::array<std::string, 6> p{std::to_string(key.world), std::to_string(key.region),
|
||||
uuid_text(commit), bytea(manifest),
|
||||
bytea(decisions), bytea(actions)};
|
||||
auto rows = db.query(
|
||||
"SELECT * FROM evolution.resolve_cellular_region_commit($1::evolution.u64, "
|
||||
"$2::evolution.u64, $3::uuid, $4::bytea, $5::bytea, $6::bytea)",
|
||||
p, timeout);
|
||||
if (!rows)
|
||||
return std::unexpected{classify(rows.error())};
|
||||
if (rows->size() != 1 || (*rows)[0].size() != 6 || !(*rows)[0][0])
|
||||
return std::unexpected{malformed(false)};
|
||||
const auto& status = *(*rows)[0][0];
|
||||
if (status == "absent")
|
||||
return ResolvedCommit{Resolution::absent, {}};
|
||||
if (status == "conflict")
|
||||
return ResolvedCommit{Resolution::conflict, {}};
|
||||
const PgRows receipt{
|
||||
std::vector<std::optional<std::string>>((*rows)[0].begin() + 1, (*rows)[0].end())};
|
||||
auto head = status == "committed" ? parse_head(receipt) : std::nullopt;
|
||||
if (!head)
|
||||
return std::unexpected{malformed(false)};
|
||||
return ResolvedCommit{Resolution::committed, *head};
|
||||
}
|
||||
|
||||
std::expected<std::optional<CommittedAction>, LeaseStoreFailure>
|
||||
find_region_action(Postgres& db, RegionKey key, const LeaseGrant& lease, const Uuid& account,
|
||||
std::uint64_t action_id, milliseconds timeout) {
|
||||
|
||||
@@ -183,6 +183,16 @@ void runtime_cannot_bypass_the_guard() {
|
||||
CHECK(release_region_lease(*db, key, *lease, 5s));
|
||||
}
|
||||
|
||||
void cellular_publisher_adapter_rejects_malformed_requests() {
|
||||
auto db = runtime();
|
||||
const std::vector<std::uint8_t> empty;
|
||||
auto published = publish_cellular_checkpoint(*db, empty, empty, empty, 5s);
|
||||
CHECK(failed(published, LeaseStoreError::invalid));
|
||||
auto resolved = resolve_cellular_region_commit(*db, {1, 999}, id(0xC1), empty, empty, empty,
|
||||
5s);
|
||||
CHECK(failed(resolved, LeaseStoreError::invalid));
|
||||
}
|
||||
|
||||
void acquire_renew_release_and_publish() {
|
||||
auto admin = owner();
|
||||
const auto key = provision(*admin, 20);
|
||||
@@ -517,6 +527,7 @@ void measure_round_trips() {
|
||||
|
||||
void run_region_lease_store_tests() {
|
||||
runtime_cannot_bypass_the_guard();
|
||||
cellular_publisher_adapter_rejects_malformed_requests();
|
||||
acquire_renew_release_and_publish();
|
||||
database_time_expiry_and_paused_writer();
|
||||
queued_writer_uses_post_lock_database_time();
|
||||
|
||||
Reference in New Issue
Block a user