1
0
Fork 0
Commit graph

34 commits

Author SHA1 Message Date
4022e5b5f1 feat(intelligence): add attendance-gated feature unlocks to mission pages
Missions gain an attendanceUnlocks tier list (admin tab plus side-op dialog),
rendered as a timeline under the attendance card: reached tiers light up in
their accent, unreached tiers stay muted with an X TO GO tag.

- shared derivation, validation and side-op parser in lib/intelligence
- thresholds sorted on save, duplicates rejected, above-max allowed
- one compact field in the Discord roll-call; attendance hash now includes
  tiers, embed schema version 4
- int tests and an e2e render check at two attendance levels
2026-11-21 02:30:48 -05:00
5e1f200261 feat(wiki): replace textarea overlay with a CodeMirror markdown editor
The body editor painted highlighted markdown in a div behind a transparent-text
textarea, so the painted text and the caret were two different layout engines.
Any wrap-point difference (borders, scrollbar gutters, engine rounding, trailing
newlines) shifted the overlay by whole lines once content soft-wrapped, making
clicks land on the wrong glyph and the document end feel unreachable. The CSS
patch that preceded this reduced the drift but could not remove the class of bug.

CodeMirror 6 owns text and caret together, so the failure mode is gone by
construction rather than by maintenance. The body remains a markdown string, so
prepareMarkdown, ::: directives, wikilinks, templates, revisions and the preview
pipeline are untouched, with no data migration.

- WikiMarkdownEditor: EditorView lifecycle, theme and markdown HighlightStyle
  bound to the app's CSS tokens, history, line wrapping, IME-safe keymap.
- markdownCommands: one pure command table shared by toolbar buttons and keys.
- editorChange: toolbar updates dispatch only the differing span, keeping undo
  granular and selections outside the edit intact.
- Removes WikiEditorHighlightLayer, editorMetrics, lib/wiki/editorHighlight,
  useEditorHistory and the now-dead textarea selection reader.
- Adds e2e proof: glyph-precise clicks across wrapped paragraphs, list items,
  image markdown and scrolled documents land at the exact clicked offset.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-11-18 15:12:22 -05:00
80f71dc917 fix(map-objectives): read Playwright request failure via errorText 2026-10-27 02:13:44 -04:00
3bef63af33 feat(map-objectives): superuser-authored strategic objectives on mission maps
Add a superuser-authored objective layer (defend, assault, secure, etc.)
shown as labelled map markers on both the world map and mission planning
map, with per-layer toggles on the planning map.

- collection: MapObjectives (map_objectives table, enums, FKs)
- lib: objectives service + objectiveTypes + permissions + event emit
- actions/api: create/update/delete objectives server actions
- UI: feature-layer toggles, objective picker dialog, world/plan markers,
  SQF export, dossier dialog integration
- generated: regenerate payload schema + types for map_objectives
- tests: 10 integration specs + e2e spec
- docs: CHANGELOG, map-system, AGENTS guides
2026-10-27 02:12:31 -04:00
6be14c9815 test(test-db): template database + schema-hash cache + clone primitives
Reworks the test-db module into explicit primitives: ensureTemplateDatabase
(dropped/recreated + built once per schema hash change, cached in
.cache/testdb-template.json), cloneTemplateInto, dropDatabaseIfPresent and
dropStaleWorkerDatabases. bootstrapTestDatabase() keeps its export but is
re-expressed as guarantee-template + fresh clone for the serial databases
(vitest pre-stage-2, Playwright), so repeated runs skip drizzle push
entirely. The legacy truncate+push flow survives verbatim as
bootstrapSerialDatabase for the TEST_DATABASE_URI bisect mode. Nothing may
connect to the template while clones run (loud invariant comment).
2026-10-21 10:03:33 -04:00
0af105e055 test(interior): harden cleanup afterAll, raise decay timeouts, and fix seed typing 2026-10-20 19:50:19 -04:00
d80a93c30c test(interior): e2e smoke covering enter, open, cleanup, and collect 2026-10-20 18:33:14 -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
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
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
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
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
0453742f32 test(garage): cover placement validation, access gating, and bridge sync 2026-10-13 16:02:58 -04:00
0bb9719139 feat(minigames): show upcoming games as disabled with a release countdown
- 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.
2026-10-11 18:47:43 -04:00
e59e16344e test(minigames): e2e smoke for the leaderboards page and document periods
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.
2026-10-11 17:06:52 -04:00
1f230c0868 feat(missions): add a per-mission planning map with Arma markers
- 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.
2026-10-04 02:53:21 -04:00
80ad24580a fix(tech-tree): save canvas positions in one request so auto-arrange cannot overload the server
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.
2026-10-03 04:08:29 -04:00
d43b2ef658 feat(tech-tree): drag groups, snap to grid, and route edges around nodes
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.
2026-10-03 03:28:27 -04:00
5f7fd508a5 test(tech-tree): add integration and e2e coverage
- `tech-tree-layout.int.spec.ts`: pure layout (wrapping, manual overrides,
  category bands, forward-edge warnings, cycles, catalog-stability).
- `tech-tree-prereq-edits.int.spec.ts`: add/remove/switch prerequisites with
  cycle rejection and the pin-on-connect stability contract.
- `tech-tree-stability.int.spec.ts`: freeze pins every relocated card on a
  data change, plus edge visuals (per-path colors, per-source lanes).
- `tech-categories.int.spec.ts`: CRUD, RBAC, division gating, FK set-null,
  position round-trip.
- `tech-tree.e2e.spec.ts`: nav entry, render, preview/panel edits, both
  quick-create paths, drag persistence + Auto-arrange, save positions
  surviving a reload, connect/disconnect, and multi-column wrapping.
2026-10-01 10:04:07 -04:00
d16e721ccc test(e2e): seed e2e user, serialize workers, and deflake specs
The suite could not pass on the test database: global setup now seeds the shared dev/Test123 login with a superuser Roles doc and the dashboard rank, and points its own Payload connection at the test database. Playwright runs one worker with generous test and expect timeouts because first navigation to a route triggers a cold webpack compile, and gains E2E_BROWSER_PATH to swap the browser binary when the installed Vivaldi crashes under automation. The landing page gains the missing h1 the guest specs assert, login flows wait for the redirect to land, strict-mode locator collisions get exact or level-scoped matches, the session banner test re-signs the login claims with a short expiry using the runtime secret, and the reservation dialog click forces the dispatch and verifies the dialog opened (the trigger goes aria-hidden behind the modal mid-click, which stranded the retry loop).
2026-09-30 18:43:29 -04:00
8b79c1379d feat(tours): add permission-aware guided tours with replay and device opt-out
Pages declare brief tours in code, keyed to stable data-tour anchors. The layout resolves each visitor's access signals (intelligence and logistics qualifications, admin-panel access, feature flags) and step filtering hides what a user cannot reach, mirroring the sidebar. A tour auto-starts the first time a browser visits its page; dismissals are remembered per browser in localStorage. The header gains a replay control for on-demand runs on toured routes, the tour card gains Skip all tours on this device to opt a browser out of auto-starts, and the Account page holds the re-enable toggle. The card and spotlight get a distinct overlay treatment (glow, accent strip, outlined target).
2026-09-30 18:43:21 -04:00
962064a5a4 feat(session): add pre-expiry warning banner with extend button
- SessionExpiryBanner: live countdown, warn 15min early, one-shot toast, Extend button
- countdown.ts: pure countdown helpers (timeUntilExpiry, sessionExpiryPhase, formatCountdown)
- useSessionExpired: added unlock handler for SESSION_EXTENDED_EVENT
- useGameTick: exported SESSION_EXTENDED_EVENT for session extension
- unit tests: 14/14 pass for countdown helpers
- e2e test: banner renders with countdown + extend button
2026-09-23 15:02:10 -04:00
8135c9850b feat(test): run tests against a dedicated truncated database
Bootstrap a per-run test database (ensure, push schema, truncate, seed baselines, repair sequences), wire vitest/playwright globals, and gate schema push behind DB_PUSH. Serial test files share the one database.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-09-22 17:58:17 -04:00
679a0f7879 feat(logistics): supply box management surface 2026-09-21 08:19:33 -04:00
42066e9d13 feat(operations): reservation creation flow
Add the create-reservation dialog and its option sources for todo 3 of
ops-reservations-and-crate-sync.

- src/lib/operations/reservationOptions.ts: server-only option pool
  (listReservationOptions) returning upcoming unit-visible missions, idle
  unreserved vehicles, operational structures, budget accounts (no
  balances), per-origin stock, and a capped roster.
- src/components/frontend/operations/reservations/CreateReservationDialog.tsx:
  client dialog with core fields, personnel/vehicle multi-picks, cargo
  line repeater, budget + expiry; client pre-validation mirrors the
  server validator; engine errors render verbatim.
- Mount the dialog on the reservations list page, server-gated by
  operation-reservations:create + hasLogisticsQualification.
- Integration tests for the option scopes; e2e spec written (run in F3).

tsc clean; 5/5 integration tests pass.
2026-09-21 04:39:09 -04:00
c19d0d05ee feat(ui): tactical operation primitives and role surfaces
Reusable dossier primitives (classification strips, brackets, readouts, provenance chips, notice states) plus server-rendered /operations overview, ledger drill-down, and AAR with permission-gated sections and an authorized reconciliation panel. Realtime refresh is enhancement only.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-09-20 02:44:53 -04:00
25975db23f refactor(minigames): move routes, components, and libs under minigames parents
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-09-09 00:02:59 -04:00
0996b9b7c2 feat(opord): scale tiers to 10/15/20 questions with expanded briefings 2026-09-08 12:34:37 -04:00
95663924ea feat(minigames): anti-cheat pass for OPORD Recall
- briefing is now self-paced (player clicks Begin recall; no memo countdown)
- recall quiz has a hard server-validated time band per tier (45/60/75s limits, minimum plausible human time, 2.5s grace); scripted instant or over-limit submissions are rejected
- briefing is rendered on canvas: no selectable text in the DOM, copy/cut/context-menu/ctrl-a-c-x-s-p blocked; screenshots remain possible but burn quiz time
- ?seed=<n> URL param pins a deterministic scenario (no server meaning; used by the e2e spec to know the grid)
- e2e spec updated for the new flow and asserts no grid text leaks into the DOM
2026-09-08 11:46:53 -04:00
eaa0325b6d feat(minigames): add OPORD Recall briefing-recall minigame
- seeded OPORD generator (grid, azimuth, H-HOUR, phase lines, codewords, callsign, frequency) in pure lib src/lib/opord-recall.ts with per-tier memo windows (25/18/12s) and quiz sizes (4/6/8)
- server action submitOpordRecallResult validates input, recomputes score server-side, persists to Profiles progression.minigames.opordRecall, broadcasts XP, emits minigame:opord-recall event
- UI at /opord: briefing countdown, one-at-a-time quiz, debrief metres, tier radio group, SSE presence, REST leaderboard per tier
- profiles migration 20260908_152021 (7 additive columns) + XP hook wiring
- nav entries in command palette and NavUser Exercises submenu
- e2e spec plays a full round and asserts debrief + leaderboard row
2026-09-08 11:26:18 -04:00
f312b7b8f4 test(e2e): refresh frontend login and landing smoke tests
Enable baseURL in playwright config and replace the placeholder
homepage check with a landing-page test and a dev-user login flow.
2026-08-10 16:01:51 -04:00
Z8MB1E
4d639387f4 feat: initial payload scaffolding 2025-10-24 02:07:13 -04:00
Z8MB1E
e4a367489f feat: initial commit 2025-10-15 14:03:31 -04:00