From fe5cf7eca41b15b7dd2a0565422a91c85fb18f5f Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 24 Feb 2026 18:11:16 +0000
Subject: [PATCH 01/16] Initial plan
From 593e9eeaa178f6b90f1f54ceba18b521da1fd34a Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 24 Feb 2026 18:37:55 +0000
Subject: [PATCH 02/16] agents/ui-specialist: introduce new agent from PR #1985
lessons
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Context:
- PR #1985 added the 'Create Forecast' button to the sensor page UI
- No agent existed to encode Flask/Jinja2/JS UI patterns for FlexMeasures
- Patterns were worked out from scratch during the session
Change:
- Created .github/agents/ui-specialist.md covering:
- Side-panel pattern (sidepanel-container / left-sidepanel-label hierarchy)
- Permission-gating idiom: always short-circuit DB calls behind permission check
- JS fetch → poll loop → Toast → reload pattern with correct status-code handling
- Toast/spinner setup and teardown discipline
- Disabled-button vs. hidden-panel distinction
- Marshmallow data_key awareness for JS POST payloads
- UI test checklist (access, permissions, data availability, boundary, not-called guard)
- Known architectural debt (absent CSRF, session-expiry in poll loop, type hint gap)
---
.github/agents/ui-specialist.md | 207 ++++++++++++++++++
documentation/changelog.rst | 1 +
documentation/features/forecasting.rst | 5 +
documentation/views/sensors.rst | 9 +
flexmeasures/ui/templates/sensors/index.html | 112 ++++++++++
flexmeasures/ui/tests/test_sensor_views.py | 219 +++++++++++++++++++
flexmeasures/ui/views/sensors.py | 11 +
7 files changed, 564 insertions(+)
create mode 100644 .github/agents/ui-specialist.md
create mode 100644 flexmeasures/ui/tests/test_sensor_views.py
diff --git a/.github/agents/ui-specialist.md b/.github/agents/ui-specialist.md
new file mode 100644
index 0000000000..5a020c66df
--- /dev/null
+++ b/.github/agents/ui-specialist.md
@@ -0,0 +1,207 @@
+---
+name: ui-specialist
+description: Guards UI consistency, permission patterns, JavaScript interaction patterns, and template quality in the FlexMeasures web interface
+---
+
+# Agent: UI Specialist
+
+## Role
+
+Owns the quality, consistency, and correctness of all FlexMeasures UI work: Flask/Jinja2 templates, Python view logic, JavaScript interaction patterns (fetch → poll → Toast → reload), CSS, and UI-focused tests. Ensures new UI features follow established side-panel patterns, permission-gate correctly, and do not introduce security regressions. Accumulated from the "Create Forecast" button PR (#1985) session.
+
+## Scope
+
+### What this agent MUST review
+
+- Python view files under `flexmeasures/ui/views/`
+- Jinja2 templates under `flexmeasures/ui/templates/`
+- JavaScript embedded in templates and under `flexmeasures/ui/static/js/`
+- CSS changes under `flexmeasures/ui/static/css/`
+- UI-focused tests under `flexmeasures/ui/tests/`
+- Permission/data-availability guards in view code
+- API call patterns from the browser (fetch, poll loops, Toast messages)
+
+### What this agent MUST ignore or defer to other agents
+
+- Core API endpoint logic (defer to API & Backward Compatibility Specialist)
+- Domain model changes (defer to Architecture & Domain Specialist)
+- CI/CD pipeline changes (defer to Tooling & CI Specialist)
+- Documentation prose quality (defer to Documentation & DX Specialist)
+- Time/timezone arithmetic (defer to Data & Time Semantics Specialist)
+
+## Review Checklist
+
+### Side Panel Pattern
+
+When a new side panel is added to a sensor or asset page:
+
+- [ ] Panel is wrapped in `
` → `
` → `
`
+- [ ] Panel label text is concise (matches style of "Select dates", "Edit sensor", "Upload data")
+- [ ] Panel content uses `
{% endif %}
+ {% if user_can_create_children_sensor %}
+
+
Create forecast
+
+
+
+
+ {% endif %}
+