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

@@ -11,9 +11,8 @@ import IHP.ControllerPrelude
import Data.Aeson (toJSON, object, (.=))
import Application.Helper.Controller (isInRegression, widgetCycleCounts)
import Application.Helper.TypeRegistry (validateWidgetType, validatePolicyScope, activeWidgetTypes, activePolicyScopes)
import Application.Helper.AgentBridge (callAgent, checkGovernancePolicy, bridgeErrorMessage)
import Application.Helper.AgentBridge (callAgent, checkGovernancePolicy, bridgeErrorMessage, BridgeResponse)
import Application.Helper.ModelRouter (resolveAgent)
import Data.List (intercalate)
instance Controller WidgetsController where
beforeAction = ensureIsUser
@@ -91,10 +90,10 @@ instance Controller WidgetsController where
|> validateField #widgetType nonEmpty
|> (case widgetTypeVal of
Left msg -> attachFailure #widgetType msg
Right () -> id)
Right () -> \x -> x)
|> (case policyScopeVal of
Left msg -> attachFailure #policyScope msg
Right () -> id)
Right () -> \x -> x)
|> ifValid \case
Left widget -> render NewView { widget, hubs, adapterSpecs, widgetTypes, policyScopes }
Right widget -> do
@@ -145,10 +144,10 @@ instance Controller WidgetsController where
|> validateField #widgetType nonEmpty
|> (case widgetTypeVal of
Left msg -> attachFailure #widgetType msg
Right () -> id)
Right () -> \x -> x)
|> (case policyScopeVal of
Left msg -> attachFailure #policyScope msg
Right () -> id)
Right () -> \x -> x)
|> ifValid \case
Left widget -> render EditView { widget, hubs, adapterSpecs, widgetTypes, policyScopes }
Right widget -> do