Commit 99dbb6f
Optimization (#102)
* fix(mqtt): bound telemetry database pressure
Coalesce ordered per-vehicle telemetry into bounded multi-row writes while preserving source timestamps, durable signal history, and broker replay semantics.
Separate liveness from dependency readiness, expose pool-pressure metrics, and tune API, worker, PostgreSQL, Helm, and Compose defaults for resource-constrained home servers.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c4f5fe6d-5e00-4d43-a379-96a3491480e3
* feat(fsd): add drive attribution insights
Add synchronized counter collection, confidence-aware per-drive attribution, dashboard comparisons, and approximate route evidence across the FSD and drives experiences.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ecf38089-132f-4123-b33f-23d9133f2db9
* feat(fsd): add firmware spotlight and weekly digest FSD section
Backend: add BuildFirmwareSpotlight to compare same-route FSD share before/after the latest firmware pair (high-confidence drives only, sorted by |share change|).
Frontend:
- Add FirmwareSpotlightPanel to FSD drive analytics showing before/after route comparisons
- Add FsdSection + useFsdWeeklyDigestNotification to the weekly digest page, wiring in useFsdInsightsRange for the selected Monday-Sunday week (once-per-week browser notification, no permission prompting)
- Add CSV/JSON export for contributing drives (SI meters, drops unmeasured FSD distance)
- Add downloadJSON helper to csvExport.ts
All changes preserve SI units end-to-end and null-safety for unmeasured data.
* feat(web,api): add FSD observatory reset-safe journal
Introduce an Observatory view stitching drive and counter-reset events into a single honesty-first timeline. Resets never contribute travelled distance, and unknown/ambiguous FSD kilometres stay null instead of being coerced to zero. Adds commute stories that split repeated routes into firmware-version chapters.
Backend: buildObservatory in drive_aggregate.go computes stitched/high/estimated/ambiguous FSD totals, a capped timeline (max 200 events), and per-route commute chapters. New Observatory/ObservatoryEvent/ObservatoryTotals/ObservatoryCommuteStory types added to DriveAnalytics response.
Frontend: new FsdObservatoryPanel component renders the journal, KPIs, and commute stories; wired into FSDInsightsPage. Types, fixtures, and mock API updated to match the new response shape.
* fix(api): treat only Disconnected as charge end
Tesla's Complete/Stopped/NoPower states mean the vehicle is still plugged in — only Disconnected means unplugged. This was causing charge sessions to end prematurely.
Changes:
- enums.IsChargeEnded now only returns true for Disconnected
- FSM and telemetry session tracker updated to keep charging sessions alive through Complete/Stopped/NoPower
- Gear=Park now debounces before ending a drive (Neutral is rolling, not parked, and no longer treated as park)
- FSM confirmed debounced transitions now commit immediately instead of waiting for the next batch
- MQTT: delay broker Connect until after PipelineSubscriber/DefaultPublishHandler are wired, so queued QoS 1 messages delivered right after CONNACK aren't dropped; split NewProductionPipelineMQTT into construct + ConnectProductionPipelineMQTT
Updated tests across datarepair, telemetry sessions, fsm, enums, and mqtt packages to match.
* feat(physics): add Tesla physics views
Add Tesla-honest physics APIs and UI for charge, park, vampire drain, FSD trip meters, gear events, session certificates, and outage replay. Extend FSD analytics with commute comparisons and firmware-tagged counter resets.
* Add TeslaSync-only physics views
Adds a backend `/physics/exclusive` report that derives TeslaSync-only physics signals, including clocks, life tape, contradictions, meter genealogy, unknown budgets, firmware epochs, mode laws, and range disagreement without inventing missing values. Adds frontend routes, navigation, i18n, API hooks, types, and tests for the new Tesla-only page.
* fix(mqtt): handle startup reconnect race
Serialize reconnect epoch changes with subscription setup and retry stale initial SUBACKs. Add coverage for overlapping OnConnect and connection-loss startup races.
* perf(api): stream and cap physics timeline reads
Physics endpoints buffered every signal_log event for the window before folding, which made the 14-day exclusive and 7-day outage lookbacks unbounded in memory and latency.
- Replace the buffer-then-fold-then-collapse pipeline in internal/signal with a streaming timelineFolder that folds, collapses, and caps rows as events arrive; add TimelineOptions.MaxRows and log truncation.
- Apply CollapseBy and MaxRows to charge, theater, silent, cockpit, heartbeat, park-truth, vampire, exclusive, and outage timeline reads.
- Split exclusiveFields into a collapsed history set plus a high-resolution 90s black-box query, and drop battery_level/driving_distance_m from collapse keys where they defeated collapsing.
- Shrink vampire lookback to 7d and outage lookback to 2h.
- Move charge, outage, and exclusive query policies from operational/live to historical.
- gofmt alignment across teslaphysics/types.go.
* Rename Tesla-only hub to Tesla Physics
Updates navigation, route labels, page copy, i18n strings, catalog description, and tests to use the Tesla Physics naming.
* Revamp Tesla physics pages
Redesign the Tesla-only physics hub with feature cards, provenance, empty states, and richer detail views backed by data tables. Update related i18n labels and tests to preserve unknown/null semantics for clocks, MQTT, FSD meters, range, modes, and life tape states.
* fix(web): remove inner frame from PWA app icons
Android and iOS apply their own squircle/circle masks to launcher icons, so the pre-drawn inner frame and accent stroke were being clipped into visible border arcs on the splash screen.
- Drop the inset surface rect + accent stroke from all icon modes in `appIcon.ts`, the static SVG sources, the favicon, and the index.html splash mark
- Make launcher/splash icons full-bleed; the PWA `any` purpose now uses the apple (unrounded) canvas
- Add missing `icon-maskable-192.svg` / `icon-maskable-512.svg` sources and regenerate all PNGs via sharp
- Keep accent validation in `buildAppIconSvg` for API stability even though it is no longer drawn
- Update tests and icons README with the regeneration command and the no-frame rule
* fix(web): correct TS types and JSX in TeslaOnlyPage
DataTable column definitions were typed as a single `Column<T>` instead of `Column<T>[]`, breaking type checking across all 13 panels. Also wrap the empty-state branch in a fragment so the JSX comment is no longer parsed as an object literal.
* feat(settings): add guided Fleet Setup
Add a routed, searchable Fleet Setup workspace for Tesla connection, token status, telemetry subscription, domain readiness, and stream health. Introduce typed hooks and coverage for Fleet API setup flows.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c4f5fe6d-5e00-4d43-a379-96a3491480e3
Copilot-Session: ecf38089-132f-4123-b33f-23d9133f2db91 parent 4a3425e commit 99dbb6f
241 files changed
Lines changed: 21258 additions & 841 deletions
File tree
- cmd
- automation-worker
- export-worker
- notification-worker
- resubscribe
- docs
- guide
- runbooks
- grafana/provisioning/datasources
- helm/teslasync
- templates
- internal
- api
- datarepair
- devtools
- fsd
- telemetry
- teslaphysics
- app
- config
- database
- notification
- enums
- fsm
- health
- mqtt
- notification/fsddigest
- signal
- tesla
- config
- templates
- normalize
- router
- writers
- ops/config
- web
- e2e
- public
- icons
- src
- __tests__
- api/hooks
- components/layout
- sidebar
- features
- admin/components/ingest-xray
- analytics
- components/weekly-digest
- pages
- battery
- components
- pages
- charging
- components
- pages
- dashboard/widgets
- registry
- driving
- components
- drive-detail
- fsd-insights
- __tests__
- pages
- explore
- settings
- components/fleet-setup
- pages
- system/pages
- vehicles/pages
- hooks
- __tests__
- i18n
- en
- lib
- __tests__
- types
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
24 | 37 | | |
25 | 38 | | |
26 | 39 | | |
| |||
83 | 96 | | |
84 | 97 | | |
85 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
86 | 110 | | |
87 | 111 | | |
| 112 | + | |
| 113 | + | |
88 | 114 | | |
89 | 115 | | |
90 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
302 | 303 | | |
303 | 304 | | |
304 | 305 | | |
305 | | - | |
| 306 | + | |
| 307 | + | |
306 | 308 | | |
307 | 309 | | |
308 | 310 | | |
| |||
356 | 358 | | |
357 | 359 | | |
358 | 360 | | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | 361 | | |
391 | 362 | | |
392 | 363 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
174 | | - | |
| 175 | + | |
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
214 | | - | |
| 214 | + | |
| 215 | + | |
215 | 216 | | |
216 | 217 | | |
217 | 218 | | |
| |||
292 | 293 | | |
293 | 294 | | |
294 | 295 | | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | 296 | | |
324 | 297 | | |
325 | 298 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
177 | 178 | | |
178 | 179 | | |
179 | 180 | | |
180 | | - | |
| 181 | + | |
181 | 182 | | |
182 | 183 | | |
183 | 184 | | |
| |||
213 | 214 | | |
214 | 215 | | |
215 | 216 | | |
216 | | - | |
| 217 | + | |
217 | 218 | | |
218 | 219 | | |
219 | 220 | | |
| |||
0 commit comments