Skip to content

Commit 1ead294

Browse files
atulmguptaCopilot
andcommitted
feat(web,api): day log complete history without layer filter
Default all event layers, paginate until total_events, and keep truncated only for signal/gear caps. Display SI via useUnits, quieter drive accent, and guideline-clean page/timeline components. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 8c1358b commit 1ead294

19 files changed

Lines changed: 2144 additions & 533 deletions

File tree

internal/api/daylog/doc.go

Lines changed: 54 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@
55
//
66
// # Taxonomy
77
//
8-
// Every event carries {id, ts, type, layer, vehicle_id, ref_kind,
9-
// ref_id, payload}. Timestamps are UTC (RFC3339); ts values are the
10-
// source row's event time, never synthesised. Titles are NOT served
11-
// by this API: the frontend localises by type so i18n stays complete.
8+
// Every event carries {id, ts, type, layer, vehicle_id, source,
9+
// ref_kind, ref_id, payload}. Timestamps are UTC (RFC3339); ts values
10+
// are the source row's event time, never synthesised. Titles are NOT
11+
// served by this API: the frontend localises by type so i18n stays
12+
// complete. Transitions report previous → new in payload from/to;
13+
// absent states are omitted, never invented.
14+
//
15+
// The default view is the COMPLETE history: an omitted ?layers=
16+
// enables every optional layer. An explicit CSV narrows to a subset.
1217
//
1318
// Default layer (always on):
1419
//
@@ -19,32 +24,48 @@
1924
// charge_start charging_sessions started_at start_place, start_soc_pct /charging/:id
2025
// charge_end charging_sessions ended_at energy_added_wh, duration_s, /charging/:id
2126
// end_soc_pct
22-
// parked fsm_transitions ts from_state —
23-
// online fsm_transitions ts from_state —
24-
// asleep fsm_transitions ts from_state —
25-
// offline fsm_transitions ts from_state —
26-
// state_change fsm_transitions ts from_state, to_state (unknown target) —
27-
// locked security_events ts (locked=true) — —
28-
// unlocked security_events ts (locked=false)— —
29-
// lock_unknown security_events ts state (unparseable to_state) —
30-
// sentry_on security_events ts state (proto token, e.g. Armed) —
31-
// sentry_off security_events ts state (Off/Unknown token) —
32-
// sentry_unknown security_events ts state (missing to_state) —
33-
// remote_start_on signal_log ts — —
34-
// remote_start_off signal_log ts — —
27+
// parked fsm_transitions ts from, to —
28+
// online fsm_transitions ts from, to —
29+
// asleep fsm_transitions ts from, to —
30+
// offline fsm_transitions ts from, to —
31+
// state_change fsm_transitions ts from, to (unknown target) —
32+
// locked security_events ts (locked=true) from, to (bool) —
33+
// unlocked security_events ts (locked=false) from, to (bool) —
34+
// lock_unknown security_events ts from, to (raw) —
35+
// sentry_on security_events ts from, to (full proto tokens) —
36+
// sentry_off security_events ts from, to (full proto tokens) —
37+
// sentry_unknown security_events ts from, to (raw) —
38+
// valet_on/off security_events ts from, to (bool) —
39+
// security security_events ts event_type, from, to (unrecognized) —
40+
// remote_start_on signal_log ts from, to (bool) —
41+
// remote_start_off signal_log ts from, to (bool) —
3542
// sw_update software_updates created_at version, status —
3643
// sw_update_installed software_updates installed_at version —
3744
//
38-
// Optional layers (off by default, enabled via ?layers=):
45+
// Optional layers (on by default; narrowed via ?layers=):
46+
//
47+
// layer type(s) signal field(s)
48+
// turn_signals turn_signal {component, from, to, from/to_value} LightsTurnSignal (direction IS in the enum)
49+
// lights hazards_on/off, high_beams_on/off {from, to} LightsHazardsActive, LightsHighBeams
50+
// doors_windows door_open/closed {door, from, to}, DoorState* (bool), Fd/Fp/Rd/RpWindow
51+
// window {window, from, to, from/to_value} (WindowState enum)
52+
// hvac hvac_on/off {from, to, from/to_value} HvacPower (HvacPowerState enum, not watts)
53+
// gear gear {from, to, from/to_raw} drive_telemetry.gear ("ShiftStateD"/"D")
54+
// homelink homelink_nearby_on/off, arrived/left_{home, HomelinkNearby, LocatedAtHome,
55+
// work,favorite} {from, to} LocatedAtWork, LocatedAtFavorite
56+
//
57+
// Unmapped signal fields surface as generic signal events
58+
// {field, from, to} on the layer that queried them.
59+
//
60+
// # Enum display labels
3961
//
40-
// layer type(s) signal field(s)
41-
// turn_signals turn_signal {value} LightsTurnSignal (enum number, no label map)
42-
// lights hazards_on/off, high_beams_on/off LightsHazardsActive, LightsHighBeams
43-
// doors_windows door_open/closed {door}, window {window, value} DoorState*, Fd/Fp/Rd/RpWindow
44-
// hvac hvac_on {power_w} / hvac_off HvacPower (on = watts != 0)
45-
// gear gear {gear} drive_telemetry.gear (P/R/N/D)
46-
// homelink homelink_nearby_on/off, arrived/left_{home, HomelinkNearby, LocatedAtHome,
47-
// work,favorite} LocatedAtWork, LocatedAtFavorite
62+
// signal_log stores proto enum NUMBERS. The timeline labels them with
63+
// read-side display maps (turnSignalShort, windowShort, hvacShort,
64+
// gearShortForm) that cite their generated sources
65+
// (internal/tesla/protomodel/enum_parsers_gen.go + the proto). These
66+
// maps do not import proto bindings and do not re-run the codec's
67+
// prefix-trim; the parity test asserts every entry against the
68+
// generated String() output. Unknown numbers render raw, never guessed.
4869
//
4970
// # Source-of-truth decisions
5071
//
@@ -65,10 +86,14 @@
6586
// scope and intentionally not mapped.
6687
// - Summary sums skip NULL measures; a sum with zero contributors is
6788
// null (unknown), never a fake 0 — except that counts are exact.
89+
// - Previous states come from stored data only: the prior row of the
90+
// same series (in-window chain seeded by a pre-window lookup for
91+
// security_events, whose writer leaves from_state NULL).
6892
//
6993
// # Bounds
7094
//
71-
// Output is hard-capped at dayLogEventCap events (truncated=true when
72-
// over). signal_log and drive_telemetry inputs are fetched with LIMITs;
73-
// hitting an input cap also sets truncated because edges may be lost.
95+
// Events page with limit (default 500, max 2000) + offset;
96+
// total_events counts every assembled event so callers page until
97+
// complete. truncated=true reports data LOSS (a signal/gear input cap
98+
// was hit), never paging: a partial page is not truncation.
7499
package daylog

0 commit comments

Comments
 (0)