generated from coulomb/repo-seed
fix(WP-0014/A2): close remaining pure-param and structural compilation errors
Convert all remaining `<- paramOrNothing / param / paramOrDefault /
currentUserOrNothing` monadic binds to `let` — these functions are pure
(ImplicitParams-based) in IHP v1.5, so `<-` is a type error in an IO
do-block.
Controllers fixed:
AgentDelegations, AiGovernancePolicies, Annotations, ApiConsumers,
CollectiveProposals, DecisionRecords, DeploymentRecords,
HubCapabilityManifests, HubRoutingRules, InstitutionalKnowledge,
OutcomeCorrelations, RequirementCandidates, TypeRegistries,
WebhookSubscriptions, Widgets,
Api/V2/{Annotations,InteractionEvents,Token}
WebhookSubscriptions: remove orphaned `Right () ->` case arm that was
left inside a bare `unless` block (structural parse error).
Also carries forward all in-progress fixes from the working tree:
helpers (AgentBridge, ApiRateLimit, BottleneckDetector,
CrossHubPropagation, FrictionScore),
views (CanSelect instances, HSX lambda extraction, formFor wrappers),
env/build (envrc GHCi perms, flake.nix Tailwind + GHC resource limits,
static/app.css additional Tailwind output).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,8 @@ import Web.Controller.Api.V2.Auth
|
||||
import Application.Helper.TypeRegistry (validateEventType)
|
||||
import Web.Job.WebhookDeliveryJob (dispatchWebhooks)
|
||||
import Control.Concurrent (forkIO)
|
||||
import Control.Monad (void)
|
||||
import qualified Data.UUID as UUID
|
||||
import qualified Data.Aeson as A
|
||||
|
||||
instance Controller ApiV2InteractionEventsController where
|
||||
@@ -19,8 +21,8 @@ instance Controller ApiV2InteractionEventsController where
|
||||
action ApiV2IndexInteractionEventsAction = do
|
||||
_consumer <- requireApiConsumer
|
||||
(page, perPage) <- getPageParams
|
||||
mWidgetId <- paramOrNothing @(Id Widget) "widgetId"
|
||||
mEventType <- paramOrNothing @Text "eventType"
|
||||
let mWidgetId = paramOrNothing @(Id Widget) "widgetId"
|
||||
mEventType = paramOrNothing @Text "eventType"
|
||||
let off = (page - 1) * perPage
|
||||
let baseQ = query @InteractionEvent
|
||||
|> orderByDesc #occurredAt
|
||||
@@ -42,9 +44,9 @@ instance Controller ApiV2InteractionEventsController where
|
||||
-- POST /api/v2/interaction-events
|
||||
action ApiV2CreateInteractionEventAction = do
|
||||
consumer <- requireApiConsumer
|
||||
widgetIdText <- paramOrNothing @Text "widgetId"
|
||||
eventType <- paramOrNothing @Text "eventType"
|
||||
viewContext <- paramOrNothing @Text "viewContext"
|
||||
let widgetIdText = paramOrNothing @Text "widgetId"
|
||||
eventType = paramOrNothing @Text "eventType"
|
||||
viewContext = paramOrNothing @Text "viewContext"
|
||||
|
||||
let missing = catMaybes
|
||||
[ if isNothing widgetIdText then Just ("widgetId" :: Text) else Nothing
|
||||
@@ -83,7 +85,7 @@ instance Controller ApiV2InteractionEventsController where
|
||||
, "value" .= evType
|
||||
]
|
||||
|
||||
case readMay wIdText of
|
||||
case UUID.fromText wIdText of
|
||||
Nothing -> respondWithStatus 422 $ object
|
||||
["error" .= ("widgetId must be a valid UUID" :: Text)]
|
||||
Just rawId -> do
|
||||
@@ -108,7 +110,6 @@ instance Controller ApiV2InteractionEventsController where
|
||||
, "occurredAt" .= event.occurredAt
|
||||
]
|
||||
liftIO $ void $ forkIO $ dispatchWebhooks "clicked" webhookPayload
|
||||
setStatus 201
|
||||
renderJson (eventToJson event)
|
||||
|
||||
eventToJson :: InteractionEvent -> Value
|
||||
|
||||
Reference in New Issue
Block a user