M12.6: add scoped multi-region cellular census queries
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 2m22s
Foundation / checks (network) (push) Successful in 20m57s
Foundation / checks (client) (push) Successful in 22m5s
Foundation / checks (tsan) (push) Successful in 24m37s
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 45m14s
Foundation / checks (postgres) (push) Canceled after 45m8s

This commit is contained in:
dingo
2026-10-18 15:11:51 -04:00
parent a180c41ae7
commit 82568da9cd
20 changed files with 621 additions and 4 deletions
@@ -71,6 +71,7 @@ class CellularCensus {
query(std::uint64_t anchor, CellularCensusScope scope) const;
private:
friend class CellularCensusSet;
CellularCensus() = default;
[[nodiscard]] static std::expected<CellularCensus, CellularCensusError>
observe(const CellularLives&, std::span<const CellularCohortMember>, std::uint32_t population);
@@ -78,5 +79,9 @@ class CellularCensus {
CellularCensusBoundary boundary_;
std::vector<CellularCensusRow> rows_;
std::vector<std::vector<std::size_t>> children_;
// Complete immutable identity evidence for cross-region consistency checks.
// A short content digest alone cannot establish equality.
std::vector<biology::Genome> genomes_;
std::vector<std::uint64_t> residents_;
};
} // namespace evo::server
@@ -0,0 +1,55 @@
#pragma once
#include "evo/server/lifecycle/cellular_census.hpp"
#include <cstddef>
#include <cstdint>
#include <expected>
#include <span>
#include <vector>
namespace evo::server {
// A query/work bound, not a selected world size or proof of world completeness.
inline constexpr std::size_t max_cellular_census_regions = 64;
struct CellularCensusSetBoundary {
std::uint64_t world{}, frame{}, tick{};
std::uint32_t owner_format{}, rules{};
std::uint64_t quantum_microseconds{biology::cellular_motion_tick_microseconds};
bool operator==(const CellularCensusSetBoundary&) const = default;
};
enum class CellularCensusSetError : std::uint8_t {
invalid_request,
coverage,
boundary,
genome_conflict,
resident_conflict
};
// Detached observations of an explicitly declared region set. No branch,
// commit, permission, ownership or globally complete reconciliation proof.
class CellularCensusSet {
public:
// required_regions must be nonzero, strictly ascending and contain 1..64 IDs.
// Exactly one observation per required region, at the exact common boundary.
// Raw/cohort classification may differ; owner format/rules/quantum may not.
[[nodiscard]] static std::expected<CellularCensusSet, CellularCensusSetError>
observe(CellularCensusSetBoundary, std::span<const std::uint64_t> required_regions,
std::span<const CellularCensus> observations);
[[nodiscard]] const CellularCensusSetBoundary& boundary() const noexcept {
return boundary_;
}
// Sorted by region, owning detached copies. Lifetime: this object.
[[nodiscard]] std::span<const CellularCensus> regions() const noexcept {
return regions_;
}
// Unknown everywhere is an error, never absence. An absent local anchor can
// contribute zero only after the complete declared set has been validated.
// Nonresident totals count historical record occurrences, not unique lives.
[[nodiscard]] std::expected<CellularCensusTotals, CellularCensusError>
query(std::uint64_t anchor, CellularCensusScope scope) const;
private:
CellularCensusSet() = default;
CellularCensusSetBoundary boundary_;
std::vector<CellularCensus> regions_;
};
} // namespace evo::server