fix: add headroom to dashboard bar scales

This commit is contained in:
inman committed 2026-09-02 11:28:47 +08:00
1 parent ed456e6a5d
commit 63b387f679
5 files changed
+96 -10

No files matched your search

@@ -0,0 +1,55 @@
# Task: Add dynamic nice scale to dashboard bars
## Identity
- Task ID: 20260902-dashboard-nice-scale-d8c31a
- Mode: Feature
- Branch: codex/20260902-dashboard-nice-scale-d8c31a-dashboard-nice-scale-d8c31a
- Worktree: /Users/inmanx/Documents/lwltAPI-dashboard-nice-scale-d8c31a
- Base commit: e530b7a3489c8f2be2f15f69de2149658aaa8ca3
- Owner: codex
- Status: Ready for integration
## Scope
- Replace max-item normalization in both dashboard rankings with an independent dynamic “nice” scale that leaves visible headroom above the leading bar.
- Keep row-as-bar presentation, descending operation-count order, exact operation/success labels, fixed layout, scrolling, and drill-through behavior unchanged.
- Update static asset cache versions and focused dashboard regression coverage.
## Intent And Constraints
- Choose readable count intervals from `1 / 2 / 5 / 10` steps over roughly five intervals, round the observed maximum upward, and advance one further interval when the maximum already lands exactly on a scale boundary.
- Expected reference cases include `43 → 50`, `359 → 400`, and exact-boundary `100 → 120`; empty data remains safe.
- Compute task-type and employee scales independently. Operation count alone controls bar length; success count remains text and no completion rate or percentage is introduced.
- Preserve leadership-only access, business-safe language, employee/task-type drill-through, and all task/ERP authorization boundaries.
- Do not change the dashboard API, restart or deploy services, mutate runtime data, access ERP, or introduce an organization concept.
## Outcome
- Added a reusable dynamic ranking scale that divides the observed maximum into roughly five readable intervals using `1 / 2 / 5 / 10` steps.
- The scale rounds upward and advances one additional interval when the maximum already lands exactly on a boundary, so the leading bar always keeps visible headroom.
- Reference values now resolve as `43 → 50`, `359 → 400`, `100 → 120`, `1 → 2`, and empty data → `1`.
- Task-type and employee rankings compute their scales independently. Existing descending operation-count order, row-as-bar rendering, exact operation/success counts, fixed panel layout, scrolling, and drill-through remain unchanged.
- Updated the static asset cache version and added executable regression assertions for the dynamic-scale reference cases.
- No API, authorization, runtime data, ERP, deployment, or service-restart behavior changed.
## Verification
- `node --check LianSyn-platform/app.js`: passed.
- Focused account/dashboard regression: 8/8 passed, including dynamic-scale cases `0 → 1`, `1 → 2`, `43 → 50`, `100 → 120`, and `359 → 400`.
- `node --run check:repo`: 10/10 passed.
- `node --run check`: passed.
- `node --run test:control-plane`: 153/153 passed.
- `node --run test:legacy`: 256/256 passed.
- `node --run build`: passed.
- `git diff --check`: passed.
- Isolated browser preview at `http://127.0.0.1:8892/operations-dashboard?nice-scale=1` used a non-persistent mock dashboard response and the actual feature source/CSS. It rendered task-type widths `86% / 54% / 52% / 48% / 48%` for totals `43 / 27 / 26 / 24 / 24`, and employee width `89.75%` for total `359`.
- Visual inspection confirmed both leading bars retain right-side headroom. DOM and interaction verification confirmed descending order, exact operation/success text, and task-type click-through selecting `order_delete`; no completion-rate or percentage label was shown.
## Follow-ups
- Integrate the isolated commit only after the active main-branch password-flow integration releases its ownership gate, then reload the standard 8786 dashboard for a final runtime check.
## Promotion Candidates
- None. This is a focused visual-scale correction within the accepted count-based ranking behavior and does not change product, authorization, API, or data semantics.