Commit Graph

154 Commits

Author SHA1 Message Date
Reese Norris
b1f4d09291 ci: fix check-hygiene.sh exit status; gate gofmt, hygiene, import-graph
Convert all five scan_files pipelines to process substitution so failed
is set in the parent shell. CI runs gofmt, hygiene, and import-graph
before race tests.
2026-07-27 13:45:42 -04:00
Reese Norris
a31aa38d8a hygiene: remove panics from web JWT helper and CoalesceOutbound
getJwtContext returns nil when missing/wrong type; requireJwtContext
aborts with 500 at every non-optional call site so handlers fail closed
without panic. NewCoalesceOutbound returns (*CoalesceOutbound, error)
instead of panicking on nil writeAsync. Tracks the cleanup design doc.
2026-07-27 13:45:19 -04:00
Reese Norris
7a2d5794e9 chore: track colocated memory DSN test and sweatbox stylesheet
Add missing main_test for normalizeColocatedMemoryDSN and the sweatbox
operator console CSS that was left untracked.
2026-07-23 21:17:32 -04:00
Reese Norris
287100acf8 fix(web): airport editor map size + drop no-JS text fallback
Pin the enhanced map host to a definite viewport height and invalidate
Leaflet size on layout changes so OSM tiles fill the pane. Remove the
bottom apt/air text backup forms to reclaim console space.
2026-07-23 21:17:32 -04:00
Reese Norris
f58157b113 merge: e2e CI flake fixes (ATC chat + beacon) onto dev
Bring in fix/ci-dev: harden TestE2E_ATCChatAndITRange and
TestE2E_BeaconAssignAndFPRequest against gnet cross-connection races.
2026-07-23 21:00:52 -04:00
Reese Norris
eac0b579e5 merge: users page refactor and pilot PPL gate onto dev
Merge refactor/users-page work: dense Users directory, instructor rating
adjust, pilot_rating VATSIM scale, and optional REQUIRE_PILOT_PPL.
2026-07-23 20:56:15 -04:00
Reese Norris
7bd8a4a40d docs: cancel Playwright e2e for airport editor (boring-web)
No browser automation suite; Go PE + pure Node webjs tests only.
2026-07-23 20:49:05 -04:00
Reese Norris
6f80c534d9 web: airport-editor validation UX and docs polish
Live client + server confirm validation panel, empty states, sweatbox
handoff copy, and residual docs.
2026-07-23 20:37:49 -04:00
Reese Norris
1726fbe751 merge: combine validate API (PR5) with editor edit modes (PR7) 2026-07-23 20:24:58 -04:00
Reese Norris
840c92b12b fix: JWT auth loads user for pilot PPL gate; unit test REQUIRE_PILOT_PPL
Populate user store in JWT auth tests and add TestAttemptAuth_RequirePilotPPL
covering pilot reject / ATC allow / PPL allow.
2026-07-23 20:17:30 -04:00
Reese Norris
ed32e93220 web: airport-editor draw/edit modes and Blob download
Full edit loop: draw park/taxi/rwy/hold/aircraft, vertex edit, Blob
download, dirty hash + Mark clean, Raw preview+Apply.
2026-07-23 20:16:51 -04:00
Reese Norris
3bc93e0101 feat: optional REQUIRE_PILOT_PPL gate for pilot FSD logins
Add config REQUIRE_PILOT_PPL (default false). When enabled, #AP pilot
connections need pilot_rating PPL or higher; ATC is unchanged. Exposed
in admin config editor and /api/v1/config.
2026-07-23 20:13:33 -04:00
Reese Norris
2df0ee6eb8 protocol: match VATSIM pilot rating IDs and names
Use the official pilot scale (0 P0, 1 PPL, 3 IR, 7 CMEL, 15 ATPL,
31 FI, 63 FE) for storage, UI labels, validation, and docs.
2026-07-23 20:05:54 -04:00
Reese Norris
660c135757 fix: address review feedback for airport-editor map layers
Tooltip XSS: bind textContent Element tooltips; escapeHtml unit-tested.
Toolbar-only basemap; list Enter/Space; dead branch; document blank-tile hook.
2026-07-23 20:00:15 -04:00
Reese Norris
cdb82fcc53 docs(web): document instructor vs supervisor user-admin privileges 2026-07-23 19:53:21 -04:00
Reese Norris
85e8e8880a web: instructor rating adjust; SUP+ full mutate; pilot_rating
I1–I3 may open the Users directory and set network/pilot ratings up to
their own ceilings on any certificate. Create and name/password remain
Supervisor+. Add users.pilot_rating (0–5) via migration.
2026-07-23 19:53:03 -04:00
Reese Norris
dd04b4c004 web: airport-editor map layers and surface/aircraft lists (read-only)
Load APT/AIR, render OSM map layers, select for inspector view, fit bounds.
Hard scope: no draw tools or Blob download yet.
2026-07-23 19:52:28 -04:00
Reese Norris
e67e1dc3d2 merge: combine airport-editor shell (PR3) with webjs modules (PR4) 2026-07-23 19:42:40 -04:00
Reese Norris
cbe41611dd fix: address review feedback for webjs parse-format modules 2026-07-23 19:42:28 -04:00
Reese Norris
4da89f3e20 web: read-only edit rail for higher-rated users
Supervisors can open Administrator accounts in the directory but see a
disabled view (no Update). Unauthorized POSTs still fail server-side.
2026-07-23 19:39:01 -04:00
Reese Norris
3a74a97a10 webjs: APT/AIR parse-format modules with parity tests
ES modules under static/airport-editor; Node tests in webjs/ import
via relative path; check-webjs.sh + CI Node 20.
2026-07-23 19:36:58 -04:00
Reese Norris
eecc145a45 web: Admin validate-apt/air JSON API via pkg/twrfiles
Stateless POST validators with Admin 403 JSON (never redirect).
APIV1 envelope; data.errors only; no geometry return.
2026-07-23 19:36:33 -04:00
Reese Norris
d5b1819f4a web: dense user directory with filterable list and rail forms
Replace the three-card user editor with an SSR directory plus create/edit
rail. Filters live in the URL, POST preserves them via dir_* fields, and
users.css provides a dense 16:9 layout. PE tests cover search, sort,
pagination, and rating-ceiling scoping.
2026-07-23 19:35:09 -04:00
Reese Norris
eb88d7a93a fix: address review feedback for db ListUsers CountUsers
Strengthen LIKE metachar and CountUsers tests: escapeLike unit table,
literal %/_/\ seed matches, CountUsers with Query and Limit/Offset ignored.
2026-07-23 19:32:55 -04:00
Reese Norris
d044980e6e db: add UserListFilter ListUsers and CountUsers
Add filterable list/count APIs with safe LIKE escaping, sort whitelist,
default limit 50 / cap 200, and list SELECT without password hashes.
2026-07-23 19:32:55 -04:00
Reese Norris
0a3b911ea9 twrfiles: add FormatAPT/FormatAIR with byte goldens
Normative emission for dual-language parity: all headers, always
runway displaced/turnoff, %.6f coords, Surfaces slice order, AIR 16 fields.
2026-07-23 19:24:37 -04:00
Reese Norris
6695a3a63c fix: address review feedback for twrfiles extract
Docs point fixtures at pkg/twrfiles/testdata; export DefaultRegistration;
tighten coverage tests; drop dead legacy fixture paths; AGENTS wire checklist.
2026-07-23 19:16:40 -04:00
Reese Norris
a3e74fa6bd fix(e2e): harden ATC chat and beacon tests against gnet races
CI race runs failed intermittently on TestE2E_ATCChatAndITRange and
TestE2E_BeaconAssignAndFPRequest after security/gnet hardening.

- Wait for pilot $FP broadcast before SERVER:FP re-request so the plan is
  stored across event loops (empty plan skipped #PC beacon).
- Exchange ATC % positions until peers observe each other before @49999
  chat and @94835 IT range fan-out.
2026-07-23 19:15:08 -04:00
Reese Norris
7832aa18f4 fix: address review feedback for airport-editor shell
Parse form before CSRF so oversized bodies get size flash not 403;
add body-size and POST authz PE tests; slog.Debug; AIR attachment assert.
2026-07-23 19:14:00 -04:00
Reese Norris
bf65f06934 twrfiles: extract APT/AIR parse types from sweatbox
Move pure file-shaped types and ParseAPT/ParseAIR into stdlib-only
pkg/twrfiles. sweatbox keeps type aliases and thin wrappers so callers
need minimal renames. Export IsWordName for taxi validation.
2026-07-23 19:08:07 -04:00
Reese Norris
34480db437 web: add /airport-editor shell with echo-download
Admin-only MPA shell with dual textareas and CSRF echo-download.
No server persistence; pure body echo. Map region inert without JS.
2026-07-23 19:00:42 -04:00
Reese Norris
3ba2b2c364 feat: add XP12 apt.dat download and sweatbox .apt converter tooling
Operators can fetch Global Airports apt.dat locally (-download) and convert
to TWRTrainer-style .apt files. openfsd does not ship Laminar data; bulk
outputs and apt.dat caches stay gitignored. See docs/xplane-airport-data.md.
2026-07-23 18:25:35 -04:00
Reese Norris
6ea10a16ae feat: shared SQLite defaults, quiet runtime, sweatbox control panel
Default DATABASE_SOURCE_NAME to an on-disk WAL file so colocated FSD+web
share one DB; rewrite bare :memory: to a shared in-memory DSN; migrate and
seed config from web as well. Default Gin to release and slog to info.
Rework sweatbox instructor UI with command rail, drafts, and history.
2026-07-23 17:34:27 -04:00
Reese Norris
6563136de6 Merge branch 'security/fsd-hardening' into dev
Combine serviceapi DTO extraction and ATC/protocol fixes with FSD
connection, rate, and auth hardening. Prefer server-built leave packets
on client delete over rebroadcasting client-forged #DA/#DP.
2026-07-22 16:09:33 -04:00
Reese Norris
86e86c4350 feat: FSD connection, rate, and auth hardening
Add per-IP/CID connection caps, login/idle timeouts, per-session rate
limits, non-blocking fan-out, ATC vis-range caps, auth-fail throttling,
loopback-default service HTTP, and JWT secret entropy fixes.
2026-07-22 16:08:48 -04:00
Reese Norris
93789bf72f feat: serviceapi DTOs, $HC handoff cancel, and ATC race fixes
Extract pure JSON DTOs into internal/serviceapi so web no longer imports
server. Add $HC wire type, persist assigned beacons, fix ValidATC before
first position, and prevent double leave notifications.
2026-07-22 16:06:11 -04:00
Reese Norris
e695eab227 chore: upgrade Go deps, toolchain, and CI actions
Bump direct modules (gin, jwt, migrate, pq, envconfig, sqlite, x/crypto,
x/net) and Go to 1.26 to clear Dependabot alerts and pick up current
releases. Refresh Dockerfile base image and GitHub Actions majors.
2026-07-21 18:20:24 -04:00
Reese Norris
1d65dcfc79 feat: implement SECPOS secondary visibility centers
Advertise SECPOS=1 and apply ' secondary center packets to multi-box
range search so ATC can see pilots outside the primary visibility box.
2026-07-21 18:11:50 -04:00
Reese Norris
825994dedc add openfsd binary to gitignore 2026-07-21 17:50:06 -04:00
Reese Norris
69627b0f89 fix: race-safe FacilityType, Docker Go 1.25, geo cell tests
Make Session.FacilityType atomic.Int32 so concurrent handleATCPosition
writes and HTTP online-users reads no longer race under -race. Bump the
Dockerfile build image to golang:1.25 to match go.mod. Add CellIndex/
CellCover unit tests so internal/geo meets the 98% coverage floor.
2026-07-19 15:43:47 -04:00
Reese Norris
f67f09b4de perf: gnet FSD I/O plane with coalesced outbound writes
Replace per-connection reader/writer goroutines with a fixed gnet
event-loop pool and CoalesceOutbound (latest-wins position queue,
immediate reliable flush). Keep classic net path for ForceClassicFSD
and injected Listen. Drop HANDOFF.md after completing the I/O pass.
2026-07-18 16:03:27 -04:00
Reese Norris
db62baf4bf perf: lock-free postoffice slab path; handoff for gnet I/O pass
Replace dual linear/R-tree registry with atomic live slabs, free-list
tombstones, and O(1) UpdatePosition via session VisBox atomics. Drop
tidwall/rtree. Add real-world hub benches. HANDOFF.md tasks the next
agent with gnet fixed-worker I/O plus position write coalescing (delete
after reading).
2026-07-18 15:22:18 -04:00
Reese Norris
f0f60d6ace sweatbox: synthetic badge, coverage gate, ops polish
Expose OnlineUserPilot.Synthetic on service HTTP /online_users so
operators and the dashboard can badge in-process sweatbox aircraft.
Enforce ≥95% hard coverage on internal/sweatbox in check-coverage.sh.
2026-07-17 20:57:39 -04:00
Reese Norris
94a711149c sweatbox: pattern legs and P1 command set
Add rectangular left/right traffic pattern geometry, circuit kinematics,
and the TWRTrainer-style P1 instructor commands (enter legs, landing types,
extend/turn, go-around, pattern size, closed-traffic takeoff rejoin).
2026-07-17 20:57:37 -04:00
Reese Norris
845527ea05 web: sweatbox live refresh progressive enhancement 2026-07-17 20:57:36 -04:00
Reese Norris
cd5a5f36c0 fix: address review feedback for sweatbox instructor page
Cover scenario/unpause/multipart/error paths; fail closed on scenario JSON
parse; cap flash msg length; remove dead sticky form fields; tighten XSS
assertions; MaxBytesReader on small form POSTs.
2026-07-17 20:57:34 -04:00
Reese Norris
d9084f866e web: boring-web sweatbox instructor page
Server-rendered Administrator instructor UI at /sweatbox with CSRF forms,
flash PRG, FSD service HTTP proxy, and disabled/unavailable messaging when
SWEATBOX_ENABLED is off or the control plane is unreachable. No JS required
for the primary path.
2026-07-17 20:57:34 -04:00
Reese Norris
73487b7b67 fix: address review feedback for sweatbox e2e 2026-07-17 20:57:33 -04:00
Reese Norris
d60bda0257 server: e2e sweatbox visibility, FP, delete, kick/kill lifecycle 2026-07-17 20:57:33 -04:00
Reese Norris
331b711d8f server: service HTTP sweatbox API (gated)
Register /sweatbox/* on service HTTP only when SweatboxHost is allocated
(SWEATBOX_ENABLED). Same fsd_service JWT + Administrator middleware as
existing routes. 2 MiB body limit on airport/scenario/command payloads.
2026-07-17 20:57:31 -04:00