1
0
Fork 0
Commit graph

1043 commits

Author SHA1 Message Date
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
000036beda v0.11.1 - approval reset on edit, tech tree conflict protection 2026-10-15 12:12:32 -04:00
02ad121220 docs: add v0.11.1 changelog entry 2026-10-15 12:12:25 -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
b5bef669ec v0.11.0 - add first-party analytics, minigame phasing-out 2026-10-15 00:33:09 -04:00
94e32c1816 docs: add v0.11.0 changelog entry 2026-10-15 00:33:02 -04:00
a5bbcdd8ec fix(analytics): drop non-route export from collector route
Next.js rejects arbitrary exports from a route module, so the production
build failed on `export const ANALYTICS_SID_COOKIE` in /api/collect. The
constant is used only inside that file, so make it module-private. The client
SDK keeps its own copy in client-analytics/core.
2026-10-15 00:32:41 -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
9907f45155 v0.10.1 - NPC dialogue attachments, condition groups, block lists, Discord dispatch, public events, server-backed NEW badges, live edge routing 2026-10-14 17:28:47 -04:00
68782394e0 docs: add v0.10.1 changelog entry 2026-10-14 17:26:47 -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
59f01610ca feat(npc-dialogue): opt-in public visibility for event node effects
Dialogue-emitted game events default to restricted (npc:dialogue policy) so
narrative branches stay spoilable-free, which also hid announcements authors
intended for everyone. Event nodes can now mark their effect's log entry
public: NpcDialogueEffect gains an optional eventVisibility field, runEffect
threads it into every emitGameEvent call (emit, reward, flag), and the node
editor exposes a "Show this event to everyone" checkbox for those effect
types.

Omitted eventVisibility keeps today's behavior exactly: resolveEventVisibility
falls back to the per-type restricted policy. The separate restricted flag:set
audit written by the PlayerFlags hooks is untouched.

Verified live on dev: two injected event nodes (with and without the flag)
stored visibility "public" and "restricted" respectively; flow and probe rows
cleaned up afterward.
2026-10-14 15:15:38 -04:00
95a2412206 fix(npc-dialogue): re-route edges live while dragging cards
Edges in the dialogue flow editor bent around where cards used to be until
the page was saved and refreshed, because RoutedFlowEdge memoized its
obstacle rectangles on the React Flow store's nodeLookup Map. That Map is
mutated in place during a drag, so the memo key never changed and the cached
rects only refreshed on remount.

Compute the card rectangles in the editor from its own live `nodes` state and
hand them to each edge through `data`, which is how the tech tree already
drives its routed edges. Obstacles stay render-only: serialize() persists
deriveEdges(clean) separately, so nothing new reaches stored flow data.

Verified by dragging a non-endpoint card over an unrelated edge and sampling
that edge's path mid-drag: 4 of 5 held positions re-routed with the fix, 0 of
5 without it (same test, same document).
2026-10-14 15:00:08 -04:00
43397f16cb docs(analytics): add event taxonomy README and analytics domain guide 2026-10-14 12:13:01 -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
35a88ccd8f v0.10.0 - add garage vehicle bays, rotate thumbnails, fix grid drag previews 2026-10-13 16:45:21 -04:00
ed9914d2a3 docs: add v0.10.0 changelog entry 2026-10-13 16:45:14 -04:00
cecf35fcc1 docs: record frontend page padding convention in LESSONS.md 2026-10-13 16:43:16 -04:00
61ac2122d6 fix(garage): pad garage page content like sibling routes
The page root used flex flex-col gap-6 without the site-standard p-5,
so contents rendered flush against the header and sidebar.
2026-10-13 16:43:16 -04:00
fe57d63311 fix(garage): always fit the vehicle bay grid to its container
Cell size was computed from the wrapper width without subtracting the
inventory frame's p-2 padding and borders, so the grid was ~16px wider
than its container and grew a horizontal scrollbar. Subtract the 18px
frame chrome, lower the cell floor 40->24 (legibility guard only), and
switch the wrapper to overflow-hidden so no scrollbar can appear.
2026-10-13 16:43:16 -04:00
45bb0bd029 feat(garage): rotate vehicle thumbnails with their cards
Vehicle orientation is meaningful in a bay, so a parked-then-turned
vehicle now shows its silhouette turned too. The rotated image is sized
from the card's pixel dimensions (long edge against the card height) and
anchored to the card centre so the 90deg turn happens around the middle
instead of clipping against the top edge. Name labels stay upright.
2026-10-13 16:43:02 -04:00
7c135cd282 fix(grids): resize drag preview when rotating mid-drag
dnd-kit pins the DragOverlay container to the activator rect measured
at drag start, so pressing R while dragging left the preview at the
pre-rotation footprint (a square-ish box for elongated items). Pass the
live rotated dimensions through the DragOverlay style prop, which is
spread after the pinned rect, in all three R-to-rotate grids: garage
vehicle bay, locker, and structure storage.
2026-10-13 16:42:50 -04:00
0453742f32 test(garage): cover placement validation, access gating, and bridge sync 2026-10-13 16:02:58 -04:00
053c35a70c feat(arma): import vehicle mass and category defaults, add library picker 2026-10-13 16:02:58 -04:00
0d73da1142 feat(garage): grid UI with dispatch and store, replacing deployed vehicles list 2026-10-13 16:02:58 -04:00
3f15fbfb11 feat(arma-bridge): handle garage deposit, withdraw, and sync events 2026-10-13 16:02:58 -04:00
6c1bbda944 feat(garage): add vehicle bay schema fields, geometry helpers, and backfill 2026-10-13 16:02:58 -04:00
8f91bfedbd v0.9.2 - add journal XP, fix journal dates and editor spacing 2026-10-13 15:54:08 -04:00
0830719561 docs: add v0.9.2 changelog entry 2026-10-13 15:53:19 -04:00
75817ed3fe feat(contributions): fade the XP hint out and polish the amount 2026-10-13 15:52:57 -04:00
e96fdb7f58 feat(contributions): award 25 XP per journal entry, one per day 2026-10-13 15:52:57 -04:00
f481efb108 feat(contributions): add a reusable XP hint with a glint animation 2026-10-13 15:27:00 -04:00
076de5d60c feat(journals): animate the XP hint 2026-10-13 15:27:00 -04:00
88d674cff6 feat(journals): hint when a draft will earn XP 2026-10-13 15:20:59 -04:00
283cd3f4b2 chore(nav): relabel the contributions leaderboard entry to Contributions 2026-10-13 15:13:10 -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
f1634fb335 fix(editor): space paragraphs in the shared rich text editor 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
49bc918c67 feat(contributions): add staff moderation panel to grant and revoke XP 2026-10-13 14:46:10 -04:00
87dc4deadb docs(contributions): document the journal-publish rule 2026-10-13 14:37:53 -04:00
7f65e0371b test(contributions): cover journal publish XP, substance gate, and cap 2026-10-13 14:37:53 -04:00