Add input-aware durable action lookup
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 40s
Foundation / checks (ecs) (push) Successful in 1m50s
Foundation / checks (postgres) (push) Failing after 50s
Foundation / checks (tsan) (push) Failing after 31s
Foundation / checks (network) (push) Failing after 3m5s
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 4m22s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 40s
Foundation / checks (ecs) (push) Successful in 1m50s
Foundation / checks (postgres) (push) Failing after 50s
Foundation / checks (tsan) (push) Failing after 31s
Foundation / checks (network) (push) Failing after 3m5s
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 4m22s
This commit is contained in:
@@ -191,6 +191,11 @@ scoped change before starting the next segment.
|
|||||||
tests verify identical retry bytes and reject zero ticks, malformed flags,
|
tests verify identical retry bytes and reject zero ticks, malformed flags,
|
||||||
reserved bytes and noncanonical absent-target addresses. Durable lookup and
|
reserved bytes and noncanonical absent-target addresses. Durable lookup and
|
||||||
publication remain open.
|
publication remain open.
|
||||||
|
- 11.3d-5d: `ActionLedger` now has input-aware single and batch record queries.
|
||||||
|
Its compatibility implementation exposes legacy outcomes without cellular
|
||||||
|
bytes, which is insufficient to admit v7 retries and therefore fails closed.
|
||||||
|
PostgreSQL overrides, exact-byte admission comparison and publication remain
|
||||||
|
open.
|
||||||
|
|
||||||
## Exit boundary
|
## Exit boundary
|
||||||
|
|
||||||
|
|||||||
@@ -6152,3 +6152,17 @@ compile/run of the cellular protocol test and codec, plus `git diff --check`.
|
|||||||
The CMake/Ninja target remains stalled before compilation. `clang-format` and
|
The CMake/Ninja target remains stalled before compilation. `clang-format` and
|
||||||
`clang-tidy` are unavailable on this Windows PATH. Durable ledger lookup,
|
`clang-tidy` are unavailable on this Windows PATH. Durable ledger lookup,
|
||||||
PostgreSQL publication, crash resolution and CI remain pending.
|
PostgreSQL publication, crash resolution and CI remain pending.
|
||||||
|
|
||||||
|
## 2026-10-10 — M11.3d-5d input-aware action ledger API (CI pending)
|
||||||
|
|
||||||
|
Extended `ActionLedger` with single and batch durable-record queries that carry
|
||||||
|
an optional canonical cellular input beside the final outcome. Its default
|
||||||
|
adapter preserves existing implementations but returns no cellular input for
|
||||||
|
legacy rows; that cannot prove an exact v7 retry, so callers must refuse such
|
||||||
|
reuse. The network regression now asserts this fail-closed compatibility view.
|
||||||
|
|
||||||
|
Executed locally: warning-as-error MSVC 19.44 compile of the updated admission
|
||||||
|
implementation and network regression translation units, plus `git diff
|
||||||
|
--check`. The combined network executable was not rebuilt or run locally; CI
|
||||||
|
must run the network suite. The PostgreSQL implementation, exact-input matching
|
||||||
|
and cellular publication remain pending.
|
||||||
|
|||||||
@@ -68,6 +68,13 @@ struct ActionKey {
|
|||||||
AccountId account;
|
AccountId account;
|
||||||
std::uint64_t action_id{};
|
std::uint64_t action_id{};
|
||||||
};
|
};
|
||||||
|
struct DurableActionRecord {
|
||||||
|
ActionOutcome outcome;
|
||||||
|
// Present only for cellular actions. This is the canonical 24-byte biological
|
||||||
|
// input, independent of the session and epoch used to deliver a retry.
|
||||||
|
std::optional<std::array<std::uint8_t, cellular_action_input_bytes>> cellular_input;
|
||||||
|
friend bool operator==(const DurableActionRecord&, const DurableActionRecord&) = default;
|
||||||
|
};
|
||||||
class ActionLedger {
|
class ActionLedger {
|
||||||
public:
|
public:
|
||||||
ActionLedger() = default;
|
ActionLedger() = default;
|
||||||
@@ -79,6 +86,14 @@ class ActionLedger {
|
|||||||
[[nodiscard]] virtual std::expected<std::vector<std::optional<ActionOutcome>>,
|
[[nodiscard]] virtual std::expected<std::vector<std::optional<ActionOutcome>>,
|
||||||
ActionLedgerError>
|
ActionLedgerError>
|
||||||
find_all(std::span<const ActionKey> keys);
|
find_all(std::span<const ActionKey> keys);
|
||||||
|
// Input-aware queries are used by v7 cellular actions. The compatibility
|
||||||
|
// default preserves legacy ledgers; absence of cellular_input cannot prove
|
||||||
|
// an exact cellular retry and must be treated as an identity conflict.
|
||||||
|
[[nodiscard]] virtual std::expected<std::optional<DurableActionRecord>, ActionLedgerError>
|
||||||
|
find_record(const AccountId& account, std::uint64_t action_id);
|
||||||
|
[[nodiscard]] virtual std::expected<std::vector<std::optional<DurableActionRecord>>,
|
||||||
|
ActionLedgerError>
|
||||||
|
find_all_records(std::span<const ActionKey> keys);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ActionLedger(ActionLedger&&) = default;
|
ActionLedger(ActionLedger&&) = default;
|
||||||
|
|||||||
@@ -438,6 +438,29 @@ ActionLedger::find_all(std::span<const ActionKey> keys) {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::expected<std::optional<DurableActionRecord>, ActionLedgerError>
|
||||||
|
ActionLedger::find_record(const AccountId& account, std::uint64_t action_id) {
|
||||||
|
auto found = find(account, action_id);
|
||||||
|
if (!found.has_value())
|
||||||
|
return std::unexpected(found.error());
|
||||||
|
if (!found.value())
|
||||||
|
return std::optional<DurableActionRecord>{};
|
||||||
|
return std::optional<DurableActionRecord>{DurableActionRecord{*found.value(), std::nullopt}};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::expected<std::vector<std::optional<DurableActionRecord>>, ActionLedgerError>
|
||||||
|
ActionLedger::find_all_records(std::span<const ActionKey> keys) {
|
||||||
|
std::vector<std::optional<DurableActionRecord>> out;
|
||||||
|
out.reserve(keys.size());
|
||||||
|
for (const auto& key : keys) {
|
||||||
|
auto found = find_record(key.account, key.action_id);
|
||||||
|
if (!found.has_value())
|
||||||
|
return std::unexpected(found.error());
|
||||||
|
out.push_back(*found);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
IntentAdmission::Found IntentAdmission::lookup(const AccountId& account,
|
IntentAdmission::Found IntentAdmission::lookup(const AccountId& account,
|
||||||
std::uint64_t action_id) const {
|
std::uint64_t action_id) const {
|
||||||
Found f;
|
Found f;
|
||||||
|
|||||||
@@ -477,6 +477,11 @@ void deferred_actions() {
|
|||||||
return a.admit(session, SessionAction{session, 5, id, 1, tick}, f);
|
return a.admit(session, SessionAction{session, 5, id, 1, tick}, f);
|
||||||
};
|
};
|
||||||
ledger.records.emplace_back(alice, ActionOutcome{9, ActionResult::committed_no_effect, 40, 3});
|
ledger.records.emplace_back(alice, ActionOutcome{9, ActionResult::committed_no_effect, 40, 3});
|
||||||
|
const auto legacy_record = ledger.find_record(alice, 9);
|
||||||
|
CHECK(legacy_record && legacy_record->has_value() &&
|
||||||
|
legacy_record->value().outcome ==
|
||||||
|
ActionOutcome{9, ActionResult::committed_no_effect, 40, 3} &&
|
||||||
|
!legacy_record->value().cellular_input);
|
||||||
CHECK(!admit(1, 9, 101) && !admit(1, 20, 101) && !admit(2, 30, 102));
|
CHECK(!admit(1, 9, 101) && !admit(1, 20, 101) && !admit(2, 30, 102));
|
||||||
// In-memory refusals answer at once; a repeat of a waiting action is a duplicate.
|
// In-memory refusals answer at once; a repeat of a waiting action is a duplicate.
|
||||||
CHECK(admit(1, 20, 101) == ActionReceipt{20, AdmitStatus::duplicate, 100, 101});
|
CHECK(admit(1, 20, 101) == ActionReceipt{20, AdmitStatus::duplicate, 100, 101});
|
||||||
|
|||||||
Reference in New Issue
Block a user