- DrainageResult now exposes flow_accumulation + max_accumulation for
D-209 attractor-strength normalization.
- Rewrite merge_small_basins from an O(merges x n) loop (rescanned the
whole grid per merge) to an adjacency-graph + union-find pass: one grid
scan, lazy merges. Cuts D8 drainage at 512x256 from ~299ms to ~45ms,
meeting the D-208 ~50ms target (the module had never been run at
canonical resolution before — it was orphaned). Determinism preserved
(smallest by (size,id), largest neighbor by (size, lowest id)).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The procedural server cascade (Phase 4) and the frozen names-only pool
supersede the Python atlas geometry generator and the LLM namer. Retire:
- generate_atlas.py (geometry production — cities/roads/rivers placement)
- gemma_naming.py, naming_core.py + tests (test_batch_naming,
test_register_selection, qa_naming) and run-atlas-naming.sh (the LLM
place-namer; its output is now the frozen pool)
- apply_name_fixes.py (name-field patches), fix_fewshot_bleed.py /
prune_atlas_features.py (geometry tools)
- import_city_names.py (redundant with import_economics name-pool path)
Pipeline updates: drop the generate_atlas step + atlas-generate /
test-atlas-determinism targets from the Makefile; remove generate_atlas
from the stamp registry (import_economics is the sole regen-db generator);
drop run-atlas-determinism from tests/run-all; refresh stale references in
schema_version, backfill_cultural_corridor, earth_blocklist (kept as
reference data), populate_terrain_reference, and heightmap.rs.
The Gemma prompting methodology is preserved in
docs/gemma-naming-methodology.md (separate commit).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Rework the regen-db atlas path for the names-only marker pool:
- populate_atlas_city_names now reads the names.cities pool instead of
the retired geometry-bearing cities[] records; population/kind are
deferred to placement (#955). Adds a deterministic clear-then-insert
(no UNIQUE on (body_id, name)) that fixes a latent duplicate-
accumulation bug — atlas_city_names dropped from an inflated 3276 to a
clean 329 pooled names + 134 corp-HQ rows.
- ensure_atlas_index_schema applies the canonical ATLAS INDEX block from
systems-schema.sql and empties the 8 geometry tables every regen; the
Phase 4 server cascade fills them (they start empty — the revealed gap).
- Sol (system 'GJ 0') is permanently exempt from the normal generators:
skipped in both the name-pool importer and the corp-HQ cross-ref.
- MIGRATION_SQL drops the retired generate_atlas meta stamp row so the
fail-closed stamp checker accepts older committed DBs.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Deterministic ±scatter on body radii seeded by body_id hash — no two
bodies share the same radius. Gas giants 40k-60k km, moons 200-2600 km,
rocky planets ±15% from class base. Oort/asteroid skip radius (NULL).
Sol system gets real planetary radii. body_radius_km exported to
star_map_data.json for client orbital diagram sizing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gen_queue: add in_flight_count tracking for all work item types (not
just AnalyzeBody). Rewrite saturation test with AnalyzeBody items.
Fix priority_ordering test thread count to match new gate.
rng: collapse to single AtlasRng::new(seed) constructor — callers
own their seed transform.
import_province_boundaries: fix "savepoint" comment to "transaction".
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
WorldTier enum fixed to Epicenter/Regional/Backwater/Passage/Waypoint
(D-218). Full enum implementations for ComplexityTier, SettingType,
SettlementClass, DistrictType, PoliticalArchetype, FoundingOrientation,
TerritorialStatus, GeographicAttractor, AttractorType, and
CompatibilityMatrix. SystemNameIndex with Aho-Corasick text scanning
for background pre-generation queue integration (D-206).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New tables: atlas_body_heightmaps (D-202), atlas_city_names (D-207),
atlas_feature_names, atlas_province_boundaries (D-205), body_radius_km
column (D-204). Three new importers: heightmap BLOBs, city names from
wiki markers.json, province boundaries via D8 watershed analysis.
economic_role normalized to 7 canonical values (D-194). Stamp fix in
generate_atlas.py to hash all tracked source files. systems.db regenerated.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Three root causes: SnapshotBuffer hard-dependency in economy.rs
(Option-wrapped), TickPhase::configure missing from SimulationPlugin
(added idempotent call), and stale golden file after D-192 dropped
the version field (regenerated).
All 6 previously-failing tests now pass with zero regressions.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
asset-pipeline.md (2 locations) and systems-schema.sql still pointed
at import_economics.py as the SCHEMA_VERSION home after the extraction
to a shared module.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1. decisions_sync.py: fix refs_created inflation (check rowcount),
remove dead IntegrityError except block
2. Extract SCHEMA_VERSION to shared tooling/schema_version.py —
both generators import from single source of truth
3. generate_atlas.py: narrow bare except to OperationalError +
"duplicate column" check
4. check-systems-db-stamp: add cross-generator schema_version
agreement assertion (defense-in-depth)
5. decision wrapper: add show + orphan-tickets to usage text
6. Add schema_version.py to all three source watch lists
(GENERATOR_SOURCES, IMPORT_ECONOMICS_SOURCES, generate_atlas
_write_stamp) — prevents silent staleness on version bump
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace SHA-1 hash in meta.schema_version with an orderable semver
string ("1.0.0"). SHA preserved in new schema_sha column for tamper
detection. Enables savegame migration lineage in Phase 5+ — saves can
record their schema version and determine which migrations to apply.
Updated both generators, check-systems-db-stamp validation (rejects
old SHA-hex values), schema DDL, and asset-pipeline docs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Addresses Tyre, Hoshe, and lead review comments on PR #137:
- **Audit doc amendment** (Tyre E1 / Hoshe H1 / Lead): add "Lead override
(2026-04-21)" section at top of docs/architecture/sprint-37-878-audit.md.
Rewrites the conclusion to "DECISION: STRIP" with the cascade-based
rationale. Preserves the original audit body as the pre-override record.
- **Regression tests** (Lead 2a-2b / Hoshe H2 / H3): add POSITIVE
assertions of the new uniform behavior so silent reintroduction fails.
- `phase2_container_verb_labels_uniform_regardless_of_player_state` —
two trials (empty KG, POI-bearing KG) assert container verb labels
equal Phase-1 defaults.
- `monologue_pool_selection_uniform_no_archetype_key` — two observers
with divergent MonologueState both draw from OBSERVE_NPC_LINES.
- **Decision record amendments** (Lead 3 / Tyre S2): D-032, D-035, and
D-057 amended with Phase 6 deferral wording. "Retired pending Phase 6,
not deferred with scaffolding." Reintroduction gate: a confirmed
Phase 6 character-model design.
- **types.rs doc fixes** (Tyre S1 / Hoshe H5): StartupMessage protocol-
flow comment updated to reflect no-version handshake (D-192).
ObserverSnapshot version-history block grows a "Sprint 37 wire-format
shifts" section documenting D-192 + #878 schema drops.
- **observer/tests.rs:944 comment** (Hoshe H6): rewritten to cite
cascade rationale instead of the stale D-032-SUPERSEDED premise.
- **tests/run-atlas-determinism exit** (Hoshe H7): exit 0 when EXIT_CODE=2
(venv/DB missing = skip, not fail). Preserves skip semantics for
tests/run-all on machines without the Python venv.
Follow-up tickets filed:
- #895 (server, low): expand check-systems-db-stamp GENERATOR_SOURCES
to cover gemma_naming.py + naming_core.py (Tyre S3).
- #896 (planning, low): add CLAUDE.md carveout for server wiki writes
closing coverage gates (Tyre S4 / Hoshe H8).
H4 investigation: v01_integration_playthrough.rs was not the only E2E
handshake→tick→snapshot test; coverage preserved by bridge_ipc.rs,
bridge_tcp.rs, and game_loop.rs (the latter is pre-existing-broken
per #885). No replacement test needed.
1142/1142 lib tests pass. cargo clippy -- -D warnings clean.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
After #878 removed the `character` field, the manual Default impl is
derivable. Clippy flags this under `derivable_impls` with -D warnings.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sprint 37 dead-code sweep closing out two stale supersession chains:
#877 (D-167, 2026-03-24): Removes HeritageRoot type alias and
ZonePaletteModifier::Heritage variant from server/src/simulation/
generator.rs. The 7 abstract heritage roots were retired in favour of
the corridor cultural system; these two stubs were the only remaining
references.
#878 (D-032 + cascade rule): Strips the entire CharacterArchetype
(Smuggler/Detective) trace from the server. Per lead direction
2026-04-21 and the development cascade (CLAUDE.md), character/NPC/
verb-differentiation/monologue code is Phase 6 detail that should
not exist in code yet. The running archetype trace was pre-cascade
filler, not production — production is only the client's character-
creation UI and insert screens (client follow-up in #882).
Deleted:
- CharacterArchetype enum + StartupMessage.character_archetype field
- archetype_verb_label() + archetype branch of apply_phase2_verb_filter
(D-057 character-verb differentiation — marked superseded)
- MonologueState.character partitioning
- Gauntlet archetype plumbing (setup_gauntlet no longer takes an archetype)
- server/content/schemas/drama_module.schema.yaml (zero Rust consumers)
- server/content/modules/tier1/smuggling_ring_v0_1.yaml
- server/tests/archetype_monologue.rs (regression guard for the removed system)
- server/tests/v01_integration_playthrough.rs (archetype-dependent)
Decision updates:
- decisions/content.md D-032 supersession rewritten to cite the cascade
(v0.2 drop invalidated the prior D-117 framing).
- decisions/content.md D-035 tag taxonomy: `character` enum footnote
updated; field noted as unused, do not reintroduce without a
confirmed Phase 6 design.
- decisions/perception.md D-057: archetype-verb differentiation marked
superseded.
Also bundles the types.rs version-field removal from #874 since the
file was already touched here.
Full trace audit in docs/architecture/sprint-37-878-audit.md.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Removes the PROTOCOL_VERSION lockstep handshake across the bridge
transports. HandshakeMessage is now an empty marker indicating the
server is ready; the client sends StartupMessage next. Field-presence
and roundtrip behavioral tests are retained — tautological
version-literal assertions were deleted in Sprint 36.
After this lands, genuine schema drift surfaces as MessagePack
missing-field errors downstream, which is the intended signal per
D-192. Client ticket #875 is blocked by this commit and will ride
the same wave; server schema changes in #878 (character_archetype
removal) also depend on PROTOCOL_VERSION already being gone.
types.rs changes are bundled with the broader #877/#878 dead-code
sweep in the following commit, since they share the same file.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds and expands wiki/corporations/*.md entries so make economy-db
Phase 2 gate passes end-to-end without the 21 raw-commodity / system
coverage failures. Unblocks Phase 2 demand simulation.
Existing corporations (15): tag additions to baektu-mining-alliance,
bergkraft-antriebswerke, bifrost-marmor, gate-corporation,
hanyang-precision, jeju-lattice, nordmark-skog, norrland-woodcraft,
salud-alliance, shetland-wool, societe-chimique, stalownia-kowalski,
svanevann-waters, thrds, tongyeong-drive.
New corporations (6): arbour-aggregates, earth-standard-group,
rush-mining, scapa-flow-industries, sede-chemical-works,
threshold-fuel-syndicate.
systems.db regenerated — coverage validation now passes.
Cross-team scope note: wiki/ is copy-team territory per CLAUDE.md.
Writes here are accepted by lead for this sprint (maintenance sweep,
pragmatic fix); copy-team review follow-up filed as #884.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds Serialize/Deserialize to SelectedBookmark and wires it into
SaveStateV1 so a loaded game remembers which bookmark and starting
location the player picked. Replaces the TODO at bookmark/mod.rs:95
(originally deferred to Sprint 37 alongside #614).
Also refactors BookmarkPlugin to accept an injected BookmarkRegistry
via BookmarkPlugin::new(registry) (#862). The Default constructor
still wires the canonical tycoon registry — injection is for tests
and future TOML loading. Flagged in PR #132 review as a follow-up.
Updates bookmark spec §4.4 to remove the v0.2-deferred scope note.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The "no co-present NPC assigned to a Simmering triangle" branch fires
as WARN every few seconds during early gameplay when no NPC relationships
have escalated. This is normal state, not an error condition — downgrade
to debug so the warning channel reflects actual problems.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Addresses all blocking + minor items from PR #136 review.
Architectural change (T2/H3 — the review's main complaint):
generate_brands was previously a separate Rust binary that produced a TOML
artifact, with its stamp written "on behalf" by import_economics.py at the
end of its own run. Reviewers flagged the invisible coupling: two sources
of truth in a system designed to have one, and no way to tell from the
stamp that one "generator" was really a subroutine of the other.
import_economics now invokes tooling/generate-brands as the first step of
its main() flow, before opening its own DB connection. The TOML artefact
is still produced and still committed (useful for diff-review of brand
changes), but there's now one pipeline owner. The meta table carries two
rows (import_economics, generate_atlas) not three; the Rust binary's
source SHA folds into import_economics' stamp via IMPORT_ECONOMICS_SOURCES.
A MIGRATION_SQL DELETE cleans up pre-merge DBs that still have the
orphan generate_brands row.
Other review items addressed in-line:
H1 generate_atlas._write_stamp no longer commits — transaction ownership
stays with the caller (matches import_economics pattern). Stamp +
atlas data now commit atomically; a failed stamp rolls back the
atlas data rather than leaving a stamp-missing-data intermediate.
H2 _file_sha1 (in both import_economics, generate_atlas,
check-systems-db-stamp) raises FileNotFoundError on missing sources
instead of silently contributing an empty-bytes hash. A ghost-SHA
convergence could otherwise produce vacuous "fresh" passes.
H4 pre-push no-meta-table warning rephrased — was "run after next
regeneration", now "run now if this DB was generated by you".
T1 asset-pipeline.md determinism claim softened: the stamp is
deterministic (same source → same recorded SHA), the DB binary is
not (generated_at + SQLite rowids/freelist churn).
T3 asset-pipeline.md gains a "migration escape hatch" section naming
MIGRATION_SQL in import_economics.py as the only sanctioned path
for direct writes, and forbidding hand-run sqlite-exec / one-off
patch scripts / SQLite-GUI edits.
T4 Makefile regen-db now runs as a single shell with `set -e`. A
failure in one generator halts the pipeline immediately, preventing
the "stale data, fresh stamp" state where a later step stamped a
DB whose earlier step had failed. import_economics' exit code 2
(coverage gate warning) remains explicitly tolerated.
T5 pre-push stamp check now runs on a branch's first push too —
compares against origin/main instead of origin/$BRANCH, closing
the gap where a new branch could ship a stale DB via the first push.
T6 check-systems-db-stamp fails closed on unknown generator_names in
meta — a future branch adding a new generator without registering
it in GENERATOR_SOURCES will now be rejected, not silently skipped.
T7 /pr-push watch list gains a mutual cross-reference comment with
GENERATOR_SOURCES in check-systems-db-stamp, plus the missing
names.rs source file, so the two lists cannot silently drift.
Follow-up tickets created:
#887 T8 decisions-orphan-tickets CLI — surfaces tickets whose
decision_ref points at a non-existent D-record.
#888 T9 meta.schema_version monotonic semver — for savegame migration
lineage in Phase 5+ (SHA comparison can't be ordered).
Verified:
make regen-db end-to-end — OK
make check-systems-db — OK, 2 generator(s) up to date
STALE detection — OK, verified by touching generate_atlas.py
/pr-push watch list — OK, flags this branch's changed sources
decision show D-159 — OK, structured output with tickets + refs
Refs: #855#856#857#858#859 PR #136
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds systems.db regeneration discipline (#855) via a `meta` table (#856)
stamped by every generator, a pre-push hook that rejects stale DBs (#857),
and the top-level `make regen-db` / `make check-systems-db` targets that
drive the whole pipeline.
The stamp stores SHA-1 of generator source + schema, so the pre-push hook
can cheaply detect "you changed a generator but forgot to regen the DB"
before a binary merge conflict lands. Sprint 36 hit that class of conflict
on two branches touching systems.db simultaneously — this is the systemic
fix.
Regenerated systems.db is stamped; `make check-systems-db` passes.
Refs: #855#856#857
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- tooling/planet-gen/earth_blocklist.txt: document GJ0d (Earth body) as
blocklist-exempt so Brussels (and other Earth-canonical city names) are
not flagged on next sol_import.py run (R2 issue 1)
- wiki/star-systems/GJ-380/bodies/GJ380c/markers.json: rename Selet Basin
→ Subin Basin (Kumasi river namesake). Brings Akan register on GJ380c
to 3/29 features distributed across river, mountain, lake — credible
multi-generational trade corridor read instead of minimum-viable patch
(R2 issue 2)
- server/data/systems.db: atlas_oceans resynced for GJ380c
- docs/atlas/hand-refine-log.md:119: corrected stale log entry — Aldren
Pass was subsequently renamed Randalfoss to eliminate the cross-system
Aldren stem collision with GJ380c (R2 nit 3)
- tooling/planet-gen/refine_log_849.md: Groombridge cross-corridor
addendum updated to reflect 3/29 Akan register distribution
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
price_tier was documented in D-189 §5 and present in brands.toml but
silently discarded on import — absent from schema, INSERT, and V-B06.
- Add price_tier TEXT column to brand_products CREATE TABLE
- Add COLUMN_MIGRATIONS entry for ALTER TABLE on existing DBs
- Add VALID_PRICE_TIERS constant (mass/premium/luxury/flagship/institutional)
- Include price_tier in product_rows tuple and INSERT OR REPLACE
- Add price_tier to V-B06 enum checks; skip NULL (nullable column)
- Backfill 4 pre-amendment anchor brands (8 entries): Calloway flagship/premium,
VGV luxury/premium, thrds luxury/premium, Bífröst flagship/luxury
V-B01..V-B06 all pass.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Per R-012: delete conversation.rs, both overheard content files, and
remove all 6 wire-up points (social_plugin, bridge/types, monologue,
voice/integration). Protocol version 22 → 23. Scope confirmed by
#842 audit — npc/ and content/global/ untouched. Surviving NPC
components (NpcName, NpcColorIndex, NpcConversation) migrated to
simulation/npc_components.rs for use by D-080 knowledge propagation.
Also applies pre-existing cargo fmt debt (names.rs and 4 others).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Names all 33 null-name auto-detected Sol features: Earth ocean + 3 rivers,
24 Luna mountain ranges (real IAU lunar mountain names), 4 Mars mountains,
1 Europa mountain. All using real-world geographic names. Cross-reference
arcs added on Mars (Hellas-, Chryse-) and Europa (Conamara-, Pwyll-).
Adds sol_name_fixes.py for reproducible Sol feature naming. Updates refine
log to mark Sol complete with full audit metrics for all 6 touched systems.
DB synced: GJ0d, GJ0d-1, GJ0e, GJ0f-2 (all Sol inhabited bodies).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Systematic sweep eliminated all city name cross-body collisions across the
273 inhabited bodies. Started from Forum Veritas/Jade Harbor/Fort Iron
clusters identified during the #849 analysis pass.
Strategy: use world proper_name as capital city name wherever unique.
For worlds sharing a proper_name, author corridor-appropriate alternates.
All edits synced to atlas_cities via generate_atlas.py --body.
Before: 119+ cross-body city collisions, worst-case ×20 (Jade Harbor)
After: 0 cross-body city collisions
Clusters eliminated: Forum Veritas ×10, Jade Harbor ×19, Fort Iron ×10,
Eisenstadt ×7, Fjordheim/Fjordholm ×6 each, Eisenberg/Eisenfels/Hanseong ×5
each, Ridge Marker ×5, plus 20+ smaller clusters down to ×2.
River/ocean collisions (Rio Grande ×23 rivers, Steinbruch ×19, etc.)
remain — these affect uninhabited secondary bodies at scale and require a
dedicated batch-script pass.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove overheard.ron (1629 lines) and overheard.yaml.deprecated. D-078 overheard
system is retired — the content and production pipeline for ambient NPC dialogue
is deferred until the world is walkable (Phase 6). Deep module interdependencies
(perception, simulation, bridge) mean the server-side plumbing stays in place;
only the content files with no live consumers are removed.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CultureResolver with Arc<Mutex<Connection>> over systems.db (SQLITE_OPEN_READ_ONLY).
3-pass lookup: system_id → body_id (COALESCE parent fallback) → station_id.
CultureResolverResource registered in main.rs with graceful warn-on-missing.
BookmarkRegistry.build_catalog() uses resolver for allowed_locations_cultures.
8 unit tests including concurrent safety. SQLite fixture at
server/src/knowledge/fixtures/culture_test.db.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
White-glove name pass on the five highest-traffic inhabited bodies in the
Ran (GJ 144) and Tau Ceti (GJ 71) systems. All markers.json edits synced
to atlas_* tables via generate_atlas.py.
GJ144d Kallast (2B pop): 4 fixes — "Aldren Pass" river renamed to
Randalfoss (avoids cross-system stem collision with Lendel's "Aldren");
two generic oceans renamed (Keldmere, Seterfjord — the latter cross-refs
mountain Seterfjellet); POI renamed to "Kallast Gate Terminal".
Established cross-ref arcs: Rán-, Seter-, Keld-.
GJ144e Vethis (1.2B pop): 9 fixes — 4 river renames (1 cardinal, 1
earth-echo, 2 generics), 1 ocean (Ash- overuse → Veth Mere), 3 mountain
renames (2 generics, 1 Ash- overuse). Established arcs: Grey- (4 names),
Thorn- (2), Kel- (3), Veth- (3), Ash- (2, down from 3).
GJ71c Threshold (600M pop): 1 fix — river "Aethelred" (Anglo-Saxon)
replaced with "Gaius" to complete the all-Latin survey-team arc (Octavius,
Septimus, Quintus, Valeria, Marcus, Gaius).
GJ71d Arden (500M pop): 2 fixes — "Concordia Hall" city renamed "The
Praxis" (Concordia = GJ71c ocean, cross-body stem collision); "Basilica
Nova" river renamed "Via Principia" (exact name match with GJ71c POI).
GJ71d-1 Verantis (20M pop): no name changes — mountains already updated
in prior pass (The Lateranum, The Curia Magna, etc.); DB sync only.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>