fix: classify historical dashboard task types

This commit is contained in:
inman committed 2026-09-01 20:15:55 +08:00
1 parent 2bb5827867
commit 0d63201b29
3 files changed
+281 -227

No files matched your search

@@ -0,0 +1,59 @@
# Task: Classify historical dashboard task types
## Identity
- Task ID: 20260901-dashboard-historical-types-a7d3e4
- Mode: Feature
- Branch: main
- Worktree: /Users/inmanx/Documents/lwltAPI
- Base commit: 2bb58278674e628c3dbdcaaa8365237a7bb64ae6
- Owner: codex
- Status: Ready for integration
## Scope
- Correct the leadership dashboard's historical task-type dimension without rewriting historical task records.
- Derive a stable, business-readable type from the registered route, original instruction, or stored business action.
- Make every derived type available to the same clickable type filter used by the dashboard.
- Preserve the dashboard's full-range aggregates and improve the default read path after historical classification was added.
## Intent And Constraints
- “Other tasks” must be a genuine residual category, not the default for older records that predate persisted route IDs.
- Dashboard labels must describe business work and must not expose action names, codes, payload structure, or implementation details.
- Historical records, original inputs, outcomes, authorization grants, and ERP state must remain unchanged; classification is read-only at presentation time.
- A type shown in the breakdown must remain touchable: selecting it must narrow the same task/person/input/output view.
- Whole-dashboard aggregates must not be truncated by the 2,000-item keyword-search safety bound. That bound applies only when a keyword requires decrypting and searching all candidate content.
## Outcome
- Added deterministic historical classification in this order: persisted registered type, exact original directive, stored business action, then a small set of business-readable dashboard fallback types.
- Added leadership-safe fallback types for historical order deletion, hotel arrangements, roster imports, and order updates. Their internal stored action names are never returned as visible labels.
- Added fallback types to the dashboard's type selector and API validation, so breakdown rows for those categories drill through to the matching task list.
- Reduced the current 30-day standard-database residual “其他任务” bucket from 306 of 359 tasks to 2 of 359 tasks without updating any task rows.
- Preserved all 359 tasks in the full-range summary. The overall dashboard no longer inherits the 2,000-item keyword-search bound; only keyword searches retain that guard.
- Split the read path into a lightweight full-range aggregate projection and a detailed page projection. Original encrypted input is loaded for the visible page and only for historical rows that require it to disambiguate type.
- Added the organization predicate required by the existing input-history index to both leadership input-count queries.
- Reduced the measured 359-task dashboard service read from about 21.2 seconds to about 5.5 seconds on the current standard database while retaining 50 detailed task rows.
- No task data, database schema, authorization, ERP state, runtime process, or external system was changed.
## Verification
- Real standard-database read-only smoke: 359 total tasks; “其他任务” 2; “删除订单” 43; 50 detailed page rows.
- Real standard-database touch-filter smoke and API option inspection confirmed the four historical fallback types are valid selector options and use the same type filter path.
- TypeScript check: passed.
- Focused account/leadership regression: 8/8 passed.
- `node --run check:repo`: 10/10 passed.
- `node --run test:control-plane`: 153/153 passed.
- `node --run test:legacy`: 256/256 passed.
- `node --run build`: passed.
- `node --check LianSyn-platform/app.js`: passed.
- `git diff --check`: passed.
## Follow-ups
- The running 8786 control-plane process still serves the previously loaded TypeScript module. This projection update requires a separately authorized service restart before the live browser shows the corrected historical type totals.
## Promotion Candidates
- None. The canonical dashboard contract already states that task type is a leadership dimension and that the surface is business-facing; this task corrects the implementation without changing that accepted contract.