adventure: show the party, the pets, and what you missed
Four small surfaces the game has had all along and the web has never shown. The party roster on the adventurer page is the one with a bug behind it. The board resolved an expedition by owner id, so a player seated on somebody else's run has been reading as "idle in town" while standing in a tier-4 dungeon. Seats now ride the roster detail beside the supply and threat numbers, and an opted-out player's seat is anonymised rather than dropped: a party of three rendered as a pair contradicts everything printed next to it. Pets show their levelling. They have earned XP from every won fight since that wiring was fixed and the only place a level ever appeared was a Matrix line that scrolled away. The threshold comes from the engine, in the engine's own centi-XP, because a copy of the curve here would drift the first time a band moved. "While you were away" is the one panel on the site about the reader rather than the realm. Two stamps behind it, not one: a single column would show the news, move the clock, and render an empty box over the same events on the reader's first refresh. And the story permalink names its region, which has been hardcoded empty behind a `// reserved` comment since the page shipped.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestAwayWindowOnlyMovesOnANewVisit pins the session gap directly. Within the
|
||||
// gap the window is held; past it, it advances to where the reader actually left
|
||||
// off — never to now, or everything between their last load and this one would
|
||||
// fall down the crack.
|
||||
func TestAwayWindowOnlyMovesOnANewVisit(t *testing.T) {
|
||||
if err := Init(t.TempDir() + "/visit.db"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() { Close() })
|
||||
|
||||
t0 := int64(1_000_000)
|
||||
if _, first, err := AdvVisitWindow("sub-1", t0); err != nil || !first {
|
||||
t.Fatalf("first call: first=%v err=%v", first, err)
|
||||
}
|
||||
// A minute later: same visit, window pinned to where it started.
|
||||
from, _, err := AdvVisitWindow("sub-1", t0+60)
|
||||
if err != nil || from != t0 {
|
||||
t.Fatalf("window = %d (err %v), want it held at %d inside the session", from, err, t0)
|
||||
}
|
||||
// Well past the gap: a new visit, reading from the last heartbeat (t0+60),
|
||||
// not from now.
|
||||
from, _, err = AdvVisitWindow("sub-1", t0+60+advVisitSessionGap+1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if from != t0+60 {
|
||||
t.Errorf("window = %d, want the previous heartbeat %d — anything else drops or replays events",
|
||||
from, t0+60)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user