feat(simulation): wire L3->L4 GenerateSkeleton dispatch (T-1022) #157

Merged
jpmschweitzer merged 2 commits from layer4-skeleton-dispatch into main 2026-06-07 18:42:13 +02:00
Owner

Summary

Wires Layer-3 settlement placement → Layer-4 quarter-skeleton generation (T-1022, D-234).

The Layer-4 geometry (D-234 morphology-correct streets, the D-234b waterfront rule) was fully implemented but dormant: no production call site dispatched GenerateSkeleton from a placement, so founding_orientation stayed pinned to the context_from_read_set Cardinal stub.

Changes (server/src/atlas/plugin.rs)

  • Expand the GenCompletion::BodyAnalyzed arm of drain_generation_completions: before caching the body, iterate state.placements and submit one GenerateSkeleton per settlement.
  • Per placement: build the D-199 context from read_set (via the pure context_from_read_set), override founding_orientation with the attractor-matched value carried on CityPlacement (D-213), and derive a canonical, namespace-isolated quarter_id from (world_seed, body, city) (D-194/D-230) — replacing the city_id * 10 placeholder.
  • Dispatch logic extracted into the pure build_skeleton_work_item helper (DB-free unit testing).
  • Reader + world seed are optional system params (mirrors serve_atlas_requests); absent either, dispatch is skipped and the body is still cached.
  • Edge cases handled: empty placements → no-op; per-placement read_set error → warn + skip. Station/multi-source dispatch (Q-109) is out of scope — BodyAnalyzed only fires on the planetary AnalyzeBody path.

Tests

  • build_skeleton_work_item_threads_orientation_and_canonical_quarter_id — asserts the placement's orientation (e.g. Coastal) replaces the Cardinal stub, and the canonical quarter_id formula (not city_id*10).
  • quarter_id_is_deterministic_and_city_scoped — same inputs → same id; different city → different id.

Verification

  • cargo build clean
  • cargo test --lib1327 passed, 0 failed
  • cargo clippy --lib -- -D warnings clean

Notes

  • Runtime smoke not run (this is a background-dispatch wiring; a planetary body with placements now produces GenerateSkeletonSkeletonGenerated → quarters populated, exercised via the existing cascade + new helper tests).
## Summary Wires Layer-3 settlement placement → Layer-4 quarter-skeleton generation (**T-1022**, D-234). The Layer-4 geometry (D-234 morphology-correct streets, the D-234b waterfront rule) was fully implemented but **dormant**: no production call site dispatched `GenerateSkeleton` from a placement, so `founding_orientation` stayed pinned to the `context_from_read_set` `Cardinal` stub. ## Changes (`server/src/atlas/plugin.rs`) - Expand the `GenCompletion::BodyAnalyzed` arm of `drain_generation_completions`: before caching the body, iterate `state.placements` and submit one `GenerateSkeleton` per settlement. - Per placement: build the D-199 context from `read_set` (via the pure `context_from_read_set`), **override `founding_orientation`** with the attractor-matched value carried on `CityPlacement` (D-213), and derive a canonical, namespace-isolated `quarter_id` from `(world_seed, body, city)` (D-194/D-230) — replacing the `city_id * 10` placeholder. - Dispatch logic extracted into the pure `build_skeleton_work_item` helper (DB-free unit testing). - Reader + world seed are optional system params (mirrors `serve_atlas_requests`); absent either, dispatch is skipped and the body is still cached. - Edge cases handled: empty placements → no-op; per-placement `read_set` error → warn + skip. Station/multi-source dispatch (Q-109) is out of scope — `BodyAnalyzed` only fires on the planetary `AnalyzeBody` path. ## Tests - `build_skeleton_work_item_threads_orientation_and_canonical_quarter_id` — asserts the placement's orientation (e.g. `Coastal`) replaces the Cardinal stub, and the canonical quarter_id formula (not `city_id*10`). - `quarter_id_is_deterministic_and_city_scoped` — same inputs → same id; different city → different id. ## Verification - `cargo build` clean - `cargo test --lib` — **1327 passed, 0 failed** - `cargo clippy --lib -- -D warnings` clean ## Notes - Runtime smoke not run (this is a background-dispatch wiring; a planetary body with placements now produces `GenerateSkeleton` → `SkeletonGenerated` → quarters populated, exercised via the existing cascade + new helper tests).
jpmschweitzer added 1 commit 2026-06-07 13:32:56 +02:00
The Layer-4 quarter-skeleton geometry (D-234: morphology-correct streets +
the D-234b waterfront rule) was fully implemented but dormant — no
production call site dispatched GenerateSkeleton from a settlement
placement, so founding_orientation stayed pinned to the
context_from_read_set Cardinal stub.

Expand the BodyAnalyzed arm of drain_generation_completions to, before
caching the body, submit one GenerateSkeleton per CityPlacement: build the
D-199 context from the read-set, override founding_orientation with the
attractor-matched value carried on the placement (D-213), and derive a
canonical namespace-isolated quarter_id from (world_seed, body, city)
(D-194/D-230) instead of the city_id*10 placeholder. Dispatch logic is
extracted into the pure build_skeleton_work_item helper for DB-free testing.

Reader + world seed are optional system params (mirrors serve_atlas_requests);
absent either, dispatch is skipped and the body is still cached. Empty
placements and per-placement read_set errors are handled (warn + skip).
Station/multi-source dispatch (Q-109) is out of scope — BodyAnalyzed only
fires on the planetary AnalyzeBody path.

Tests: orientation-override + canonical-quarter_id unit test and a
determinism/city-scoping test on the helper. Full lib suite green (1327).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jpmschweitzer added 1 commit 2026-06-07 13:34:03 +02:00
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jpmschweitzer merged commit 17f6e910ac into main 2026-06-07 18:42:13 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jpmschweitzer/settled-reach#157