mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-15 16:42:41 +00:00
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:
@@ -300,7 +300,7 @@ func renderForkPrompt(zone ZoneDefinition, pf pendingFork) string {
|
||||
}
|
||||
|
||||
// recordRoomCleared appends the current room to rooms_cleared and
|
||||
// bumps last_action_at, without advancing current_room/current_node.
|
||||
// bumps last_action_at, without advancing current_node.
|
||||
// Used by the graph-mode fork path: clearing the room is a separate
|
||||
// step from choosing where to go next. Returns the updated DungeonRun
|
||||
// snapshot reloaded post-write so callers see fresh fields.
|
||||
@@ -377,9 +377,8 @@ func completeRunAtNode(runID string, boss bool) error {
|
||||
}
|
||||
|
||||
// advanceZoneRunNode moves a run to nextNode: appends to visited_nodes,
|
||||
// sets current_node, bumps current_room (legacy dual-write), and
|
||||
// clears any pending fork prompt. Caller is expected to have already
|
||||
// called recordRoomCleared for the prior node.
|
||||
// sets current_node, and clears any pending fork prompt. Caller is
|
||||
// expected to have already called recordRoomCleared for the prior node.
|
||||
func advanceZoneRunNode(runID, nextNode string) error {
|
||||
r, err := getZoneRun(runID)
|
||||
if err != nil {
|
||||
@@ -390,16 +389,14 @@ func advanceZoneRunNode(runID, nextNode string) error {
|
||||
}
|
||||
visited := append(r.VisitedNodes, nextNode)
|
||||
visitedJSON, _ := json.Marshal(visited)
|
||||
nextRoom := r.CurrentRoom + 1
|
||||
_, err = db.Get().Exec(`
|
||||
UPDATE dnd_zone_run
|
||||
SET current_node = ?,
|
||||
visited_nodes = ?,
|
||||
current_room = ?,
|
||||
node_choices = '{}',
|
||||
last_action_at = CURRENT_TIMESTAMP
|
||||
WHERE run_id = ?`,
|
||||
nextNode, string(visitedJSON), nextRoom, runID)
|
||||
nextNode, string(visitedJSON), runID)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user