generated from coulomb/repo-seed
feat(P4): IHF Phase 4 complete — Outcome Observation and Antifragility Loop
Some checks failed
Test / test (push) Has been cancelled
Some checks failed
Test / test (push) Has been cancelled
Closes the IHF improvement loop. Full antifragility chain now traversable: Widget → Annotation → Candidate → Requirement → Decision → Deployment → OutcomeSignal New artifacts: - DeploymentRecord (immutable, links DecisionRecord to a deployed version) - OutcomeSignal (append-only; DB trigger prevents UPDATE/DELETE) - ChangeEvaluation (one-per-deployment; UNIQUE constraint; 1–5 score) New capabilities: - DeploymentRecordsController (index, show, new, create) - RecordOutcomeSignalAction — capture improved/regressed/neutral/inconclusive signals - Pre/post comparison panel on deployment show (±30-day event/annotation counts) - Regression detection — improved signal followed by high/critical annotation - ChangeEvaluation — idempotent score+rationale per deployment - Recurrence tracking — cycle count per widget, leaderboard - AntifragilityDashboardAction (autoRefresh, 5 panels) per hub - Phase 4 integration tests (T01–T08 logic coverage) - docs/phase4-summary.md; SCOPE.md updated to Phase 4 complete State Hub: workstream 07e9c860 → completed Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -205,3 +205,61 @@ CREATE INDEX impl_change_refs_decision_id_idx ON implementation_change_reference
|
||||
|
||||
-- Back-reference: which candidate was promoted to a requirement (Phase 3)
|
||||
ALTER TABLE requirement_candidates ADD COLUMN requirement_id UUID REFERENCES requirements(id) ON DELETE SET NULL;
|
||||
|
||||
-- Deployment records — connect decisions to deployed versions (Phase 4)
|
||||
CREATE TABLE deployment_records (
|
||||
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
||||
impl_ref_id UUID REFERENCES implementation_change_references(id) ON DELETE SET NULL,
|
||||
decision_id UUID NOT NULL REFERENCES decision_records(id) ON DELETE RESTRICT,
|
||||
version_ref TEXT NOT NULL,
|
||||
deployed_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
||||
deployed_by UUID REFERENCES users(id),
|
||||
notes TEXT,
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX deployment_records_decision_id_idx ON deployment_records (decision_id);
|
||||
CREATE INDEX deployment_records_deployed_at_idx ON deployment_records (deployed_at DESC);
|
||||
|
||||
-- Outcome signals — append-only observation of widget behaviour post-deployment (Phase 4)
|
||||
CREATE TABLE outcome_signals (
|
||||
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
||||
widget_id UUID NOT NULL REFERENCES widgets(id) ON DELETE CASCADE,
|
||||
deployment_id UUID NOT NULL REFERENCES deployment_records(id) ON DELETE CASCADE,
|
||||
signal_type TEXT NOT NULL,
|
||||
value NUMERIC,
|
||||
observed_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX outcome_signals_widget_id_idx ON outcome_signals (widget_id);
|
||||
CREATE INDEX outcome_signals_deployment_id_idx ON outcome_signals (deployment_id);
|
||||
CREATE INDEX outcome_signals_observed_at_idx ON outcome_signals (observed_at DESC);
|
||||
|
||||
CREATE OR REPLACE FUNCTION prevent_outcome_signal_mutation()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
RAISE EXCEPTION 'outcome_signals is append-only: UPDATE and DELETE are not permitted';
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER outcome_signals_no_update
|
||||
BEFORE UPDATE ON outcome_signals
|
||||
FOR EACH ROW EXECUTE FUNCTION prevent_outcome_signal_mutation();
|
||||
|
||||
CREATE TRIGGER outcome_signals_no_delete
|
||||
BEFORE DELETE ON outcome_signals
|
||||
FOR EACH ROW EXECUTE FUNCTION prevent_outcome_signal_mutation();
|
||||
|
||||
-- Change evaluations — one score per deployment (Phase 4)
|
||||
CREATE TABLE change_evaluations (
|
||||
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
|
||||
deployment_id UUID NOT NULL REFERENCES deployment_records(id) ON DELETE CASCADE,
|
||||
decision_id UUID REFERENCES decision_records(id) ON DELETE SET NULL,
|
||||
score SMALLINT NOT NULL CHECK (score BETWEEN 1 AND 5),
|
||||
rationale TEXT NOT NULL,
|
||||
evaluated_by UUID REFERENCES users(id),
|
||||
evaluated_at TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
|
||||
UNIQUE (deployment_id)
|
||||
);
|
||||
|
||||
CREATE INDEX change_evaluations_deployment_id_idx ON change_evaluations (deployment_id);
|
||||
|
||||
Reference in New Issue
Block a user