fix(engine): add_location defaults discovered=True so runtime-named places stay on the Atlas (#261/#371 follow-up) - #650
Conversation
…laces stay on the Atlas (#261/#371 follow-up) PR #371 added `discovered: bool = False` to the Location model (fog-of-war seeds opt IN) but the runtime path `add_location` was never updated — so a place the DM names into the world mid-play serialized discovered=False and the Atlas hid it until the party visited it. Pre-#371 those places were visible. This threads a `discovered: bool = True` param into the new-Location constructor only (the update path preserves an existing place's discovered state), keeps deliberate fog-of-war expressible via discovered=False, and adds a 4-test regression suite. Closes #408.
|
Warning Review limit reached
More reviews will be available in 25 minutes and 44 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Comment |
TL;DR
Revives PR #408 (verified absent from main). A real regression the additive
discoveredfield (PR #371 / #261) introduced on the runtime path:add_locationnever setdiscovered, so a place the DM names into the world mid-play serializeddiscovered=Falseand the Atlas hid it until the party visited it. Pre-#371 those places were visible. This restores that withdiscovered: bool = Trueas the default, keeps deliberate fog-of-war expressible viadiscovered=False, and adds a 4-test regression suite.The bug (verified, file:line anchored)
servers/engine/models.py:841—Location.discovered: bool = False(added by fix(openworlds): atlas-seed — #261 #371 so fog-of-war seeds must opt in).servers/engine/server.py(add_location) — the new-Location constructor wasLocation(name=…, description=…, hex=coords, region=region, travel_times=tt)with nodiscovered=→ every runtime-added place serializeddiscovered=False.viewer/server.py(_atlas_visible_location_ids) — a place shows whenvisited OR discovered is True OR discovered is None;discovered is False and not visited→ hidden. Old snapshots (field absent →None) stay visible, so the regression bites only the runtimeadd_locationpath, where the model default makes it an explicitFalse.Net: a far-off / future-destination place the DM adds (without
make_current) is invisible on the Atlas until visited — a silent change from pre-#371 behavior.Why
discovered=Trueis the right default (not fog-of-war)seed_worldsets day-1 regionsdiscovered=Trueadd_location'd places were visiblehiddenflag for deliberate suppressiondiscoveredwas never the runtime "hide it" leverFalsedefault exists so fog-of-war seeds opt inA place the DM names into the world mid-play is, by that act, known — the player should see it. Deliberate fog-of-war stays available via
discovered=False.The fix (additive, engine-only)
add_locationgains adiscovered: bool = Trueparam, threaded into the new-Location constructor only.location_idreuse) is untouched → an existing place'sdiscoveredis preserved, never clobbered by the default (so editing a hidden place's description doesn't reveal it).make_current=Truestill arrives the party (visited=True) → visible regardless; unchanged.discovered=Falserumour path + thehidden-vs-discovereddistinction.Tests —
servers/engine/tests/test_add_location_discovered.py(4)discovered=Trueandvisited=False(proves visibility comes from the flag, not a visit)discovered=False→ fog-of-war opt-in preservedlocation_idreuse, defaultdiscovered=True) → existingdiscovered=Falsepreserved, description updatedmake_current=True→visited=True+ becomescurrent_location_idLocally: 4/4 new tests pass; the 16 existing
discovered/seed_worldcontent tests stay green.Closes #408.