8 Commits
Author SHA1 Message Date
vinihcrosaandClaude Opus 4.8 45506efede build(web): 3D asset pipeline + three/r3f deps (foundation for 3D view)
Add three, @react-three/fiber, @react-three/drei (runtime) and gltf-transform /
gltfpack (dev) plus apps/web/scripts/build-3d-assets.sh, which compresses the
local Baía de Guanabara + celso_furtado source packs into web-ready GLBs
(meshopt geometry + WebP@1024 textures — no KTX2 transcoder needed under our
COOP/COEP). v1 subset = batimetria + ilhas + ponte + vessel (~21MB, down from
~640MB); topografia excluded (pathological per-tile textures). Generated GLBs are
gitignored — run the script once locally before using the 3D view.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 00:46:58 -03:00
vinihcrosaandClaude Opus 4.8 e2b50cde87 feat(web): scenario list screen + routing (Meus cenários)
Add react-router-dom with two routes: "/" → MyScenariosPage (scenario grid with
search, create, open, delete against the scenarios API) and "/editor" → AppShell.
"Sair do cenário" returns to the list. New: use-scenarios hook, ScenarioCard,
MyScenariosPage (+ tests, 235 web tests green).

API: backfill legacy initialConditions rows missing instanceId so GET /scenarios
serializes under the updated schema.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 22:19:20 -03:00
vinihcrosaandClaude Sonnet 4.6 53ce4a91f6 feat: environmental conditions, vessel instanceId, panel stability, regression tests
Environmental Conditions feature:
- C++ EnvironmentTimeline: time-series current/wind data, JSON serialization
- WASM bindings: loadEnvironment(), World integration
- TypeScript types: CurrentSeries, WindSeries, EnvironmentPayload
- Zustand environmentStore with React panel (EnvironmentConditionPanel)
- Mock WASM current drift physics: nautical→body-frame velocity applied in step()

Bug fixes:
- Vessel instanceId: unique auto-increment ID per scenario instance prevents duplicate
  vesselId crash when adding two vessels of same type
- vesselPanelStore: separate vesselTypeId field so config fetch uses correct type ID
  (not instanceId) after the instanceId/vesselId split
- VesselMarker stable eventHandlers: useMemo + useRef pattern prevents react-leaflet
  from re-registering Leaflet listeners every 50ms tick, fixing panel clicks during
  active simulation

Tests:
- Playwright regression suite (e2e/regression.spec.ts): 8 tests covering panel open
  during simulation, multi-click consistency, two VLCC no error, dual marker render,
  individual panel open, remove-one behavior, current drift, no-drift baseline

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-29 11:29:16 -03:00
vinihcrosaandClaude Sonnet 4.6 ff7cf13d17 chore(web): upgrade React 18 → 19 and react-leaflet 4 → 5
react-leaflet v5 requires React 19 — now fully compatible without
peer dependency warnings. No API changes needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-28 03:48:15 -03:00
vinihcrosaandClaude Sonnet 4.6 6ba2755448 fix(web): downgrade react-leaflet to v4 for React 18 compatibility
react-leaflet v5 requires React 19 — caused "render2 is not a function"
runtime crash and white screen. Downgraded to v4.2.1.

fix(docker): separate DB volume mount from API dist directory

Volume was mounted at /app/apps/api, overwriting compiled dist/ with stale
files from previous container runs. Changed mount to /app/data for DB only.

fix(api): copy area.json and vessel1.json into API Docker image

Seed files could not resolve JSON data at container startup.
Added COPY in Dockerfile and corrected path depth from 5 to 4 levels.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-28 03:44:16 -03:00
vinihcrosaandClaude Sonnet 4.6 788f7982f9 feat(web): implement scenario-creator feature
- ScenarioCreatorPage: full-screen layout (sidebar + Leaflet map)
- AreaMapView: Leaflet map with area polygon and draggable vessel markers
- VesselMarker: SVG icon rotated by heading
- ScenarioForm: scenario name input + area dropdown
- VesselList: add/remove vessels with heading editor
- SimulationControls: start/stop buttons + live simulation time display
- Sidebar: composition of all form components
- useScenarioStore: Zustand draft state (area, vessels, positions, headings)
- useAreas / useVessels: fetch hooks with loading/error/retry
- geo.ts: equirectangular lat/lng ↔ meters conversion + isInsidePolygon
- simulationStore: extend with loadScenario + scenarioVessels state
- simulation.worker: support loadScenario message with multi-vessel init
- 59 unit tests, coverage >80% on all metrics (stmts 94%, branches 84%)
- E2E Playwright smoke spec for scenario-creator flow
- gitignore: add apps/web/coverage/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-28 03:33:11 -03:00
vinihcrosaandClaude Sonnet 4.6 8539f1a46a test(web): configure Playwright E2E + Vitest unit testing with 80% coverage rule
- Add Playwright (Chromium) for E2E tests with webServer auto-start
- Add Vitest + @testing-library/react + coverage-v8 with 80% threshold
- Add smoke E2E spec and jest-dom setup file
- Update turbo.json with test:e2e task
- Enforce 80% coverage rule in AGENTS.md (global testing policy)
- Add full Testes section to docs/conventions/frontend.md
- Add tasks.md for scenario-creator feature (14 tasks, T01–T14)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-28 03:22:21 -03:00
vinihcrosaandClaude Sonnet 4.6 6295d540a4 feat: migrate to monorepo with WASM core, Fastify API, and React frontend
- Move C++ sources to core/ subdirectory (T05)
- Add pnpm workspaces + Turborepo pipeline (T06)
- Add Emscripten CMake target and build-wasm.sh (T07)
- Implement Embind bindings via YmirBindings.cpp (T08)
- Add packages/types with TypeBox schemas for VesselDTO, ScenarioDTO, SimulationStateDTO (T09)
- Create apps/api: Fastify v4 + Drizzle ORM + SQLite with vessels/scenarios CRUD (T10-T13)
- Create apps/web: Vite + React 18 + COOP/COEP headers (T14)
- Add simulation.worker.ts for WASM loop in Web Worker (T15)
- Add Zustand simulationStore (T16)
- Add TelemetryPanel component (T17)
- Verified: pnpm build 3/3 tasks, 21ms cached; ctest 211/211 pass (T18-T19)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-28 00:08:28 -03:00