generated from coulomb/repo-seed
feat(WP-0009): IHF GAAF Compliance Foundation — type registries, extension manifests, architectural contracts
Some checks failed
Test / test (push) Has been cancelled
Some checks failed
Test / test (push) Has been cancelled
Implements IHUB-WP-0009: closes four GAAF-2026 gaps before domain hub work begins. - TypeRegistry helper + controllers/views (hub_kind, hub_capability_manifest) - HubCapabilityManifest entity with validation and registry linkage - ARCHITECTURE-LAYERS.md + CI-enforced boundary contracts - Alembic migration 1743724800, fitness tests (Test/Architecture/) - GAAF spec, Operational Architecture spec, domain hub extension guide - Updates to CLAUDE.md, SCOPE.md, Schema.sql, Routes, FrontController, Types state_hub_sync: pending (tunnel was STALE at completion time; run fix-consistency) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,9 +7,7 @@ import Web.View.Annotations.Show
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ControllerPrelude
|
||||
|
||||
validCategories :: [Text]
|
||||
validCategories = ["friction", "defect", "wish", "policy_concern", "doc_gap", "trust", "other"]
|
||||
import Application.Helper.TypeRegistry (validateAnnotationCategory, activeAnnotationCategories)
|
||||
|
||||
validSeverities :: [Text]
|
||||
validSeverities = ["low", "medium", "high", "critical"]
|
||||
@@ -35,16 +33,21 @@ instance Controller AnnotationsController where
|
||||
render ShowView { widget, annotation, mCandidate }
|
||||
|
||||
action NewAnnotationAction { widgetId } = do
|
||||
widget <- fetch widgetId
|
||||
widget <- fetch widgetId
|
||||
categories <- activeAnnotationCategories
|
||||
let annotation = newRecord @Annotation
|
||||
render NewView { widget, annotation }
|
||||
render NewView { widget, annotation, categories }
|
||||
|
||||
action CreateAnnotationAction { widgetId } = do
|
||||
widget <- fetch widgetId
|
||||
mUser <- currentUserOrNothing
|
||||
widget <- fetch widgetId
|
||||
categories <- activeAnnotationCategories
|
||||
mUser <- currentUserOrNothing
|
||||
let actorId = fmap (.id) mUser
|
||||
actorType = maybe "anonymous" (const "user") mUser
|
||||
|
||||
category <- paramOrDefault @Text "" "category"
|
||||
categoryResult <- validateAnnotationCategory category
|
||||
|
||||
let annotation = newRecord @Annotation
|
||||
annotation
|
||||
|> fill @'["body", "category", "severity", "parentId", "widgetStateRef"]
|
||||
@@ -52,10 +55,12 @@ instance Controller AnnotationsController where
|
||||
|> set #actorId (fmap (Id . unId) actorId)
|
||||
|> set #actorType actorType
|
||||
|> validateField #body nonEmpty
|
||||
|> validateField #category (`elem` validCategories)
|
||||
|> validateField #severity (`elem` validSeverities)
|
||||
|> (case categoryResult of
|
||||
Left msg -> attachFailure #category msg
|
||||
Right () -> id)
|
||||
|> ifValid \case
|
||||
Left annotation -> render NewView { widget, annotation }
|
||||
Left annotation -> render NewView { widget, annotation, categories }
|
||||
Right annotation -> do
|
||||
createRecord annotation
|
||||
setSuccessMessage "Annotation added"
|
||||
|
||||
Reference in New Issue
Block a user