M10.9d: batch durable action lookups (one per poll, one per commit)
Foundation / checks (deploy) (push) Successful in 3m27s
Foundation / checks (ecs) (push) Successful in 1m57s
Foundation / checks (client) (push) Successful in 12m41s
Foundation / checks (network) (push) Successful in 13m33s
Foundation / checks (tsan) (push) Successful in 7m54s
Foundation / checks (checks) (push) Successful in 32m56s
Foundation / checks (postgres) (push) Successful in 46m10s
Foundation / postgres-tools (push) Successful in 18s
Foundation / image (push) Successful in 2m33s
Foundation / server-image (push) Successful in 4m24s

The fourth dev drill showed a synchronous PostgreSQL round trip per action on the
simulation thread: at admission (uniqueness) and again at commit (first-record rule).
About 12 lookups landed on each commit tick (commit ticks 58-70 ms, session p99 30-39 ms).

- ActionLedger::find_all; persistence::find_region_actions applies the schema v11
  find_region_action to many pairs in one statement (no migration).
- IntentAdmission::admit/verify: actions only the ledger can refuse wait for one verify
  per poll; receipts still go out in the same poll. committed() asks once per commit.
- Tests: deferred_actions (network_control), find_region_actions and find_all (Postgres).
- ADR-0097 fourth run, ADR-0092 amendment, VALIDATION; refresh the dev session window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-08 21:35:43 -04:00
co-authored by Claude Opus 5.5
parent 3ee22694cc
commit 07d12a4d82
13 changed files with 430 additions and 45 deletions
+18
View File
@@ -166,6 +166,15 @@ void store_rules() {
std::optional{CommittedAction{131, 10, 1}}));
CHECK(holds(find_region_action(*db, r.key, *lease, alice, 3, 5s),
std::optional<CommittedAction>{}));
// M10.9d: the same answers for several pairs in one statement, in the order asked.
const std::vector<ActionRef> asked{{alice, 3}, {bob, 1}, {alice, 2}, {alice, 1}, {bob, 7}};
auto many = find_region_actions(*db, r.key, *lease, asked, 5s);
CHECK(many &&
*many == std::vector<std::optional<CommittedAction>>{
std::nullopt, CommittedAction{131, 3, 1}, CommittedAction{131, 10, 1},
CommittedAction{131, 3, 1}, std::nullopt});
CHECK(holds(find_region_actions(*db, r.key, *lease, {}, 5s),
std::vector<std::optional<CommittedAction>>{}));
// Exact retry and resolution include the action block.
const auto block = encode_actions(actions, 0, 10);
@@ -223,6 +232,9 @@ void store_rules() {
CHECK(later);
auto fenced = find_region_action(*db, r.key, *lease, alice, 1, 5s);
CHECK(!fenced && fenced.error().kind == LeaseStoreError::fenced);
const std::vector<ActionRef> one{{alice, 1}};
auto fenced_many = find_region_actions(*db, r.key, *lease, one, 5s);
CHECK(!fenced_many && fenced_many.error().kind == LeaseStoreError::fenced);
CHECK(holds(find_region_action(*db, r.key, *later, alice, 3, 5s),
std::optional{CommittedAction{131, 12, 2}}));
#ifdef EVO_POSTGRES_SESSIONS
@@ -236,8 +248,14 @@ void store_rules() {
std::optional{evo::network::ActionOutcome{
3, evo::network::ActionResult::committed_no_effect, 12, 2}}));
CHECK(holds(ledger.find(who, 99), std::optional<evo::network::ActionOutcome>{}));
const std::vector<evo::network::ActionKey> keys{{who, 99}, {who, 3}};
CHECK(holds(ledger.find_all(keys),
std::vector<std::optional<evo::network::ActionOutcome>>{
std::nullopt, evo::network::ActionOutcome{
3, evo::network::ActionResult::committed_no_effect, 12, 2}}));
current.reset();
CHECK(!ledger.find(who, 3));
CHECK(!ledger.find_all(keys));
#endif
CHECK(release_region_lease(*db, r.key, *later, 5s));
}