Debit reserve for proposed cellular motion
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (client) (push) Failing after 4m23s
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 (tsan) (push) Canceled after 32s
Foundation / checks (checks) (push) Canceled after 5m42s
Foundation / checks (postgres) (push) Canceled after 1m19s

This commit is contained in:
dingo
2026-10-10 21:18:57 -04:00
parent e781e929d8
commit 6816eda6a5
5 changed files with 76 additions and 0 deletions
+16
View File
@@ -31,12 +31,20 @@ struct CellularMotionProposal {
accounting::Picojoules movement_cost{};
auto operator<=>(const CellularMotionProposal&) const = default;
};
struct CellularMotionCandidate {
CellularPosition position;
accounting::Inventory reserve_after;
accounting::Inventory heat_after;
accounting::Picojoules movement_cost{};
auto operator<=>(const CellularMotionCandidate&) const = default;
};
enum class CellularMotionError : std::uint8_t {
invalid_area,
invalid_extent,
outside_area,
invalid_intent,
unsupported_rate_period,
insufficient_reserve,
overflow
};
@@ -47,6 +55,14 @@ enum class CellularMotionError : std::uint8_t {
propose_cellular_motion(CellularArea area, CellularPosition position, std::uint32_t extent_um,
CellularIntent intent, const MetabolicBudget& budget) noexcept;
// Detached one-tick candidate: movement is refused if reserve cannot pay, and
// paid energy moves to heat in the same returned value. Inputs are unchanged.
[[nodiscard]] std::expected<CellularMotionCandidate, CellularMotionError>
propose_funded_cellular_motion(CellularArea area, CellularPosition position,
std::uint32_t extent_um, CellularIntent intent,
const MetabolicBudget& budget, accounting::Inventory reserve,
accounting::Inventory heat) noexcept;
// Axis-aligned square footprints touching at an edge count as in contact.
[[nodiscard]] bool cellular_footprints_contact(CellularPosition a, std::uint32_t extent_a_um,
CellularPosition b,