Require contact for cellular patch uptake
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (network) (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 49s
Foundation / checks (ecs) (push) Canceled after 42s
Foundation / checks (client) (push) Canceled after 49s

This commit is contained in:
dingo
2026-10-10 21:18:08 -04:00
parent 44732967e7
commit e781e929d8
5 changed files with 33 additions and 5 deletions
+3
View File
@@ -117,6 +117,9 @@ scoped change before starting the next segment.
- 11.3a-2: ADR-0103 and the habitat's pure perception projection implement the
5 mm footprint-gap trial radius and exact in-range stock view. Live authenticated
server replication and the complete cellular checkpoint remain open.
- 11.3c-2: habitat uptake proposals now require an authoritative in-bounds cell
footprint and refuse a patch outside contact. Atomic patch/life publication,
competing-life resolution and tick ordering remain open.
## Exit boundary
+14
View File
@@ -5887,3 +5887,17 @@ dry-run; clang-tidy 19.1.5 using the MSVC `/std:c++latest` argument; and
`git diff --check`. Linux GCC, ASan+UBSan, authenticated server visibility and
the full CI suite remain pending CI. This projection is not yet wired into live
replication or a persistent cellular checkpoint.
## 2026-10-10 — M11.3c-2 contact-gated patch uptake (CI pending)
The habitat uptake proposal now validates the cell footprint against the finite
arena and requires footprint contact with the requested stocked patch before it
calculates any transfer. Missing and non-contact patches are distinct refusals;
the helper still only proposes post-transfer balances and does not publish or
mutate either owner.
Executed locally: warning-as-error MSVC Debug and Release `NDEBUG` compile/run,
focused CTest for motion, uptake and habitat (3/3 passed), clang-format 19.1.5,
clang-tidy 19.1.5 with MSVC `/std:c++latest`, and `git diff --check`. CI
qualification, simultaneous claims and atomic patch/life publication remain
open.
+3 -2
View File
@@ -56,6 +56,7 @@ enum class CellularHabitatError : std::uint8_t {
duplicate_patch,
overflow,
missing_patch,
not_in_contact,
uptake,
outside_area,
format,
@@ -86,8 +87,8 @@ class CellularHabitat {
[[nodiscard]] std::expected<std::vector<CellularPatchPerception>, CellularHabitatError>
perceive(CellularPosition position, std::uint32_t extent_um) const;
[[nodiscard]] std::expected<CellularPatchUptakeProposal, CellularHabitatError>
propose_uptake(CellularPatchAddress address, accounting::Inventory reserve,
const MetabolicBudget& budget) const noexcept;
propose_uptake(CellularPatchAddress address, CellularPosition position, std::uint32_t extent_um,
accounting::Inventory reserve, const MetabolicBudget& budget) const noexcept;
// Canonical little-endian envelope, FNV-1a64 checksum for corruption checks only.
[[nodiscard]] std::vector<std::uint8_t> snapshot() const;
+9 -1
View File
@@ -152,12 +152,20 @@ CellularHabitat::perceive(CellularPosition position, std::uint32_t extent_um) co
}
std::expected<CellularPatchUptakeProposal, CellularHabitatError>
CellularHabitat::propose_uptake(CellularPatchAddress address, accounting::Inventory reserve,
CellularHabitat::propose_uptake(CellularPatchAddress address, CellularPosition position,
std::uint32_t extent_um, accounting::Inventory reserve,
const MetabolicBudget& budget) const noexcept {
if (extent_um == 0 || extent_um > config_.width_um || extent_um > config_.height_um ||
position.x_um > config_.width_um - extent_um ||
position.y_um > config_.height_um - extent_um)
return std::unexpected{CellularHabitatError::outside_area};
const auto index = find(address);
if (!index)
return std::unexpected{CellularHabitatError::missing_patch};
const auto& patch = config_.patches[*index];
if (!cellular_footprints_contact(position, extent_um, {patch.address.x_um, patch.address.y_um},
cellular_patch_pitch_um))
return std::unexpected{CellularHabitatError::not_in_contact};
const auto uptake = propose_cellular_uptake(patch.stock, reserve, budget);
if (!uptake)
return std::unexpected{CellularHabitatError::uptake};
+4 -2
View File
@@ -44,13 +44,15 @@ void create_query_and_propose() {
CHECK(!(*made)->find({2'000, 1'000}));
CHECK((*made)->totals() == Inventory{{3'000}, {{{50}, {25}, {12}, {5}}}});
const auto plan = (*made)->propose_uptake({0, 0}, {}, uptake_budget());
const auto plan = (*made)->propose_uptake({0, 0}, {0, 0}, 20, {}, uptake_budget());
CHECK(plan && plan->patch == CellularPatchAddress{0, 0});
CHECK(plan->transfer.acquired == Inventory{{50}, {{{5}, {2}, {1}, {0}}}});
CHECK(plan->transfer.patch_after == Inventory{{950}, {{{15}, {8}, {4}, {2}}}});
CHECK(plan->transfer.reserve_after == plan->transfer.acquired);
CHECK((*made)->patches()[0].stock == Inventory{{1'000}, {{{20}, {10}, {5}, {2}}}});
CHECK(!(*made)->propose_uptake({2'000, 0}, {}, uptake_budget()));
CHECK(!(*made)->propose_uptake({2'000, 0}, {0, 0}, 20, {}, uptake_budget()));
const auto distant = (*made)->propose_uptake({1'000, 0}, {0, 0}, 20, {}, uptake_budget());
CHECK(!distant && distant.error() == CellularHabitatError::not_in_contact);
}
void canonical_snapshot_round_trip() {