fix(WP-0017/E4): Layer 3 error fixes — round 2 (18 files)

Fixes 46 compile errors across 18 controllers and views:
- BridgeResponse missing from explicit import lists (Widgets, RequirementCandidates,
  DecisionRecords, AgentDelegations) — dot-notation HasField resolution fails without
  the type in scope under DuplicateRecordFields
- unId not in IHP v1.5 — replaced all fmap (Id . unId) with fmap coerce
- respondWith not in IHP — replaced with plain redirectTo in 5 controllers
- [hubId] list param to sqlQuery — replaced with (Only hubId) tuple
- deleteWhere not in IHP — replaced with query/filterWhere/fetch/deleteRecords
- fill @'["label"] mismatch — field is label_ in generated types, not label
- PersistUUID/toUUID (persistent-style) — replaced with (Only id)
- intercalate + jsonArrayTexts ambiguity in GovernanceTemplates — hid Index import,
  removed local duplicates, added Data.Text (intercalate)
- Int16 not in scope in AntifragilityDashboard — changed to Int (score :: Int)
- typeArraySection type mismatch in HubCapabilityManifests/Edit — unified to [Text]
- renderForm arity mismatch — added action param to DecisionRecords/New.renderForm
- Missing qualified Data.Aeson import in AdaptiveThresholds
- Missing ?request::Request constraint in Api/V2/WidgetPatterns.renderJsonWithStatus

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-12 12:17:45 +00:00
parent c40f11d657
commit 3737845e02
18 changed files with 120 additions and 159 deletions

View File

@@ -94,23 +94,23 @@ instance View AntifragilityDashboardView where
</div>
|]
where
deployedIds = map (.id) allDeployments
openGaps = filter (\d -> any (\r -> r.decisionId == d.id) allImplRefs
&& not (any (\dp -> dp.decisionId == d.id) allDeployments))
allDecisions
recentDeploys = take 20 (sortByDesc (.deployedAt) allDeployments)
regressedWidgets = filter (\w -> w.id `elem` regressionWidgetIds) widgets
avgScoreText
| null allEvaluations = ""
| otherwise =
let avg = fromIntegral (sum (map (.score) allEvaluations)) / fromIntegral (length allEvaluations) :: Double
in show (round avg :: Int) <> "/5"
improvedPctText
| null allSignals = ""
| otherwise =
let improved = length (filter (\s -> s.signalType == "improved") allSignals)
pct = (fromIntegral improved * 100 `div` length allSignals) :: Int
in show pct <> "%"
deployedIds = map (.id) allDeployments
openGaps = filter (\d -> any (\r -> r.decisionId == d.id) allImplRefs
&& not (any (\dp -> dp.decisionId == d.id) allDeployments))
allDecisions
recentDeploys = take 20 (sortByDesc (.deployedAt) allDeployments)
regressedWidgets = filter (\w -> w.id `elem` regressionWidgetIds) widgets
avgScoreText
| null allEvaluations = ""
| otherwise =
let avg = fromIntegral (sum (map (.score) allEvaluations)) / fromIntegral (length allEvaluations) :: Double
in show (round avg :: Int) <> "/5"
improvedPctText
| null allSignals = ""
| otherwise =
let improved = length (filter (\s -> s.signalType == "improved") allSignals)
pct = (fromIntegral improved * 100 `div` length allSignals) :: Int
in show pct <> "%"
sortByDesc :: Ord b => (a -> b) -> [a] -> [a]
sortByDesc f = sortBy (\a b -> compare (f b) (f a))
@@ -171,7 +171,7 @@ signalDot "neutral" = "inline-block w-2 h-2 rounded-full bg-gray-400"
signalDot "inconclusive" = "inline-block w-2 h-2 rounded-full bg-yellow-400"
signalDot _ = "inline-block w-2 h-2 rounded-full bg-gray-300"
renderEvalBadge :: Int16 -> Html
renderEvalBadge :: Int -> Html
renderEvalBadge score = [hsx|
<span class={scoreClass score <> " text-xs px-2 py-0.5 rounded font-medium"}>
{show score}/5
@@ -269,7 +269,7 @@ outcomeClass "merged" = "bg-indigo-100 text-indigo-800"
outcomeClass "reframed" = "bg-orange-100 text-orange-800"
outcomeClass _ = "bg-gray-100 text-gray-600"
scoreClass :: Int16 -> Text
scoreClass :: Int -> Text
scoreClass n
| n <= 2 = "bg-red-100 text-red-800"
| n == 3 = "bg-yellow-100 text-yellow-800"