Branching zones G9b: stop persisting current_room / room_seq_json

The two legacy columns are no longer needed at runtime. CurrentRoom is
derived from len(VisitedNodes)-1 on read (lockstep with what the
dual-write era stored), and RoomSeq is a transient in-memory field
populated only when a fresh run is started.

- INSERT, SELECT, and UPDATE statements drop the two columns. The
  schema still carries them — they retire in G9c.
- scanZoneRun derives CurrentRoom and falls back to a linear-derived
  CurrentNode only if a row predates the G4 dual-write deploy.
- markRoomCleared rewritten to walk the registered graph (first
  outgoing edge / dead-end completion). Tests that use it as an
  end-to-end run driver continue to pass.
- advanceZoneRunNode drops its current_room dual-write.
- adventure_activity_unified reads visited_nodes for the daily
  "X/N rooms" progress fragment.
- Camp boss-room test pivots to setting current_node directly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
prosolis
2026-05-09 17:21:33 -07:00
parent 103cf30987
commit a5c0a83e2a
4 changed files with 69 additions and 51 deletions

View File

@@ -267,24 +267,27 @@ func TestCampLocationCheck_BossRoomBlocks(t *testing.T) {
defer cleanupZoneRuns(uid)
defer cleanupExpeditions(uid)
// Pre-create a zone run, then advance current_room to the boss room.
// Pre-create a zone run, then warp current_node to the graph's boss.
run, err := startZoneRun(uid, ZoneGoblinWarrens, 1, nil)
if err != nil {
t.Fatal(err)
}
// Walk to the boss room directly (last index).
bossIdx := -1
for i, rt := range run.RoomSeq {
if rt == RoomBoss {
bossIdx = i
g, ok := loadZoneGraph(run.ZoneID)
if !ok {
t.Fatalf("no graph for zone %q", run.ZoneID)
}
bossNodeID := ""
for nid, n := range g.Nodes {
if n.IsBoss {
bossNodeID = nid
break
}
}
if bossIdx < 0 {
t.Fatal("no boss room in seq")
if bossNodeID == "" {
t.Fatal("no boss node in graph")
}
exp := &Expedition{RunID: run.RunID}
// Force current_room to bossIdx.
if _, err := db.Get().Exec(`UPDATE dnd_zone_run SET current_room = ? WHERE run_id = ?`, bossIdx, run.RunID); err != nil {
if _, err := db.Get().Exec(`UPDATE dnd_zone_run SET current_node = ? WHERE run_id = ?`, bossNodeID, run.RunID); err != nil {
t.Fatal(err)
}
cleared, problem := campLocationCheck(exp)