@consiliency/agent-board-schema 1.64.0 → 1.74.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.
Files changed (171) hide show
  1. package/README.md +19 -0
  2. package/fixtures/already-applied.json +44 -4
  3. package/migrations/20261015000100_agent_board_session_provenance.sql +367 -0
  4. package/migrations/20261015000200_agent_board_request_preserve_removed.sql +87 -0
  5. package/migrations/20261015000300_agent_board_rls_correlation.sql +132 -0
  6. package/migrations/20261015000400_agent_board_resolution_authority.sql +146 -0
  7. package/migrations/20261026000100_agent_board_thread_association.sql +1287 -0
  8. package/migrations/20261101000100_agent_board_session_measured_mint.sql +145 -0
  9. package/migrations/20261104065658_agent_board_reply_delivery.sql +659 -0
  10. package/migrations/20261104170000_agent_board_tasking_replay_scope.sql +320 -0
  11. package/migrations/20261104180000_agent_board_delivery_writer_execute.sql +51 -0
  12. package/migrations/20261104190000_agent_board_message_replay_scope.sql +373 -0
  13. package/package.json +1 -1
  14. package/schema-manifest.json +93 -3
  15. package/src/deployment-drift-main.test.mjs +156 -0
  16. package/src/deployment-drift-script.test.mjs +14 -1
  17. package/src/policy-comment.test.mjs +17 -0
  18. package/src/tooling.test.mjs +12 -2
  19. package/tests/agent_board_661_reply_delivery.test.sql +185 -0
  20. package/tests/agent_board_667_boundary.test.sql +162 -0
  21. package/tests/agent_board_667_conversion_branches.test.sql +91 -0
  22. package/tests/agent_board_667_conversion_profile.test.sql +112 -0
  23. package/tests/agent_board_667_history_class.test.sql +785 -0
  24. package/tests/agent_board_667_native_cast_effect.test.sql +88 -0
  25. package/tests/agent_board_667_realtime_apply_behavior.test.sql +117 -0
  26. package/tests/agent_board_667_realtime_apply_controls.test.sql +143 -0
  27. package/tests/agent_board_667_realtime_apply_profile.test.sql +61 -0
  28. package/tests/agent_board_667_retention.test.sql +201 -0
  29. package/tests/agent_board_667_routing.test.sql +294 -0
  30. package/tests/agent_board_667_sender_effects.test.sql +100 -0
  31. package/tests/agent_board_667_sender_profile_controls.test.sql +29 -0
  32. package/tests/agent_board_667_storage_delimiter_behavior.test.sql +84 -0
  33. package/tests/agent_board_667_storage_delimiter_controls.test.sql +23 -0
  34. package/tests/agent_board_667_storage_delimiter_profile.test.sql +61 -0
  35. package/tests/agent_board_667_storage_search_behavior.test.sql +93 -0
  36. package/tests/agent_board_667_storage_search_controls.test.sql +22 -0
  37. package/tests/agent_board_667_storage_search_profile.test.sql +60 -0
  38. package/tests/agent_board_667_storage_timestamp_behavior.test.sql +58 -0
  39. package/tests/agent_board_667_storage_timestamp_controls.test.sql +22 -0
  40. package/tests/agent_board_667_storage_timestamp_profile.test.sql +54 -0
  41. package/tests/agent_board_667_writers.test.sql +281 -0
  42. package/tests/agent_board_717_message_replay_scope.test.sql +828 -0
  43. package/tests/agent_board_717_tasking_replay_scope.test.sql +661 -0
  44. package/tests/agent_board_addressing.test.sql +8 -5
  45. package/tests/agent_board_claim_subject_gate.test.sql +7 -3
  46. package/tests/agent_board_claimpolicy_race.test.sql +39 -11
  47. package/tests/agent_board_consent_gating.test.sql +4 -4
  48. package/tests/agent_board_delegate_role_class.test.sql +33 -15
  49. package/tests/agent_board_delivery_writer_execute.test.sql +371 -0
  50. package/tests/agent_board_fk_lock_edges.test.sql +3 -0
  51. package/tests/agent_board_gatenull_membstate.test.sql +7 -4
  52. package/tests/agent_board_hosted_delegates.test.sql +5 -2
  53. package/tests/agent_board_inbox_rpcs.test.sql +5 -3
  54. package/tests/agent_board_obsgate.test.sql +8 -4
  55. package/tests/agent_board_obsgate4.test.sql +2 -2
  56. package/tests/agent_board_outbox_wake_ordering.test.sql +25 -2
  57. package/tests/agent_board_own_post_not_delivered.test.sql +11 -9
  58. package/tests/agent_board_policy_correlation.test.sql +189 -0
  59. package/tests/agent_board_request_removed.test.sql +96 -0
  60. package/tests/agent_board_resolution_authority.test.sql +190 -0
  61. package/tests/agent_board_session_identity_behavior_classes.test.sql +2 -2
  62. package/tests/agent_board_session_identity_limits.test.sql +1 -1
  63. package/tests/agent_board_session_identity_measured_mint.test.sql +342 -0
  64. package/tests/agent_board_session_identity_predicate_isolation.test.sql +146 -0
  65. package/tests/agent_board_session_provenance.test.sql +106 -0
  66. package/tests/agent_board_sidserver_authority.test.sql +69 -0
  67. package/tests/agent_board_sidserver_catalog.test.sql +47 -0
  68. package/tests/agent_board_signed_write_gateway.test.sql +4 -2
  69. package/tests/agent_board_task_thread_lock_order.test.sql +67 -42
  70. package/tests/agent_board_v2_invariants.test.sql +5 -2
  71. package/tests/agent_board_write_enforcement_class.test.sql +3 -3
  72. package/tests/catalog/function_execute_privileges.json +43 -7
  73. package/tests/catalog/p_metadata_parameters.json +16 -0
  74. package/tests/fixtures/agent_board_667_apply_rls_guard.sql +195 -0
  75. package/tests/fixtures/agent_board_667_apply_rls_provenance.md +125 -0
  76. package/tests/fixtures/agent_board_667_apply_rls_reference.sql +1903 -0
  77. package/tests/fixtures/agent_board_667_conversion_guard.sql +162 -0
  78. package/tests/fixtures/agent_board_667_conversion_reference.md +23 -0
  79. package/tests/fixtures/agent_board_667_conversion_reference.sql +5325 -0
  80. package/tests/fixtures/agent_board_667_delimiter_guard.sql +92 -0
  81. package/tests/fixtures/agent_board_667_delimiter_provenance.md +116 -0
  82. package/tests/fixtures/agent_board_667_delimiter_reference.sql +10150 -0
  83. package/tests/fixtures/agent_board_667_search_guard.sql +92 -0
  84. package/tests/fixtures/agent_board_667_search_provenance.md +141 -0
  85. package/tests/fixtures/agent_board_667_search_reference.sql +4779 -0
  86. package/tests/fixtures/agent_board_667_sender_guard.sql +102 -0
  87. package/tests/fixtures/agent_board_667_sender_reference.md +20 -0
  88. package/tests/fixtures/agent_board_667_sender_reference.sql +875 -0
  89. package/tests/fixtures/agent_board_667_timestamp_graph.sql +84 -0
  90. package/tests/fixtures/agent_board_667_timestamp_guard.sql +94 -0
  91. package/tests/fixtures/agent_board_667_timestamp_provenance.md +99 -0
  92. package/tests/fixtures/agent_board_667_timestamp_reference.sql +2938 -0
  93. package/tests/isolation/expected/association_artifact_anchor_order.out +108 -0
  94. package/tests/isolation/expected/association_board_vs_board.out +71 -0
  95. package/tests/isolation/expected/association_post_wait_authority.out +77 -0
  96. package/tests/isolation/expected/association_strong_history_writers.out +203 -0
  97. package/tests/isolation/expected/association_strong_isolation.out +185 -0
  98. package/tests/isolation/expected/association_vs_artifact_claim_escalation.out +199 -0
  99. package/tests/isolation/expected/association_vs_heartbeat.out +78 -0
  100. package/tests/isolation/expected/association_vs_multi_anchor_artifact.out +67 -0
  101. package/tests/isolation/expected/association_vs_private_message.out +67 -0
  102. package/tests/isolation/expected/association_vs_task_and_conflict.out +133 -0
  103. package/tests/isolation/expected/association_vs_taskful_cross_thread.out +133 -0
  104. package/tests/isolation/expected/consent_approval_lock.out +1 -1
  105. package/tests/isolation/expected/message_replay_scope.out +209 -0
  106. package/tests/isolation/expected/tasking_replay_scope.out +125 -0
  107. package/tests/isolation/specs/association_artifact_anchor_order.spec +46 -0
  108. package/tests/isolation/specs/association_board_vs_board.spec +37 -0
  109. package/tests/isolation/specs/association_post_wait_authority.spec +48 -0
  110. package/tests/isolation/specs/association_strong_history_writers.spec +61 -0
  111. package/tests/isolation/specs/association_strong_isolation.spec +50 -0
  112. package/tests/isolation/specs/association_vs_artifact_claim_escalation.spec +41 -0
  113. package/tests/isolation/specs/association_vs_heartbeat.spec +47 -0
  114. package/tests/isolation/specs/association_vs_multi_anchor_artifact.spec +38 -0
  115. package/tests/isolation/specs/association_vs_private_message.spec +33 -0
  116. package/tests/isolation/specs/association_vs_task_and_conflict.spec +38 -0
  117. package/tests/isolation/specs/association_vs_taskful_cross_thread.spec +42 -0
  118. package/tests/isolation/specs/consent_approval_lock.spec +13 -7
  119. package/tests/isolation/specs/message_replay_scope.spec +77 -0
  120. package/tests/isolation/specs/tasking_replay_scope.spec +72 -0
  121. package/tests/mutations/717-f1/M0_prefix_main_acl_and_comments.sql +11 -0
  122. package/tests/mutations/717-f1/M10_wrapper_stops_delegating.sql +7 -0
  123. package/tests/mutations/717-f1/M11_transitive_recipient_content.sql +8 -0
  124. package/tests/mutations/717-f1/M12_transitive_recipient_visibility.sql +8 -0
  125. package/tests/mutations/717-f1/M13_transitive_worker_content.sql +15 -0
  126. package/tests/mutations/717-f1/M1a_regrant_upsert_delivery_recipient.sql +1 -0
  127. package/tests/mutations/717-f1/M1b_regrant_upsert_inbox_item.sql +1 -0
  128. package/tests/mutations/717-f1/M1c_regrant_queue_inbox_callbacks.sql +1 -0
  129. package/tests/mutations/717-f1/M1d_regrant_queue_board_post_callbacks.sql +1 -0
  130. package/tests/mutations/717-f1/M1e_regrant_next_thread_message_sequence.sql +1 -0
  131. package/tests/mutations/717-f1/M2_blanket_schema_grant.sql +1 -0
  132. package/tests/mutations/717-f1/M3_new_overload_of_sink.sql +10 -0
  133. package/tests/mutations/717-f1/M4_new_route_calling_sink.sql +7 -0
  134. package/tests/mutations/717-f1/M5_actor_trusts_supplied_id.sql +5 -0
  135. package/tests/mutations/717-f1/M6_signed_route_granted_to_authenticated.sql +1 -0
  136. package/tests/mutations/717-f1/M7_worker_granted_to_authenticated.sql +1 -0
  137. package/tests/mutations/717-f1/M8_recipient_state_rewrites_visibility.sql +5 -0
  138. package/tests/mutations/717-f1/M9_public_route_revoked_from_service_role.sql +1 -0
  139. package/tests/mutations/717-f1/outbox_wake_ordering/W1_regrant_queue_inbox_callbacks.sql +1 -0
  140. package/tests/mutations/717-f1/outbox_wake_ordering/W2_revoke_worker_from_service_role.sql +1 -0
  141. package/tests/mutations/717-f1/outbox_wake_ordering/W3_invoker_caller_of_sink.sql +1 -0
  142. package/tests/mutations/717-f1/outbox_wake_ordering/W4_public_regrant_board_post_sink.sql +1 -0
  143. package/tests/mutations/717-f1/run.sh +17 -0
  144. package/tests/mutations/717-f2b/C1_new_delivery_route.sql +4 -0
  145. package/tests/mutations/717-f2b/C2_new_replay_lookup.sql +3 -0
  146. package/tests/mutations/717-f2b/C3_internal_regranted.sql +2 -0
  147. package/tests/mutations/717-f2b/C4_wrapper_writes_delivery.sql +9 -0
  148. package/tests/mutations/717-f2b/C5_class_member_dynamic_sql.sql +9 -0
  149. package/tests/mutations/717-f2b/C6_drop_board_scope_constraint.sql +2 -0
  150. package/tests/mutations/717-f2b/C7_state_private_helper_content.sql +14 -0
  151. package/tests/mutations/717-f2b/L1_dm_lock_split_by_recipient.sql +8 -0
  152. package/tests/mutations/717-f2b/L2_dm_lock_removed.sql +12 -0
  153. package/tests/mutations/717-f2b/L3_mc_lock_split_by_recipients.sql +8 -0
  154. package/tests/mutations/717-f2b/L4_mc_lock_removed.sql +12 -0
  155. package/tests/mutations/717-f2b/M0_prefix_definitions.sql +17 -0
  156. package/tests/mutations/717-f2b/M10_mc_lookup_any_author.sql +15 -0
  157. package/tests/mutations/717-f2b/M11_dm_swallow_refusal.sql +8 -0
  158. package/tests/mutations/717-f2b/M12_mc_swallow_refusal.sql +8 -0
  159. package/tests/mutations/717-f2b/M13_signed_dm_swallows_refusal.sql +32 -0
  160. package/tests/mutations/717-f2b/M14_signed_mc_swallows_refusal.sql +20 -0
  161. package/tests/mutations/717-f2b/M15_mc_any_source.sql +7 -0
  162. package/tests/mutations/717-f2b/M1_dm_drop_recipient_proof.sql +16 -0
  163. package/tests/mutations/717-f2b/M2_mc_drop_recipient_proof.sql +16 -0
  164. package/tests/mutations/717-f2b/M3_dm_metadata_as_proof.sql +12 -0
  165. package/tests/mutations/717-f2b/M4_mc_metadata_as_proof.sql +16 -0
  166. package/tests/mutations/717-f2b/M5_dm_any_mode.sql +11 -0
  167. package/tests/mutations/717-f2b/M6_dm_board_delivery_counts.sql +11 -0
  168. package/tests/mutations/717-f2b/M7_mc_any_mode.sql +11 -0
  169. package/tests/mutations/717-f2b/M8_dm_thread_stamp_as_proof.sql +12 -0
  170. package/tests/mutations/717-f2b/M9_dm_lookup_any_author.sql +15 -0
  171. package/tests/mutations/717-f2b/run.sh +82 -0
@@ -0,0 +1,84 @@
1
+ -- Test-only parser graph for the eight reviewed SELECT templates and the SQL
2
+ -- folder helper. Parsing creates views; none of these views is queried. The
3
+ -- caller must first establish the exact wrappers, dispatch and target profile.
4
+ create temp table xb_st_views(rel oid primary key) on commit drop;
5
+ create temp table xb_st_static(fn oid,problem text) on commit drop;
6
+ do $graph$
7
+ declare q record; nm text;
8
+ begin
9
+ if not exists(select 1 from pg_temp.xb_st_prerequisite_problems()) then
10
+ for q in select identity,payload#>>'{}' as sql from pg_temp.xb_st_reference where kind='query' order by identity loop
11
+ nm := 'xb_st_query_'||q.identity;
12
+ execute format('create temp view %I as %s',nm,q.sql);
13
+ insert into pg_temp.xb_st_views values(to_regclass('pg_temp.'||nm));
14
+ end loop;
15
+ begin
16
+ insert into pg_temp.xb_st_static select d.oid::oid,null::text
17
+ from extensions.plpgsql_show_dependency_tb(
18
+ 'storage.search_by_timestamp(text,text,integer,integer,text,text,text,text,text,text,text)'::regprocedure,0::oid) d
19
+ where d.type='FUNCTION';
20
+ exception when others then
21
+ insert into pg_temp.xb_st_static values(null,sqlstate||':'||sqlerrm);
22
+ end;
23
+ end if;
24
+ end $graph$;
25
+ create or replace function pg_temp.xb_st_collations() returns table(coll oid)
26
+ language sql volatile set search_path=pg_catalog as $$
27
+ select distinct m[1]::oid from pg_temp.xb_st_views v join pg_rewrite r on r.ev_class=v.rel
28
+ cross join lateral regexp_matches(r.ev_action::text,':(?:inputcollid|collid|varcollid|constcollid|opcollid|funccollid) ([0-9]+)','g') m
29
+ where m[1]::oid<>0
30
+ union select a.attcollation from pg_attribute a where a.attrelid=to_regclass('storage.objects') and a.attcollation<>0
31
+ union select x from pg_index i cross join lateral unnest(i.indcollation) x where i.indrelid=to_regclass('storage.objects') and x<>0
32
+ $$;
33
+ create or replace function pg_temp.xb_st_roots() returns table(origin text,fn oid)
34
+ language sql volatile set search_path=pg_catalog as $$
35
+ select 'query '||v.rel::regclass::text,d.refobjid from pg_temp.xb_st_views v
36
+ join pg_rewrite r on r.ev_class=v.rel join pg_depend d on d.classid='pg_rewrite'::regclass and d.objid=r.oid
37
+ where d.refclassid='pg_proc'::regclass
38
+ -- pg_depend intentionally omits pinned built-ins. The stored parser trees
39
+ -- retain their executable OIDs; enumerate those as well, including MIN.
40
+ union select 'query executable '||v.rel::regclass::text,m[2]::oid
41
+ from pg_temp.xb_st_views v join pg_rewrite r on r.ev_class=v.rel
42
+ cross join lateral regexp_matches(r.ev_action::text,':(funcid|aggfnoid|winfnoid|opfuncid|elemfuncid) ([0-9]+)','g') m
43
+ where m[2]::oid<>0
44
+ union select 'static callable '||m[1],p.oid from pg_proc target
45
+ cross join lateral regexp_matches(target.prosrc,'([a-z_][a-z_0-9]*)\s*\(','g') m
46
+ join pg_proc p on p.proname=m[1]
47
+ where target.oid=to_regprocedure('storage.search_by_timestamp(text,text,integer,integer,text,text,text,text,text,text,text)')
48
+ and p.prokind<>'a'
49
+ union select 'static reader expression',fn from pg_temp.xb_st_static where fn is not null
50
+ union select 'target expression',d.refobjid from pg_depend d
51
+ where d.refclassid='pg_proc'::regclass and (
52
+ d.classid='pg_attrdef'::regclass and d.objid in(select oid from pg_attrdef where adrelid=to_regclass('storage.objects'))
53
+ or d.classid='pg_constraint'::regclass and d.objid in(select oid from pg_constraint where conrelid=to_regclass('storage.objects'))
54
+ or d.classid='pg_class'::regclass and d.objid in(select indexrelid from pg_index where indrelid=to_regclass('storage.objects')))
55
+ union select 'target executable',m[2]::oid from (
56
+ select adbin::text as tree from pg_attrdef where adrelid=to_regclass('storage.objects')
57
+ union select conbin::text from pg_constraint where conrelid=to_regclass('storage.objects') and conbin is not null
58
+ union select indexprs::text from pg_index where indrelid=to_regclass('storage.objects') and indexprs is not null
59
+ union select indpred::text from pg_index where indrelid=to_regclass('storage.objects') and indpred is not null
60
+ ) e cross join lateral regexp_matches(e.tree,':(funcid|aggfnoid|winfnoid|opfuncid|elemfuncid) ([0-9]+)','g') m
61
+ where m[2]::oid<>0
62
+ $$;
63
+ -- Discover aggregate callback columns from the catalog, rather than writing a
64
+ -- list that silently omits the next PostgreSQL callback slot.
65
+ create or replace function pg_temp.xb_st_aggregate_slots() returns table(aggregate oid,slot text,fn oid)
66
+ language plpgsql volatile set search_path=pg_catalog as $$
67
+ declare a record;
68
+ begin
69
+ for a in select attname from pg_attribute where attrelid='pg_aggregate'::regclass
70
+ and atttypid='regproc'::regtype and attnum>0 and not attisdropped loop
71
+ return query execute format('select g.aggfnoid::oid,%L,g.%I::oid from pg_aggregate g where g.%I::oid<>0',a.attname,a.attname,a.attname);
72
+ end loop;
73
+ end $$;
74
+ create or replace function pg_temp.xb_st_reach() returns table(fn oid)
75
+ language sql volatile set search_path=pg_catalog as $$
76
+ with recursive edges(source,target) as (
77
+ select p.oid,p.prosupport::oid from pg_proc p where p.prosupport<>0
78
+ union select d.objid,d.refobjid from pg_depend d where d.classid='pg_proc'::regclass and d.refclassid='pg_proc'::regclass
79
+ union select aggregate,fn from pg_temp.xb_st_aggregate_slots()
80
+ ), reach(fn) as (
81
+ select fn from pg_temp.xb_st_roots()
82
+ union select e.target from reach r join edges e on e.source=r.fn
83
+ ) select fn from reach
84
+ $$;
@@ -0,0 +1,94 @@
1
+ -- Finite test-only effect proof for search_by_timestamp, not a Storage exemption.
2
+ -- Requires conversion_guard and sender_guard (portable relation metadata only).
3
+ create or replace function pg_temp.xb_st_profile(p_rel oid) returns jsonb
4
+ language sql volatile set search_path=pg_catalog as $$
5
+ select jsonb_set(s,'{indexes}',(select jsonb_agg(x order by x::text collate "C")
6
+ from jsonb_array_elements(s->'indexes') x)) from (select pg_temp.xb_sf_profile(p_rel) s) q
7
+ $$;
8
+ create or replace function pg_temp.xb_st_aggregate(p_fn oid) returns jsonb
9
+ language plpgsql volatile set search_path=pg_catalog as $$
10
+ declare result jsonb; a record; slots jsonb := '{}';
11
+ begin
12
+ select to_jsonb(g)-'aggfnoid'-'aggsortop'-'aggtranstype'-'aggmtranstype' into result
13
+ from pg_aggregate g where g.aggfnoid=p_fn;
14
+ if result is null then return null; end if;
15
+ for a in select attname from pg_attribute where attrelid='pg_aggregate'::regclass
16
+ and atttypid='regproc'::regtype and attnum>0 and not attisdropped loop
17
+ execute format('select to_jsonb(pg_temp.xb_cf_fn(%I::oid)) from pg_aggregate where aggfnoid=$1',a.attname)
18
+ into slots using p_fn;
19
+ result := (result-a.attname)||jsonb_build_object(a.attname,slots);
20
+ end loop;
21
+ return result||(select jsonb_build_object('sort_operator',pg_temp.xb_cf_named(g.aggsortop,'operator'),
22
+ 'transition_type',pg_temp.xb_cf_type(g.aggtranstype),'moving_type',pg_temp.xb_cf_type(g.aggmtranstype),
23
+ 'owner',pg_get_userbyid(p.proowner),'acl',p.proacl,'kind',p.prokind,'volatility',p.provolatile,
24
+ 'security_definer',p.prosecdef,'settings',p.proconfig,'parallel',p.proparallel,'strict',p.proisstrict,
25
+ 'source',p.prosrc,'library',p.probin,'cost',p.procost,'rows',p.prorows,'leakproof',p.proleakproof,
26
+ 'result',pg_temp.xb_cf_type(p.prorettype),'arguments',pg_get_function_arguments(p.oid),
27
+ 'support',pg_temp.xb_cf_fn(p.prosupport),'variadic',pg_temp.xb_cf_type(p.provariadic),
28
+ 'argument_modes',p.proargmodes,'argument_names',p.proargnames)
29
+ from pg_aggregate g join pg_proc p on p.oid=g.aggfnoid where g.aggfnoid=p_fn);
30
+ end $$;
31
+ create or replace function pg_temp.xb_st_collation(p_oid oid) returns jsonb
32
+ language sql volatile set search_path=pg_catalog as $$
33
+ select to_jsonb(c)-'oid'-'collnamespace'-'collowner'||jsonb_build_object(
34
+ 'owner',pg_get_userbyid(c.collowner),'schema',n.nspname) from pg_collation c
35
+ join pg_namespace n on n.oid=c.collnamespace where c.oid=p_oid
36
+ $$;
37
+
38
+ \ir agent_board_667_timestamp_reference.sql
39
+
40
+ create or replace function pg_temp.xb_st_prerequisite_problems() returns table(identity text,problem text)
41
+ language sql volatile set search_path=pg_catalog as $$
42
+ select r.identity,'wrapper or helper declaration/security drift' from pg_temp.xb_st_reference r
43
+ where r.kind='wrapper' and r.payload is distinct from pg_temp.xb_cf_meta(to_regprocedure(r.identity))
44
+ union all select 'storage.objects','missing or unreviewed ordinary target profile'
45
+ where (select payload from pg_temp.xb_st_reference where kind='target') is distinct from pg_temp.xb_st_profile(to_regclass('storage.objects'))
46
+ union all select 'storage.objects.'||p.polname,'unreviewed SELECT policy' from pg_policy p where p.polrelid=to_regclass('storage.objects')
47
+ union all select 'storage.objects.'||r.rulename,'unreviewed rewrite rule' from pg_rewrite r where r.ev_class=to_regclass('storage.objects')
48
+ union all select i.inhrelid::regclass::text||' -> '||i.inhparent::regclass::text,'unreviewed inheritance edge'
49
+ from pg_inherits i where to_regclass('storage.objects') in(i.inhrelid,i.inhparent)
50
+ union all select 'schema storage','schema security drift' from pg_namespace n
51
+ where n.nspname='storage' and (select payload from pg_temp.xb_st_reference where kind='schema') is distinct from
52
+ jsonb_build_object('owner',pg_get_userbyid(n.nspowner),'acl',(select jsonb_agg(a::text order by a::text collate "C") from unnest(n.nspacl) a))
53
+ union all select identity,problem from pg_temp.xb_cf_problems()
54
+ -- Every overload/shadow of a called name is a resolution input. Names are
55
+ -- derived from the parser graph plus the static PL/pgSQL dependency parser.
56
+ union all select pg_temp.xb_cf_fn(p.oid),'unreviewed overload or shadow' from pg_proc p
57
+ where p.proname in(select payload#>>'{}' from pg_temp.xb_st_reference where kind='name')
58
+ and not exists(select 1 from pg_temp.xb_st_reference r where r.kind='resolution' and to_regprocedure(r.identity)=p.oid)
59
+ union all select r.identity,'resolution declaration/security drift' from pg_temp.xb_st_reference r
60
+ where r.kind='resolution' and r.payload is distinct from case when (select prokind from pg_proc where oid=to_regprocedure(r.identity))='a'
61
+ then pg_temp.xb_st_aggregate(to_regprocedure(r.identity)) else pg_temp.xb_cf_meta(to_regprocedure(r.identity)) end
62
+ $$;
63
+
64
+ \ir agent_board_667_timestamp_graph.sql
65
+
66
+ create or replace function pg_temp.xb_st_problems() returns table(identity text,problem text)
67
+ language sql volatile set search_path=pg_catalog as $$
68
+ select identity,problem from pg_temp.xb_st_prerequisite_problems()
69
+ union all select 'timestamp query graph','not all eight dynamic shapes and the helper were parsed'
70
+ where (select count(*) from pg_temp.xb_st_views)<>9
71
+ union all select 'timestamp static parser',problem from pg_temp.xb_st_static where problem is not null
72
+ union all select 'timestamp aggregate parser','timestamp MIN was not discovered'
73
+ where not exists(select 1 from pg_temp.xb_st_roots() r join pg_proc p on p.oid=r.fn where p.prokind='a')
74
+ union all select pg_temp.xb_cf_fn(g.fn),'unreviewed query/support/aggregate callback'
75
+ from pg_temp.xb_st_reach() g where not exists(select 1 from pg_temp.xb_st_reference r
76
+ where r.kind in('primitive','aggregate','wrapper') and to_regprocedure(r.identity)=g.fn)
77
+ union all select r.identity,'query/support callback declaration or security drift' from pg_temp.xb_st_reference r
78
+ where r.kind='primitive' and r.payload is distinct from pg_temp.xb_cf_meta(to_regprocedure(r.identity))
79
+ union all select r.identity,'aggregate dispatch drift' from pg_temp.xb_st_reference r
80
+ where r.kind='aggregate' and r.payload is distinct from pg_temp.xb_st_aggregate(to_regprocedure(r.identity))
81
+ union all select n.nspname||'.'||c.collname,'unreviewed query collation' from pg_temp.xb_st_collations() x
82
+ join pg_collation c on c.oid=x.coll join pg_namespace n on n.oid=c.collnamespace
83
+ where not exists(select 1 from pg_temp.xb_st_reference r where r.kind='collation'
84
+ and r.identity=format('%I.%I',n.nspname,c.collname) and r.payload=pg_temp.xb_st_collation(c.oid))
85
+ union all select d.refobjid::regclass::text,'unexpected query relation' from pg_temp.xb_st_views v
86
+ join pg_rewrite r on r.ev_class=v.rel join pg_depend d on d.classid='pg_rewrite'::regclass and d.objid=r.oid
87
+ where d.refclassid='pg_class'::regclass and d.refobjid not in(v.rel,to_regclass('storage.objects'))
88
+ $$;
89
+ create or replace function pg_temp.xb_st_admitted() returns table(fn oid)
90
+ language sql volatile set search_path=pg_catalog as $$
91
+ select to_regprocedure(identity)::oid from pg_temp.xb_st_reference where kind='wrapper'
92
+ and identity='storage.search_by_timestamp(text,text,integer,integer,text,text,text,text,text,text,text)'
93
+ and not exists(select 1 from pg_temp.xb_st_problems())
94
+ $$;
@@ -0,0 +1,99 @@
1
+ # #667: finite Storage timestamp-reader disposition
2
+
3
+ This test-only disposition covers exactly
4
+ `storage.search_by_timestamp(text,text,integer,integer,text,text,text,text,text,text,text)`.
5
+ It does not admit the other Storage readers or `realtime.apply_rls` and does not
6
+ approve PR #707. No application migration or protected isolation input changes.
7
+
8
+ ## Source and reconstruction
9
+
10
+ The input is CI run `40555288153`, job `122369607014`, protocol-2 failure catalog
11
+ SHA256 `bd5946a94b8c7266ca186ff6a33949008418cd156c1b500786a916a7e9673156`.
12
+ It records PostgreSQL 17.11, Storage v1.84.19 and the exact reader/helper bodies,
13
+ owners, ACLs, relation metadata and registered dispatch. The reader definition
14
+ MD5 is `323c4e2739e9c9bcfc082f7f14289338`; the SQL folder helper's is
15
+ `0dc62b74fb855d4f504f50f900f93927`.
16
+
17
+ The owned reconstruction used cached PostgreSQL `17.11.0.004`; CI used
18
+ `17.11.0.006`. The retained Storage migrations were replayed with role installation
19
+ disabled, since their bootstrap conflicts with the disposable image's existing
20
+ role graph. The empty `storage.objects` table was then reconstructed from the
21
+ captured column, constraint, index and trigger declarations. This removes a
22
+ historical dropped-column slot and supplies the captured version-key index.
23
+ These are changes to the disposable fixture only. The resulting target profile,
24
+ reader/helper bodies and security metadata match the captured catalog. This is
25
+ a selective reconstruction, not a claim that the entire native platform matches.
26
+
27
+ `generate-667-timestamp-reference.mjs` validates retained native, owned-collection
28
+ and query-expansion JSON inputs. It has only manual `--check` and `--output`
29
+ modes; it never connects to a database or refreshes a CI failure automatically.
30
+ The collector uses the fixture's metadata/parser helpers and retains complete
31
+ declarations, callback metadata, parser roots and security records. The generator
32
+ checks every observed primitive against native source/library/security fields;
33
+ full declarations and additional aggregate fields collected from the owned
34
+ build must still match live native CI. A declaration hash is not binary attestation.
35
+
36
+ ## Effect boundary
37
+
38
+ The reviewed body has one dynamic SELECT template. Its two sort columns, two
39
+ directions and two version expressions produce eight query shapes. Caller
40
+ values remain bound parameters. The generator derives all eight expansions
41
+ directly from the captured body, replaces parameters with typed constants and
42
+ checks that the supplied expansions are identical. A ninth parser view contains
43
+ the exact SQL folder-helper expression. Views are parsed, never queried.
44
+
45
+ Before parsing, the guard checks both wrappers, the ordinary heap target,
46
+ schema security, the existing conversion-dispatch proof, and every overload or
47
+ shadow of the discovered callable names. New policies, rules or inheritance
48
+ edges refuse admission. Relation profiles retain columns, defaults, generated
49
+ expressions, constraints, ACLs and indexes, with index records sorted by content.
50
+
51
+ `pg_depend` omits pinned built-ins. Therefore the executable OIDs in the stored
52
+ PostgreSQL 17 parser trees are inspected as well. This is deliberately a parser
53
+ for these exact templates, not arbitrary SQL. Roots also include stored target
54
+ expressions, the static dependency parser and a conservative callable-name census
55
+ of the bound reader body. That census may include harmless matches in comments;
56
+ it cannot exempt a new overload. Support and function-dependency edges are
57
+ followed recursively. SQL helper effects are parsed separately; every reached
58
+ non-helper executable must be a reviewed PostgreSQL C/internal primitive.
59
+
60
+ Aggregate callback columns come from `pg_attribute`, not a callback allowlist.
61
+ Timestamp MIN's transition/combine functions, aggregate flags, sort operator and
62
+ types are bound. Query and target collations are discovered and bound as well.
63
+ The pre-existing conversion guard supplies the type/operator/cast/range/operator
64
+ family/text-search/language/access-method dispatch boundary.
65
+
66
+ DML triggers are not SELECT callbacks. A positive control installs a live
67
+ INSERT trigger: native SELECT leaves its marker untouched; an own INSERT invokes
68
+ it. A DML-performing reader mutant fails the no-callback assertion. This is not
69
+ an exemption for SELECT policies or rewrite rules.
70
+
71
+ ## Executed scope and limits
72
+
73
+ Native behavior emits 19 assertions; the native profile emits 15. The independent
74
+ overload control emits four even on a minimal substrate. Absent-native branches
75
+ emit a real absence/no-admission assertion and receive no native credit.
76
+
77
+ The retained parent ledgers contain 80 complete phases, 974 assertions and 33
78
+ planned red observations. These are repeated/scoped observations, not 33 distinct
79
+ mutation families. Physical catalog changes and detection-arm omissions were
80
+ tested separately. Source mutations have installed-definition readbacks;
81
+ catalog-state mutations retain the changed catalogs. Restored runs check the
82
+ reviewed profiles and applicable exact function definitions.
83
+
84
+ Tests exercise filtering, projection, cursor/limit, literal prefixes, default and
85
+ inclusive version modes, service-role reads and authenticated empty-policy reads.
86
+ The folder fixture has two timestamps, so replacing MIN with MAX fails its
87
+ specific assertion. An owned policy callback actually writes its marker during
88
+ the native SELECT, and the policy remains unadmitted.
89
+
90
+ Unaccepted attempts remain retained: the initial filter mutation aborted a
91
+ single-row assertion (now replaced by aggregate state comparison); one concurrent
92
+ proof restoration deadlocked (completed serially); and changing a pinned built-in
93
+ declaration did not change its builtin-OID runtime dispatch. The latter receives
94
+ no primitive-behavior kill credit. Its metadata drift was caught separately, and
95
+ a real reader-expression mutation pins the affected result field. No test claims
96
+ to mutate PostgreSQL's C binary or prove arbitrary privileged SQL safe.
97
+
98
+ These tests do not establish whole-PR acceptance, fresh native-platform equality,
99
+ new isolation credit, or the effects of the three still-unresolved routines.