5.2 KiB
5.2 KiB
V1.1 Handoff: Done vs Pending
Date: 2026-03-19
Completed in this pass
Owner KPI (scan-first)
- Snapshot freshness now updates when KPI rows are edited (
patchWeeklyKpiRowtouches parent snapshotupdatedAt). - Owner board metadata now shows
sourcetogether withlastUpdatedAtand coverage. - Drill-down
<details>sections are no longer forced closed on rerender.
Human Capital
- Removed write side-effect from
GET /api/human-capital/dashboard(read no longer auto-publishes KPIs). peopleendpoint now requires owner/HC leader (canManageHumanCapital) for employee-level visibility.lifecycle-eventsGET now requires owner/HC leader.updatesGET now hides non-published items from non-managers.- CSV export fixed to real newlines (
\n) instead of escaped\\ntext. - People endpoint now calls
ensureEmployeeProfiles()to reduce first-load/race gaps. - HC compliance input excludes auto-published HC KPI section (
human-capital-auto-v1) to prevent KPI self-feedback. - Churn trend denominator now uses month-specific estimated headcount rather than current headcount for all months.
Operations / Maintenance
- Removed write side-effect from
GET /api/operations/dashboard(read no longer auto-publishes KPIs). - Added owner approval action endpoint:
PATCH /api/operations/approvals/[id]. - Added policy endpoint:
GET/PATCH /api/operations/policy. - Work-order read/list is department-scoped.
- Template read/list is department-scoped.
- Reminder read/list is department-scoped.
- Asset update/delete now validates department ownership before mutating.
- Work-order patch now validates department scope and blocks non-owner state transitions when owner approval is pending.
- Production-plan patch now validates department scope and enforces owner-only transitions for
approved/released. - Production-plan create enforces owner-only for privileged states and sets approval metadata accordingly.
- Maintenance policy bootstrap now backfills missing owner approver when possible.
- Work-order create now validates asset/template department ownership and resolves owner approver fallback.
- Operations dashboard payload now includes
workOrderId/productionPlanIdin approval inbox entries. - Operations UI owner inbox now has Approve/Reject actions wired to approval API.
- Operations UI now shows down-assets in summary and an upcoming maintenance list.
Marketing
- Meta connection/disconnect now avoids inactive-row unique collisions by clearing stale inactive rows before state flips.
- Meta sync now attempts both Facebook and Instagram ingestion (best-effort Instagram discovery/fetch).
- Social snapshot writes now dedupe same
department+channel+range+capturedAtbefore create. - SocialPanel no longer computes local fallback growth math from snapshots; it displays server insights only.
- Initiative drawer now includes attribution fields in UI: channel, page ID, campaign tag, date window.
- Initiative drawer includes "Use auto values" action and displays last auto-fill summary.
- Marketing scoring and initiative mapping now consume auto-attributed actuals when manual values are still zero.
- Sync auto-fill now respects attribution page/date windows; campaign-tagged records are intentionally skipped until campaign-level data is ingested.
Database / schema
- Prisma migration created:
prisma/migrations/20260319180300_0012_v11_scan_first_owner_department_dashboards/migration.sql.
Validation status
npm testpasses (19/19).npm run buildpasses.- Recharts static-generation warnings remain (
width(-1)/height(-1)), non-blocking but should be cleaned later.
Remaining / Follow-up items
High-priority follow-up
- Add campaign-level attribution ingestion for Meta sync (currently campaign-tagged initiatives are skipped to avoid bad attribution).
- Add explicit CRUD coverage for operations entities still missing full lifecycle endpoints (e.g., delete/update routes for every list entity as originally envisioned).
- Add automated API tests for new authorization hardening and owner-approval transition guards.
Medium-priority follow-up
- Add UI controls for operations policy thresholds (
costThreshold,downtimeThresholdHours, approver owner). - Improve Instagram metrics quality (current implementation is best-effort and may use limited fields depending on account permissions).
- Normalize/chunk dashboard chart containers to remove Recharts build-time width warnings.
Optional / V1.2 candidates
- Improve attribution model to support campaign/source dimensions end-to-end in stored metrics.
- Add audit trail events for owner approval actions (who/when/why) in UI timeline.
- Add integration tests for Meta sync -> initiative auto-fill -> publish -> owner KPI chain.
Quick resume commands
cd /home/mdares03/benell
npm test
npm run build
Notes for next person
- Projects module was intentionally left unchanged per V1.1 scope.
- Department dashboards now feed owner KPI via explicit publish endpoints (read endpoints no longer mutate KPI data).