Skip to content

Commit b8a8e82

Browse files
authored
Merge pull request #109 from SoundBlaster/feature/BUG-T18-error-breakdown-full-width
BUG-T18: Error Breakdown full width layout fix
2 parents 8ae13b4 + e27452e commit b8a8e82

8 files changed

Lines changed: 159 additions & 10 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# PRD: BUG-T18 — Error Breakdown full-width layout fix
2+
3+
## Objective
4+
Implement the Web UI layout change so the "Error Breakdown" widget is rendered as a full-width chart card in the dashboard, not as a half-width card inside the two-column chart grid. The fix must preserve existing responsive behavior across desktop, tablet, and mobile breakpoints and avoid regressions in dashboard rendering.
5+
6+
Scope is limited to frontend dashboard assets and associated regression tests:
7+
- `src/mcpbridge_wrapper/webui/static/index.html`
8+
- `src/mcpbridge_wrapper/webui/static/dashboard.css`
9+
- Relevant web UI unit tests that validate served dashboard markup/contracts.
10+
11+
Out of scope:
12+
- Backend metrics aggregation logic
13+
- Chart data semantics
14+
- Non-layout redesign of dashboard widgets
15+
16+
## Success Criteria
17+
- Error Breakdown card spans the full row width in the charts layout at non-mobile breakpoints.
18+
- Existing Tool Usage (Bar) and Tool Distribution (Pie) widgets remain correctly rendered.
19+
- Mobile layout (`<=768px`) remains single-column and unaffected.
20+
- Regression test coverage exists for the full-width Error Breakdown layout contract.
21+
- All quality gates pass with coverage remaining >= 90%.
22+
23+
## Acceptance Tests
24+
1. Inspect served dashboard HTML and verify Error Breakdown container uses the full-width layout class.
25+
2. Verify CSS rules still allow full-width containers via `grid-column: 1 / -1`.
26+
3. Manual smoke check at representative widths: `1450px`, `1200px`, `1024px`, `768px`, and narrow mobile.
27+
4. Run quality gates:
28+
- `pytest`
29+
- `ruff check src/`
30+
- `mypy src/`
31+
- `pytest --cov`
32+
33+
## Test-First Plan
34+
1. Add or extend a server/web UI unit test that asserts the served dashboard markup encodes a full-width Error Breakdown container.
35+
2. Run targeted test module to validate the new assertion fails before layout update (or verify current state is missing the contract).
36+
3. Apply minimal markup/CSS updates to satisfy the failing test.
37+
4. Re-run targeted tests, then full quality gates.
38+
39+
## Execution Plan
40+
### Phase 1: Baseline and Contract Definition
41+
- Inputs: current dashboard HTML/CSS and web UI tests.
42+
- Outputs: explicit layout contract for Error Breakdown full-width behavior.
43+
- Verification: targeted test captures required class/layout structure.
44+
45+
### Phase 2: Layout Implementation
46+
- Inputs: chart row markup and existing `.chart-container.wide` CSS behavior.
47+
- Outputs: Error Breakdown widget updated to opt into full-width spanning without changing data bindings.
48+
- Verification: served HTML and manual viewport checks confirm full-width rendering.
49+
50+
### Phase 3: Regression and Validation
51+
- Inputs: updated tests and quality gate commands.
52+
- Outputs: passing tests, lint/type checks, and coverage report; validation report artifact.
53+
- Verification: command outputs recorded with PASS verdict and coverage >= 90%.
54+
55+
## Constraints and Decisions
56+
- Reuse existing `wide` layout contract instead of introducing a new custom layout system.
57+
- Keep changes minimal and local to avoid unintended visual regressions.
58+
- Preserve existing chart IDs and JS hooks to avoid runtime chart initialization breakage.
59+
60+
## Notes
61+
- Update `SPECS/Workplan.md` status fields for BUG-T18 during ARCHIVE.
62+
- If additional chart-grid responsiveness issues are discovered, track them as separate follow-up tasks rather than extending BUG-T18 scope.
63+
64+
---
65+
**Archived:** 2026-02-26
66+
**Verdict:** PASS
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Validation Report: BUG-T18
2+
3+
## Task
4+
Error Breakdown widget must be full width streatched.
5+
6+
## Implementation Summary
7+
- Updated dashboard markup so the Error Breakdown container now uses the existing full-width grid contract (`chart-container wide`) with a stable container ID.
8+
- Added a regression test in `tests/unit/webui/test_server.py` to enforce that the served dashboard HTML keeps Error Breakdown as a full-width chart container.
9+
- Preserved existing chart IDs and JS hooks (`chart-error-breakdown`) to avoid runtime behavior changes.
10+
11+
## Quality Gates
12+
13+
### 1) `PYTHONPATH=src pytest`
14+
- Result: PASS
15+
- Evidence: `652 passed, 5 skipped`
16+
17+
### 2) `ruff check src/`
18+
- Result: PASS
19+
- Evidence: `All checks passed!`
20+
21+
### 3) `mypy src/`
22+
- Result: PASS
23+
- Evidence: `Success: no issues found in 18 source files`
24+
25+
### 4) `PYTHONPATH=src pytest --cov`
26+
- Result: PASS
27+
- Evidence:
28+
- `652 passed, 5 skipped`
29+
- `Required test coverage of 90.0% reached`
30+
- `Total coverage: 91.33%`
31+
32+
## Validation Notes
33+
- Test-first flow was followed:
34+
- Added regression test for full-width Error Breakdown container.
35+
- Confirmed it failed before markup change.
36+
- Applied layout fix and confirmed the test passed.
37+
- Full-width behavior is implemented via existing `.chart-container.wide { grid-column: 1 / -1; }` layout rule, preserving responsive behavior conventions already used by timeline/latency charts.
38+
39+
## Verdict
40+
PASS

SPECS/ARCHIVE/INDEX.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# mcpbridge-wrapper Tasks Archive
22

3-
**Last Updated:** 2026-02-25 (BUG-T20_Session_Timeline_can_show_negative_duration_due_to_incorrect_entry_ordering)
3+
**Last Updated:** 2026-02-26 (BUG-T18_Error_Breakdown_full_width_layout_fix)
44

55
## Archived Tasks
66

77
| Task ID | Folder | Archived | Verdict |
88
|---------|--------|----------|---------|
9+
| BUG-T18 | [BUG-T18_Error_Breakdown_full_width_layout_fix/](BUG-T18_Error_Breakdown_full_width_layout_fix/) | 2026-02-26 | PASS |
910
| BUG-T20 | [BUG-T20_Session_Timeline_can_show_negative_duration_due_to_incorrect_entry_ordering/](BUG-T20_Session_Timeline_can_show_negative_duration_due_to_incorrect_entry_ordering/) | 2026-02-25 | PASS |
1011
| BUG-T19 | [BUG-T19_Audit_Log_and_Session_Timeline_are_inconsistent_with_tool_charts_in_multi_process_runs/](BUG-T19_Audit_Log_and_Session_Timeline_are_inconsistent_with_tool_charts_in_multi_process_runs/) | 2026-02-25 | PASS |
1112
| BUG-T13 | [BUG-T13_Per-Tool_Latency_Statistics_does_not_show_params_when_capture_params_is_false/](BUG-T13_Per-Tool_Latency_Statistics_does_not_show_params_when_capture_params_is_false/) | 2026-02-25 | PASS |
@@ -251,6 +252,7 @@
251252
| [REVIEW_bug_t15_webui_port_config.md](_Historical/REVIEW_bug_t15_webui_port_config.md) | Review report for BUG-T15 |
252253
| [REVIEW_bug_t16_pie_responsive.md](_Historical/REVIEW_bug_t16_pie_responsive.md) | Review report for BUG-T16 |
253254
| [REVIEW_bug_t18_workplan_entry.md](_Historical/REVIEW_bug_t18_workplan_entry.md) | Review report for BUG-T18 |
255+
| [REVIEW_bug_t18_error_breakdown_layout.md](_Historical/REVIEW_bug_t18_error_breakdown_layout.md) | Review report for BUG-T18 full-width layout fix |
254256
| [REVIEW_bug_t17_audit_log_rows_stay_unfolded.md](_Historical/REVIEW_bug_t17_audit_log_rows_stay_unfolded.md) | Review report for BUG-T17 |
255257
| [REVIEW_bug_t14_latency_rows.md](_Historical/REVIEW_bug_t14_latency_rows.md) | Review report for BUG-T14 |
256258
| [REVIEW_bug_t20_session_timeline_ordering.md](_Historical/REVIEW_bug_t20_session_timeline_ordering.md) | Review report for BUG-T20 |
@@ -265,6 +267,8 @@
265267

266268
| Date | Task ID | Action |
267269
|------|---------|--------|
270+
| 2026-02-26 | BUG-T18 | Archived REVIEW_bug_t18_error_breakdown_layout report |
271+
| 2026-02-26 | BUG-T18 | Archived Error_Breakdown_full_width_layout_fix (PASS) |
268272
| 2026-02-25 | BUG-T20 | Archived REVIEW_bug_t20_session_timeline_ordering report |
269273
| 2026-02-25 | BUG-T20 | Archived Session_Timeline_can_show_negative_duration_due_to_incorrect_entry_ordering (PASS) |
270274
| 2026-02-25 | BUG-T19 | Archived REVIEW_bug_t19_audit_session_consistency report |
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## REVIEW REPORT — BUG-T18 Error Breakdown Layout
2+
3+
**Scope:** origin/main..HEAD
4+
**Files:** 7
5+
6+
### Summary Verdict
7+
- [x] Approve
8+
- [ ] Approve with comments
9+
- [ ] Request changes
10+
- [ ] Block
11+
12+
### Critical Issues
13+
- None.
14+
15+
### Secondary Issues
16+
- None.
17+
18+
### Architectural Notes
19+
- The implementation reuses the existing `.chart-container.wide` grid contract, which is already the dashboard’s established mechanism for full-width chart cards.
20+
- A dedicated regression assertion on served dashboard markup keeps this layout requirement explicit and low-maintenance.
21+
22+
### Tests
23+
- `PYTHONPATH=src pytest` — PASS (`652 passed, 5 skipped`)
24+
- `ruff check src/` — PASS
25+
- `mypy src/` — PASS
26+
- `PYTHONPATH=src pytest --cov` — PASS (`91.33%`, requirement `>=90%`)
27+
28+
### Next Steps
29+
- FOLLOW-UP is skipped because no actionable review findings were identified.

SPECS/INPROGRESS/next.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
## Recently Archived
44

5+
- **BUG-T18** — Error Breakdown widget must be full width streatched (2026-02-26, PASS)
56
- **BUG-T20** — Session Timeline can show negative duration due to incorrect entry ordering (2026-02-25, PASS)
67
- **BUG-T19** — Audit Log and Session Timeline are inconsistent with tool charts in multi-process runs (2026-02-25, PASS)
7-
- **BUG-T13** — Per-Tool Latency Statistics does not show params when `capture_params` is false (2026-02-25, PASS)
88

99
## Suggested Next Tasks
1010

11-
- BUG-T18 — Error Breakdown widget must be full width streatched
1211
- BUG-T4 — Repeated Xcode permission prompts for each short-lived MCP client process
1312
- BUG-T1 — Kimi CLI MCP Connection Failure

SPECS/Workplan.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,11 +1598,12 @@ Temporarily increase dashboard refresh interval via config to reduce frequency o
15981598

15991599
---
16001600

1601-
### BUG-T18: Error Breakdown widget must be full width streatched
1601+
### BUG-T18: Error Breakdown widget must be full width streatched
16021602
- **Type:** Bug / Web UI / Layout
1603-
- **Status:** 🔴 Open
1603+
- **Status:** ✅ Fixed (2026-02-26)
16041604
- **Priority:** P2
16051605
- **Discovered:** 2026-02-20
1606+
- **Completed:** 2026-02-26
16061607
- **Component:** Web UI Dashboard (`webui/static/index.html`, `webui/static/dashboard.css`)
16071608
- **Affected Clients:** All clients using Web UI dashboard
16081609
- **Affected Surface:** Error Breakdown widget
@@ -1623,10 +1624,10 @@ Likely the widget container is using the default chart card class and is not mar
16231624
None.
16241625

16251626
#### Resolution Path
1626-
- [ ] Reproduce on current dashboard layout and confirm non-full-width rendering
1627-
- [ ] Update chart container/layout rules so Error Breakdown spans full width
1628-
- [ ] Validate responsive behavior at desktop/tablet/mobile breakpoints
1629-
- [ ] Add regression coverage for full-width Error Breakdown layout
1627+
- [x] Reproduce on current dashboard layout and confirm non-full-width rendering
1628+
- [x] Update chart container/layout rules so Error Breakdown spans full width
1629+
- [x] Validate responsive behavior at desktop/tablet/mobile breakpoints
1630+
- [x] Add regression coverage for full-width Error Breakdown layout
16301631

16311632
#### Related Items
16321633
- **P10-T1** ✅ — Web UI dashboard chart layout baseline

src/mcpbridge_wrapper/webui/static/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ <h3>Tool Usage (Bar)</h3>
6565
<h3>Tool Distribution (Pie)</h3>
6666
<canvas id="chart-tool-pie"></canvas>
6767
</div>
68-
<div class="chart-container">
68+
<div class="chart-container wide" id="chart-error-breakdown-container">
6969
<h3>Error Breakdown</h3>
7070
<canvas id="chart-error-breakdown"></canvas>
7171
<div id="error-breakdown-empty" class="chart-empty-msg">No errors recorded</div>

tests/unit/webui/test_server.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,16 @@ def test_dashboard_served(self, client):
263263
assert "/static/dashboard.css" in response.text
264264
assert "/static/dashboard.js" in response.text
265265

266+
def test_dashboard_error_breakdown_widget_is_full_width(self, client):
267+
"""Error Breakdown chart container spans full width in charts layout."""
268+
response = client.get("/")
269+
assert response.status_code == 200
270+
assert (
271+
'<div class="chart-container wide" id="chart-error-breakdown-container">'
272+
in response.text
273+
)
274+
assert '<canvas id="chart-error-breakdown"></canvas>' in response.text
275+
266276
def test_dashboard_js_uses_uniform_client_widget_escaping(self, client):
267277
"""Client widget interpolations in dashboard.js use escapeHtml uniformly."""
268278
response = client.get("/static/dashboard.js")

0 commit comments

Comments
 (0)