Files
headroom/openspec/changes/capacity-expert-mode/proposal.md
Santhosh Janardhanan 3324c4f156 feat(allocation): implement resource allocation feature
- Add AllocationController with CRUD + bulk endpoints
- Add AllocationValidationService for capacity/estimate validation
- Add AllocationMatrixService for optimized matrix queries
- Add AllocationPolicy for authorization
- Add AllocationResource for API responses
- Add frontend allocationService and matrix UI
- Add E2E tests for allocation matrix (20 tests)
- Add unit tests for validation service and policies
- Fix month format conversion (YYYY-MM to YYYY-MM-01)
2026-02-25 16:28:47 -05:00

33 lines
2.4 KiB
Markdown

## Why
Capacity planning today requires switching between team members one at a time in a calendar card view — too slow for a daily standup. Managers need a spreadsheet-style grid where the entire team's availability for the month is visible and editable at a glance, in under a minute.
## What Changes
- Add an **Expert Mode toggle** to the Capacity Planning page (right-aligned on the tabs row), persisted in `localStorage`.
- When Expert Mode is ON, replace the per-member calendar card view with a **dense planning grid**: team members as rows, days-of-month as columns.
- Each cell accepts exactly one of: `H`, `O`, `0`, `.5`, `0.5`, `1` — any other value is invalid (red on blur, submit disabled globally).
- `H` and `O` are interchangeable display tokens that both normalize to `0` for math; the frontend always preserves and displays the typed token.
- Typing `0` on a weekend column auto-renders as `O`; typing `0` on a holiday column auto-renders as `H`.
- Live KPI bar above the grid shows **Capacity (person-days)** and **Projected Revenue** updating as cells change.
- Batch save: a single **Submit** button commits all pending changes; disabled while any invalid cell exists.
- Backend gains a new **batch availability endpoint** to accept multiple `{team_member_id, date, availability}` entries in one request.
## Capabilities
### New Capabilities
- `capacity-expert-mode`: Spreadsheet-style planning grid for bulk team availability editing with token-based input, live KPI bar, and batch save.
### Modified Capabilities
- `capacity-planning`: Existing per-member calendar and summary remain unchanged; Expert Mode is purely additive. No requirement changes to existing scenarios.
## Impact
- **Frontend**: New `CapacityExpertGrid` component; `capacity/+page.svelte` gains mode toggle + localStorage persistence; `capacity.ts` API client gains batch update function; new `expertModeStore` or localStorage util.
- **Backend**: New `POST /api/capacity/availability/batch` endpoint in `CapacityController`; `CapacityService` gains `batchUpsertAvailability()` with consolidated cache invalidation.
- **No schema changes**: `team_member_daily_availabilities` table is unchanged; values stored remain `0`, `0.5`, `1`.
- **No breaking changes**: Existing calendar mode, summary, holidays, and PTO tabs are unaffected.
- **Tests**: New unit tests for token normalization/validation; new feature test for batch endpoint; new component tests for grid and toggle.