generated from coulomb/repo-seed
Some checks failed
Test / test (push) Has been cancelled
Delivers the hub registry discovery UI, widget pattern library, governance template library, and marketplace dashboard. Key changes: - Schema: widget_patterns (widget_type FK to registry), widget_pattern_versions, pattern_adoptions, governance_templates (categories JSONB, validated at controller), governance_template_clones — all GAAF-compliant, no bare TEXT type discriminators - Migration: 1743897600-ihf-phase10-hub-registry.sql - HubRegistry controller + views: browsable view over hub_capability_manifests, hub_health_snapshots, hubs with per-hub GAAF compliance indicator - WidgetPatterns controller + views: publish, version, adopt; adoption triggers manifest amendment draft when new types are introduced - GovernanceTemplates controller + views: CRUD, clone with category validation against annotation_category_registry - MarketplaceDashboard controller + view: full-text search, widget-type filter, sort, trending panel, autoRefresh - API v2: /api/v2/hub-registry, /api/v2/widget-patterns (+ adopt endpoint) - OpenAPI spec updated with Phase 10 paths - GAAF scorecard: Customization 2.5 → 3.2; overall 3.41 → 3.56 (Strong) - CLAUDE.md: Phase 10 complete; active workplan → Phase 11 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
84 lines
3.9 KiB
SQL
84 lines
3.9 KiB
SQL
-- IHF Phase 10 — Hub Registry and Widget Marketplace
|
|
-- IHUB-WP-0011-T01: widget_patterns, widget_pattern_versions, pattern_adoptions,
|
|
-- governance_templates, governance_template_clones
|
|
--
|
|
-- GAAF constraints:
|
|
-- widget_patterns.widget_type FKs to widget_type_registry(name)
|
|
-- governance_templates.categories is JSONB; validated at controller layer
|
|
-- No HubRegistry table — hub registry is a view over existing tables
|
|
|
|
-- widget_patterns: reusable widget definitions tied to registered types
|
|
CREATE TABLE widget_patterns (
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
hub_id UUID NOT NULL REFERENCES hubs(id),
|
|
name TEXT NOT NULL,
|
|
description TEXT,
|
|
widget_type TEXT NOT NULL REFERENCES widget_type_registry(name),
|
|
is_cross_hub BOOLEAN NOT NULL DEFAULT FALSE,
|
|
is_published BOOLEAN NOT NULL DEFAULT FALSE,
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL
|
|
);
|
|
|
|
CREATE INDEX widget_patterns_hub_id_idx ON widget_patterns (hub_id);
|
|
CREATE INDEX widget_patterns_widget_type_idx ON widget_patterns (widget_type);
|
|
CREATE INDEX widget_patterns_is_published_idx ON widget_patterns (is_published);
|
|
|
|
-- widget_pattern_versions: explicit version history
|
|
CREATE TABLE widget_pattern_versions (
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
widget_pattern_id UUID NOT NULL REFERENCES widget_patterns(id) ON DELETE CASCADE,
|
|
version_number INTEGER NOT NULL,
|
|
definition JSONB NOT NULL,
|
|
changelog TEXT,
|
|
published_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
|
UNIQUE (widget_pattern_id, version_number)
|
|
);
|
|
|
|
CREATE INDEX widget_pattern_versions_pattern_idx ON widget_pattern_versions (widget_pattern_id);
|
|
|
|
-- pattern_adoptions: which hubs have adopted which patterns
|
|
CREATE TABLE pattern_adoptions (
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
widget_pattern_id UUID NOT NULL REFERENCES widget_patterns(id),
|
|
adopting_hub_id UUID NOT NULL REFERENCES hubs(id),
|
|
pinned_version_id UUID REFERENCES widget_pattern_versions(id),
|
|
is_version_pinned BOOLEAN NOT NULL DEFAULT FALSE,
|
|
is_anonymous BOOLEAN NOT NULL DEFAULT FALSE,
|
|
adopted_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
|
UNIQUE (widget_pattern_id, adopting_hub_id)
|
|
);
|
|
|
|
CREATE INDEX pattern_adoptions_pattern_idx ON pattern_adoptions (widget_pattern_id);
|
|
CREATE INDEX pattern_adoptions_hub_idx ON pattern_adoptions (adopting_hub_id);
|
|
|
|
-- governance_templates: requirement distillation and decision templates
|
|
-- categories: JSONB array of annotation_category_registry names
|
|
-- validated at the controller layer (array FK not expressible in SQL)
|
|
CREATE TABLE governance_templates (
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
hub_id UUID NOT NULL REFERENCES hubs(id),
|
|
name TEXT NOT NULL,
|
|
description TEXT,
|
|
categories JSONB NOT NULL DEFAULT '[]',
|
|
template_body JSONB NOT NULL,
|
|
is_published BOOLEAN NOT NULL DEFAULT FALSE,
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL
|
|
);
|
|
|
|
CREATE INDEX governance_templates_hub_id_idx ON governance_templates (hub_id);
|
|
CREATE INDEX governance_templates_is_published_idx ON governance_templates (is_published);
|
|
|
|
-- governance_template_clones: adoption record for governance templates
|
|
CREATE TABLE governance_template_clones (
|
|
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
|
governance_template_id UUID NOT NULL REFERENCES governance_templates(id),
|
|
cloning_hub_id UUID NOT NULL REFERENCES hubs(id),
|
|
cloned_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
|
UNIQUE (governance_template_id, cloning_hub_id)
|
|
);
|
|
|
|
CREATE INDEX governance_template_clones_template_idx ON governance_template_clones (governance_template_id);
|
|
CREATE INDEX governance_template_clones_hub_idx ON governance_template_clones (cloning_hub_id);
|