1
0
Fork 0
Commit graph

208 commits

Author SHA1 Message Date
a01ccaa7f1 fix(minigames): keep the Bomperator estimate replay clock moving forward
Root cause of the remaining jitter, and why stride tuning never touched it.
projectServerPosition replayed every unacknowledged input, then moved its
replay clock back to that input's receive time even when it predated the
snapshot. The trailing segment (targetMs - t) then included the input's
whole age, so a keepalive still in flight inflated the estimate by up to
the 400ms re-assert cadence: a phantom lead of 1-4 cells that the reconcile
then chased toward a position the server never occupied.

Prod telemetry fits exactly: gap p50 1.0, p95 4.12, max 4.5, 22% of
snapshots easing, frameMax 38ms, remoteSnaps 0, 13 ghost rows. No hitches,
no server-side jumps, just an estimator biased by pending input age. The
bias scale with ack latency, which is why the first match looked clean
(p50 0.18) and a match with RTT spikes to 53ms did not.

- clamp the replay clock: an input whose receive time is at or before `t`
  contributes its direction only, never a rewind
- the component now calls the shared projectServerPosition instead of
  keeping an inline copy of the same replay (one implementation, one fix)
- unit tests pin both behaviors (stale input adds no travel, newer input
  still advances); harness 12 scenarios plus the two new tests green
2026-10-21 01:40:50 -04:00
b51d4bc0d0 fix(minigames): stop Bomperator prediction losing time and disagreeing on ghosts
Prod telemetry (3291 snapshots, one match): gap p50 0.18 but p95 1.22,
max 4.19 cells and 43 eases. A 4-cell gap is ~0.6s of running, so these
are events, not latency noise. Tuning the correction envelope could only
change how they were presented.

- advance prediction by real elapsed time (1s sanity cap) instead of a
  100ms slice: the engine runs on wall clock, so every main-thread hitch
  over 100ms left a permanent gap that had to be eased back. The ease
  branch keeps its own 100ms slice so a catch-up frame cannot discharge
  a whole gap at once
- release held keys when the tab hides: input is level-triggered, so a
  backgrounded tab kept the technician running server-side and then
  snapped back on return
- replay optimistic ghost charges in the server estimate too; pred saw a
  charge the estimate did not, so every unconfirmed placement read as
  divergence while it was in flight
- telemetry: per-row longest frame and ghost count, frameMax/ghostRows in
  stats, so the next playtest attributes any remaining gap directly
- harness mirror: same 1s catch-up and 100ms ease slice; 12 scenarios green
2026-10-21 01:20:13 -04:00
0af105e055 test(interior): harden cleanup afterAll, raise decay timeouts, and fix seed typing 2026-10-20 19:50:19 -04:00
f2de7941ca fix(interior): bootstrap snapshots lazily, enforce per-room access, and cover gaps 2026-10-20 18:33:43 -04:00
d80a93c30c test(interior): e2e smoke covering enter, open, cleanup, and collect 2026-10-20 18:33:14 -04:00
68cd3cce7c feat(interior): fixture repairs, condition decay, and station blocking
completeInteriorJob restores broken fixtures on repair jobs. New decay.ts applies per-room condition loss (elapsed days x conditionPerDay x Game Rules multiplier) on the interior-tick bin, gated by interior.decayEnabled with a baseline first run that only stamps the structure clock; fixtures at or below the authored effectFloor break with new interior:fixture-broken events, floors condition at 0, and station starts fail room_damaged below the floor.

Declares blocksStation on structure-rooms fixture state: provisioning wrote it but the missing column silently stripped it, so broken doorway fixtures could never block stations. Regression test covers persistence through provisioning plus the end-to-end gate.
2026-10-20 16:17:01 -04:00
6bc295b630 feat(interior): station recipes unlock gating and flagged asset outputs
Produce starts now honor presence-based unlocks_recipe/unlocks_station effects (station marker is its authored name) and reject unknown or gated recipes with recipe_locked, locked stations with station_locked. Asset outputs credit game-structures.storedAssets behind a new Game Rules interior.assetOutputsEnabled switch (default off), prechecked before any deposit so a disabled switch parks the job untouched; storageBridge.depositAssetsToStructure merges quantities by asset without duplicate rows.
2026-10-20 16:01:35 -04:00
0b7959662a feat(interior): upgrade completion, tech/labor gates, and module bonuses
Complete-time level advance (clamped to maxLevel), open/upgrade tech and labor gates sourced from npc-staffing and technologies.researchedAt, and pure duration/output math in effects.ts applied to job durations and produce resource output.

Adds interior_job_speed and interior_output_bonus module effect types to the shared module system (additive aggregates; existing consumers unaffected) with a migration, which also closes Step 1 drift making structures_rooms_levels_effects.value nullable and adding its target column.
2026-10-20 15:44:36 -04:00
1b8c84be47 feat(interior): open-room and cleanup jobs with junk loot rolls
Open jobs consume the entry level's materials and duration, then flip the room to its destination level at completion. Cleanup runs fixed-time, decrement one junk level per run, and roll one weighted drop from the authored junk loot table onto the job for collection.

Fixes provisionInterior's inverted guard so rooms provision lazily on first entry instead of requiring an already-set provisionedAt, and adds the interior integration suite covering provisioning idempotency, access modes, start gates, cancel refund, collect refusal on full storage, sweep completion, notifications, and loot roll determinism.
2026-10-20 14:57:30 -04:00
f62f5265fa feat(intelligence): export mission briefings to SQF
Add a briefing export dialog with a diary script and a structured text array. Convert Lexical formatting, including bold, code, underline, colors, headings, lists, and quotes, into Arma Structured Text. Scope the shared color palette to the briefing editors and render colors on the mission page.
2026-10-20 14:22:17 -04:00
3c774279aa feat(minigames): superuser developer console dock across all ten games
Adds a shared fixed-position debugging dock (Controls/State/Log tabs) gated
to dynamic superusers, mounted per minigame. Multiplayer games gain synced
server-authoritative admin commands with [dev-admin] audit logging: poker
(force fold, force street, per-viewer reveal-all, clock control, stack
adjust, force expire), blackjack (bankroll adjust, next-card injection,
dealer override, force expire), bomperator (pure applyAdminCommand: crates,
pickups, eliminate, freeze, sudden death, timer, end round; mirrored over
the arena REST path), and CFF Versus (reveal fleets, force shot outcome,
skip turn). Solo games get client-side tuning via persisted dev settings:
flappy physics sliders plus pause and invincibility, EOD layout reveal and
seeded boards, radio transcript view and timer freeze, aim trainer seed and
difficulty overrides plus hitbox overlay, OPORD answer reveal and study
window, call-for-fire target reveal, seeded grids, and free corrections.

Includes 26 new integration specs (command purity, gating, audit lines) and
a poker e2e smoke for the dock. Plan: Minigame Developer Console.
2026-10-20 12:48:27 -04:00
d15beb8e35 fix(minigames): end Bomperator WS jitter with ack-sized envelope and rate-limited trims
Prod telemetry (bompDebug, 783 snapshots): ping RTT of 3-24ms shrank the
correction envelope to ~0.75 cells while the real gap noise floor sat at
p95 1.0, so 13% of snapshots trimmed and each trim closed its whole
excess in one frame - constant micro-teleports.

- size the envelope from transport RTT plus the server-side component of
  measured input-to-ack latency (tick queue + snapshot turnaround),
  which ping/pong cannot see; HTTP behavior stays near the v0.12.6 tuning
- rate-limit trims to 0.35 cells per snapshot (a run-speed glide); the
  >2.5-cell ease branch remains the fallback for genuine divergence
- harness mirror updated: maxJump now capped at 0.35 across all 12
  scenarios, prod-trace pulls 162 -> 47, zero teleports throughout
2026-10-20 02:02:00 -04:00
707c5f6c81 feat(event-log): hide routine tick events behind a toggle
Add a client-safe ROUTINE_EVENT_TYPES list (game:tick, economy:tick, market:auto-generate) and hide those types on /events behind an off-by-default Routine ticks switch. The dashboard always excludes them so real events fill the recent list.

Tick bins now skip no-op emissions: game tick requires shipment, construction, or production activity; market tick requires an expiry or generation; economy tick requires processed items or errors. Historical events stay in the database and remain visible via the toggle or the admin panel.
2026-10-19 20:03:51 -04:00
afa79b4be4 feat(tech): member-facing tech research system and tech tree
Add a research pipeline over the existing technology tree: Research
Facility blueprint fields copied to structure instances, tech-researches/
tech-ballots/tech-ballot-votes collections, Game Rules research config,
pure rules lib (capacity, duration math, eligibility, intel-weighted
tally with tie cascade), a timestamp-derived tech-tick bin that opens,
resolves, advances and completes research with notifications, vote
casting server actions, and a read-only member-facing tech tree page at
/intelligence/tech-tree with veil blackout and dossier-style panels.

Includes migration 20261019_184409_add_tech_research_system, permission
groups, event and notification types, sidebar entry, and integration
plus e2e coverage.
2026-10-19 17:28:26 -04:00
57b6999e61 fix(base): allow admin labor headcount edits while hiring is disabled
The admin game-structures Labor Crew panel writes through setLaborHeadcount, which failed closed whenever Game Rules staffHiringEnabled was off. Back-office operators had to toggle hiring on just to adjust headcount.

setLaborHeadcount now accepts an allowWhenHiringDisabled option. Only the admin API route passes it; player-facing server actions keep the gate.
2026-10-19 14:25:55 -04:00
f5166c80b6 fix(ai-compose): keep named action instructions in the system prompt
The plugin carries a named action's whole instruction in the system
prompt (Expand, Simplify, Rephrase, Proofread, Summarize, Tone,
Translate), while Compose on richText wraps the field's own system prompt
in buildRichTextSystem, which adds rules demanding lexical JSON and a
blog layout. buildComposeSystem discarded the incoming system prompt and
kept only the block-placeholder paragraph, so every named action reached
the model without its instruction and richText Compose lost the field's
own prompt too.

Keep the caller's prompt and strip only the contradiction: cut at the
plugin's RULES marker, re-append the extracted block-placeholder
paragraph, drop the JSON and layout lines as a backstop in case that
marker is reworded, then append AI_OUTPUT_RULES. The fieldType argument
is no longer needed.

The tests embed the plugin's real Expand, Simplify and Rephrase systems
and assert each instruction arrives intact with the rules appended.
2026-10-19 13:34:37 -04:00
2713a786e4 fix(arena): clamp early-timer catch-up so the tick loop holds 20Hz
Node timers can fire a sub-millisecond early relative to
performance.now(); Math.floor((now - scheduledFor) / TICK_MS) then yields
-1, and (1 + extra) shaved a whole tick off the next schedule. The
resulting delay-0 re-fire doubled the sim rate (~33-40Hz observed on the
live arena during integration testing; local repro confirmed it is the
scheduler, not the host).

Clamp extra to [0, TICK_CATCHUP_CAP] and add a wall-clock regression test
that pins driftReport ticksRun to ~20/s (fails at the doubled rate).
2026-10-19 13:12:20 -04:00
3d73aee193 fix(ai-compose): one prose output contract for every field prompt
Rich text fields received the plugin's richText system prompt, which
demanded lexical JSON and a blog layout of [paragraph]/[heading] markers,
next to an instruction asking for plain prose. The model answered by
arguing about the conflict, and that argument was saved into the field.
Text fields had the mirror problem: a prose instruction sent over a
transport that forced JSON.

Every field now asks for plain prose and nothing else, and the handler
assembles the JSON the Compose client already parses:

- src/lib/ai/composeSystem.ts owns the shared rules, keeps only the
  plugin's [[[BLOCK_<n>]]] echo instruction for richText, and wraps prose
  into lexical JSON or a single field value.
- payload.config.ts routes every wrappable schema through
  generatePlainText; streamObject stays only as the fallback for shapes
  prose cannot fill, such as a hasMany array.
- Truncated output reaches the client again (finish_reason length was
  swallowed on the prose path).

Adds tests/int/ai-compose-system.int.spec.ts (10 cases) and picks up the
generated payload-types.ts drift for the model field description.
2026-10-19 13:03:33 -04:00
394db6dfa1 feat(arena): websocket match replication for Ordnance Disposal
Adds a dedicated Node 22 + ws arena server (src/arena) that owns live
Ordnance Disposal matches: drift-corrected 20Hz tick loop with capped
catch-up and tick-drift logging, per-socket snapshot fan-out, 30s jose
ticket auth, and awards via the idempotent results callback route.

Client gains a transport abstraction (transport.ts): WsTransport first
when NEXT_PUBLIC_ARENA_URL is baked into the bundle, HttpTransport
(today's actions + SSE + guarded poll, behavior unchanged) as automatic
fallback after two connection failures or a 5s setup timeout; absent
env var means pure HTTP (kill switch / rollback path). Next actions
proxy the match lifecycle to the arena when ARENA_SECRET +
ARENA_INTERNAL_URL are set; the in-process registry stays untouched as
the default backend.

Deploy wiring: runner-arena Dockerfile target, compose service, env
docs, DEPLOYMENT.md checklist. Tests: arena module suite (19), live
server WS suite (3), prediction harness ws-grade latency scenario.
2026-10-19 12:27:17 -04:00
923831ba82 feat(minigames): make period standings the primary board on game pages
The six period-scored game pages (flappy, eod, opord, radio,
qualification, call-for-fire) now render their current-period
PeriodStandingsCard directly under the game board, in the slot the
lifetime board used to occupy. Each game's all-time leaderboard moves
below it into a collapsed AllTimeLeaderboard disclosure (shadcn
Collapsible) that expands on click, so period standings are centered and
primary and the lifetime board is opt-in.

PeriodStandingsCard drops its period/all-time toggle and keeps the
current period only, now with the presence line the pages previously
omitted. The old "Anchored period standings" heading and card block are
removed from the six page.tsx files. The e2e spec covers the collapsed
all-time section on /minigames/flappy.
2026-10-19 12:14:57 -04:00
ce682becec feat(minigames): touch controls and responsive board for Bomperator
- Extract pressDir/releaseDir/stopAll edge callbacks; keyboard, D-pad and
  swipes all feed the same held-stack path (prediction, keepalives and the
  pending ledger stay input-source agnostic)
- BomperatorTouchControls: 4-way pad + stop center + plant button on coarse
  pointers, per-button pointer capture for hold-and-plant multi-touch
- Board gestures: dominant-axis swipe sets direction, quick tap stops
- Canvas scales via CSS (w-full h-auto, fixed internal buffer), so prediction
  is viewport-independent; touch-action/overscroll guards on the board
- Harness: backgrounded-tab scenario (4s rAF freeze under prod trace replay)
  proves resume never teleports (teleports=0, maxJump 0.43)
- E2E smoke at 390x844 hasTouch: page loads without horizontal overflow
2026-10-19 10:11:30 -04:00
a72f1bbe03 feat(call-for-fire-versus): resize fleet, add second FOB, charred destroyed cells with burn effect
Command Post becomes a 3x2 rect that flips wide/tall, the Ammo Depot L grows to four cells, the FOB becomes two cells, and a second FOB (Forward Operating Base II) joins the fleet for 16 cells across five structures. Fully destroyed structures now render charred black instead of red, and their cells burn with flame and ember particles for 45 seconds after destruction, driven by a new impact timestamp on each shot.
2026-10-19 09:34:40 -04:00
d3bb69ffbc fix(minigames): end Bomperator teleport-back with trace-proven envelope correction
Root cause: Node event-loop stalls drop the server's setInterval ticks with
no catch-up, so the sim permanently lags wall clock; the old all-inputs-acked
pull let that gap stack past the snap threshold and discharge as an instant
backward teleport (the reported complaint).

- Component: lead-aware correction envelope, trim on every snapshot,
  capped-rate ease (2.5x speed) past 2.5 cells; resets still snap via the
  ack-backwards branch. No latency-precision mechanisms (the v0.12.4 lesson).
- prediction.ts: drop the unused decision-nudge exports.
- Harness: replay recorded production HAR latency
  (tests/fixtures/bomperator-prod-rtt.json), model server tick stalls, add
  per-reconcile jump telemetry. A/B proof under trace+stalls: v0.12.3 policy
  teleports twice (max jump 2.59 cells); envelope policy zero (max 1.10).
2026-10-18 02:11:15 -04:00
2a941c5a5b fix(minigames): resolve the current period before building standings boards
The default ?period=current scope arrives as periodId null, and
buildLeaderboardPayload built the boards before resolving currentPeriod(),
so buildPeriodBoards short-circuited to zero entries: the live period's
board was always empty even while ledger rows existed for it. Resolve the
period first and feed its id into the boards, and cover the default scope
with a real-clock regression test (the suite previously only exercised
explicit period ids).
2026-10-18 02:06:32 -04:00
655407ab7d fix(minigames): stop Bomperator teleport-back with envelope correction and decision nudges
- Extract client prediction helpers to bomperator/prediction.ts (predStep/
  predAdvance port, alignDecisionToServer, projectServerPosition)
- Nudge prediction across cell boundaries at turn/stop edges so client and
  server commit to the same rounding decision; ghosts use the server's
  projected placement cell
- Stamp snapshot arrival time; event projections use measured age, reconcile
  estimate keeps the calibrated half-tick bias
- Replace pending-gated pull and instant 2.5-cell snap with a lead-aware
  correction envelope plus capped-rate ease (2.5x speed); resets still snap
  via the ack-backwards branch
- Add offline deterministic prediction harness (real engine + modeled network
  + frame-by-frame reconcile mirror), 9 scenarios incl. rAF stalls and a
  pre/post-fix ghost-mismatch comparison
2026-10-18 01:09:56 -04:00
ad512bde11 test(minigames): cover bomperator input seq guard and snapshot echo
Two registry specs: stale/out-of-order seq posts are ignored while the newest
intent wins, and each seat's last applied seq is echoed in the snapshot.
2026-10-16 01:41:41 -04:00
e29af6bc29 test(minigames): add bomperator engine and registry specs
22 engine tests cover grid seeding, movement, charge fuse/detonation, chain
blasts, kick-push, round end and sudden death. 17 registry tests cover lobby,
seat lifecycle, reconnect window, dissolve below two seats, expiry sweep and XP
reward derivation.
2026-10-16 00:32:54 -04:00
3eb8ada8f8 feat(bot): add edit modal to /changelog for last-minute copy tweaks
/changelog edit=true resolves the target entry (latest or one version,
ranges rejected) and opens a modal prefilled with its raw markdown
instead of posting. Submit re-checks staff, renders the edited text
through the existing splitForDiscord pipeline and posts the amber
embed(s). One-shot by design: CHANGELOG.md is never written back.
Entries over the 4000-char modal cap refuse edit mode. Modal path
skips deferReply (first-response rule, same as /announce); submits
route through bot/index.ts on the ptf-changelog-edit: prefix.
2026-10-15 12:34:18 -04:00
caf77e3a6b feat(tech-tree): optimistic concurrency for the tree editor
Guard the Technologies collection with an X-PTF-If-Unmodified-At
precondition hook (update-only, header-only) that rejects stale writes
with HTTP 409 and a stale_write payload, placed before the approval
reset hook. Bulk position writes gain per-row ifUnmodifiedAt tokens in
one all-or-nothing statement; conflicts return the offending ids and
successful writes return fresh tokens so clients advance their own
versions. The lite editor shows a Version Conflict dialog (load latest
or overwrite anyway); canvas position conflicts surface as a toolbar
banner with refresh / force-overwrite plus red node rings.

Tests: new tech-tree-concurrency int spec (guard, coexistence with the
approval reset, positions preconditions), two e2e scenarios for the
dialog and the banner; existing positions spec adapted to the new
return shape.
2026-10-15 11:48:30 -04:00
4f129fc59a feat(approval): reset reviewed documents to in progress on non-superuser edits
Add resetApprovalStatusOnEdit(), a collection beforeChange hook factory: when a
non-superuser updates a document whose stored approvalStatus is approved or
revision_requested, the status is rewritten to in_progress so the edit goes
through review again. Creates, superusers (system:admin-access), and system
writes with no user (catalog imports, seeds) are exempt, and an explicit
in_progress/ready_for_review in the edit is honored.

Wired into Technologies, Assets, Resources, Vehicles, and Structures.

Structures also moves from the legacy isDeveloper filterOptions gate to
approvalStatusFieldAccess("structures"), matching the other four collections
and removing the hard ValidationError when saving an already-approved structure.

Tests: 12 cases in tests/int/division-admin-access.int.spec.ts.
2026-10-15 10:01:02 -04:00
1d6db3b92b Merge branch 'feat/first-party-analytics'
# Conflicts:
#	src/migrations/index.ts
2026-10-15 00:17:58 -04:00
33f3f7aa75 feat(minigames): add phasing-out status with estimated removal date
Add a "phasingOut" minigame status and an `estimatedRemovalDate` field so a
game can be announced as leaving soon while staying fully playable and keeping
scoring periods (unlike retired games). Visibility is the only difference:

- Sidebar badge + tooltip (amber "Phasing out", countdown to removal) in
  NavMinigames, via new phasingOutTooltip in countdown.ts.
- In-game banner (PhasingOutBanner) on all 9 game pages, wired from
  getMinigameReleaseState (added the fetch to call-for-fire, which lacked it).
- registry.ts status union + field; loadRegistry.ts maps the field;
  config status select + estimatedRemovalDate date field added.
- Migration adds the enum value and column (idempotent); types + db schema
  regenerated.

Adds tests for visibility, round-trip, and period scoring; updates the
minigames domain guide.
2026-10-14 23:51:37 -04:00
88e89c9e55 feat(npc-dialogue): post opted-in event effects to Discord dispatch channel
Event nodes gain a 'Post this event to the Discord NPC dispatch channel'
checkbox. The flag rides emit() onto game_event_logs (discordRequested +
announcement bookkeeping columns, migration add_event_log_discord_fields),
and a new bot poller stamps pending rows into an amber NPC Dispatch embed
with relative-time mention and a link back to the source contact.

Bot delivery itself is unverifiable locally (no Discord token or channel id
in dev); the DB-side contract is covered by an integration test and a live
probe walk confirmed discord_requested persists end to end.
2026-10-14 16:57:33 -04:00
20c70151e3 feat(npc-dialogue): rich text editor and block lists in dialogue markup
DialogueText gains line-based block lists: consecutive lines starting
with - / * render as bullets, 1. / 2) as ordered lists, with item
content running through the inline parser so markup nests inside items.

Node editing swaps plain textareas for a shared MarkupEditor (line,
narration, lead-in, closing, tooltip, lock message, event message):
a formatting toolbar (bold, italic, code, color, link, bullet and
numbered list), a right-click menu wrapping the selection in tokens,
and a live DialogueText preview on the long-form fields. Storage stays
the plain custom-markup string; the editor only wraps selections.
2026-10-14 16:33:23 -04:00
c299acbe4f feat(npc-dialogue): condition groups and ternary text tokens
Conditions become a discriminated union: the existing flag leaf plus a
single-level group combining leaves with AND / OR / NOR. The evaluator
recurses one level, and every flat-assuming site (choice gating, graph
validation, editor, canvas previews) is group-aware; DB entry gates stay
flat by design. The node editor gains a shared condition builder with a
combinator dropdown and repeatable rows for both branch nodes and gated
choices.

Display strings also gain ternaries: {{ key ? yes : no }}, {{ !key ? .. }},
and numeric compares like {{ rep >= 5 ? .. }}. A brace-depth scanner
rewrites ternaries over bounded passes so branches may nest flag tokens
and even nested ternaries, then plain interpolation runs its single
never-rescanned pass. Ternary keys join collectNodeTokens so the server
reads exactly the flags a node needs.
2026-10-14 16:21:16 -04:00
a1aaed913d feat(npc-dialogue): attach files to conversation lines
Nodes can carry pointers to media docs (transcripts, sealed orders,
images). Authors upload from the node editor (gated on
npc-dialogues:update); the runtime resolves ids to file URLs server-side
and players open them in a dossier-styled viewer modal with download
and new-tab escape hatches. Deleted media resolve to nothing instead of
dead chips.
2026-10-14 16:05:15 -04:00
799c3216d2 feat(npc-dialogue): back NEW badges with server-side read markers
The per-browser localStorage tracking reset on every new device and kept
re-badging whole conversations whenever a GM edited the flowchart (hash
change), which players read as "nothing I read is remembered". Read
progress now lives in a npc-dialogue-states collection: one row per
(user, dialogue, node) with a unique index, so a node badges NEW exactly
once per player and GM edits never re-flag content they already saw.

- New collection NpcDialogueStates (own-doc access, staff-visible admin
  view) plus migration add_npc_dialogue_states.
- lib/npc-dialogue/states.ts: listSeenNodeIds for the page and an
  idempotent markNodeRead; exposed via the markNpcDialogueNodeRead
  server action, called fire-and-forget as nodes type in.
- The contacts page seeds initialSeenNodeIds into NpcConversation; the
  component keeps an optimistic local set and no longer touches
  localStorage. seen.ts and its tests are removed.

Verified live: fresh account shows NEW on all choices, reading the
"Who are you?" branch and reloading drops that badge while unread
branches keep theirs; npc_dialogue_states holds exactly the traversed
nodes. Interpolation int suite green (30/30).
2026-10-14 15:35:47 -04:00
ce0d23e94b test(analytics): add collector, rollup, retention integration suite and e2e smoke
- tests/int/analytics.int.spec.ts: envelope validation, bot filtering, rate
  limiting, sessionization, retroactive attribution, rollup idempotency,
  retention purges (11 tests)
- tests/e2e/analytics.e2e.spec.ts: dev-flag guest pageview lands in the test
  DB, collector accepts beacons and rejects garbage, dashboard renders for a
  superuser
- playwright.config.ts: enable NEXT_PUBLIC_ANALYTICS_DEV for the e2e webServer
2026-10-14 12:13:01 -04:00
268d4bb117 feat(analytics): add first-party analytics collector, SDK, rollups, and admin dashboard
Phase 1 of replacing Microsoft Clarity with first-party usage analytics:
- Plain Postgres tables via shared DDL module (src/lib/analytics/schema.ts)
  executed by both the add_analytics_tables migration and the test bootstrap;
  test-db.ts drops them around drizzle push (composite-PK introspector bug)
- /api/collect beacon collector with IP/UA enrichment, retroactive login
  attribution, bot blocklist, per-IP rate limiting, strict validation
- Client SDK (src/lib/client-analytics): SPA pageviews, clicks, scroll depth,
  focus, data-track visibility, heartbeats; NEXT_PUBLIC_ANALYTICS_DEV=1 dev
  gate with console mirror; mounted beside Clarity in the two frontend layouts
- Hourly rollup + daily retention bins (payload analytics-rollup/-purge)
- Chronicle read progress/completion, wiki new-clicked/created, minigame
  route mapping custom events
- admin:analytics:manage permission (+ roles enum migration) and the
  /admin/analytics Payload view with six recharts-backed report panels
2026-10-14 12:12:53 -04:00
0453742f32 test(garage): cover placement validation, access gating, and bridge sync 2026-10-13 16:02:58 -04:00
e96fdb7f58 feat(contributions): award 25 XP per journal entry, one per day 2026-10-13 15:52:57 -04:00
3cc97bf791 fix(journals): render in-world dates in UTC so the day never shifts 2026-10-13 15:04:06 -04:00
420bc06f84 fix(journals): cut the card excerpt at the first paragraph 2026-10-13 15:02:23 -04:00
0a955035a1 fix(journals): preserve paragraph breaks in the card excerpt 2026-10-13 14:59:21 -04:00
c323d0d853 test(contributions): cover the moderation grant and revoke actions 2026-10-13 14:46:10 -04:00
7f65e0371b test(contributions): cover journal publish XP, substance gate, and cap 2026-10-13 14:37:53 -04:00
8d5aa081ba fix(bot): read open-ended changelog ranges in the newest direction
CHANGELOG.md is newest-first, but resolveChangelogRange treated its two
range ends as a closed min/max index pair. A range with only a starting
version ("0.6.0..") therefore resolved to the oldest entries through
0.6.0 instead of 0.6.0 and everything newer, so the release-notes command
announced the wrong set of releases.

Resolve each open end toward the direction it opens: "X.." runs from the
newest entry down to X, "..X" runs from X to the oldest entry, and a
closed range still normalizes to min/max. Adds a regression test against
the shipped file.
2026-10-13 11:18:24 -04:00
2a264a4530 test(audit): support exact route filtering in the mobile audit
AUDIT_ROUTE_FILTER now accepts "=/route" for an exact match in addition to
the existing substring match, so a single route such as the dashboard can be
audited on its own without pulling in every route that contains the filter.
2026-10-13 10:38:45 -04:00
3b3bba5d54 test(audit): refresh baseline after the final mobile gate
Full 390x844 pass on a fresh dev server: 68/68 routes ok, zero findings in
every violation class (overflow, grid, hoverOnly, tapTarget), leaving only
the review tiers (611 marginal, 6 WCAG-exempt inline links, 1 informational
hidden-on-mobile) plus the banking hydration fix.
2026-10-12 23:04:29 -04:00
5765492494 test(audit): measure effective tap targets and report violation tiers
Raw element boxes overstated violations, so the check now measures what a
user actually taps, and reports the tiers separately (violation under
24px, marginal 24-39px, inline-exempt):

- effective target is the wrapping label, or label[for] for small
  checkables only. Verified in the browser that clicking a label toggles
  its Radix Switch (label rows are 84px tall); a Select's 14px caption
  label is not charged because its 36px trigger is the real target
- stretched-link cards (after:absolute inset-0) are measured on the
  positioned ancestor, not the 18px anchor inside
- sr-only proxy controls (under 8px) and input[type=range] are excluded
  (a slider's thumb is the target, not the 4px track)
- display:inline anchors in prose get the WCAG 2.5.8 inline exception and
  are reported as tapTargetInlineText
- refreshed baseline: 0 violations, 573 marginal, 6 inline, 1 hidden
2026-10-12 22:17:58 -04:00