Skip to content

Optimization - #102

Merged
atulmgupta merged 14 commits into
mainfrom
optimization
Sep 4, 2026
Merged

atulmgupta merged 14 commits into
mainfrom
optimization

Conversation

@atulmgupta

Copy link
Copy Markdown
Contributor

Description

Closes #

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would break existing functionality)
  • Documentation update
  • Infrastructure / CI change

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or my feature works
  • New and existing tests pass locally
  • I have updated the documentation accordingly
  • My changes generate no new warnings

Screenshots (if applicable)

atulmgupta and others added 14 commits August 30, 2026 16:20
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
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
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.
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.
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.
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.
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.
Serialize reconnect epoch changes with subscription setup and retry stale initial SUBACKs. Add coverage for overlapping OnConnect and connection-loss startup races.
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.
Updates navigation, route labels, page copy, i18n strings, catalog description, and tests to use the Tesla Physics naming.
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.
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
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.
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.
Copilot AI lite review requested due to automatic review settings September 4, 2026 18:38
@atulmgupta
atulmgupta merged commit 99dbb6f into main Sep 4, 2026
25 of 33 checks passed
@atulmgupta
atulmgupta deleted the optimization branch September 4, 2026 18:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Note

This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants