@rulemetric/local 0.14.0 → 0.14.2

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,22 @@
1
+ -- Pi is an explicitly pinned eval actor. It does not inherit Harbor support.
2
+ ALTER TABLE public.profiles DROP CONSTRAINT profiles_measurement_preferences_check;
3
+ ALTER TABLE public.profiles ADD CONSTRAINT profiles_measurement_preferences_check CHECK (
4
+ measurement_preferences IS NULL OR (
5
+ jsonb_typeof(measurement_preferences) = 'object'
6
+ AND measurement_preferences ?& ARRAY['engine', 'model']
7
+ AND (measurement_preferences - 'engine' - 'model') = '{}'::jsonb
8
+ AND (
9
+ (measurement_preferences->'engine' = 'null'::jsonb AND measurement_preferences->'model' = 'null'::jsonb)
10
+ OR (
11
+ measurement_preferences->>'engine' IN ('claude', 'codex', 'pi')
12
+ AND (
13
+ (measurement_preferences->>'engine' = 'claude' AND measurement_preferences->'model' = 'null'::jsonb)
14
+ OR (jsonb_typeof(measurement_preferences->'model') = 'string'
15
+ AND length(btrim(measurement_preferences->>'model')) BETWEEN 1 AND 200
16
+ AND (measurement_preferences->>'engine' <> 'pi'
17
+ OR btrim(measurement_preferences->>'model') ~ '^[^[:space:]/:]+/[^[:space:]/]+$'))
18
+ )
19
+ )
20
+ )
21
+ ) IS TRUE
22
+ );
@@ -0,0 +1,5 @@
1
+ -- A version number without its body cannot replay what was queued. Never
2
+ -- backfill old rows from today's memory; their historical body is unknown.
3
+ ALTER TABLE public.memory_experiments ADD COLUMN memory_body text;
4
+ COMMENT ON COLUMN public.memory_experiments.memory_body IS
5
+ 'Immutable treatment content captured when queued. NULL on legacy trials; workers verify their version before using a current body.';
@@ -0,0 +1,16 @@
1
+ -- Checklist requests are not accounts or verified marketing subscriptions.
2
+ CREATE TABLE public.marketing_leads (
3
+ id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
4
+ email text NOT NULL CHECK (email = lower(btrim(email)) AND length(email) BETWEEN 3 AND 254),
5
+ asset text NOT NULL CHECK (asset = 'instruction-audit-v1'),
6
+ source text NOT NULL CHECK (source = 'token-triage'),
7
+ marketing_consent boolean NOT NULL DEFAULT false,
8
+ consent_version text NOT NULL CHECK (consent_version = 'marketing-v1'),
9
+ email_verified_at timestamptz,
10
+ created_at timestamptz NOT NULL DEFAULT now(),
11
+ UNIQUE (email, asset)
12
+ );
13
+ ALTER TABLE public.marketing_leads ENABLE ROW LEVEL SECURITY;
14
+ REVOKE ALL ON public.marketing_leads FROM PUBLIC, anon, authenticated;
15
+ COMMENT ON TABLE public.marketing_leads IS
16
+ 'Unverified checklist requests. Never enroll in campaigns without email verification and an unsubscribe workflow. No public reads.';
@@ -0,0 +1,16 @@
1
+ -- 00221 left 00101's no-argument function beside a default-argument overload,
2
+ -- making the weekly call ambiguous. Preserve both signatures without defaults.
3
+ alter function public.prune_old_snapshot_content(integer)
4
+ rename to prune_snapshot_payload_batch;
5
+
6
+ create or replace function public.prune_old_snapshot_content()
7
+ returns text language sql security definer set search_path = public
8
+ as $function$
9
+ select public.prune_snapshot_payload_batch(1000);
10
+ $function$;
11
+
12
+ create function public.prune_old_snapshot_content(p_batch_size integer)
13
+ returns text language sql security definer set search_path = public
14
+ as $function$
15
+ select public.prune_snapshot_payload_batch(p_batch_size);
16
+ $function$;
@@ -0,0 +1,15 @@
1
+ -- Invalid catalog templates free their slot without recording an effect verdict.
2
+ ALTER TABLE instruction_experiments
3
+ DROP CONSTRAINT instruction_experiments_stopped_reason_check;
4
+ ALTER TABLE instruction_experiments
5
+ ADD CONSTRAINT instruction_experiments_stopped_reason_check
6
+ CHECK (stopped_reason IN ('graduated', 'trial_neutral', 'trial_inconclusive', 'content_changed', 'inactive_project', 'invalid_template', 'delivery_refused'));
7
+
8
+ -- The old renderer delivered only the first 2,000 raw characters. Do not pool
9
+ -- those assignments with sessions receiving the full extracted body now.
10
+ -- Conservative for envelopes: restart rather than transfer uncertain evidence.
11
+ UPDATE instruction_experiments e
12
+ SET status = 'stopped', stopped_reason = 'content_changed'
13
+ FROM instructions i
14
+ WHERE e.instruction_id = i.id AND e.status = 'running'
15
+ AND length(i.content) > 2000;