fix(WP-0014/A2): continued type-correctness fixes and Tailwind CSS output

- Schema.sql: add FK constraints for phases 6–12 so IHP generates Id X
  instead of UUID for FK columns (widget_adapter_specs, friction_scores,
  hub_routing_rules, agent_proposals, hub_capability_manifests, etc.)
- HubHealth, ModelRouter, ApiInteractionEvents: remove toUUID() wrappers
  now that FK columns carry proper Id types
- FederatedGovernance/Dashboard, HubRoutingRules/Index: same Id comparison fix
- AgentProposals/Index, DecisionRecords/Index, ApiConsumers/Edit: Id type fixes
- BottleneckDetector: add Data.Coerce import; CrossHubPropagation: add guard
- ApiKeys: qualify cryptohash-sha256 import to resolve package ambiguity
- WebhookDeliveryJob: use LBS.fromStrict; remove duplicate diffUTCTime
- Sessions/New: use renderFlashMessages (IHP built-in)
- ArchiveRecords/LineageInspector: simplify renderChainStep signature
- static/app.css: Tailwind CSS output (2011 lines) — A3 confirmed
- workplans/IHUB-WP-0015-local-deployment-intro-ui.md: add workplan

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-08 01:49:41 +00:00
parent 34cc18b4c7
commit 74bab5f6f2
17 changed files with 2218 additions and 32 deletions

View File

@@ -1053,3 +1053,93 @@ ALTER TABLE agent_review_records ADD FOREIGN KEY (proposal_id) REFERENCES agent_
ALTER TABLE confidence_annotations ADD FOREIGN KEY (proposal_id) REFERENCES agent_proposals(id);
ALTER TABLE institutional_knowledge_entries ADD FOREIGN KEY (hub_id) REFERENCES hubs(id);
ALTER TABLE institutional_knowledge_entries ADD FOREIGN KEY (decision_record_id) REFERENCES decision_records(id);
-- Additional FK constraints for IHP type generation (Id vs UUID)
-- Phase 6 — widget_adapter_specs
ALTER TABLE widget_adapter_specs ADD FOREIGN KEY (envelope_contract_id) REFERENCES envelope_emission_contracts(id);
ALTER TABLE widget_adapter_specs ADD FOREIGN KEY (reporting_contract_id) REFERENCES interaction_reporting_contracts(id);
ALTER TABLE widgets ADD FOREIGN KEY (adapter_spec_id) REFERENCES widget_adapter_specs(id);
-- Phase 7 — friction_scores, bottleneck_records, hub_health_snapshots
ALTER TABLE friction_scores ADD FOREIGN KEY (widget_id) REFERENCES widgets(id);
ALTER TABLE bottleneck_records ADD FOREIGN KEY (hub_id) REFERENCES hubs(id);
ALTER TABLE hub_health_snapshots ADD FOREIGN KEY (hub_id) REFERENCES hubs(id);
ALTER TABLE cross_hub_propagations ADD FOREIGN KEY (source_hub_id) REFERENCES hubs(id);
-- Phase 8 — widget_ownerships, hub_routing_rules, stewardship_roles
ALTER TABLE widget_ownerships ADD FOREIGN KEY (widget_id) REFERENCES widgets(id);
ALTER TABLE widget_ownerships ADD FOREIGN KEY (owner_hub_id) REFERENCES hubs(id);
ALTER TABLE widget_ownerships ADD FOREIGN KEY (steward_hub_id) REFERENCES hubs(id);
ALTER TABLE hub_routing_rules ADD FOREIGN KEY (source_hub_id) REFERENCES hubs(id);
ALTER TABLE hub_routing_rules ADD FOREIGN KEY (target_hub_id) REFERENCES hubs(id);
ALTER TABLE stewardship_roles ADD FOREIGN KEY (hub_id) REFERENCES hubs(id);
ALTER TABLE requirement_candidates ADD FOREIGN KEY (routed_to_hub_id) REFERENCES hubs(id);
-- User actor references (nullable)
ALTER TABLE annotation_threads ADD FOREIGN KEY (created_by) REFERENCES users(id);
ALTER TABLE requirement_candidates ADD FOREIGN KEY (created_by) REFERENCES users(id);
ALTER TABLE triage_states ADD FOREIGN KEY (changed_by) REFERENCES users(id);
ALTER TABLE requirements ADD FOREIGN KEY (created_by) REFERENCES users(id);
ALTER TABLE decision_records ADD FOREIGN KEY (decided_by) REFERENCES users(id);
ALTER TABLE policy_references ADD FOREIGN KEY (created_by) REFERENCES users(id);
ALTER TABLE implementation_change_references ADD FOREIGN KEY (linked_by) REFERENCES users(id);
ALTER TABLE deployment_records ADD FOREIGN KEY (deployed_by) REFERENCES users(id);
ALTER TABLE agent_review_records ADD FOREIGN KEY (reviewer_id) REFERENCES users(id);
-- change_evaluations
ALTER TABLE change_evaluations ADD FOREIGN KEY (deployment_id) REFERENCES deployment_records(id);
ALTER TABLE change_evaluations ADD FOREIGN KEY (decision_id) REFERENCES decision_records(id);
ALTER TABLE change_evaluations ADD FOREIGN KEY (evaluated_by) REFERENCES users(id);
-- agent_proposals source refs
ALTER TABLE agent_proposals ADD FOREIGN KEY (source_widget_id) REFERENCES widgets(id);
ALTER TABLE agent_proposals ADD FOREIGN KEY (source_candidate_id) REFERENCES requirement_candidates(id);
ALTER TABLE agent_proposals ADD FOREIGN KEY (source_thread_id) REFERENCES annotation_threads(id);
ALTER TABLE agent_proposals ADD FOREIGN KEY (source_decision_id) REFERENCES decision_records(id);
ALTER TABLE agent_proposals ADD FOREIGN KEY (agent_registration_id) REFERENCES agent_registrations(id);
-- GAAF type registry owner refs (nullable)
ALTER TABLE widget_type_registry ADD FOREIGN KEY (owner_hub_id) REFERENCES hubs(id);
ALTER TABLE event_type_registry ADD FOREIGN KEY (owner_hub_id) REFERENCES hubs(id);
ALTER TABLE annotation_category_registry ADD FOREIGN KEY (owner_hub_id) REFERENCES hubs(id);
ALTER TABLE policy_scope_registry ADD FOREIGN KEY (owner_hub_id) REFERENCES hubs(id);
-- hub_capability_manifests
ALTER TABLE hub_capability_manifests ADD FOREIGN KEY (hub_id) REFERENCES hubs(id);
-- Phase 9 — api_consumers, webhook_deliveries, api_request_log
ALTER TABLE api_consumers ADD FOREIGN KEY (hub_capability_manifest_id) REFERENCES hub_capability_manifests(id);
ALTER TABLE webhook_deliveries ADD FOREIGN KEY (webhook_subscription_id) REFERENCES webhook_subscriptions(id);
ALTER TABLE api_request_log ADD FOREIGN KEY (api_consumer_id) REFERENCES api_consumers(id);
-- Phase 10 — widget_patterns, pattern_adoptions, governance_templates
ALTER TABLE widget_patterns ADD FOREIGN KEY (hub_id) REFERENCES hubs(id);
ALTER TABLE widget_pattern_versions ADD FOREIGN KEY (widget_pattern_id) REFERENCES widget_patterns(id);
ALTER TABLE pattern_adoptions ADD FOREIGN KEY (adopting_hub_id) REFERENCES hubs(id);
ALTER TABLE pattern_adoptions ADD FOREIGN KEY (pinned_version_id) REFERENCES widget_pattern_versions(id);
ALTER TABLE governance_templates ADD FOREIGN KEY (hub_id) REFERENCES hubs(id);
ALTER TABLE governance_template_clones ADD FOREIGN KEY (governance_template_id) REFERENCES governance_templates(id);
ALTER TABLE governance_template_clones ADD FOREIGN KEY (cloning_hub_id) REFERENCES hubs(id);
-- Phase 11 — agent_registrations, model_routing_policies, agent_delegations, collective_proposals
ALTER TABLE agent_registrations ADD FOREIGN KEY (hub_id) REFERENCES hubs(id);
ALTER TABLE model_routing_policies ADD FOREIGN KEY (hub_id) REFERENCES hubs(id);
ALTER TABLE model_routing_policies ADD FOREIGN KEY (agent_registration_id) REFERENCES agent_registrations(id);
ALTER TABLE agent_delegations ADD FOREIGN KEY (delegating_agent_id) REFERENCES agent_registrations(id);
ALTER TABLE agent_delegations ADD FOREIGN KEY (receiving_agent_id) REFERENCES agent_registrations(id);
ALTER TABLE agent_delegations ADD FOREIGN KEY (parent_proposal_id) REFERENCES agent_proposals(id);
ALTER TABLE collective_proposals ADD FOREIGN KEY (source_widget_id) REFERENCES widgets(id);
ALTER TABLE collective_proposals ADD FOREIGN KEY (source_candidate_id) REFERENCES requirement_candidates(id);
ALTER TABLE collective_proposal_contributions ADD FOREIGN KEY (collective_proposal_id) REFERENCES collective_proposals(id);
ALTER TABLE collective_proposal_contributions ADD FOREIGN KEY (agent_registration_id) REFERENCES agent_registrations(id);
ALTER TABLE ai_governance_policies ADD FOREIGN KEY (hub_id) REFERENCES hubs(id);
ALTER TABLE ai_governance_policies ADD FOREIGN KEY (agent_registration_id) REFERENCES agent_registrations(id);
ALTER TABLE agent_performance_records ADD FOREIGN KEY (agent_registration_id) REFERENCES agent_registrations(id);
ALTER TABLE agent_performance_records ADD FOREIGN KEY (hub_id) REFERENCES hubs(id);
-- Phase 12 — outcome_correlations, pattern_performance_records, adaptive_threshold_configs, learning_insights
ALTER TABLE outcome_correlations ADD FOREIGN KEY (hub_id) REFERENCES hubs(id);
ALTER TABLE pattern_performance_records ADD FOREIGN KEY (widget_pattern_id) REFERENCES widget_patterns(id);
ALTER TABLE pattern_performance_records ADD FOREIGN KEY (hub_id) REFERENCES hubs(id);
ALTER TABLE adaptive_threshold_configs ADD FOREIGN KEY (hub_id) REFERENCES hubs(id);
ALTER TABLE learning_insights ADD FOREIGN KEY (hub_id) REFERENCES hubs(id);