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:
@@ -6,12 +6,14 @@ import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
|
||||
data ShowView = ShowView
|
||||
{ record :: !DecisionRecord
|
||||
, policyRefs :: ![PolicyReference]
|
||||
, implRefs :: ![ImplementationChangeReference]
|
||||
, mRequirement :: !(Maybe Requirement)
|
||||
, mCandidate :: !(Maybe RequirementCandidate)
|
||||
, users :: ![User]
|
||||
{ record :: !DecisionRecord
|
||||
, policyRefs :: ![PolicyReference]
|
||||
, implRefs :: ![ImplementationChangeReference]
|
||||
, deploymentRecords :: ![DeploymentRecord]
|
||||
, evaluations :: ![ChangeEvaluation]
|
||||
, mRequirement :: !(Maybe Requirement)
|
||||
, mCandidate :: !(Maybe RequirementCandidate)
|
||||
, users :: ![User]
|
||||
}
|
||||
|
||||
instance View ShowView where
|
||||
@@ -92,6 +94,24 @@ instance View ShowView where
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Deployments -->
|
||||
<div class="bg-white rounded-lg border border-gray-200 px-6 py-4">
|
||||
<div class="flex items-center justify-between mb-3">
|
||||
<h2 class="text-sm font-semibold text-gray-700">Deployments</h2>
|
||||
{if null implRefs
|
||||
then mempty
|
||||
else [hsx|
|
||||
<a href={(pathTo NewDeploymentRecordAction) <> "?decisionId=" <> show record.id}
|
||||
class="text-xs border border-indigo-300 text-indigo-600 px-3 py-1 rounded hover:bg-indigo-50">
|
||||
New Deployment
|
||||
</a>
|
||||
|]}
|
||||
</div>
|
||||
{if null deploymentRecords
|
||||
then [hsx|<p class="text-sm text-gray-400">No deployments recorded yet.</p>|]
|
||||
else [hsx|{forEach deploymentRecords (renderDeploymentRow evaluations)}|]}
|
||||
</div>
|
||||
|
||||
<!-- Implementation references -->
|
||||
<div class="bg-white rounded-lg border border-gray-200 px-6 py-4">
|
||||
<h2 class="text-sm font-semibold text-gray-700 mb-3">Implementation References</h2>
|
||||
@@ -201,6 +221,36 @@ systemBadgeClass "linear" = "bg-violet-100 text-violet-800"
|
||||
systemBadgeClass "jira" = "bg-blue-100 text-blue-800"
|
||||
systemBadgeClass _ = "bg-gray-100 text-gray-600"
|
||||
|
||||
renderDeploymentRow :: [ChangeEvaluation] -> DeploymentRecord -> Html
|
||||
renderDeploymentRow evals dr = [hsx|
|
||||
<div class="flex items-center justify-between py-2 border-b border-gray-100 last:border-0">
|
||||
<div class="flex items-center gap-2 text-sm">
|
||||
<a href={ShowDeploymentRecordAction { deploymentRecordId = dr.id }}
|
||||
class="font-mono text-indigo-600 hover:text-indigo-800">{dr.versionRef}</a>
|
||||
<span class="text-xs text-gray-400">{show dr.deployedAt}</span>
|
||||
</div>
|
||||
{maybe mempty renderEvalSummary mEval}
|
||||
</div>
|
||||
|]
|
||||
where
|
||||
mEval = find (\e -> e.deploymentId == dr.id) evals
|
||||
|
||||
renderEvalSummary :: ChangeEvaluation -> Html
|
||||
renderEvalSummary ev = [hsx|
|
||||
<span class={scoreClass ev.score <> " text-xs px-2 py-0.5 rounded font-medium"}>
|
||||
{starsFor ev.score}
|
||||
</span>
|
||||
|]
|
||||
|
||||
starsFor :: Int16 -> Text
|
||||
starsFor n = pack (Prelude.replicate (fromIntegral n) '★') <> pack (Prelude.replicate (5 - fromIntegral n) '☆')
|
||||
|
||||
scoreClass :: Int16 -> Text
|
||||
scoreClass n
|
||||
| n <= 2 = "bg-red-100 text-red-800"
|
||||
| n == 3 = "bg-yellow-100 text-yellow-800"
|
||||
| otherwise = "bg-green-100 text-green-800"
|
||||
|
||||
userName :: [User] -> Maybe (Id User) -> Text
|
||||
userName _ Nothing = "—"
|
||||
userName users (Just uid) = maybe "(unknown)" (.name) (find (\u -> u.id == uid) users)
|
||||
|
||||
Reference in New Issue
Block a user