@rulemetric/local 0.17.2 → 0.17.3

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,24 @@
1
+ -- Keep the scheduled producer's canonical candidate view in step with the
2
+ -- public Test command. A project containing only removals, trims or provider
3
+ -- pitches must still receive its daily discovery job. No adoption gate changes.
4
+ create or replace view public.instruction_training_candidate_suggestions as
5
+ select s.id as suggestion_id, s.user_id, s.project_path, s.instruction_id, s.score,
6
+ (select max(se.started_at)
7
+ from project_checkouts pc join sessions se on se.project_id = pc.project_id
8
+ where pc.path = s.project_path and se.user_id = s.user_id) as last_session_activity_at
9
+ from instruction_suggestions s
10
+ join instructions i on i.id = s.instruction_id
11
+ where s.kind in ('add', 'remove', 'trim')
12
+ and s.accepted_at is null and s.dismissed_at is null and s.declined_at is null
13
+ and s.is_stale = false and i.archived = false
14
+ and (i.type in ('instruction', 'rule', 'skill', 'prompt')
15
+ or (i.type = 'feature' and i.frontmatter->>'source' = 'vendor_guidance'))
16
+ and exists (select 1 from public.project_canonical_checkouts c where c.path = s.project_path)
17
+ and not exists (
18
+ select 1 from eval_targets t where t.user_id = s.user_id
19
+ and t.metadata->>'suggestionId' = s.id::text
20
+ and t.metadata->>'sourceInputHash' = md5(i.name || E'\n' || coalesce(i.content, ''))
21
+ );
22
+
23
+ comment on view public.instruction_training_candidate_suggestions is
24
+ 'Canonical scheduled discovery candidates: instruction add/remove/trim or provider guidance, active canonical projects, one testing budget per exact source. enqueue_instruction_training applies the activity window. Adoption consent is independent.';