@rulemetric/local 0.15.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ -- Exploration has its own prospective admission contract; it does not invent a
2
+ -- positive frozen study. Existing confirmations retain their source requirement.
3
+ alter table public.scoped_live_confirmations alter column source_study_id drop not null;
4
+ alter table public.scoped_live_confirmations add constraint scoped_live_source_mode check ((
5
+ (coalesce(protocol->>'mode', 'confirmation') = 'confirmation' and source_study_id is not null)
6
+ or (protocol->>'mode' = 'exploration' and source_study_id is null
7
+ and protocol->'research'->>'adoptionPolicy' = 'no-adoption'
8
+ and protocol->'verification'->>'kind' = 'artifact-checks')
9
+ ) is true);
@@ -0,0 +1,14 @@
1
+ -- Preserve the actual pre-treatment work request independently of a launch job lifecycle.
2
+ alter table public.scoped_live_confirmation_assignments add column task_evidence jsonb;
3
+
4
+ create or replace function public.guard_scoped_live_assignment() returns trigger
5
+ language plpgsql set search_path = public as $$
6
+ begin
7
+ if row(new.id,new.confirmation_id,new.user_id,new.task_id,new.external_session_id,new.arm,new.phase,new.model,new.configuration_hash,new.enrollment_evidence,new.task_evidence,new.assigned_at)
8
+ is distinct from row(old.id,old.confirmation_id,old.user_id,old.task_id,old.external_session_id,old.arm,old.phase,old.model,old.configuration_hash,old.enrollment_evidence,old.task_evidence,old.assigned_at)
9
+ or (old.delivered_at is not null and row(new.delivered_at,new.delivery_hash) is distinct from row(old.delivered_at,old.delivery_hash))
10
+ or (old.outcome_at is not null and row(new.outcome_at,new.outcome,new.outcome_detail) is distinct from row(old.outcome_at,old.outcome,old.outcome_detail)) then
11
+ raise exception 'Scoped assignment identity, delivery and outcome evidence are immutable';
12
+ end if;
13
+ return new;
14
+ end $$;