generated from coulomb/repo-seed
feat(P3): IHF Phase 3 complete — Governance and Decision Linkage
Implements the full governance layer: - Schema: requirements, decision_records, policy_references, implementation_change_references; requirement_candidates gets requirement_id back-reference - RequirementsController (index/show; promotion-only create) - DecisionRecordsController (CRUD + policy/impl ref management) - GovernanceDashboardAction on HubsController (AutoRefresh) - PromoteToRequirementAction + LinkToDecisionAction on candidates - Outcome immutability enforced at controller level (fill excludes outcome) - Full six-outcome vocabulary with Tailwind color roles - Integration tests for all Phase 3 paths - FrontController: registers Phase 2 missing controllers + all Phase 3 - SCOPE.md + docs/phase3-summary.md updated Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import Web.View.Hubs.Show
|
||||
import Web.View.Hubs.New
|
||||
import Web.View.Hubs.Edit
|
||||
import Web.View.Hubs.TriageDashboard
|
||||
import Web.View.Hubs.GovernanceDashboard
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ControllerPrelude
|
||||
@@ -110,3 +111,48 @@ instance Controller HubsController where
|
||||
, recentEscalations
|
||||
, allAnnotations
|
||||
}
|
||||
|
||||
action GovernanceDashboardAction { hubId } = autoRefresh do
|
||||
hub <- fetch hubId
|
||||
widgets <- query @Widget
|
||||
|> filterWhere (#hubId, hubId)
|
||||
|> fetch
|
||||
let widgetIds = map (.id) widgets
|
||||
|
||||
-- All requirements whose source candidate is in this hub's widgets
|
||||
allCandidates <- query @RequirementCandidate
|
||||
|> filterWhereIn (#sourceWidgetId, widgetIds)
|
||||
|> fetch
|
||||
let acceptedCandidateIds = map (.id) (filter (\c -> c.status == "accepted") allCandidates)
|
||||
|
||||
allRequirements <- query @Requirement
|
||||
|> filterWhereIn (#sourceCandidateId, acceptedCandidateIds)
|
||||
|> fetch
|
||||
|
||||
-- Recent decisions (last 20) — scoped to this hub's requirements
|
||||
let requirementIds = map (.id) allRequirements
|
||||
recentDecisions <- query @DecisionRecord
|
||||
|> filterWhereIn (#requirementId, map Just requirementIds)
|
||||
|> orderByDesc #decidedAt
|
||||
|> limit 20
|
||||
|> fetch
|
||||
|
||||
-- All hub decisions (for outcome counts)
|
||||
allDecisions <- query @DecisionRecord
|
||||
|> filterWhereIn (#requirementId, map Just requirementIds)
|
||||
|> fetch
|
||||
|
||||
-- All annotations for traceability coverage
|
||||
allAnnotations <- query @Annotation
|
||||
|> filterWhereIn (#widgetId, widgetIds)
|
||||
|> fetch
|
||||
|
||||
render GovernanceDashboardView
|
||||
{ hub
|
||||
, widgets
|
||||
, allCandidates
|
||||
, allRequirements
|
||||
, recentDecisions
|
||||
, allDecisions
|
||||
, allAnnotations
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user