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.
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.
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.
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).
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.
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.
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.
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.
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).
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).
- 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
/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.
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.
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.
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.
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.
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.
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.
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.
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).
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.
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.
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.
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
The harness was measuring against a viewport Chromium had already widened:
with isMobile true it grows the layout viewport to fit overflowing content,
so scrollWidth > innerWidth could never fire and real overflows were masked.
hasTouch alone gives (pointer: coarse) while keeping the 390px viewport
fixed, which is what surfaced the remaining resources overflow.
- grid class: flag only grids that overflow a non-scrolling container;
drop the narrow-track rule (it flagged intentional icon columns) and
skip min-w-max boards, which scroll by design
- structures detail now resolves from game-structures (the page's
collection), so the previous phantom 404 is gone
- refreshed baseline: overflow, grid and hoverOnly all at zero
Pass 2 Session A: scripted Playwright audit over all frontend routes at
mobile viewport, classifying overflow, dialog, grid, hoverOnly,
hiddenMobile, tapTarget (<24px WCAG violation) and tapTargetMarginal
(24-39px review tier) findings.
- resolves dynamic route ids from REST, skips unresolvable ones instead
of navigating literal bracket URLs
- blocks the realtime SSE stream, uses domcontentloaded, retries 5xx and
errors once, and aborts if the dev server dies mid-run
- AUDIT_ROUTE_FILTER for targeted re-audits (writes filtered files so
the baseline report is never clobbered)
- markdown report clusters findings into cross-route pattern groups;
Sessions B-D fix per class and re-run this as the regression gate
- includes the initial baseline report (159 tap violations, 24 overflow
findings on 6 routes, 4 cramped grids, 1 hover-only, 1 hidden-on-mobile)
- award-rules collection: metric/operator/value threshold rules linked to
awards, with auto-retire-lower-tiers and once-per-series flags, active
toggle, and award-rules:* permissions
- src/lib/awards/metrics.ts: pure metric resolvers (years of service from
dossier.enlistmentDate with account-age fallback, account age, missions
attended, total XP) plus operator comparison, unit tested
- evaluateAwardRules() sweeper: idempotent, dry-run capable; grants land as
profile rows with awardedBy null so the existing afterChange hook sends
award:granted notifications; upgrades replace the lower series tier in
place preserving the original date; emits award:rule-granted events
- award-tick payload bin for daily evaluation + admin Award Automation
view with Evaluate now (dry run) preview and Apply grants
- seedYearsOfServiceRules.ts wires the four years-of-service ribbons into
one advancement series and creates their rules (idempotent, dev seeded)
- migration add_award_rules_automation (table + awards event target enum)
- New Journals collection (Chronicle group): title, Lexical body, status
draft/published, optional in-world date and mission link; authors read,
edit, and delete their own entries at any status while every logged-in
user reads published ones; journals:* staff permissions bypass ownership
and gate the admin page (registered in the permission registry)
- /journals list with compose dialog and /journals/[id] reader reusing the
Chronicle typography; edit/delete controls for authors and staff; drafts
carry the DraftBadge and stay invisible to everyone but their author
- Server actions create/update/delete with ownership checks, publish-time
journal:created and journal:deleted feed events (journals added to the
GameEventLogs target collection enum via migration)
- Sidebar entry under Chronicle, command palette destination, admin panel
icon; excerpt extractor as a pure module (src/lib/journals/excerpt.ts)
- Access-control integration spec covers draft privacy, publish visibility,
non-author write blocking, and staff override (5 tests)
- normalizeSidebarOrder moves pinned sections (Platform) to the front, so
even hand-crafted stored orders cannot displace it; enforced server-side
in updateSidebarOrder via the same helper
- Customize mode renders Platform statically with a pin marker instead of
a drag grip; only the remaining sections are sortable
- Spec updated: user order preserved after the pinned head, new pinning test
- preferences.display.sidebarOrder json field on Users + named migration
add_sidebar_order_preference + regenerated types
- New pure helper src/lib/sidebar/order.ts (section ids, labels, default
order, normalizeSidebarOrder) modeled on lib/dashboard/layout.ts, with
tests/int/sidebar-order.int.spec.ts covering fallback/dupes/missing ids
- AppSidebar renders sections from the normalized order; feature-flagged-off
sections skip their slot and keep stored positions
- Customize mode: dnd-kit sortable grips on group headers, save-on-drop via
new updateSidebarOrder action, Reset clears the preference, Done exits;
hidden while the sidebar is collapsed
- updateSidebarOrder sanitizes server-side and rewrites full preferences
- Fix sibling clobbering: saveDashboardLayout now preserves sidebarOrder,
and updatePreferences now preserves both sidebarOrder and dashboard.layout
Completes the terminology pass: the "How to place" help block and the
engine's user-facing error strings ("Missing structure", "Structures cannot
overlap", "Placement is closed", "The opponent has not placed their
structures") now match the place/structure/target vocabulary used elsewhere
in the duel. Also splits a comment that had been merged onto the scoreOf
declaration. Strings only; no behavior change.
The L now pivots on its elbow (corner) cell instead of being re-laid-out in
its bounding box, so rotating keeps that one cell in place instead of
shifting the whole piece. Orientation 0 is the L look with the elbow at the
bottom-left and arms up and to the right.
Cells are the anchor plus two arm vectors rotated in quarter-turns, so the
anchor is always occupied. The editor recovers a stored emplacement's
(anchor, rotation) by matching its cells against every candidate, and the
engine test asserts the anchor cell is present in all four orientations.
The Ammo Depot is now a 3-cell L (a 2x2 box minus one corner) instead of a
2-cell line. Emplacement orientation becomes quarter-turns (0-3) so the L
can turn through all four; lines still use 0/1, the square ignores it.
The editor seeds an emplacement's rotation by matching its stored cells
against each orientation, the rotate toggle shows "Rotate 90°" for the L,
and the engine/rotation tests cover the four L orientations.
The placement and battle grids inherited a 32px line-height, so any cell
holding the emplacement glyph grew taller than its square width (29x34),
making the row gaps look inconsistent once emplacements were placed. Set
leading-none on the grids so cells stay square.
Add a shape to emplacements ("line" | "square") and lay out the Command
Post as a 2x2 block (size 4) instead of a 3-cell line. cellsForFob resolves
cells per definition; the placement editor, preview, and tests use it.
Head-to-head artillery duel in a new "multiplayer" registry category
(out of periods). Each operator hides a fire-base fleet on a 10x10 grid,
then takes turns calling fire: the first mission is a grid designation,
every later shot adjusts from that operator's last impact using the
single-player range/deflection controls. First to reduce every enemy
emplacement wins; a cap decides on emplacements then cells.
Pure engine in src/lib/minigames/call-for-fire-versus (engine, views,
types, constants) is client-safe and unit-tested. The server-only
registry mirrors the blackjack table pattern (globalThis-anchored Map,
lobby, per-turn timeout, expiry sweep, single-instance only); its views
are built per viewer so the opponent's fleet layout never leaves the
server. The client polls the match snapshot (the in-memory SSE bus is
unreliable across dev module copies). Rewards on completion update the
callForFireVersus profile group, pay XP and chips, and emit
minigame:call-for-fire-versus.
Wires the game into the registry (new multiplayer category + enum
migration), the sidebar grouping, the command palette, and the profile
XP aggregation. The registry row seed is split into its own migration
because Postgres forbids using a freshly added enum value in the same
transaction.
Verified: 21 new tests (engine + registry) plus the wider minigame suite
pass; tsc clean; a live two-player award run confirmed XP, chips, and
the event.
- Optional `estimatedReleaseDate` (date and time) on the minigames registry,
with a named migration and regenerated types.
- Sidebar: an `upcoming` game renders greyed out and non-interactive, with a
tooltip carrying the estimate and a live countdown. It is a hoverable row
rather than a disabled menu item, because a disabled Radix item sets
`pointer-events: none` and would swallow the tooltip.
- Page gate: each minigame page checks its registry status and renders
`MinigameComingSoon` instead of the arena while the game is upcoming, so a
typed URL cannot reach unfinished gameplay. The date is display only: the
game goes live when an admin flips `status` to active.
- Leaderboards exclude upcoming games, so they get neither a tab nor a board.
- Pure `countdown.ts` formatter plus a client ticker that computes the
remaining time only after mount, avoiding an SSR hydration mismatch.
Note: `registry.ts`, `payload-types.ts` and `migrations/index.ts` also carry
the Call for Fire registry row and its generated types. That feature was
committed as 6d6a5fb and announced a separate commit for those files; they are
included here because they are entangled with these edits in the same files.
Tests: pure countdown unit tests, registry/gate/leaderboard integration tests,
and an e2e that seeds an upcoming row, hovers the disabled sidebar entry to
assert the tooltip, and checks the coming-soon gate.
Bracket hidden artillery targets across patrol/checkpoint/compound
difficulties. Pure rules in src/lib/minigames/call-for-fire.ts (compass
bearing observer reports, ADD/DROP + RIGHT/LEFT corrections, scoring,
distance-to-target accuracy, injected rng) with a 23-case spec.
Wires the game into the minigame ecosystem: submit action validates the
run, updates the profile callForFire group, pays out XP and chips, emits
minigame:call-for-fire, and records the period ledger entry (accuracy is
distance-to-target on a win, null on a loss). Adds the game page with
period standings and an all-time board, a command palette entry, the
Target icon, and the profiles XP aggregation.
The registry row and regenerated payload types land with the minigame
registry changes in a separate commit.
Phase 8 of the minigame periods feature:
- e2e smoke: the unified leaderboards page shows the period boards, the Core
game tabs and the achievements section; switching to All-Time reveals the
cardtable games; a game page shows its anchored period standings card.
(Passes with the bundled Chromium via E2E_BROWSER_PATH; Vivaldi crashes under
automation, as the root guide warns.)
- Integration coverage already added alongside each phase: entry recording,
the close pipeline and awards, month/year windows, the registry, the read
model and the in-app notifications, plus a pure bot renderer test.
- Document the periods, achievements and registry invariants in the minigames
AGENTS guide.
Phase 6 of the minigame periods feature:
- Muteable `minigame:achievement` notification type; the close pipeline now
notifies each winner in-app, but only when the achievement row is newly
written, so a re-run or a concurrent closer never double-sends.
- New bot service `achievementAnnouncements` polls achievements with no
announcedAt, groups them by window, posts ONE embed per window to
DISCORD_ANNOUNCE_CHANNEL_ID, then stamps announcedAt + discordMessageId.
A failed post leaves the rows unannounced so the next tick retries them.
- Pure, testable renderer (bot/lib/achievementRender.ts) for grouping and the
embed shape; window labels reuse the period/calendar helpers.
- Register the service in the bot registry and add
DISCORD_ACHIEVEMENT_POLL_MS (default 60s).
- Tests: renderer grouping/ordering/fallbacks and the in-app notification
path (including idempotency).
Phase 5 of the minigame periods feature:
- Read model (lib/minigames/periods/standings.ts) that shapes period boards
from the ledger (rank, placement points, names) and All-Time boards from the
untouched profile aggregates into one row type.
- GET /api/minigames/leaderboards: ?period=current|<id>|all-time, returning
the period, the period list, the boards and the achievements honor roll.
- New /minigames/leaderboards page: period selector (current, every past
period, All-Time), per-game tabs, and the achievements honor roll. Core-only
in period mode; every registered game in All-Time.
- Shared client pieces: useLeaderboards hook, StandingsTable,
PeriodStandingsCard (period by default, All-Time toggle) and
AchievementsHonorRoll.
- Each Core game page gains an "Anchored period standings" card so the period
board is visible on the game itself; its existing all-time board and
mode/difficulty selectors are untouched, and it links to the full page.
(Plan said replace the inline board; keeping it preserves the per-mode
selectors, so the period board is added instead. Easy to swap if you prefer.)
- Ledger fetch helper extracted to lib/minigames/periods/ledger.ts.
- Integration test for the period boards, the All-Time path and the honor roll.
Phase 4 of the minigame periods feature:
- Server registry loader (lib/minigames/loadRegistry.ts) reads the
minigames collection and falls back to the built-in seven when it is empty
or unreadable, so the nav and boards never render blank.
- The sidebar minigames dropdown now renders from the registry (Core and
Cardtable groups, retired games hidden, registry order), with lucide icons
resolved from the icon-name string through a client icon map and a
safe fallback.
- Period scoring is registry-driven: the close pipeline uses core games with
countsForPeriods instead of a hardcoded list. A retired game simply stops
accruing entries and drops out of the next period while its history stays.
- Integration tests for the fallback, ordering, retirement filtering and the
non-scoring-game exclusion; the older minigame specs now wipe the registry
too so files stay order-independent.
Phase 3 of the minigame periods feature:
- Record each ledger row's own instant (`occurredAt`, server clock at
submit) so calendar windows score runs that actually happened in them.
Backfilled from createdAt for existing rows.
- Pure UTC calendar windows (lib/minigames/periods/calendar.ts): completed
month and year windows, with the first window of each kind partial because
it begins at the anchor, and nothing crowned until the window has ended.
- Close pipeline extended: after the period sweep it crowns Player of the
Month and Player of the Year for every completed window, scored with the
same placement ladder as the period champion. Idempotent like the period
close (achievement unique key plus an existence check).
- period-tick logs the crowned windows; integration tests cover window
enumeration, both crowns and idempotency.
Phase 2 of the minigame periods feature:
- Pure board + award math (lib/minigames/periods/boards.ts): best-performer
boards from the ledger, a fixed top-N placement ladder summed across the
five Core boards, and the five period awards (Period Champion, Diligence,
Dedication, Precision, Most Improved) with the locked tie-break (raw
period score, then earliest submission).
- Close pipeline (lib/minigames/periods/lifecycle.ts): computes boards for a
period, writes its achievement rows, and marks it closed. Idempotent: the
status is re-checked before committing and the achievements unique key
makes a duplicate close insert nothing, so the tick and the admin override
cannot double-grant.
- Shared rules resolver (lib/minigames/periods/rules.ts), now used by both
the entry recorder and the close pipeline.
- New period-tick bin (registered in payload.config.ts) closes every due
period and materializes the current one, mirroring the mission tick.
- Admin close/reopen route (POST /api/minigame-periods/close), gated on the
minigame-periods:close permission. Reopen removes the period's awards so a
future close can re-grant them.
- Integration tests for the pure math and the full close/reopen cycle, plus a
clean-slate guard so the two minigame specs stay order-independent.
Phase 1 of the minigame periods feature:
- Shared server-side recorder (lib/minigames/periods/record.ts) writes one
minigame-entries row per completed scored run, lazily creating the
anchored period it belongs to (unique startDate makes it race-safe).
Failures are swallowed so a ledger hiccup can never break a submission.
- Pure anchored-period math (lib/minigames/periods/derive.ts).
- Wire the recorder into all five Core submit actions after their profile
update: flappy (passes > 0), EOD (win), radio (>= 1 correct message),
aim trainer and OPORD (any completed round).
- Server-validated durations for every game: flappy and radio watch now
report durationMs (with bounds), aim trainer reports its run duration
(clamped to the 30s course), EOD derives it from seconds, OPORD from
timeMs.
- Integration test covering derivation, lazy period creation, pre-anchor
null period and the never-throw guarantee.
Defer the reply before the permission check (uncached member fetch + DB
lookups) so a slow preamble no longer trips Discord's 3-second window and
shows "The application did not respond". Wrap all post-defer work in one
try/catch that editReplies an error, and make channel resolution catch fetch
errors so an unreachable DISCORD_CHANGELOG_CHANNEL_ID replies clearly instead
of hanging the interaction.
Also export compareVersions and make the shipped-file test assert
newest-first rather than a hardcoded version.
The startDateTime default in the Missions collection and the weekly
generate-mission bin both forced the date at least a week out by adding 7
days to the offset to the next Saturday. Generated midweek that landed on
the Saturday AFTER the coming one (a Tuesday generation went 11 days out
instead of 4), which also pushed the bot's roll-call (posted within 3 days
of start) days into the future and read as a missing roll-call.
Add nextSaturdayStart() to the unit-timezone date helpers: the nearest
upcoming Saturday at 20:00 America/New_York, rolling a week only once
today's 20:00 has passed. Use it for the collection default and the
generator, derive the generator codeName datestamp in unit time, and cover
the boundary cases in tests/int/next-saturday-start.int.spec.ts.
/changelog now accepts an inclusive range via from..to notation: v0.3.0..v0.5.0
(an inclusive slice, output oldest-to-newest), either end open (v0.3.0.. to the
latest, ..v0.5.0 from the oldest), and reversed ranges are normalized. Each
version posts as its own amber embed. Ranges over 10 versions warn but proceed.
Posts a CHANGELOG.md release entry to #releases (new DISCORD_CHANGELOG_CHANNEL_ID,
falls back to the announce channel). /changelog targets the latest entry;
/changelog <version> targets a specific version for catch-up.
Rendering is a pure, tested module (bot/lib/changelogRender.ts): entries are
split on "# vX.Y.Z" headers, ### sections become bold, bullets become the
bullet glyph, and entries over Discord's 4096-char limit are split across
messages at section/bullet boundaries with the header re-attached to each
chunk. Guild-scoped, staff-only command.
Reward users for helping build the app: wiki pages, mission planning
markers (queued until the mission completes), surveys, and manual awards.
Contribution XP folds into the existing virtual profile total, so it
flows into the level ladder, sidebar XP display, dashboard, and profile.
- contribution-entries ledger collection + profile progression.contributions.xpEarned bucket
- src/lib/contributions service (record/grant/expire/revoke, caps, idempotency, leaderboard) with a pure rules module
- per-mission planning-map delegation (missions:update grants) and a completed/cancelled map lock
- wiki, survey, and marker action/hook integration
- contribution:* event types, muteable notifications, permissions group, event targets
- profile Contributions section and /contributions leaderboard
- migration, reconcile tool, and integration tests
Staff with read-all oversight (superuser / system:admin-access) see everyone's
notifications in the bell. Add a "Show all users" switch inside the dropdown,
rendered only when the caller can view others, that narrows the feed to the
caller's own notifications. The choice is remembered per browser (localStorage)
and the unread badge follows the selected scope.
The inbox route now reports canViewOthers and honors scope=all|mine; non-staff
callers are always forced to their own regardless of the param.
The open-slot notice fired for a claimed slot because upcomingFridayRange
built its query window from the server-local calendar. On the UTC deploy
container, Wednesday 8 PM ET is already Thursday, so the window became
Fri 00:00Z-23:59Z (Thu 8 PM ET - Fri 8 PM ET) and any op starting Friday
evening Eastern fell outside it: hasMissionOnFriday said open,
getFridayClaimant found no claimant, and the dedup token rendered the
wrong date (October 8 instead of October 9).
The window is now Friday 00:00-23:59:59.999 America/New_York computed
from the Eastern calendar date, identical on any server timezone. When it
is already Friday Eastern, that day itself is the slot, keeping the dedup
token stable from Wednesday through the op day so late claims still
credit. Tests use explicit UTC instants plus a regression case for the
prod scenario, verified under TZ=UTC and America/New_York.
Root cause of the upload failures: the launcher writes an
<?xml version="1.0"?> prologue, Payload sniffs uploads with
fileTypeFromBuffer, and the collection mimeTypes allowlist lacked
application/xml, so every genuine launcher export was rejected with
'Invalid MIME type: application/xml'.
- Add application/xml to the mod-lists upload mimeTypes (the document is
still stored as text/html; verified end to end).
- New pure parser src/lib/modlistPreset.ts validates the launcher export
structure (arma:Type=preset meta + data-type=ModContainer rows) and is
shared by the server action (authoritative) and CreateSideOpDialog
(instant client-side feedback).
- Plain-text lists are no longer accepted anywhere: dialog accept/hint,
collection mimeTypes, and the action now agree on HTML presets only.
- Upload name defaults to the preset's own arma:PresetName.
- Tests: tests/int/modlist-preset.int.spec.ts (9 cases).
VoiceSubmissions, ModLists and MissionFiles relied on Payload's default
upload staticDir (the collection slug resolved from cwd), so prod wrote
their files to /app/<slug> instead of the mounted /app/media volume and
every redeploy wiped them (voice takes returned 500 on play/download).
Pin all three under media/ subdirs like story Voiceovers already does,
add regression guards, and fix the audio-preview fallbacks that pointed
at the media collection's file route instead of the owning collection.
Wire the previously orphaned LaborCrewPanel into the game-structures
editor so staff can set actual headcount and per-worker wage for a
labor classification. Adds a laborCrewPanel ui field on the edit view,
a POST route under /api/game-structures that authenticates and gates on
game-structures:update, delegates to the canonical setLaborHeadcount
service (enforcing caps and wage logic), and an integration test
covering auth, validation, and cap enforcement.
The countdown rendered each time unit with a raw monospace space,
which reads wide and odd when inline with proportional text. Split the
value into per-unit inline-flex cells separated by a CSS gap so spacing
stays consistent, and cover the new markup in the interpolate
integration test.
The MCP plugin's key collection was gated by hasRoles(), which reads only
the legacy roles enum column. All current admins authenticate through
dynamic roleDocs superuser roles, so nobody could create an MCP API key
and every client of /api/mcp got 401. Both override blocks (MCP keys and
the AI plugin instructions) now use requirePermission('system:admin-access'),
and the sync-only admin.hidden checks were dropped in favor of the read
gate, matching the repo's requireAdminPageAccess pattern.
Adds tests/int/mcp-api-keys.int.spec.ts covering the plain-user rejection,
dynamic-superuser key creation with HMAC index resolution (mirroring the
plugin's resolveAccessSettings), explicit system:admin-access grants, and
read visibility.
- Enlarge flow-editor wire handles from size-2 (8px) to size-3 (12px) so
they are easier to click and grab.
- Select an edge by clicking it, then remove it with the Delete key.
Selection is tracked in state and the highlight renders through BaseEdge
stroke props so the chosen line stands out.
- Edges are a derived projection, so deletion scrubs the hop from the
source node data via a new pure removeHopFromNode() helper in dialogue.ts
(choice row, condition branch, or single continuation).
- Add tests/int/npc-dialogue-remove-hop.int.spec.ts (4 tests).
Choice rows in the dialogue node editor now have up/down buttons so a
choice can be moved up or down into the desired order, which is the
order shown to the player. The swap lives in a pure reorderChoice
helper (no-op at the edges, input not mutated) with a focused test.
Event node flag effects previously always wrote the active participant's
flag. A flag's identity is (owner, key), so the same key can hold
independent values for different owners, but there was no way to target
them from the editor.
- Add flagTarget ("self" | "global" | "user") + flagTargetUserId to
NpcDialogueEffect. "self" (default) keeps current behavior.
- Add resolveFlagOwner (flags.ts) to map a scope onto the player-flags
user column; "user" with no id falls back to the participant so a
misconfigured effect never nudges the global flag.
- Move applyFlagEffect into flags.ts, parameterized by resolved owner;
the runtime action resolves the owner and delegates.
- Add a Target control (+ user picker) to the event node editor and
validateGraph enforcement for the "user" scope.
- Integration tests cover owner resolution and self/global/user writes.
Archived tickets disappear from every front-end surface for all users
(staff included): helpdesk list, detail page 404s, dashboard widget, and
project board/sprints/releases/search views. They remain fully visible in
the Payload admin panel, where un-archiving restores them. The collection
hook stamps archivedAt and appends an activity entry on each toggle; the
archiveTicket server action is tickets:staff gated and emits a
ticket:archive event. Edits and votes on archived tickets are rejected.
New Game collection reinforcement-pools (name, faction, armaFactions,
available, enabled) with manual-edit audit via reinforcement:adjust. The
events hook applies reinforcement.spawn/.refund deltas (soft limits, no
floor, idempotent by eventId) before the game's next pull, and a new GET
/api/arma/v1/reinforcements endpoint serves enabled pools to the server.
The helper counted arma-commands DB-wide, so any spec file that leaves a
game-server online (operation-*, supply-*, respawn-tickets) made later
web-originated locker edits leak into the count once vitest's timing-based
file order put those files first. Filter commands by this run's instance
refs, and mark the grid-metadata fixture write with the lockerSyncOrigin
context flag so it stops enqueuing an echo command of its own.
- game-event-logs gains visibility (public|restricted) + requiredPermissions
(any-of gate from the permission registry); read access becomes a Where
clause: public OR actor-is-me OR held permission; superusers and
game-event-logs:update staff see all; admin panel gate unchanged
- src/utils/event-log/visibility.ts: per-type policy map consumed by
emitGameEvent, with per-emit overrides; npc:dialogue and flag:set start
restricted, everything else stays public
- PlayerFlags hooks emit restricted flag:set audit events on every flag
write (admin edits and dialogue effects alike)
- fix dashboard RecentEvents leaking events: local API find now runs as
the viewer with overrideAccess false
- SSE broadcast sends an opaque nudge for restricted events instead of
type/actor metadata
- /events table marks restricted rows with a lock badge
- migration 20261007_025942_add_event_log_visibility + regenerated types
- tests/int/event-log-visibility.int.spec.ts (8 cases)
Rearranging nodes on the canvas (positions, edge ids, styling) no longer
changes the flow hash, so tidying a conversation in the editor does not
re-badge it as NEW for every player. The hash now covers node identity,
type, data, and edge source/target with order-independent serialization;
real text or branching edits still re-flag.
- DialogueText rewritten as a recursive parser so markup accumulates
({green}**bold green**{/} and friends nest freely, colors close inner-first)
- [label](url) dialogue links open in an iframe popup dialog so
conversation progress survives; only http(s)/relative urls render
- NEW badges: Converse button + choice buttons badge unread paths via a
per-browser seen map (ptf:npc-dialogue-seen) keyed by flow hash, so GM
edits re-flag the conversation
- choices gain lockedHint: failing conditions can show the choice disabled
with a rich tooltip instead of hiding it (evaluateNpcDialogueChoices now
returns ChoiceGate pass/showLocked pairs)
- player flags gain activatesAt/expiresAt time windows honored by readFlag,
flag effects gain flagDelayMinutes for slow-burn writes, and
{{countdown:key}} tokens tick live toward activation (done/missing states)
- migration 20261006_add_flag_time_windows; spec extended to 33 tests
- npc-dialogues gains priority + entryGate (flag key/op/amount) fields
- contact page offers the highest-priority conversation whose gate
passes (ungated = fallback, ties by oldest); only the winner's flow
leaves the server so locked story content never reaches clients
- extract shared flag reads (readFlag/evaluateCondition) to
lib/npc-dialogue/flags and pure selection to lib/npc-dialogue/selection
- migration 20261006_203217_add_dialogue_entry_gate; spec covers
ordering, gating, fallback, and storage round-trip
Extract the dialogue canvas's routing upgrades into routeEdge() in the
shared lib: perpendicular handle stubs, candidate scoring (Z-step vs
straight for forward edges, top/bottom bus corridors for back edges),
per-edge detour lane spreading, and multi-pass obstacle clearing. The
NPC dialogue RoutedFlowEdge becomes a thin renderer over it, and the
tech tree RoutedEdge now inherits the same logic while keeping its own
features intact: manual waypoints route verbatim (and define the
add-a-bend base), per-source stepPosition lanes feed the Z-step, and
its fixed right/left handles map to the new direction params.
New pure spec covers the Z-step shape, blocked-forward detouring,
back-edge bus routing, per-id lane spread, and waypoint pass-through.
isMissionEvaluable now considers the full scheduled window (start +
estimated duration) rather than the start alone, so evaluation reminders
fire once a mission's window has genuinely closed. Extends the profile page,
the remindEvaluations command and the evaluationReminders service to match,
and adds integration tests. Updates the bot evaluation-reminders docs.
New locker-sync bridge: web-originated storedAssets edits enqueue a
locker.apply command sent to the game, and game-side locker.sync merges
feed back into the member UI. Position/equipment layout is preserved across
merges. Adds the lockers service, LockerStorages + ArmaSyncEvents wiring and
integration tests. Docs in docs/arma-bridge/locker-sync.md.
Per-map grid config (gridEnabled, easting/northing origin, spacing, label
digits, over-lines) rides on the Maps collection and surfaces via
/api/map-features. Pure math in src/lib/map/grid.ts mirrors CfgWorlds Grid
(floor truncation, mod-10^digits wrapping, nested levels). GridLayer renders
hairlines + edge labels on the world map and mission planning maps, and
armaGridRef now delegates to gridRef. Migration 20261005_001212_add_map_grid_config.
v0.2.33 tightened hasIntelligenceQualification to write permissions for wiki
moderation, but the same check also gated navigation: regular members lost the
Intelligence sidebar section, command palette entries, keyboard shortcuts,
dashboard widgets, and tour steps. Add canViewIntelligence (intel read
permissions, with the strict qualification as a fallback) and use it for those
visibility surfaces. Wiki moderation, the tech tree, and division admin pages
keep the strict qualification.
- New mission-map-markers collection (permission-gated, removed with its
mission via a Missions beforeDelete hook) plus an opt-in
classification.planningMapEnabled flag on missions.
- The mission page gains a planning section: place and edit Arma markers
(icons, ellipses, rectangles, polylines) with debounced saves, an SQF copy
export, and an Arma grid readout. Everyone who can read the mission sees the
plan once enabled; editing requires missions:update or mission ownership.
- Base layers come from GET /api/map-features?layers=base, which skips the
structure, node and shipment queries; marker icons render tinted by color
exactly like in-game.
- Includes the hand-written migration, the missionMap service lib, server
actions emitting mission:map-marker-* events, and integration plus e2e
coverage.
Every canvas position write (Auto-arrange, Save positions, drags, freeze pins)
used to send one PATCH per technology, all at once. On a large tree that was
dozens of concurrent full document updates, which exhausted the database pool
and could crash the server.
- Add POST /api/tech-tree/positions: validates `{ positions: [{ id, x, y }] }`
(null x/y clears a pin, capped at 2000) and applies every position in a
single UPDATE on the tree position columns. Access mirrors the technologies
update rule (technologies:update or Intelligence membership).
- Route all canvas position writes through it; failures now surface in the
toolbar instead of being swallowed.
- Auto-arrange is optimistic: the canvas re-lays out on click and the pins
are restored if the save fails. A spinner status chip shows while a layout
save runs, and layout controls and dragging are locked until it finishes.
- Integration tests for validation and the bulk write; the e2e checks the busy
indicator and that no per-node PATCHes are sent.
- Add an `icons:arma` tool (extractArmaIcons.ts) that pulls inventory icons
out of the game's PBOs and materializes the .paa files the catalog needs.
- Extend the catalog import library with the matching planning and upsert
support, and cover it with integration tests.
- The mission tick now runs two idempotent sweeps: auto-start flips Scheduled
missions whose start time has arrived to Active, and auto-complete sets
missions whose scheduled window (start plus duration) has fully passed to
Completed with a stamped completedAt.
- Side ops are created as quiet Ready drafts and committed with a "Mark as
Scheduled" control, which is what posts the Discord roll-call and hands the
op to the lifecycle above.
- Daily schedule reminders nudge the creator to set a draft live (web
notification plus Discord DM).
- Adds the mission lifecycle/commit event types and the matching notification
labels, and updates the bot docs.
- Promotion nominations: members can nominate a peer for promotion from their
profile, and a new /personnel/promotions page lets staff review and action
the nominations (with an optional note on each).
- Leadership transfers: a member's leadership can be handed over to another
member, surfaced on the transfers page and in the roster (which also gains a
staff remove-member dialog).
- Adds the PromotionNominations and LeadershipTransfers collections (registered
in the Payload config), their service libs, the migration, and integration
coverage.
Round out the canvas editing experience.
- Dragging one card of a multi-selection now moves and persists the whole
selection (React Flow hands the full dragged set to onNodeDragStop).
- A category band is draggable by its header, which moves every technology in
that band; the band body stays click-through.
- A "Snap: On/Off" toolbar toggle (default on, remembered per browser) snaps
dragged cards to a 46px grid that divides the column and row steps, so
snapped cards line up with the automatic layout.
- Connection lines are adjustable: select an edge to reveal "+" handles at each
segment's midpoint (click to add a bend), drag bends to reroute, and
double-click a bend to remove it. Routes persist per browser.
- Edges route around technologies they are not connected to, and corners are
rounded, so lines no longer cut through unrelated cards.
- Ctrl/Cmd-clicking to multi-select no longer pops the side panel over the
canvas.