feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
module Web.Controller.Hubs where
|
|
|
|
|
|
|
|
|
|
import Web.Types
|
|
|
|
|
import Web.View.Hubs.Index
|
|
|
|
|
import Web.View.Hubs.Show
|
|
|
|
|
import Web.View.Hubs.New
|
|
|
|
|
import Web.View.Hubs.Edit
|
feat(P2+P3): IHF Phase 2 complete; register Phase 3 workplan
Phase 2 — Structured Feedback and Triage (IHUB-WP-0002):
- Schema: annotation_threads, requirement_candidates, triage_states,
reviewer_assignments; annotations extended with severity + thread_id
- AnnotationThreadsController: create threads, assign annotations
- RequirementCandidatesController: CRUD, escalation, triage lifecycle,
reviewer assignment, my-queue
- Annotation severity (low/medium/high/critical) with Tailwind color cues
- TriageDashboardAction on HubsController with autoRefresh
- Integration tests (T01–T09), SCOPE.md updated, docs/phase2-summary.md
Phase 3 — Governance and Decision Linkage (IHUB-WP-0003):
- Workplan registered: 9 tasks, State Hub workstream 5f201ee3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 23:37:34 +00:00
|
|
|
import Web.View.Hubs.TriageDashboard
|
2026-03-29 10:38:50 +00:00
|
|
|
import Web.View.Hubs.GovernanceDashboard
|
2026-03-29 12:27:30 +00:00
|
|
|
import Web.View.Hubs.AntifragilityDashboard
|
feat(P5): IHF Phase 5 complete — agent-assisted distillation
Adds bounded AI support to the IHF governance loop. All AI outputs are
attributed (model_ref), reviewable (AgentReviewRecord), and reversible.
No autonomous decisions; no silent requirement promotion.
- T01: Schema — agent_proposals, agent_review_records,
confidence_annotations (migration 1743379200)
- T02: AgentProposalsController (index/show/accept/reject, idempotent
review guard), global nav "Agent" link
- T03: SummarizeClusterAction — Claude API cluster summary on widget show
- T04: DraftRequirementAction — AI requirement draft; acceptance creates
RequirementCandidate (human-gated)
- T05: DetectDuplicatesAction — duplicate_flag proposal on candidate show
- T06: DetectPolicySensitivityAction — policy_flag with
ConfidenceAnnotations per concern scope
- T07: ProposeImplementationAction — impl_proposal from decision show
- T08: AgentAuditDashboardAction — autoRefresh; KPI row, unreviewed queue,
recent proposals, attribution log matrix
- T09: integration tests, SCOPE.md updated, phase5-summary.md, flake.nix
adds http-conduit/aeson/string-conversions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 15:54:33 +00:00
|
|
|
import Web.View.Hubs.AgentAuditDashboard
|
2026-03-29 21:21:21 +00:00
|
|
|
import Web.View.Hubs.AdapterCompatibilityDashboard
|
feat(P7): IHF Phase 7 complete — advanced observability and operational integration
T01 schema: friction_scores, bottleneck_records, hub_health_snapshots,
cross_hub_propagations + migration 1743552000.
T02 Widget Pain Heatmap: computeFrictionScore (formula documented), RecomputeFriction
action, colour-coded grid view (green/yellow/amber/red).
T03 Workflow Bottleneck Analysis: detectBottlenecks across 4 pipeline stages
(candidate 30d, requirement 60d, decision 30d, observation 14d), idempotent,
severity from age ratio, resolve action.
T04 Hub Health Correlation: computeHubHealth (deduction table documented),
append-only HubHealthSnapshot, health history view, badge on hub Show page.
T05 Cross-Hub Propagation: annotation_cluster + widget_type_friction heuristics,
idempotent detection, acknowledge/resolve lifecycle.
T06 Operational Review Board: 4-panel AutoRefresh global dashboard — health matrix,
top-10 friction, bottleneck stage counts, open propagations.
T07 gate: 5 describe blocks in Test/Integration.hs; SCOPE.md updated Phase 7
complete; docs/phase7-summary.md written.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 21:49:22 +00:00
|
|
|
import Web.View.Hubs.FrictionHeatmap
|
|
|
|
|
import Web.View.Hubs.BottleneckDashboard
|
|
|
|
|
import Web.View.Hubs.HubHealthHistory
|
|
|
|
|
import Web.View.Hubs.OperationalReviewBoard
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
import Generated.Types
|
|
|
|
|
import IHP.Prelude
|
|
|
|
|
import IHP.ControllerPrelude
|
2026-03-29 12:27:30 +00:00
|
|
|
import Application.Helper.Controller (regressedWidgetIds, widgetCycleCounts)
|
feat(P7): IHF Phase 7 complete — advanced observability and operational integration
T01 schema: friction_scores, bottleneck_records, hub_health_snapshots,
cross_hub_propagations + migration 1743552000.
T02 Widget Pain Heatmap: computeFrictionScore (formula documented), RecomputeFriction
action, colour-coded grid view (green/yellow/amber/red).
T03 Workflow Bottleneck Analysis: detectBottlenecks across 4 pipeline stages
(candidate 30d, requirement 60d, decision 30d, observation 14d), idempotent,
severity from age ratio, resolve action.
T04 Hub Health Correlation: computeHubHealth (deduction table documented),
append-only HubHealthSnapshot, health history view, badge on hub Show page.
T05 Cross-Hub Propagation: annotation_cluster + widget_type_friction heuristics,
idempotent detection, acknowledge/resolve lifecycle.
T06 Operational Review Board: 4-panel AutoRefresh global dashboard — health matrix,
top-10 friction, bottleneck stage counts, open propagations.
T07 gate: 5 describe blocks in Test/Integration.hs; SCOPE.md updated Phase 7
complete; docs/phase7-summary.md written.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 21:49:22 +00:00
|
|
|
import Application.Helper.FrictionScore (computeFrictionScore)
|
|
|
|
|
import Application.Helper.BottleneckDetector (detectBottlenecks)
|
|
|
|
|
import Application.Helper.HubHealth (computeHubHealth)
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
|
|
|
|
|
instance Controller HubsController where
|
|
|
|
|
beforeAction = ensureIsUser
|
|
|
|
|
|
|
|
|
|
action HubsAction = do
|
|
|
|
|
hubs <- query @Hub |> orderByAsc #createdAt |> fetch
|
|
|
|
|
render IndexView { hubs }
|
|
|
|
|
|
|
|
|
|
action NewHubAction = do
|
|
|
|
|
let hub = newRecord @Hub
|
|
|
|
|
render NewView { hub }
|
|
|
|
|
|
|
|
|
|
action ShowHubAction { hubId } = autoRefresh do
|
|
|
|
|
hub <- fetch hubId
|
|
|
|
|
widgets <- query @Widget
|
|
|
|
|
|> filterWhere (#hubId, hubId)
|
|
|
|
|
|> orderByAsc #name
|
|
|
|
|
|> fetch
|
2026-04-29 10:46:50 +02:00
|
|
|
let widgetIds = map (.id) widgets
|
|
|
|
|
recentEvents <- query @InteractionEvent
|
|
|
|
|
|> filterWhereIn (#widgetId, widgetIds)
|
|
|
|
|
|> orderByDesc #occurredAt
|
|
|
|
|
|> limit 50
|
|
|
|
|
|> fetch
|
|
|
|
|
recentAnnotations <- query @Annotation
|
|
|
|
|
|> filterWhereIn (#widgetId, widgetIds)
|
|
|
|
|
|> orderByDesc #createdAt
|
|
|
|
|
|> limit 20
|
|
|
|
|
|> fetch
|
feat(WP-0009): IHF GAAF Compliance Foundation — type registries, extension manifests, architectural contracts
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>
2026-03-31 21:17:39 +00:00
|
|
|
mManifest <- query @HubCapabilityManifest
|
|
|
|
|
|> filterWhere (#hubId, hubId)
|
|
|
|
|
|> fetchOneOrNothing
|
|
|
|
|
render ShowView { hub, widgets, recentEvents, recentAnnotations, mManifest }
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
|
|
|
|
|
action CreateHubAction = do
|
|
|
|
|
let hub = newRecord @Hub
|
|
|
|
|
hub
|
feat(WP-0009): IHF GAAF Compliance Foundation — type registries, extension manifests, architectural contracts
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>
2026-03-31 21:17:39 +00:00
|
|
|
|> fill @'["slug", "name", "domain", "hubKind"]
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
|> validateField #slug nonEmpty
|
|
|
|
|
|> validateField #name nonEmpty
|
|
|
|
|
|> validateField #domain nonEmpty
|
2026-04-29 10:46:50 +02:00
|
|
|
|> validateField #hubKind (isInList ["domain", "shared"])
|
feat(WP-0009): IHF GAAF Compliance Foundation — type registries, extension manifests, architectural contracts
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>
2026-03-31 21:17:39 +00:00
|
|
|
-- 'framework' cannot be set via the UI
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
|> ifValid \case
|
|
|
|
|
Left hub -> render NewView { hub }
|
|
|
|
|
Right hub -> do
|
|
|
|
|
hub <- createRecord hub
|
|
|
|
|
setSuccessMessage "Hub created"
|
|
|
|
|
redirectTo ShowHubAction { hubId = hub.id }
|
|
|
|
|
|
|
|
|
|
action EditHubAction { hubId } = do
|
|
|
|
|
hub <- fetch hubId
|
|
|
|
|
render EditView { hub }
|
|
|
|
|
|
|
|
|
|
action UpdateHubAction { hubId } = do
|
|
|
|
|
hub <- fetch hubId
|
|
|
|
|
hub
|
feat(WP-0009): IHF GAAF Compliance Foundation — type registries, extension manifests, architectural contracts
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>
2026-03-31 21:17:39 +00:00
|
|
|
|> fill @'["slug", "name", "domain", "hubKind"]
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
|> validateField #slug nonEmpty
|
|
|
|
|
|> validateField #name nonEmpty
|
|
|
|
|
|> validateField #domain nonEmpty
|
2026-04-29 10:46:50 +02:00
|
|
|
|> validateField #hubKind (isInList ["framework", "domain", "shared"])
|
feat(T02-T11): IHF Phase 1 schema, controllers, views, and helpers
- Schema: hubs, widgets, widget_versions, interaction_events (append-only
trigger), annotations, users — single migration file
- Web layer: Types, Routes, FrontController with auth + AutoRefresh layout
- Controllers: Hubs (CRUD), Widgets (CRUD + versioning), InteractionEvents
(JSON capture, canonical event_type validation), Annotations (threaded,
append-only)
- Sessions controller for IHP auth
- Views: Hubs (index/show/new/edit), Widgets (index/show/new/edit),
Annotations (index/new), Sessions (login)
- widgetEnvelope helper with full data-* governance attributes
- Integration tests: Hub CRUD, Widget versioning, event capture, append-only
guard, annotation threading, validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 01:42:43 +00:00
|
|
|
|> ifValid \case
|
|
|
|
|
Left hub -> render EditView { hub }
|
|
|
|
|
Right hub -> do
|
|
|
|
|
updateRecord hub
|
|
|
|
|
setSuccessMessage "Hub updated"
|
|
|
|
|
redirectTo ShowHubAction { hubId = hub.id }
|
|
|
|
|
|
|
|
|
|
action DeleteHubAction { hubId } = do
|
|
|
|
|
hub <- fetch hubId
|
|
|
|
|
deleteRecord hub
|
|
|
|
|
setSuccessMessage "Hub deleted"
|
|
|
|
|
redirectTo HubsAction
|
feat(P2+P3): IHF Phase 2 complete; register Phase 3 workplan
Phase 2 — Structured Feedback and Triage (IHUB-WP-0002):
- Schema: annotation_threads, requirement_candidates, triage_states,
reviewer_assignments; annotations extended with severity + thread_id
- AnnotationThreadsController: create threads, assign annotations
- RequirementCandidatesController: CRUD, escalation, triage lifecycle,
reviewer assignment, my-queue
- Annotation severity (low/medium/high/critical) with Tailwind color cues
- TriageDashboardAction on HubsController with autoRefresh
- Integration tests (T01–T09), SCOPE.md updated, docs/phase2-summary.md
Phase 3 — Governance and Decision Linkage (IHUB-WP-0003):
- Workplan registered: 9 tasks, State Hub workstream 5f201ee3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 23:37:34 +00:00
|
|
|
|
|
|
|
|
action TriageDashboardAction { hubId } = autoRefresh do
|
|
|
|
|
hub <- fetch hubId
|
|
|
|
|
widgets <- query @Widget
|
|
|
|
|
|> filterWhere (#hubId, hubId)
|
|
|
|
|
|> fetch
|
|
|
|
|
let widgetIds = map (.id) widgets
|
|
|
|
|
|
|
|
|
|
-- All candidates for this hub's widgets
|
|
|
|
|
allCandidates <- query @RequirementCandidate
|
|
|
|
|
|> filterWhereIn (#sourceWidgetId, widgetIds)
|
|
|
|
|
|> orderByAsc #createdAt
|
|
|
|
|
|> fetch
|
|
|
|
|
|
|
|
|
|
-- Triage queue: open candidates, oldest first
|
|
|
|
|
let triageQueue = filter (\c -> c.status == "open") allCandidates
|
|
|
|
|
|
|
|
|
|
-- Recent escalations: last 20
|
|
|
|
|
recentEscalations <- query @RequirementCandidate
|
|
|
|
|
|> filterWhereIn (#sourceWidgetId, widgetIds)
|
|
|
|
|
|> orderByDesc #createdAt
|
|
|
|
|
|> limit 20
|
|
|
|
|
|> fetch
|
|
|
|
|
|
|
|
|
|
-- All annotations for category breakdown
|
|
|
|
|
allAnnotations <- query @Annotation
|
|
|
|
|
|> filterWhereIn (#widgetId, widgetIds)
|
|
|
|
|
|> fetch
|
|
|
|
|
|
|
|
|
|
render TriageDashboardView
|
|
|
|
|
{ hub
|
|
|
|
|
, widgets
|
|
|
|
|
, allCandidates
|
|
|
|
|
, triageQueue
|
|
|
|
|
, recentEscalations
|
|
|
|
|
, allAnnotations
|
|
|
|
|
}
|
2026-03-29 10:38:50 +00:00
|
|
|
|
|
|
|
|
action GovernanceDashboardAction { hubId } = autoRefresh do
|
|
|
|
|
hub <- fetch hubId
|
|
|
|
|
widgets <- query @Widget
|
|
|
|
|
|> filterWhere (#hubId, hubId)
|
|
|
|
|
|> fetch
|
|
|
|
|
let widgetIds = map (.id) widgets
|
|
|
|
|
|
|
|
|
|
-- All requirements whose source candidate is in this hub's widgets
|
|
|
|
|
allCandidates <- query @RequirementCandidate
|
|
|
|
|
|> filterWhereIn (#sourceWidgetId, widgetIds)
|
|
|
|
|
|> fetch
|
|
|
|
|
let acceptedCandidateIds = map (.id) (filter (\c -> c.status == "accepted") allCandidates)
|
|
|
|
|
|
|
|
|
|
allRequirements <- query @Requirement
|
|
|
|
|
|> filterWhereIn (#sourceCandidateId, acceptedCandidateIds)
|
|
|
|
|
|> fetch
|
|
|
|
|
|
|
|
|
|
-- Recent decisions (last 20) — scoped to this hub's requirements
|
|
|
|
|
let requirementIds = map (.id) allRequirements
|
|
|
|
|
recentDecisions <- query @DecisionRecord
|
|
|
|
|
|> filterWhereIn (#requirementId, map Just requirementIds)
|
|
|
|
|
|> orderByDesc #decidedAt
|
|
|
|
|
|> limit 20
|
|
|
|
|
|> fetch
|
|
|
|
|
|
|
|
|
|
-- All hub decisions (for outcome counts)
|
|
|
|
|
allDecisions <- query @DecisionRecord
|
|
|
|
|
|> filterWhereIn (#requirementId, map Just requirementIds)
|
|
|
|
|
|> fetch
|
|
|
|
|
|
|
|
|
|
-- All annotations for traceability coverage
|
|
|
|
|
allAnnotations <- query @Annotation
|
|
|
|
|
|> filterWhereIn (#widgetId, widgetIds)
|
|
|
|
|
|> fetch
|
|
|
|
|
|
2026-03-29 12:27:30 +00:00
|
|
|
-- Outcome signals for regression detection
|
|
|
|
|
allSignals <- query @OutcomeSignal
|
|
|
|
|
|> filterWhereIn (#widgetId, widgetIds)
|
|
|
|
|
|> fetch
|
|
|
|
|
|
|
|
|
|
let regressionWidgetIds = regressedWidgetIds allSignals allAnnotations
|
|
|
|
|
|
2026-03-29 10:38:50 +00:00
|
|
|
render GovernanceDashboardView
|
|
|
|
|
{ hub
|
|
|
|
|
, widgets
|
|
|
|
|
, allCandidates
|
|
|
|
|
, allRequirements
|
|
|
|
|
, recentDecisions
|
|
|
|
|
, allDecisions
|
|
|
|
|
, allAnnotations
|
2026-03-29 12:27:30 +00:00
|
|
|
, regressionWidgetIds
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
action AntifragilityDashboardAction { hubId } = autoRefresh do
|
|
|
|
|
hub <- fetch hubId
|
|
|
|
|
widgets <- query @Widget
|
|
|
|
|
|> filterWhere (#hubId, hubId)
|
|
|
|
|
|> fetch
|
|
|
|
|
let widgetIds = map (.id) widgets
|
|
|
|
|
|
|
|
|
|
-- Deployments for this hub's decisions
|
|
|
|
|
allCandidates <- query @RequirementCandidate
|
|
|
|
|
|> filterWhereIn (#sourceWidgetId, widgetIds)
|
|
|
|
|
|> fetch
|
|
|
|
|
let acceptedCandidateIds = map (.id) (filter (\c -> c.status == "accepted") allCandidates)
|
|
|
|
|
allRequirements <- query @Requirement
|
|
|
|
|
|> filterWhereIn (#sourceCandidateId, acceptedCandidateIds)
|
|
|
|
|
|> fetch
|
|
|
|
|
let requirementIds = map (.id) allRequirements
|
|
|
|
|
allDecisions <- query @DecisionRecord
|
|
|
|
|
|> filterWhereIn (#requirementId, map Just requirementIds)
|
|
|
|
|
|> fetch
|
|
|
|
|
let decisionIds = map (.id) allDecisions
|
|
|
|
|
allDeployments <- query @DeploymentRecord
|
|
|
|
|
|> filterWhereIn (#decisionId, decisionIds)
|
|
|
|
|
|> orderByDesc #deployedAt
|
|
|
|
|
|> fetch
|
|
|
|
|
let deploymentIds = map (.id) allDeployments
|
|
|
|
|
allSignals <- query @OutcomeSignal
|
|
|
|
|
|> filterWhereIn (#widgetId, widgetIds)
|
|
|
|
|
|> fetch
|
|
|
|
|
allEvaluations <- query @ChangeEvaluation
|
|
|
|
|
|> filterWhereIn (#deploymentId, deploymentIds)
|
|
|
|
|
|> fetch
|
|
|
|
|
allImplRefs <- query @ImplementationChangeReference
|
|
|
|
|
|> filterWhereIn (#decisionId, decisionIds)
|
|
|
|
|
|> fetch
|
|
|
|
|
allAnnotations <- query @Annotation
|
|
|
|
|
|> filterWhereIn (#widgetId, widgetIds)
|
|
|
|
|
|> fetch
|
|
|
|
|
|
|
|
|
|
let regressionWidgetIds = regressedWidgetIds allSignals allAnnotations
|
|
|
|
|
recurrenceLeaderboard = take 10 (widgetCycleCounts allCandidates allRequirements allDecisions allDeployments)
|
|
|
|
|
|
|
|
|
|
render AntifragilityDashboardView
|
|
|
|
|
{ hub
|
|
|
|
|
, widgets
|
|
|
|
|
, allDeployments
|
|
|
|
|
, allDecisions
|
|
|
|
|
, allSignals
|
|
|
|
|
, allEvaluations
|
|
|
|
|
, allImplRefs
|
|
|
|
|
, regressionWidgetIds
|
|
|
|
|
, recurrenceLeaderboard
|
2026-03-29 10:38:50 +00:00
|
|
|
}
|
feat(P5): IHF Phase 5 complete — agent-assisted distillation
Adds bounded AI support to the IHF governance loop. All AI outputs are
attributed (model_ref), reviewable (AgentReviewRecord), and reversible.
No autonomous decisions; no silent requirement promotion.
- T01: Schema — agent_proposals, agent_review_records,
confidence_annotations (migration 1743379200)
- T02: AgentProposalsController (index/show/accept/reject, idempotent
review guard), global nav "Agent" link
- T03: SummarizeClusterAction — Claude API cluster summary on widget show
- T04: DraftRequirementAction — AI requirement draft; acceptance creates
RequirementCandidate (human-gated)
- T05: DetectDuplicatesAction — duplicate_flag proposal on candidate show
- T06: DetectPolicySensitivityAction — policy_flag with
ConfidenceAnnotations per concern scope
- T07: ProposeImplementationAction — impl_proposal from decision show
- T08: AgentAuditDashboardAction — autoRefresh; KPI row, unreviewed queue,
recent proposals, attribution log matrix
- T09: integration tests, SCOPE.md updated, phase5-summary.md, flake.nix
adds http-conduit/aeson/string-conversions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 15:54:33 +00:00
|
|
|
action AgentAuditDashboardAction { hubId } = autoRefresh do
|
|
|
|
|
hub <- fetch hubId
|
|
|
|
|
proposals <- query @AgentProposal
|
|
|
|
|
|> orderByDesc #createdAt
|
|
|
|
|
|> fetch
|
|
|
|
|
reviews <- query @AgentReviewRecord |> fetch
|
|
|
|
|
widgets <- query @Widget |> fetch
|
|
|
|
|
render AgentAuditDashboardView { hub, proposals, reviews, widgets }
|
2026-03-29 21:21:21 +00:00
|
|
|
|
|
|
|
|
action AdapterCompatibilityDashboardAction { hubId } = autoRefresh do
|
|
|
|
|
hub <- fetch hubId
|
|
|
|
|
specs <- query @WidgetAdapterSpec |> orderByAsc #name |> fetch
|
|
|
|
|
widgets <- query @Widget |> filterWhere (#hubId, hubId) |> fetch
|
|
|
|
|
envelopes <- query @EnvelopeEmissionContract |> filterWhere (#status, "active") |> fetch
|
|
|
|
|
reportings <- query @InteractionReportingContract |> filterWhere (#status, "active") |> fetch
|
|
|
|
|
render AdapterCompatibilityDashboardView { hub, specs, widgets, envelopes, reportings }
|
feat(P7): IHF Phase 7 complete — advanced observability and operational integration
T01 schema: friction_scores, bottleneck_records, hub_health_snapshots,
cross_hub_propagations + migration 1743552000.
T02 Widget Pain Heatmap: computeFrictionScore (formula documented), RecomputeFriction
action, colour-coded grid view (green/yellow/amber/red).
T03 Workflow Bottleneck Analysis: detectBottlenecks across 4 pipeline stages
(candidate 30d, requirement 60d, decision 30d, observation 14d), idempotent,
severity from age ratio, resolve action.
T04 Hub Health Correlation: computeHubHealth (deduction table documented),
append-only HubHealthSnapshot, health history view, badge on hub Show page.
T05 Cross-Hub Propagation: annotation_cluster + widget_type_friction heuristics,
idempotent detection, acknowledge/resolve lifecycle.
T06 Operational Review Board: 4-panel AutoRefresh global dashboard — health matrix,
top-10 friction, bottleneck stage counts, open propagations.
T07 gate: 5 describe blocks in Test/Integration.hs; SCOPE.md updated Phase 7
complete; docs/phase7-summary.md written.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 21:49:22 +00:00
|
|
|
|
|
|
|
|
action FrictionHeatmapAction { hubId } = autoRefresh do
|
|
|
|
|
hub <- fetch hubId
|
|
|
|
|
widgets <- query @Widget |> filterWhere (#hubId, hubId) |> fetch
|
|
|
|
|
let widgetIds = map (.id) widgets
|
|
|
|
|
frictionScores <- query @FrictionScore
|
|
|
|
|
|> filterWhereIn (#widgetId, widgetIds)
|
|
|
|
|
|> fetch
|
|
|
|
|
render FrictionHeatmapView { hub, widgets, frictionScores }
|
|
|
|
|
|
|
|
|
|
action RecomputeFrictionAction { hubId } = do
|
|
|
|
|
hub <- fetch hubId
|
|
|
|
|
widgets <- query @Widget |> filterWhere (#hubId, hubId) |> fetch
|
|
|
|
|
let widgetIds = map (.id) widgets
|
|
|
|
|
annotations <- query @Annotation |> filterWhereIn (#widgetId, widgetIds) |> fetch
|
2026-04-29 10:46:50 +02:00
|
|
|
events <- query @InteractionEvent |> filterWhereIn (#widgetId, widgetIds) |> fetch
|
feat(P7): IHF Phase 7 complete — advanced observability and operational integration
T01 schema: friction_scores, bottleneck_records, hub_health_snapshots,
cross_hub_propagations + migration 1743552000.
T02 Widget Pain Heatmap: computeFrictionScore (formula documented), RecomputeFriction
action, colour-coded grid view (green/yellow/amber/red).
T03 Workflow Bottleneck Analysis: detectBottlenecks across 4 pipeline stages
(candidate 30d, requirement 60d, decision 30d, observation 14d), idempotent,
severity from age ratio, resolve action.
T04 Hub Health Correlation: computeHubHealth (deduction table documented),
append-only HubHealthSnapshot, health history view, badge on hub Show page.
T05 Cross-Hub Propagation: annotation_cluster + widget_type_friction heuristics,
idempotent detection, acknowledge/resolve lifecycle.
T06 Operational Review Board: 4-panel AutoRefresh global dashboard — health matrix,
top-10 friction, bottleneck stage counts, open propagations.
T07 gate: 5 describe blocks in Test/Integration.hs; SCOPE.md updated Phase 7
complete; docs/phase7-summary.md written.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 21:49:22 +00:00
|
|
|
signals <- query @OutcomeSignal |> filterWhereIn (#widgetId, widgetIds) |> fetch
|
|
|
|
|
candidates <- query @RequirementCandidate |> filterWhereIn (#sourceWidgetId, widgetIds) |> fetch
|
|
|
|
|
let regressionWids = regressedWidgetIds signals annotations
|
|
|
|
|
mapM_ (\w ->
|
|
|
|
|
let wAnnotations = filter (\a -> a.widgetId == w.id) annotations
|
|
|
|
|
wEvents = filter (\e -> e.widgetId == w.id) events
|
|
|
|
|
wCandidates = filter (\c -> c.sourceWidgetId == w.id) candidates
|
|
|
|
|
isRegressed = w.id `elem` regressionWids
|
|
|
|
|
in computeFrictionScore w.id wAnnotations wEvents isRegressed wCandidates
|
|
|
|
|
) widgets
|
|
|
|
|
setSuccessMessage "Friction scores recomputed"
|
|
|
|
|
redirectTo FrictionHeatmapAction { hubId }
|
|
|
|
|
|
|
|
|
|
action BottleneckDashboardAction { hubId } = autoRefresh do
|
|
|
|
|
hub <- fetch hubId
|
|
|
|
|
widgets <- query @Widget |> filterWhere (#hubId, hubId) |> fetch
|
|
|
|
|
bottlenecks <- query @BottleneckRecord
|
|
|
|
|
|> filterWhere (#hubId, hubId)
|
|
|
|
|
|> orderByAsc #stalledSince
|
|
|
|
|
|> fetch
|
|
|
|
|
render BottleneckDashboardView { hub, widgets, bottlenecks }
|
|
|
|
|
|
|
|
|
|
action DetectBottlenecksAction { hubId } = do
|
|
|
|
|
hub <- fetch hubId
|
|
|
|
|
widgets <- query @Widget |> filterWhere (#hubId, hubId) |> fetch
|
|
|
|
|
let widgetIds = map (.id) widgets
|
|
|
|
|
candidates <- query @RequirementCandidate |> filterWhereIn (#sourceWidgetId, widgetIds) |> fetch
|
|
|
|
|
let candidateIds = map (.id) candidates
|
|
|
|
|
acceptedIds = map (.id) (filter (\c -> c.status == "accepted") candidates)
|
|
|
|
|
requirements <- query @Requirement |> filterWhereIn (#sourceCandidateId, acceptedIds) |> fetch
|
|
|
|
|
let reqIds = map (.id) requirements
|
|
|
|
|
decisions <- query @DecisionRecord
|
|
|
|
|
|> filterWhereIn (#requirementId, map Just reqIds)
|
|
|
|
|
|> fetch
|
|
|
|
|
let decisionIds = map (.id) decisions
|
|
|
|
|
deployments <- query @DeploymentRecord |> filterWhereIn (#decisionId, decisionIds) |> fetch
|
|
|
|
|
_ <- detectBottlenecks hubId widgets candidates requirements decisions deployments
|
|
|
|
|
setSuccessMessage "Bottleneck detection complete"
|
|
|
|
|
redirectTo BottleneckDashboardAction { hubId }
|
|
|
|
|
|
|
|
|
|
action ResolveBottleneckAction { bottleneckRecordId } = do
|
|
|
|
|
bottleneck <- fetch bottleneckRecordId
|
|
|
|
|
now <- getCurrentTime
|
|
|
|
|
bottleneck |> set #resolvedAt (Just now) |> updateRecord
|
|
|
|
|
setSuccessMessage "Bottleneck resolved"
|
|
|
|
|
redirectTo BottleneckDashboardAction { hubId = bottleneck.hubId }
|
|
|
|
|
|
|
|
|
|
action SnapshotHubHealthAction { hubId } = do
|
|
|
|
|
hub <- fetch hubId
|
|
|
|
|
widgets <- query @Widget |> filterWhere (#hubId, hubId) |> fetch
|
|
|
|
|
let widgetIds = map (.id) widgets
|
|
|
|
|
candidates <- query @RequirementCandidate |> filterWhereIn (#sourceWidgetId, widgetIds) |> fetch
|
|
|
|
|
let acceptedIds = map (.id) (filter (\c -> c.status == "accepted") candidates)
|
|
|
|
|
requirements <- query @Requirement |> filterWhereIn (#sourceCandidateId, acceptedIds) |> fetch
|
|
|
|
|
let reqIds = map (.id) requirements
|
|
|
|
|
decisions <- query @DecisionRecord |> filterWhereIn (#requirementId, map Just reqIds) |> fetch
|
|
|
|
|
let decisionIds = map (.id) decisions
|
|
|
|
|
deployments <- query @DeploymentRecord |> filterWhereIn (#decisionId, decisionIds) |> fetch
|
|
|
|
|
signals <- query @OutcomeSignal |> filterWhereIn (#widgetId, widgetIds) |> fetch
|
|
|
|
|
annotations <- query @Annotation |> filterWhereIn (#widgetId, widgetIds) |> fetch
|
|
|
|
|
bottlenecks <- query @BottleneckRecord
|
|
|
|
|
|> filterWhere (#hubId, hubId)
|
|
|
|
|
|> filterWhereSql (#resolvedAt, "IS NULL")
|
|
|
|
|
|> fetch
|
|
|
|
|
_ <- computeHubHealth hubId widgets candidates decisions deployments signals annotations bottlenecks
|
|
|
|
|
setSuccessMessage "Hub health snapshot taken"
|
|
|
|
|
redirectTo HubHealthHistoryAction { hubId }
|
|
|
|
|
|
|
|
|
|
action HubHealthHistoryAction { hubId } = autoRefresh do
|
|
|
|
|
hub <- fetch hubId
|
|
|
|
|
snapshots <- query @HubHealthSnapshot
|
|
|
|
|
|> filterWhere (#hubId, hubId)
|
|
|
|
|
|> orderByDesc #computedAt
|
|
|
|
|
|> fetch
|
|
|
|
|
render HubHealthHistoryView { hub, snapshots }
|
|
|
|
|
|
|
|
|
|
action OperationalReviewBoardAction = autoRefresh do
|
|
|
|
|
hubs <- query @Hub |> orderByAsc #name |> fetch
|
|
|
|
|
allSnapshots <- query @HubHealthSnapshot |> orderByDesc #computedAt |> fetch
|
|
|
|
|
topFrictionScores <- query @FrictionScore |> orderByDesc #score |> limit 10 |> fetch
|
|
|
|
|
topWidgets <- mapM (\fs -> fetch fs.widgetId) topFrictionScores
|
|
|
|
|
bottlenecks <- query @BottleneckRecord
|
|
|
|
|
|> filterWhereSql (#resolvedAt, "IS NULL")
|
|
|
|
|
|> orderByAsc #stage
|
|
|
|
|
|> fetch
|
|
|
|
|
propagations <- query @CrossHubPropagation
|
|
|
|
|
|> orderByDesc #detectedAt
|
|
|
|
|
|> fetch
|
|
|
|
|
let openPropagations = filter (\p -> p.status `elem` ["open","acknowledged"]) propagations
|
|
|
|
|
render OperationalReviewBoardView
|
|
|
|
|
{ hubs
|
|
|
|
|
, allSnapshots
|
|
|
|
|
, topFrictionScores
|
|
|
|
|
, topWidgets
|
|
|
|
|
, bottlenecks
|
|
|
|
|
, openPropagations
|
|
|
|
|
}
|