-
Notifications
You must be signed in to change notification settings - Fork 0
fix: align frontend DepartmentHealth type with backend model #892
Copy link
Copy link
Closed
Labels
scope:medium1-3 days of work1-3 days of workspec:company-structureDESIGN_SPEC Section 4 - Company StructureDESIGN_SPEC Section 4 - Company Structuretype:fixBug fixes and correctionsBug fixes and correctionsv0.5Minor version v0.5Minor version v0.5
Description
Problem
The frontend DepartmentHealth interface (web/src/api/types.ts) does not match the backend DepartmentHealth Pydantic model (src/synthorg/api/controllers/departments.py).
Frontend has:
interface DepartmentHealth {
name: DepartmentName
display_name: string
health_percent: number
agent_count: number
task_count: number
cost_usd: number | null
}Backend returns:
class DepartmentHealth(BaseModel):
department_name: NotBlankStr
agent_count: int
active_agent_count: int
currency: str
avg_performance_score: float | None
department_cost_7d: float
cost_trend: tuple[TrendDataPoint, ...]
collaboration_score: float | None
utilization_percent: float # computedEvery field except agent_count is mismatched. Components reading health_percent, task_count, display_name, or cost_usd get undefined at runtime.
Why not fixed in #888
The type is consumed by 26 files across the codebase (analytics store, Dashboard page, Org Chart, utilities, and their tests). Fixing it cascades far beyond the Company page PR scope.
Scope
- Update
DepartmentHealthinweb/src/api/types.tsto match the backend model - Update all 26 consumers to use the new field names
- Update
DeptHealthBarcomponent props if needed (currently expectshealth,agentCount,taskCount) - Update all test factories and story mock data
- Verify the Dashboard and Org Chart pages still render correctly
Found by
api-contract-drift review agent during PR #888 review (confidence: 98).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
scope:medium1-3 days of work1-3 days of workspec:company-structureDESIGN_SPEC Section 4 - Company StructureDESIGN_SPEC Section 4 - Company Structuretype:fixBug fixes and correctionsBug fixes and correctionsv0.5Minor version v0.5Minor version v0.5