Skip to content

fix(engine): add_location defaults discovered=True so runtime-named places stay on the Atlas (#261/#371 follow-up) - #408

Closed
100yenadmin wants to merge 1 commit into
mainfrom
fix/add-location-discovered
Closed

fix(engine): add_location defaults discovered=True so runtime-named places stay on the Atlas (#261/#371 follow-up)#408
100yenadmin wants to merge 1 commit into
mainfrom
fix/add-location-discovered

Conversation

@100yenadmin

@100yenadmin 100yenadmin commented May 30, 2026

Copy link
Copy Markdown
Member

TL;DR

Reviewing an external suggestion, I verified a real regression the additive discovered field (PR #371 / #261) introduced on the runtime path: add_location never set discovered, 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 restores that with discovered: bool = True as the default, keeps deliberate fog-of-war expressible via discovered=False, and adds a 4-test regression suite.

The bug (verified, file:line anchored)

  • servers/engine/models.py:828Location.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 was Location(name=…, description=…, hex=coords, region=region, travel_times=tt) with no discovered= → every runtime-added place serialized discovered=False.
  • viewer/server.py:2241-2244 (_atlas_visible_location_ids) — a place shows when visited OR discovered is True OR discovered is None; discovered is False and not visitedhidden. Old snapshots (field absent → None) stay visible, so the regression bites only the runtime add_location path, where the model default makes it an explicit False.

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=True is the right default (not fog-of-war)

Signal Implication
seed_world sets day-1 regions discovered=True "known" == True
Pre-#371, add_location'd places were visible restoring, not inventing
The model already has a separate hidden flag (predicate line 2240) for deliberate suppression discovered was never the runtime "hide it" lever
The False default exists so fog-of-war seeds opt in the runtime path was simply missed when the field landed

A 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_location gains a discovered: bool = True param, threaded into the new-Location constructor only.
  • Update path (location_id reuse) is untouched → an existing place's discovered is preserved, never clobbered by the default (so editing a hidden place's description doesn't reveal it).
  • make_current=True still arrives the party (visited=True) → visible regardless; unchanged.
  • Docstring documents the default + the discovered=False rumour path + the hidden-vs-discovered distinction.

Tests — servers/engine/tests/test_add_location_discovered.py (4)

  1. default add_location → discovered=True and visited=False (proves visibility comes from the flag, not a visit — the regression fix)
  2. discovered=False → fog-of-war opt-in preserved (discovered/visited both False)
  3. update path (location_id reuse, default discovered=True) → existing discovered=False preserved, description updated
  4. make_current=Truevisited=True + becomes current_location_id (visible regardless)

Verification: ast.parse clean on both files. Engine pytest left to CI (this canonical checkout is not on the local test-execution allowlist; same approach as my prior engine PRs).

Process notes

Collision audit

DO NOT MERGE yet

Per owner — the parallel agent is still at work. Ready for review.

Provenance

External-AI suggestion ("Decide discovered= for runtime add_location"), independently verified against the tree before implementing. Follow-up to #371 / #261.

Summary by CodeRabbit

New Features

  • Added configurable visibility settings for locations. New locations appear on the Atlas by default, with an optional fog-of-war mode to keep them hidden until discovered. Existing location visibility is preserved when locations are updated.

Review Change Stack

…laces stay on the Atlas (#261/#371 follow-up)

PR #371 (#261) added `discovered: bool = False` to the Location model and
taught seed_world to set discovered=True on the world's day-1 regions +
ingested areas. The runtime world-building path `add_location`
(servers/engine/server.py) was NOT updated: its `Location(...)`
constructor never set `discovered`, so a place the DM named into the
world mid-play serialized `discovered=False` and the Atlas predicate
(viewer/server.py :: _atlas_visible_location_ids) hid it until the party
visited it.

That is a silent behavior change vs. pre-#371, where add_location'd
places appeared on the Atlas immediately (the field didn't exist, and the
predicate treats absent/None as visible).

Decision: runtime-added places should be VISIBLE by default.
-----------------------------------------------------------
A place the DM names into the world mid-play is, by that act, KNOWN —
the player should see it. Evidence this is the right default, not
fog-of-war:
  * seed_world sets day-1 regions discovered=True — "known" == True.
  * Pre-#371, add_location'd places were visible.
  * The model already has a SEPARATE `hidden` flag for deliberate
    suppression (predicate line: `if row.get("hidden"): continue`), so
    `discovered` was never meant as the runtime "hide it" lever.
  * The model's False default exists so FOG-OF-WAR SEEDS must opt in;
    the runtime path was simply missed when the field landed.

Fix (additive, engine-only):
  * Add `discovered: bool = True` param to add_location.
  * Thread it into the NEW-Location constructor only.
  * UPDATE path (location_id reuse) is untouched → an existing place's
    discovered state is PRESERVED, never clobbered by the default.
  * Pass `discovered=False` to add a rumoured/far-off place that stays
    fog-of-war until visited (the deliberate path #371 enabled).
  * make_current=True still arrives the party (visited=True) → visible
    regardless, unchanged.

Tests: servers/engine/tests/test_add_location_discovered.py (4)
  1. default add_location → discovered=True AND visited=False
     (visible purely via discovered — the regression fix)
  2. discovered=False → fog-of-war opt-in preserved
  3. update path (location_id reuse) preserves discovered=False (no clobber)
  4. make_current=True → visited=True + current (visible regardless)

Verification: ast.parse clean on both files. Engine pytest left to CI
(this checkout is not on the local test-execution allowlist).

Scope: engine-only, additive. Does NOT touch PR #371, the viewer
predicate, or any seed. Filed from an isolated worktree off origin/main
(shared canonical checkout is used by parallel sessions).

Refs: follow-up to #371 / #261; sibling to the #380 atlas-tier work.
DO NOT MERGE yet (per owner — parallel agent still at work).
@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 87ecf98e-a511-45a2-9eb4-315cc1fc6ffe

📥 Commits

Reviewing files that changed from the base of the PR and between 7221f7b and eafd9b5.

📒 Files selected for processing (2)
  • servers/engine/server.py
  • servers/engine/tests/test_add_location_discovered.py

📝 Walkthrough

Walkthrough

The PR extends the add_location MCP tool with a new discovered parameter (default True) to control whether runtime-generated locations are immediately visible on the Atlas. The implementation forwards this parameter to the Location constructor, documents preservation behavior for update paths, and includes comprehensive regression tests covering default visibility, fog-of-war opt-in, state preservation, and current location semantics.

Changes

Location visibility discovery parameter

Layer / File(s) Summary
Function signature, documentation, and implementation
servers/engine/server.py
add_location gains discovered: bool = True parameter. Docstring documents discovery defaults and state preservation on updates. Location constructor call forwards the discovered value explicitly.
Regression test suite for discovered behavior
servers/engine/tests/test_add_location_discovered.py
Four test scenarios validate default visibility (discovered=True), fog-of-war opt-in (discovered=False), update-path state preservation, and current-location behavior independent of discovered. Includes module documentation and helper utilities.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

A location appears on the Atlas bright,
Discovered by default, shining with light!
Or hide it in fog, if you prefer the night—
The parameter chosen, the visibility right. 🗺️✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description comprehensively covers the bug (with file/line anchors), justification for the fix, implementation details, test coverage, and verification notes. However, the required CLA checklist and licensing section from the template are completely missing. Add the required Licensing / CLA section with the three checkboxes as specified in the description template before merging.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main fix: adding a discovered=True default to add_location to restore pre-#371 behavior for runtime-named places on the Atlas, with follow-up references.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

100yenadmin added a commit that referenced this pull request Jun 5, 2026
…laces stay on the Atlas (#261/#371 follow-up) (#650)

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.

Co-authored-by: Eva <arncalso@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant