Skip to content

fix: multi-bug sprint across settings, insights, energy, jobs, diagnostics#65

Merged
dimakis merged 10 commits intomainfrom
fix/multi-bug-sprint
Mar 12, 2026
Merged

fix: multi-bug sprint across settings, insights, energy, jobs, diagnostics#65
dimakis merged 10 commits intomainfrom
fix/multi-bug-sprint

Conversation

@dimakis
Copy link
Owner

@dimakis dimakis commented Mar 12, 2026

Summary

  • InsightType enum mismatch: Replace _enum_column(String(255)) with postgresql.ENUM(..., create_type=False) for type, status, and impact columns on the insights table, fixing the DatatypeMismatchError that broke optimisations/analysis
  • Energy page: Add server-side tariff period fallback using TARIFF_SCHEDULE + local time; fall back to period-specific rate when current_rate is 0; filter out aggregate/accumulative sensors from ConsumptionSummary
  • Diagnostics: Align error log summary shape (errors/warnings fields); map known_patterns to frontend-expected fields; enrich traces with run_name, job_type, title
  • Jobs: Persist descriptive titles as MLflow tag ha.job_title; prefer tag in _map_trace_to_job; fix filter-before-sort by overfetching when job_type is specified
  • Activity panel: Add onClick navigation to /jobs on job list rows
  • Settings: Sync AppSettingsResponse to include notifications; use setQueryData for immediate cache update on mutation; add inline error display

Test plan

  • 93 relevant unit tests pass (test_tariff_tools, test_log_parser, test_error_patterns, test_dal_insights, test_api_settings, test_api_jobs, test_diagnostics_api, test_insight_model, test_dal_app_settings)
  • ruff format, ruff check, mypy, bandit all clean
  • Manual: verify settings save persists across page reload
  • Manual: run an optimisation and confirm insights are created without enum error
  • Manual: check energy page shows correct period/rate at night
  • Manual: click a job in the activity panel and verify navigation to /jobs
  • Manual: check diagnostics error log shows actual error/warning counts

Made with Cursor

…stics

- Fix InsightType enum mismatch: replace _enum_column(String) with
  postgresql.ENUM(create_type=False) so SQLAlchemy emits correct type
  casts for insighttype/insightstatus/insightimpact columns
- Energy tariff: add server-side period fallback using TARIFF_SCHEDULE
  when HA entity is missing; fall back to period rate when current is 0
- Energy sensors: filter out aggregate/accumulative sensors in
  ConsumptionSummary (by entity_id pattern and source attribute)
- Diagnostics error log: align summary shape (add errors/warnings from
  counts_by_level); map known_patterns to frontend-expected fields
- Diagnostics traces: enrich response with run_name, job_type, title
- Jobs: persist descriptive titles as MLflow tag ha.job_title; prefer
  tag over formatted run_name; fix filter-before-sort with overfetch
- Activity panel: add onClick navigation to /jobs on job rows
- Settings: sync AppSettingsResponse type; use setQueryData for
  immediate cache update; add inline error display for mutations

Made-with: Cursor
Defines the guided automation builder agent feature that wires
Feature 36's existing automation builder workflow into the system
as a dedicated agent with chat preset, orchestrator routing, and
step-by-step progress in the activity panel.

Made-with: Cursor
dimakis added 7 commits March 12, 2026 04:53
Cover connection/auth, subscribe, event dispatch, exponential
backoff reconnection (doubling, ceiling), backoff reset on
successful connect, start_task lifecycle, stop/cancel, and
non-event message filtering.

Made-with: Cursor
Cover event queuing, per-entity debounce, batch upsert data
shape, DB error recovery (restore pending), automation state
triggering proposal sync, stats tracking, and flush-on-stop.

Made-with: Cursor
Cover threshold filtering (all impact levels), quiet hours
(same-day, midnight-crossing), batch vs single notification,
disabled state, from_settings factory with DB and fallback,
send failure graceful return, and _parse_time helper.

Made-with: Cursor
Add NotificationForm with enabled toggle, min_impact dropdown,
quiet hours start/end time inputs. Widen SettingsValue type to
include string for notification preferences. Grid expanded to
4 columns to accommodate new tab.

Made-with: Cursor
Add optimization.jobHistory() client function with status/limit
params, useJobHistory() React Query hook, and optimization.history
query key for F38 job history UI.

Made-with: Cursor
Add expandable Job History section with status filter dropdown
and clickable rows showing status badge, truncated job ID, date,
and insight/suggestion counts. Selecting a row loads it as the
active job in the existing detail card.

Made-with: Cursor
Apply contextlib.suppress, sort imports, add type annotations
for context manager functions, and use cast for SimpleNamespace
duck-typed Insight objects.

Made-with: Cursor
The Insight entity declares insighttype, insightimpact, and
insightstatus with create_type=False (managed by Alembic).
Integration tests use Base.metadata.create_all which skips
enum creation, causing "type does not exist" errors. Create
the enum types explicitly before table creation.

Made-with: Cursor
@dimakis dimakis merged commit b15d966 into main Mar 12, 2026
14 checks passed
@dimakis dimakis deleted the fix/multi-bug-sprint branch March 12, 2026 10:44
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.

1 participant