generated from coulomb/repo-seed
fix(WP-0014): pre-flight compilation fixes, Tailwind pipeline, and admin seed
A2 — Compilation fixes: - Remove inline FK constraints from Schema.sql; IHP schema compiler cannot parse them. Add 1744329600-restore-fk-constraints.sql migration to restore referential integrity at the DB level. - Rename `#label` → `#label_` throughout to avoid clash with Haskell built-in. - Fix `hub.id == hid` UUID comparisons to use `toUUID hub.id`. - Replace non-existent `setStatus`/`respondJson` calls with `renderJsonWithStatusCode` throughout Api controllers. - Fix qualified package import for `cryptohash-sha256` in Auth.hs. - Add `CanSelect (Text, Text)` instance in Helper.View. - Refactor HSX inline lambdas to named helper functions in 100+ views (GHC cannot infer types for anonymous functions inside quasi-quoted HSX). - Fix missing imports (IHP.QueryBuilder, IHP.Fetch, Web.Routes, Only, etc.) across helpers and controllers. - Remove duplicate `diffUTCTime` definition in BottleneckDetector. - Change `createEventForHub` return type from `IO ResponseReceived` to `IO ()`. - Seed type-registry vocabulary via 1744502400-seed-type-registries.sql (moved from Schema.sql where IHP does not execute INSERT statements). A3 — Tailwind build pipeline: - Add `tailwindcss` to flake.nix native packages. - Uncomment `tailwind.exec` process in devenv shell config. - Add tailwind/tailwind.config.js (scans Web/View/**/*.hs). - Add tailwind/app.css with @tailwind directives. A4 — Admin user seed: - Add 1744416000-seed-admin-user.sql: inserts admin@inter-hub.local with bcrypt-hashed password admin1234! (cost 10). - Add .env.example documenting all required environment variables and default admin credentials. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import Web.Types
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
import Web.Routes ()
|
||||
|
||||
data AntifragilityDashboardView = AntifragilityDashboardView
|
||||
{ hub :: !Hub
|
||||
@@ -24,22 +25,22 @@ instance View AntifragilityDashboardView where
|
||||
<div class="flex items-center gap-2 text-sm text-gray-500 mb-1">
|
||||
<a href={HubsAction} class="hover:text-gray-700">Hubs</a>
|
||||
<span>/</span>
|
||||
<a href={ShowHubAction { hubId = hub.id }} class="hover:text-gray-700">{hub.name}</a>
|
||||
<a href={ShowHubAction (hub.id)} class="hover:text-gray-700">{hub.name}</a>
|
||||
<span>/</span>
|
||||
<span>Antifragility</span>
|
||||
</div>
|
||||
<h1 class="text-2xl font-semibold">Antifragility Dashboard — {hub.name}</h1>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<a href={TriageDashboardAction { hubId = hub.id }}
|
||||
<a href={TriageDashboardAction (hub.id)}
|
||||
class="text-sm border border-gray-300 px-3 py-1.5 rounded hover:bg-gray-50">
|
||||
Triage
|
||||
</a>
|
||||
<a href={GovernanceDashboardAction { hubId = hub.id }}
|
||||
<a href={GovernanceDashboardAction (hub.id)}
|
||||
class="text-sm border border-gray-300 px-3 py-1.5 rounded hover:bg-gray-50">
|
||||
Governance
|
||||
</a>
|
||||
<a href={ShowHubAction { hubId = hub.id }}
|
||||
<a href={ShowHubAction (hub.id)}
|
||||
class="text-sm border border-gray-300 px-3 py-1.5 rounded hover:bg-gray-50">
|
||||
Hub
|
||||
</a>
|
||||
@@ -67,14 +68,7 @@ instance View AntifragilityDashboardView where
|
||||
</div>
|
||||
|
||||
<!-- Regression alerts -->
|
||||
{if null regressionWidgetIds then mempty else [hsx|
|
||||
<div class="bg-red-50 border border-red-200 rounded-lg px-6 py-4 mb-6">
|
||||
<h2 class="text-sm font-semibold text-red-700 mb-3">⚠ Regression Alerts</h2>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
{forEach regressedWidgets renderRegressedBadge}
|
||||
</div>
|
||||
</div>
|
||||
|]}
|
||||
{if null regressionWidgetIds then mempty else renderRegressionAlerts regressedWidgets}
|
||||
|
||||
<!-- Open gaps: decisions with impl refs but no deployment -->
|
||||
<div class="bg-white rounded-lg border border-gray-200 px-6 py-5 mb-6">
|
||||
@@ -84,56 +78,19 @@ instance View AntifragilityDashboardView where
|
||||
(decisions with impl refs but no deployment recorded)
|
||||
</span>
|
||||
</h2>
|
||||
{if null openGaps
|
||||
then [hsx|<p class="text-sm text-gray-400">All decisions with impl refs have deployments.</p>|]
|
||||
else [hsx|
|
||||
<div class="space-y-1">
|
||||
{forEach openGaps renderGapRow}
|
||||
</div>
|
||||
|]}
|
||||
{renderOpenGaps openGaps}
|
||||
</div>
|
||||
|
||||
<!-- Recent deployments -->
|
||||
<div class="bg-white rounded-lg border border-gray-200 px-6 py-5 mb-6">
|
||||
<h2 class="text-sm font-semibold text-gray-700 mb-3">Recent Deployments</h2>
|
||||
{if null recentDeploys
|
||||
then [hsx|<p class="text-sm text-gray-400">No deployments yet.</p>|]
|
||||
else [hsx|
|
||||
<table class="w-full text-sm">
|
||||
<thead class="border-b border-gray-100">
|
||||
<tr>
|
||||
<th class="text-left py-2 text-xs font-medium text-gray-500">Version</th>
|
||||
<th class="text-left py-2 text-xs font-medium text-gray-500">Decision</th>
|
||||
<th class="text-right py-2 text-xs font-medium text-gray-500">Signals</th>
|
||||
<th class="text-right py-2 text-xs font-medium text-gray-500">Eval</th>
|
||||
<th class="text-right py-2 text-xs font-medium text-gray-500">Deployed</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-50">
|
||||
{forEach recentDeploys (renderDeployRow allDecisions allSignals allEvaluations)}
|
||||
</tbody>
|
||||
</table>
|
||||
|]}
|
||||
{renderRecentDeploysSection recentDeploys allDecisions allSignals allEvaluations}
|
||||
</div>
|
||||
|
||||
<!-- Recurrence leaderboard -->
|
||||
<div class="bg-white rounded-lg border border-gray-200 px-6 py-5">
|
||||
<h2 class="text-sm font-semibold text-gray-700 mb-3">Recurrence Leaderboard</h2>
|
||||
{if null recurrenceLeaderboard
|
||||
then [hsx|<p class="text-sm text-gray-400">No recurring widgets detected.</p>|]
|
||||
else [hsx|
|
||||
<table class="w-full text-sm">
|
||||
<thead class="border-b border-gray-100">
|
||||
<tr>
|
||||
<th class="text-left py-2 text-xs font-medium text-gray-500">Widget</th>
|
||||
<th class="text-right py-2 text-xs font-medium text-gray-500">Cycles</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-50">
|
||||
{forEach recurrenceLeaderboard (renderRecurrenceRow widgets)}
|
||||
</tbody>
|
||||
</table>
|
||||
|]}
|
||||
{renderRecurrenceSection recurrenceLeaderboard widgets}
|
||||
</div>
|
||||
|]
|
||||
where
|
||||
@@ -160,7 +117,7 @@ sortByDesc f = sortBy (\a b -> compare (f b) (f a))
|
||||
|
||||
renderRegressedBadge :: Widget -> Html
|
||||
renderRegressedBadge w = [hsx|
|
||||
<a href={ShowWidgetAction { widgetId = w.id }}
|
||||
<a href={ShowWidgetAction (w.id)}
|
||||
class="text-xs bg-red-100 text-red-800 border border-red-300 rounded px-2 py-1 hover:bg-red-200">
|
||||
{w.name}
|
||||
</a>
|
||||
@@ -169,7 +126,7 @@ renderRegressedBadge w = [hsx|
|
||||
renderGapRow :: DecisionRecord -> Html
|
||||
renderGapRow d = [hsx|
|
||||
<div class="flex items-center justify-between py-1.5 text-sm">
|
||||
<a href={ShowDecisionRecordAction { decisionRecordId = d.id }}
|
||||
<a href={ShowDecisionRecordAction (d.id)}
|
||||
class="text-indigo-600 hover:text-indigo-800">{d.title}</a>
|
||||
<span class={outcomeClass d.outcome <> " text-xs px-2 py-0.5 rounded font-medium"}>
|
||||
{d.outcome}
|
||||
@@ -181,7 +138,7 @@ renderDeployRow :: [DecisionRecord] -> [OutcomeSignal] -> [ChangeEvaluation] ->
|
||||
renderDeployRow decisions signals evals dr = [hsx|
|
||||
<tr>
|
||||
<td class="py-2 pr-4">
|
||||
<a href={ShowDeploymentRecordAction { deploymentRecordId = dr.id }}
|
||||
<a href={ShowDeploymentRecordAction (dr.id)}
|
||||
class="font-mono text-indigo-600 hover:text-indigo-800">{dr.versionRef}</a>
|
||||
</td>
|
||||
<td class="py-2 pr-4 text-gray-600">{decisionTitle}</td>
|
||||
@@ -189,7 +146,7 @@ renderDeployRow decisions signals evals dr = [hsx|
|
||||
{renderSignalSummary drSignals}
|
||||
</td>
|
||||
<td class="py-2 pr-4 text-right">
|
||||
{maybe [hsx|<span class="text-gray-400 text-xs">—</span>|] renderEvalBadge mScore}
|
||||
{maybe noEvalBadge renderEvalBadge mScore}
|
||||
</td>
|
||||
<td class="py-2 text-right text-xs text-gray-400">{show dr.deployedAt}</td>
|
||||
</tr>
|
||||
@@ -203,9 +160,7 @@ renderSignalSummary :: [OutcomeSignal] -> Html
|
||||
renderSignalSummary [] = [hsx|<span class="text-gray-400 text-xs">—</span>|]
|
||||
renderSignalSummary signals = [hsx|
|
||||
<div class="flex gap-1 justify-end">
|
||||
{forEach (take 3 signals) (\s -> [hsx|
|
||||
<span class={signalDot s.signalType}></span>
|
||||
|])}
|
||||
{forEach (take 3 signals) renderSignalDot}
|
||||
</div>
|
||||
|]
|
||||
|
||||
@@ -227,7 +182,7 @@ renderRecurrenceRow :: [Widget] -> (Id Widget, Int) -> Html
|
||||
renderRecurrenceRow widgets (wid, count) = [hsx|
|
||||
<tr>
|
||||
<td class="py-2">
|
||||
{maybe [hsx|<span class="text-gray-500">—</span>|] renderWidgetLink mWidget}
|
||||
{maybe noWidgetSpan renderWidgetLink mWidget}
|
||||
</td>
|
||||
<td class="py-2 text-right">
|
||||
<span class="text-sm font-semibold text-yellow-700">⟳ {show count}</span>
|
||||
@@ -239,10 +194,72 @@ renderRecurrenceRow widgets (wid, count) = [hsx|
|
||||
|
||||
renderWidgetLink :: Widget -> Html
|
||||
renderWidgetLink w = [hsx|
|
||||
<a href={ShowWidgetAction { widgetId = w.id }}
|
||||
<a href={ShowWidgetAction (w.id)}
|
||||
class="text-indigo-600 hover:text-indigo-800">{w.name}</a>
|
||||
|]
|
||||
|
||||
renderRegressionAlerts :: [Widget] -> Html
|
||||
renderRegressionAlerts ws = [hsx|
|
||||
<div class="bg-red-50 border border-red-200 rounded-lg px-6 py-4 mb-6">
|
||||
<h2 class="text-sm font-semibold text-red-700 mb-3">⚠ Regression Alerts</h2>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
{forEach ws renderRegressedBadge}
|
||||
</div>
|
||||
</div>
|
||||
|]
|
||||
|
||||
renderOpenGaps :: [DecisionRecord] -> Html
|
||||
renderOpenGaps [] = [hsx|<p class="text-sm text-gray-400">All decisions with impl refs have deployments.</p>|]
|
||||
renderOpenGaps gaps = [hsx|
|
||||
<div class="space-y-1">
|
||||
{forEach gaps renderGapRow}
|
||||
</div>
|
||||
|]
|
||||
|
||||
renderRecentDeploysSection :: [DeploymentRecord] -> [DecisionRecord] -> [OutcomeSignal] -> [ChangeEvaluation] -> Html
|
||||
renderRecentDeploysSection [] _ _ _ = [hsx|<p class="text-sm text-gray-400">No deployments yet.</p>|]
|
||||
renderRecentDeploysSection deploys decisions signals evals = [hsx|
|
||||
<table class="w-full text-sm">
|
||||
<thead class="border-b border-gray-100">
|
||||
<tr>
|
||||
<th class="text-left py-2 text-xs font-medium text-gray-500">Version</th>
|
||||
<th class="text-left py-2 text-xs font-medium text-gray-500">Decision</th>
|
||||
<th class="text-right py-2 text-xs font-medium text-gray-500">Signals</th>
|
||||
<th class="text-right py-2 text-xs font-medium text-gray-500">Eval</th>
|
||||
<th class="text-right py-2 text-xs font-medium text-gray-500">Deployed</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-50">
|
||||
{forEach deploys (renderDeployRow decisions signals evals)}
|
||||
</tbody>
|
||||
</table>
|
||||
|]
|
||||
|
||||
renderRecurrenceSection :: [(Id Widget, Int)] -> [Widget] -> Html
|
||||
renderRecurrenceSection [] _ = [hsx|<p class="text-sm text-gray-400">No recurring widgets detected.</p>|]
|
||||
renderRecurrenceSection leaderboard widgets = [hsx|
|
||||
<table class="w-full text-sm">
|
||||
<thead class="border-b border-gray-100">
|
||||
<tr>
|
||||
<th class="text-left py-2 text-xs font-medium text-gray-500">Widget</th>
|
||||
<th class="text-right py-2 text-xs font-medium text-gray-500">Cycles</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-50">
|
||||
{forEach leaderboard (renderRecurrenceRow widgets)}
|
||||
</tbody>
|
||||
</table>
|
||||
|]
|
||||
|
||||
noEvalBadge :: Html
|
||||
noEvalBadge = [hsx|<span class="text-gray-400 text-xs">—</span>|]
|
||||
|
||||
noWidgetSpan :: Html
|
||||
noWidgetSpan = [hsx|<span class="text-gray-500">—</span>|]
|
||||
|
||||
renderSignalDot :: OutcomeSignal -> Html
|
||||
renderSignalDot s = [hsx|<span class={signalDot s.signalType}></span>|]
|
||||
|
||||
outcomeClass :: Text -> Text
|
||||
outcomeClass "accepted" = "bg-green-100 text-green-800"
|
||||
outcomeClass "rejected" = "bg-red-100 text-red-800"
|
||||
|
||||
Reference in New Issue
Block a user