Refactor/mono gone#59
Merged
Merged
Conversation
54 prompts decomposing 28 oversized Go monolith candidates with mechanical, same-package splits. Includes staff-engineer improvements: - Per-prompt exported-identifier invariant check (HEAD vs working tree) catches accidental added/removed exports during splits. - 'go vet' added to every split, validation, and final-gate gate (catches struct-tag, fmt-verb, shadowed-var bugs that build/test miss). - '-race' added to every validation and final-gate 'go test' (matches project CI policy). - Action Step requiring per-prompt split map under REASONING before any .go edit. - Final-gate classification refined: split if shrink>=25%% OR (shrink>0 AND prefix-named siblings) OR shrink>0; deferred only if shrink<=0. - Final-gate gofmt path-glob fixed (replaced fragile TrimEnd char-set with proper directory paths). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
5 improvements: - A: Replace regex export-snapshot with parser-style PowerShell helper that handles grouped const/var blocks, generics, and method receivers (keys methods by Type.Method to avoid collisions) - B: Package-first build (./pkgDir/...) before whole-repo build in every split and validation gate, for fast localized failure - C: Recovery instructions in every split prompt's Blocked Path (git reset/git revert + re-run gate) - D: Machine-readable TSV summary block in final gate (file/baseline/now/shrink_pct/siblings/classification) plus baseline_sha re-export - E: Capture phase_37_baseline_sha in inventory prompt 00 for rollback reference Generator: session-state files/generate_phase37.py (idempotent regenerator) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
5 architectural improvements: - A: Telemetry layered live-state contract reminder (SignalStore L1 / Redis L2 / signal_log) added to all 10 telemetry split prompts (09-13, 15-19) so engineers do not co-locate hot-path code with durable-history queries - B: Domain-alignment guidance in models split (prompt 30): split by bounded context not by alphabet, name files models_<context>.go for clean future package extraction via git mv - C: Security-boundary reminder in tesla-client auth split (prompt 21): preserve internal/crypto isolation, no token logging, group for future internal/tesla/auth/ extraction - F: Cross-package import-graph invariant in every split gate: package union of imports at HEAD must equal working tree union, catches accidental coupling - Final gate FUTURE_PACKAGE_HINT TSV: maps every split file to a proposed future package extraction target for Phase 38+ planning Generator: session-state files/generate_phase37.py (idempotent regenerator) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Strategic governance, compliance, and multi-year maintainability improvements: - G1 (governance): Generator promoted from session-state to scripts/generate_phase37.py with portable __file__-relative ROOT path. Source of truth now lives in version control; produces byte-identical output to the session-state copy. Editing the generator and regenerating prompts must happen in the same change. - G2 (multi-year reproducibility): Capture go_version, engineer_email, powershell_version, os_platform in every gate's PREFLIGHT for audit reproducibility across Go toolchain upgrades and OS migrations. - G3 (cost/risk balance): Defer-with-rationale escape hatch in every split prompt's Blocked Path. After 2 recovery attempts, engineer may declare STATUS=DEFERRED with rationale; successor predecessor checks now accept STATUS=(DONE|DEFERRED) so a single impractical split does not block the entire 54-prompt chain. Final gate surfaces deferrals for Phase 38+ planning. - G4 (organizational scalability): PARALLEL_FAMILIES block in inventory documents 5 independent prompt families (automation_handler, telemetry_sessions, telemetry_handler, tesla_client, medium_singletons) that may execute concurrently across engineers while honoring intra-family predecessor chains. - G5 (irreversible decisions): CONVENTIONS_LOCK block in inventory declares the file-naming convention <orig_basename>_<suffix>.go as locked after Phase 37; Phase 38+ may git mv to subpackages but MUST NOT rename suffixes without separate governance decision. - G7 (compliance posture): Secret-scan gate in final gate (prompt 99) over diff from baseline SHA to HEAD. Blocks on AWS keys, JWTs, private-key headers, and high-entropy password/token literals. Phase 37 is mechanical and should not introduce secrets, but a careless split could expose previously buried credentials. All 54 prompts regenerated; byte-identical output verified between session-state and scripts/ copies. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Phase 37 prompt 02 - mechanical split, no behavior change Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Phase 37 prompt 03 - mechanical split, no behavior change Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Phase 37 prompt 04 - mechanical split, no behavior change Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Phase 37 prompt 05 - mechanical split, no behavior change Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Phase 37 prompt 06 - mechanical split, no behavior change Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
β¦elpers Phase 37 prompt 07 - mechanical split, no behavior change Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
β¦n_handler.go Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
β¦al gates Defect: validate gates (08, 14, 20, 27, 52) and final gate (99) set CGO_ENABLED=0 (project default) but then ran 'go test -race' which physically requires CGO=1. Result: prompt 08 correctly hit STATUS=BLOCKED with 'go: -race requires cgo; enable cgo by setting CGO_ENABLED=1' Honesty Covenant prevented the agent from silently 'fixing' the script (correct behavior). Fix: scope CGO_ENABLED=1 around the -race test invocation only; restore CGO=0 immediately after so build/vet steps remain on the project default (CGO disabled). Documented inline in the gate. Affected gates: validates 08, 14, 20, 27, 52 and final gate 99. Splits do not use -race and are unaffected. Both copies (scripts/generate_phase37.py and session-state) hash-verified in sync. Recovery: re-run prompt 08 with the regenerated gate; the new log will overwrite the BLOCKED log committed in 7f2e1f9 and successor predecessor checks will see STATUS=DONE. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
β¦n_handler.go Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Phase 37 prompt 09 - mechanical split, no behavior change Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Phase 37 prompt 10 - mechanical split, no behavior change Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Phase 37 prompt 11 - mechanical split, no behavior change Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Phase 37 prompt 12 - mechanical split, no behavior change Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Phase 37 prompt 13 - mechanical split, no behavior change Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
β¦_sessions.go Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Phase 37 prompt 15 - mechanical split, no behavior change Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Phase 37 prompt 16 - mechanical split, no behavior change Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
β¦d by prompt 16 Predecessor prompt 16 extracted liveStoreForTelemetry/updateLiveSignals/broadcastSSE/buildSSEPayload into telemetry_handler_ingest.go as part of the cohesive ProcessSignals/ProcessBatch hot path. No live-store identifiers remain in telemetry_handler.go to mechanically extract; relocating them from telemetry_handler_ingest.go would violate this prompt's allowed-files list. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
β¦rior prompts telemetry_handler.go contains no SSE code to mechanically extract: SSE HTTP handler with per-connection fan-out, keep-alive, and cancellation lives in sse_handler.go (separate file at HEAD); SSE broadcast helpers (broadcastSSE, buildSSEPayload) were moved to telemetry_handler_ingest.go by predecessor prompt 16; allowed-files list forbids modifying either source file. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Phase 37 prompt 19 - mechanical split, no behavior change Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
β¦_handler.go Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When a predecessor split prompt declares STATUS=DEFERRED via the G3 escape hatch (typically because an earlier split absorbed its cohesive area), the downstream validation gate previously failed because its hardcoded expected-files list still required the deferred file to exist. The gate now records SKIP-DEFERRED for any expected file whose source split prompt has STATUS=DEFERRED, and only fails when a file is missing while its source split is STATUS=DONE (real drift) or unknown. Affects validation prompts 08, 14, 20, 27, 52 and the generator. Surfaced by prompt 20 BLOCKED in c827596 after prompts 17 and 18 correctly DEFERRED (cohesive areas absorbed by prompt 16's larger split). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
β¦_handler.go Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Phase 37 prompt 21 - mechanical split, no behavior change Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Surface the existing theme customizer in three high-visibility places and
make the chart palette theme-aware.
- Extract <ThemePicker> shared component (mode + accent + custom builder)
with showMode/showCustom/compact props; consumed by AppearanceSettings,
the new top-bar quick-switcher popover, and (indirectly) the first-run
banner.
- Register six new command-palette entries: open theme picker (T) plus
per-theme switches (Neon Cyan, Tesla Red, Matrix Green, Royal Purple,
Solar Amber) plus Toggle dark mode.
- Add a palette-icon ThemeQuickSwitcher to the desktop sidebar header and
mobile top-bar that opens a compact ThemePicker popover. Listens for the
cross-component 'open-theme-popover' window event so other surfaces can
trigger it without prop drilling.
- Add a one-time first-run AlertBanner to the dashboard for users still on
the neon-cyan default. Persists dismissal via
teslasync:themeFirstRunDismissed:v1 (versioned key).
- Refactor lib/colors.ts to expose buildChartPalette(theme, mode) +
useChartPalette() that derives the chart series colours from the active
theme's primary and accent via deterministic HSL hue interpolation.
Semantic colours (positive/negative/warning/neutral) intentionally stay
fixed so good = green even in tesla-red. Migrate five dashboard widgets
(DriveTelemetry, DrivingDynamics, DriveEfficiencyChart, CostBreakdown,
BatteryDegradationTrend); legacy CHART_COLORS export retained for
backward compatibility.
- Add [data-role=\ heme-popover\] to the print-CSS hide list so the
popover doesn't print.
- New i18n keys: theme.openPicker, theme.switchTo/switchedTo,
theme.toggleMode, theme.firstRun{Title,Body,Open,Later},
theme.customize plus matching palette.cmd.theme* labels.
EXIT=0 STATUS=DONE β gate log committed.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move <DataFreshness> from features/dashboard/components/ to
components/data-display/ so non-dashboard pages can adopt it without
deep relative imports. Also add:
- <DataFreshnessAuto query=\{q\}> wrapper that takes a TanStack Query
result directly, collapsing the four-prop boilerplate into one line.
- FRESHNESS_COLORS named export (dot+text tier per status) for other
surfaces to share the same palette.
- forceStaleAfterMs override on <DataFreshnessAuto> so cagg-driven
pages can flag stale aggregates as amber even when the client cache
is technically fresh.
- Days/weeks fall-through in the local relative-time formatter for
caggs that refresh once a day; TODO to swap for the shared
formatRelativeTime once Prompt 08 grows i18n plural support.
- Convenience \query\ prop on WidgetShell that auto-renders
<DataFreshnessAuto> in the header for new widgets.
Backfill non-dashboard surfaces with the indicator in their PageContainer
actions slot:
- LifetimeStatsPage (cagg, forceStaleAfterMs=6h)
- TrueCostPage (cagg, forceStaleAfterMs=6h)
- BatteryDegradationPage (cagg, forceStaleAfterMs=24h)
- VampireDrainPage
- SleepEfficiencyPage
- MileagePage
- StatisticsPage
Tests: 19 new unit tests covering color tiers, status mapping, refetch
clicks, forceStaleAfterMs, and edge cases (dataUpdatedAt=0, refetchable
disabled, error state).
Gate: TypeScript clean, lint clean, 910 frontend tests pass, 0 audit
violations.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds a getting-started checklist widget that auto-completes setup steps
as the user does them: connect Tesla, pick a theme, create an alert
rule, configure a notification channel, discover the command palette,
and enable web push.
- web/src/features/onboarding/checklist.ts:
useChecklistTasks hook + dismiss/restart/discover localStorage helpers
- web/src/features/dashboard/widgets/OnboardingChecklistWidget.tsx:
progress bar + per-task rows + dismiss action + 24h celebration state
- registry/system.ts: registers 'onboarding-checklist' widget
- useDashboardLayout.ts: prepends widget to DEFAULT_DASHBOARD seed
- CommandPalette.tsx: marks 'cp-discovered' on first open
- SettingsPage.tsx: anchor IDs (#tesla-account, #appearance,
#notifications) + hash-scroll effect + 'Restart Checklist' panel
- i18n/en.json: checklist.* keys
Verification (see log):
TSC_EXIT=0, LINT_EXIT=0, FRONTEND_TEST_EXIT=0 (944 tests, 81 files)
AUDIT_TOTAL_VIOLATIONS=0, UNEXPECTED_STATUS_COUNT=0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Introduce a persistent "Skip for now" onboarding flag and UI. Add useOnboardingSkip hook (with sync helper and tests) that persists the flag to localStorage and broadcasts changes across tabs; update OnboardingGate to honour the skip flag; add a Skip button to OnboardingPage that uses the hook and navigates away. Add corresponding i18n strings and a new broadcast message type. Also update Dockerfiles to COPY CHANGELOG.md (and .dockerignore to allow it) so prebuild scripts can read it during image builds.
Portals: render Modal and the ThemeQuickSwitcher popover into document.body to avoid stacking/containing-block issues from backdrop-filter/stacking contexts. ThemeQuickSwitcher now supports left/right placement, computes fixed coordinates from the trigger, and prevents outside-clicks when the popover is portaled. Layout: rename several nav section titles/keys and simplify the sidebar bottom area (removed duplicate update/live/connection panels that are now surfaced in the footer StatusBar); minor layout and truncation tweaks. ActiveVehicleSegment: show live vehicle metrics (battery % and range) using useVehicleState with a 60s refetch and useSettings for distance conversion. CommandPalette: remove its internal Ctrl+K handler to avoid double-toggles; it now responds to a custom 'toggle-command-palette' event and CommandPaletteTrigger dispatches that event. Tests updated to mount the keyboard-shortcut host, open the palette via the custom event, and query modal backdrop on document.body.
Introduce a VehiclePaintPicker component, vehicle color palette (vehicleColors), and useVehiclePaint hook with tests to support per-vehicle paint persistence and cross-tab broadcasting. Revamp VehicleTwin to support paint palettes, per-instance SVG <defs> ids (avoid collisions), a TwinContext for paint-derived accents, and allow vehicleId/exteriorColor/paint overrides. Improve Modal stacking/overlay behavior and layout to avoid clipping. On the backend, add aliasPositionFields to map raw timeline fields (ts, speed_mph) to the legacy frontend Position contract (created_at, speed) and add tests to lock in this behavior. Misc: update related imports, tests, i18n strings, and small refactors to wire the new paint system.
Add in-tab pub/sub so multiple useVehiclePaint hook instances in the same tab stay synchronized without a refresh (subscribeInTab/notifyInTab) and wire notifications when an override is written. Update useVehiclePaint tests to cover same-tab syncing and per-vehicle scoping. Refactor VehicleTwin visuals: simplify seams/highlights, adjust stroke widths/opacities and colors, add explanatory comments, and remove redundant/overly-strong paths to make the body read as a single panel and soften reflections. Files changed: web/src/hooks/useVehiclePaint.ts, web/src/hooks/__tests__/useVehiclePaint.test.tsx, web/src/components/vehicles/VehicleTwin.tsx.
Simplify and tone down the VehicleTwin SVG styling for a cleaner, subtler appearance. Wheel artwork was simplified (single tire layer, reduced shadow, simplified rim/spoke shapes, smaller lugs/hub) and some decorative highlights removed to reduce visual clutter and rendering cost. Body surface opacities and rocker/door seam contrasts were lowered and a rear taillight diffuser accent was removed to make panels read as unified surfaces. Wheel-arch stroke widths were reduced and given opacity, and several window stroke colors/widths were softened for consistency. Overall changes focus on visual clarity and lighter-weight SVG output.
Delete archived prompt markdowns and their log files under .github/prompts/db-refactor (notably phase-37, phase-39 and related phase-40 entries). Cleans up obsolete/db-refactor artifacts to reduce repository clutter.
atulmgupta
added a commit
that referenced
this pull request
May 3, 2026
The prompt locks the new vehicle_unit_history migration to the
literal path migrations/000160_vehicle_unit_history.{up,down}.sql,
but slot 000160 is already occupied by 000160_settings_ui_density
from phase-40/44 (commit d7aa0ed, merged via PR #59 / acbb9e1).
Authored migration files, internal/tesla/unit_history/{types,cache,
repo,cache_test,repo_test}.go, and ran the prompt's exact gate
verbatim. Gate detected the collision at the explicit migration-
collision check step and reported EXIT=1 / STATUS=BLOCKED, which is
the prompt's intended diagnostic for this state.
Per covenant rule 8 (no commit on red β commit only the log when
BLOCKED), only the artifact log is committed. The package source
and migration files remain on the working tree as untracked so a
fixer pass (which can amend the prompt's allowed-files line + gate
hardcoded path from 000160 to a free slot, e.g. 000168) can rename
the migration and re-run the gate without re-authoring the package.
Honesty covenant: rule 1 (EXIT != 0 -> BLOCKED) and rule 2 (run the
exact gate command) both observed. The =/= GATE =/= block in the
log was generated by the prompt's literal gate script; tests
themselves pass cleanly (go test -race ./internal/tesla/unit_history
-> exit 0; PG-touching tests skipped via DATABASE_URL fallback).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
atulmgupta
added a commit
that referenced
this pull request
May 3, 2026
β¦60 persists Re-ran the prompt's gate verbatim on top of the previous BLOCKED commit a1762b8. Same root cause: the prompt locks the new vehicle_unit_history migration to migrations/000160_vehicle_unit_history.{up,down}.sql, but slot 000160 is occupied by 000160_settings_ui_density.{up,down}.sql from phase-40/44 (commit d7aa0ed, merged via PR #59 / acbb9e1). Gate detected the collision at the explicit migration-collision check step and reported EXIT=1 / STATUS=BLOCKED β the prompt's intended diagnostic for this state. Per covenant rule 8 (no commit on red β commit only the log when BLOCKED), only the artifact log is committed. The package source (internal/tesla/unit_history/{types,repo,cache,repo_test,cache_test}.go) and the migration files (migrations/000160_vehicle_unit_history.{up, down}.sql) are left untracked so a fixer pass can amend the prompt's allowed-files line + the gate's hardcoded path from 000160 to a free slot (000168 is next free) and re-run without re-authoring the package. Honesty covenant: rule 1 (EXIT != 0 -> BLOCKED) and rule 2 (run the exact gate command) both observed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #
Type of Change
Checklist
Screenshots (if applicable)