generated from coulomb/repo-seed
feat(P4): IHF Phase 4 complete — Outcome Observation and Antifragility Loop
Some checks failed
Test / test (push) Has been cancelled
Some checks failed
Test / test (push) Has been cancelled
Closes the IHF improvement loop. Full antifragility chain now traversable: Widget → Annotation → Candidate → Requirement → Decision → Deployment → OutcomeSignal New artifacts: - DeploymentRecord (immutable, links DecisionRecord to a deployed version) - OutcomeSignal (append-only; DB trigger prevents UPDATE/DELETE) - ChangeEvaluation (one-per-deployment; UNIQUE constraint; 1–5 score) New capabilities: - DeploymentRecordsController (index, show, new, create) - RecordOutcomeSignalAction — capture improved/regressed/neutral/inconclusive signals - Pre/post comparison panel on deployment show (±30-day event/annotation counts) - Regression detection — improved signal followed by high/critical annotation - ChangeEvaluation — idempotent score+rationale per deployment - Recurrence tracking — cycle count per widget, leaderboard - AntifragilityDashboardAction (autoRefresh, 5 panels) per hub - Phase 4 integration tests (T01–T08 logic coverage) - docs/phase4-summary.md; SCOPE.md updated to Phase 4 complete State Hub: workstream 07e9c860 → completed Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,9 +7,11 @@ import Web.View.Hubs.New
|
||||
import Web.View.Hubs.Edit
|
||||
import Web.View.Hubs.TriageDashboard
|
||||
import Web.View.Hubs.GovernanceDashboard
|
||||
import Web.View.Hubs.AntifragilityDashboard
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ControllerPrelude
|
||||
import Application.Helper.Controller (regressedWidgetIds, widgetCycleCounts)
|
||||
|
||||
instance Controller HubsController where
|
||||
beforeAction = ensureIsUser
|
||||
@@ -147,6 +149,13 @@ instance Controller HubsController where
|
||||
|> filterWhereIn (#widgetId, widgetIds)
|
||||
|> fetch
|
||||
|
||||
-- Outcome signals for regression detection
|
||||
allSignals <- query @OutcomeSignal
|
||||
|> filterWhereIn (#widgetId, widgetIds)
|
||||
|> fetch
|
||||
|
||||
let regressionWidgetIds = regressedWidgetIds allSignals allAnnotations
|
||||
|
||||
render GovernanceDashboardView
|
||||
{ hub
|
||||
, widgets
|
||||
@@ -155,4 +164,58 @@ instance Controller HubsController where
|
||||
, recentDecisions
|
||||
, allDecisions
|
||||
, allAnnotations
|
||||
, regressionWidgetIds
|
||||
}
|
||||
|
||||
action AntifragilityDashboardAction { hubId } = autoRefresh do
|
||||
hub <- fetch hubId
|
||||
widgets <- query @Widget
|
||||
|> filterWhere (#hubId, hubId)
|
||||
|> fetch
|
||||
let widgetIds = map (.id) widgets
|
||||
|
||||
-- Deployments for this hub's decisions
|
||||
allCandidates <- query @RequirementCandidate
|
||||
|> filterWhereIn (#sourceWidgetId, widgetIds)
|
||||
|> fetch
|
||||
let acceptedCandidateIds = map (.id) (filter (\c -> c.status == "accepted") allCandidates)
|
||||
allRequirements <- query @Requirement
|
||||
|> filterWhereIn (#sourceCandidateId, acceptedCandidateIds)
|
||||
|> fetch
|
||||
let requirementIds = map (.id) allRequirements
|
||||
allDecisions <- query @DecisionRecord
|
||||
|> filterWhereIn (#requirementId, map Just requirementIds)
|
||||
|> fetch
|
||||
let decisionIds = map (.id) allDecisions
|
||||
allDeployments <- query @DeploymentRecord
|
||||
|> filterWhereIn (#decisionId, decisionIds)
|
||||
|> orderByDesc #deployedAt
|
||||
|> fetch
|
||||
let deploymentIds = map (.id) allDeployments
|
||||
allSignals <- query @OutcomeSignal
|
||||
|> filterWhereIn (#widgetId, widgetIds)
|
||||
|> fetch
|
||||
allEvaluations <- query @ChangeEvaluation
|
||||
|> filterWhereIn (#deploymentId, deploymentIds)
|
||||
|> fetch
|
||||
allImplRefs <- query @ImplementationChangeReference
|
||||
|> filterWhereIn (#decisionId, decisionIds)
|
||||
|> fetch
|
||||
allAnnotations <- query @Annotation
|
||||
|> filterWhereIn (#widgetId, widgetIds)
|
||||
|> fetch
|
||||
|
||||
let regressionWidgetIds = regressedWidgetIds allSignals allAnnotations
|
||||
recurrenceLeaderboard = take 10 (widgetCycleCounts allCandidates allRequirements allDecisions allDeployments)
|
||||
|
||||
render AntifragilityDashboardView
|
||||
{ hub
|
||||
, widgets
|
||||
, allDeployments
|
||||
, allDecisions
|
||||
, allSignals
|
||||
, allEvaluations
|
||||
, allImplRefs
|
||||
, regressionWidgetIds
|
||||
, recurrenceLeaderboard
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user