@consiliency/agent-board-schema 1.68.0 → 1.75.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.
- package/fixtures/already-applied.json +32 -4
- package/migrations/20261026000100_agent_board_thread_association.sql +1287 -0
- package/migrations/20261101000100_agent_board_session_measured_mint.sql +145 -0
- package/migrations/20261104065658_agent_board_reply_delivery.sql +659 -0
- package/migrations/20261104170000_agent_board_tasking_replay_scope.sql +320 -0
- package/migrations/20261104180000_agent_board_delivery_writer_execute.sql +51 -0
- package/migrations/20261104190000_agent_board_message_replay_scope.sql +373 -0
- package/migrations/20261108000100_agent_board_send_outcome.sql +708 -0
- package/package.json +1 -1
- package/schema-manifest.json +66 -3
- package/src/deployment-drift-main.test.mjs +20 -3
- package/src/deployment-drift-script.test.mjs +77 -2
- package/src/deployment-drift.test.mjs +60 -0
- package/src/tooling.test.mjs +9 -2
- package/tests/agent_board_661_reply_delivery.test.sql +185 -0
- package/tests/agent_board_667_boundary.test.sql +162 -0
- package/tests/agent_board_667_conversion_branches.test.sql +91 -0
- package/tests/agent_board_667_conversion_profile.test.sql +112 -0
- package/tests/agent_board_667_history_class.test.sql +787 -0
- package/tests/agent_board_667_native_cast_effect.test.sql +88 -0
- package/tests/agent_board_667_realtime_apply_behavior.test.sql +117 -0
- package/tests/agent_board_667_realtime_apply_controls.test.sql +143 -0
- package/tests/agent_board_667_realtime_apply_profile.test.sql +61 -0
- package/tests/agent_board_667_retention.test.sql +201 -0
- package/tests/agent_board_667_routing.test.sql +294 -0
- package/tests/agent_board_667_sender_effects.test.sql +100 -0
- package/tests/agent_board_667_sender_profile_controls.test.sql +29 -0
- package/tests/agent_board_667_storage_delimiter_behavior.test.sql +84 -0
- package/tests/agent_board_667_storage_delimiter_controls.test.sql +23 -0
- package/tests/agent_board_667_storage_delimiter_profile.test.sql +61 -0
- package/tests/agent_board_667_storage_search_behavior.test.sql +93 -0
- package/tests/agent_board_667_storage_search_controls.test.sql +22 -0
- package/tests/agent_board_667_storage_search_profile.test.sql +60 -0
- package/tests/agent_board_667_storage_timestamp_behavior.test.sql +58 -0
- package/tests/agent_board_667_storage_timestamp_controls.test.sql +22 -0
- package/tests/agent_board_667_storage_timestamp_profile.test.sql +54 -0
- package/tests/agent_board_667_writers.test.sql +281 -0
- package/tests/agent_board_717_message_replay_scope.test.sql +828 -0
- package/tests/agent_board_717_native_surface.test.sql +223 -0
- package/tests/agent_board_717_tasking_replay_scope.test.sql +661 -0
- package/tests/agent_board_addressing.test.sql +8 -5
- package/tests/agent_board_claim_subject_gate.test.sql +7 -3
- package/tests/agent_board_claimpolicy_race.test.sql +39 -11
- package/tests/agent_board_delegate_role_class.test.sql +35 -17
- package/tests/agent_board_delivery_writer_execute.test.sql +373 -0
- package/tests/agent_board_fk_lock_edges.test.sql +3 -0
- package/tests/agent_board_hosted_delegates.test.sql +13 -3
- package/tests/agent_board_inbox_rpcs.test.sql +5 -3
- package/tests/agent_board_obsgate.test.sql +8 -4
- package/tests/agent_board_obsgate4.test.sql +2 -2
- package/tests/agent_board_outbox_wake_ordering.test.sql +25 -2
- package/tests/agent_board_own_post_not_delivered.test.sql +11 -9
- package/tests/agent_board_send_outcome.test.sql +805 -0
- package/tests/agent_board_session_identity_behavior_classes.test.sql +2 -2
- package/tests/agent_board_session_identity_limits.test.sql +1 -1
- package/tests/agent_board_session_identity_measured_mint.test.sql +342 -0
- package/tests/agent_board_session_identity_predicate_isolation.test.sql +146 -0
- package/tests/agent_board_sidserver_authority.test.sql +69 -0
- package/tests/agent_board_sidserver_catalog.test.sql +47 -0
- package/tests/agent_board_signed_write_gateway.test.sql +4 -2
- package/tests/agent_board_task_thread_lock_order.test.sql +67 -42
- package/tests/agent_board_v2_invariants.test.sql +5 -2
- package/tests/agent_board_write_enforcement_class.test.sql +12 -8
- package/tests/catalog/function_execute_privileges.json +65 -5
- package/tests/catalog/p_metadata_parameters.json +24 -0
- package/tests/fixtures/agent_board_667_apply_rls_guard.sql +195 -0
- package/tests/fixtures/agent_board_667_apply_rls_provenance.md +125 -0
- package/tests/fixtures/agent_board_667_apply_rls_reference.sql +1903 -0
- package/tests/fixtures/agent_board_667_conversion_guard.sql +162 -0
- package/tests/fixtures/agent_board_667_conversion_reference.md +23 -0
- package/tests/fixtures/agent_board_667_conversion_reference.sql +5325 -0
- package/tests/fixtures/agent_board_667_delimiter_guard.sql +92 -0
- package/tests/fixtures/agent_board_667_delimiter_provenance.md +116 -0
- package/tests/fixtures/agent_board_667_delimiter_reference.sql +10150 -0
- package/tests/fixtures/agent_board_667_search_guard.sql +92 -0
- package/tests/fixtures/agent_board_667_search_provenance.md +141 -0
- package/tests/fixtures/agent_board_667_search_reference.sql +4779 -0
- package/tests/fixtures/agent_board_667_sender_guard.sql +102 -0
- package/tests/fixtures/agent_board_667_sender_reference.md +20 -0
- package/tests/fixtures/agent_board_667_sender_reference.sql +875 -0
- package/tests/fixtures/agent_board_667_timestamp_graph.sql +84 -0
- package/tests/fixtures/agent_board_667_timestamp_guard.sql +94 -0
- package/tests/fixtures/agent_board_667_timestamp_provenance.md +99 -0
- package/tests/fixtures/agent_board_667_timestamp_reference.sql +2938 -0
- package/tests/fixtures/isolation-substrate.sql +8 -0
- package/tests/fixtures/pgtap-unexposed.sql +61 -0
- package/tests/isolation/expected/association_artifact_anchor_order.out +108 -0
- package/tests/isolation/expected/association_board_vs_board.out +71 -0
- package/tests/isolation/expected/association_post_wait_authority.out +77 -0
- package/tests/isolation/expected/association_strong_history_writers.out +203 -0
- package/tests/isolation/expected/association_strong_isolation.out +185 -0
- package/tests/isolation/expected/association_vs_artifact_claim_escalation.out +199 -0
- package/tests/isolation/expected/association_vs_heartbeat.out +78 -0
- package/tests/isolation/expected/association_vs_multi_anchor_artifact.out +67 -0
- package/tests/isolation/expected/association_vs_private_message.out +67 -0
- package/tests/isolation/expected/association_vs_task_and_conflict.out +133 -0
- package/tests/isolation/expected/association_vs_taskful_cross_thread.out +133 -0
- package/tests/isolation/expected/message_replay_scope.out +209 -0
- package/tests/isolation/expected/send_outcome_cross_board.out +40 -0
- package/tests/isolation/expected/send_outcome_independence.out +295 -0
- package/tests/isolation/expected/send_outcome_membership.out +140 -0
- package/tests/isolation/expected/send_outcome_overlap.out +89 -0
- package/tests/isolation/expected/send_outcome_reader.out +87 -0
- package/tests/isolation/expected/send_outcome_recovery.out +107 -0
- package/tests/isolation/expected/tasking_replay_scope.out +125 -0
- package/tests/isolation/specs/association_artifact_anchor_order.spec +46 -0
- package/tests/isolation/specs/association_board_vs_board.spec +37 -0
- package/tests/isolation/specs/association_post_wait_authority.spec +48 -0
- package/tests/isolation/specs/association_strong_history_writers.spec +61 -0
- package/tests/isolation/specs/association_strong_isolation.spec +50 -0
- package/tests/isolation/specs/association_vs_artifact_claim_escalation.spec +41 -0
- package/tests/isolation/specs/association_vs_heartbeat.spec +47 -0
- package/tests/isolation/specs/association_vs_multi_anchor_artifact.spec +38 -0
- package/tests/isolation/specs/association_vs_private_message.spec +33 -0
- package/tests/isolation/specs/association_vs_task_and_conflict.spec +38 -0
- package/tests/isolation/specs/association_vs_taskful_cross_thread.spec +42 -0
- package/tests/isolation/specs/message_replay_scope.spec +77 -0
- package/tests/isolation/specs/send_outcome_cross_board.spec +66 -0
- package/tests/isolation/specs/send_outcome_independence.spec +95 -0
- package/tests/isolation/specs/send_outcome_membership.spec +73 -0
- package/tests/isolation/specs/send_outcome_overlap.spec +69 -0
- package/tests/isolation/specs/send_outcome_reader.spec +61 -0
- package/tests/isolation/specs/send_outcome_recovery.spec +68 -0
- package/tests/isolation/specs/tasking_replay_scope.spec +72 -0
- package/tests/mutations/670/E1_helper_author_from_message.sql +7 -0
- package/tests/mutations/670/E2_helper_no_null_check.sql +13 -0
- package/tests/mutations/670/M10_lock_removed.sql +10 -0
- package/tests/mutations/670/M11_table_granted_to_authenticated.sql +2 -0
- package/tests/mutations/670/M12_helper_granted_to_service_role.sql +2 -0
- package/tests/mutations/670/M13_message_fk_no_cascade.sql +8 -0
- package/tests/mutations/670/M14_post_message_mints_from_metadata.sql +11 -0
- package/tests/mutations/670/M15_second_receipt_writer.sql +9 -0
- package/tests/mutations/670/M16_read_no_btrim.sql +7 -0
- package/tests/mutations/670/M17_read_volatile.sql +2 -0
- package/tests/mutations/670/M1_helper_no_service_role_guard.sql +13 -0
- package/tests/mutations/670/M3_helper_on_replay_branch.sql +10 -0
- package/tests/mutations/670/M4_read_checks_thread_existence.sql +10 -0
- package/tests/mutations/670/M5a_read_requires_thread_access.sql +10 -0
- package/tests/mutations/670/M5b_read_requires_board_membership.sql +11 -0
- package/tests/mutations/670/M6_read_admits_service_role.sql +14 -0
- package/tests/mutations/670/M7_confirmed_adds_message_sequence.sql +12 -0
- package/tests/mutations/670/M8_delivery_swallows_errors.sql +19 -0
- package/tests/mutations/670/M9_lock_key_includes_board.sql +10 -0
- package/tests/mutations/670/run.sh +84 -0
- package/tests/mutations/717-f1/M0_prefix_main_acl_and_comments.sql +11 -0
- package/tests/mutations/717-f1/M10_wrapper_stops_delegating.sql +7 -0
- package/tests/mutations/717-f1/M11_transitive_recipient_content.sql +8 -0
- package/tests/mutations/717-f1/M12_transitive_recipient_visibility.sql +8 -0
- package/tests/mutations/717-f1/M13_transitive_worker_content.sql +15 -0
- package/tests/mutations/717-f1/M1a_regrant_upsert_delivery_recipient.sql +1 -0
- package/tests/mutations/717-f1/M1b_regrant_upsert_inbox_item.sql +1 -0
- package/tests/mutations/717-f1/M1c_regrant_queue_inbox_callbacks.sql +1 -0
- package/tests/mutations/717-f1/M1d_regrant_queue_board_post_callbacks.sql +1 -0
- package/tests/mutations/717-f1/M1e_regrant_next_thread_message_sequence.sql +1 -0
- package/tests/mutations/717-f1/M2_blanket_schema_grant.sql +1 -0
- package/tests/mutations/717-f1/M3_new_overload_of_sink.sql +10 -0
- package/tests/mutations/717-f1/M4_new_route_calling_sink.sql +7 -0
- package/tests/mutations/717-f1/M5_actor_trusts_supplied_id.sql +5 -0
- package/tests/mutations/717-f1/M6_signed_route_granted_to_authenticated.sql +1 -0
- package/tests/mutations/717-f1/M7_worker_granted_to_authenticated.sql +1 -0
- package/tests/mutations/717-f1/M8_recipient_state_rewrites_visibility.sql +5 -0
- package/tests/mutations/717-f1/M9_public_route_revoked_from_service_role.sql +1 -0
- package/tests/mutations/717-f1/outbox_wake_ordering/W1_regrant_queue_inbox_callbacks.sql +1 -0
- package/tests/mutations/717-f1/outbox_wake_ordering/W2_revoke_worker_from_service_role.sql +1 -0
- package/tests/mutations/717-f1/outbox_wake_ordering/W3_invoker_caller_of_sink.sql +1 -0
- package/tests/mutations/717-f1/outbox_wake_ordering/W4_public_regrant_board_post_sink.sql +1 -0
- package/tests/mutations/717-f1/run.sh +17 -0
- package/tests/mutations/717-f2b/C1_new_delivery_route.sql +4 -0
- package/tests/mutations/717-f2b/C2_new_replay_lookup.sql +3 -0
- package/tests/mutations/717-f2b/C3_internal_regranted.sql +2 -0
- package/tests/mutations/717-f2b/C4_wrapper_writes_delivery.sql +9 -0
- package/tests/mutations/717-f2b/C5_class_member_dynamic_sql.sql +9 -0
- package/tests/mutations/717-f2b/C6_drop_board_scope_constraint.sql +2 -0
- package/tests/mutations/717-f2b/C7_state_private_helper_content.sql +14 -0
- package/tests/mutations/717-f2b/L1_dm_lock_split_by_recipient.sql +8 -0
- package/tests/mutations/717-f2b/L2_dm_lock_removed.sql +12 -0
- package/tests/mutations/717-f2b/L3_mc_lock_split_by_recipients.sql +8 -0
- package/tests/mutations/717-f2b/L4_mc_lock_removed.sql +12 -0
- package/tests/mutations/717-f2b/M0_prefix_definitions.sql +17 -0
- package/tests/mutations/717-f2b/M10_mc_lookup_any_author.sql +15 -0
- package/tests/mutations/717-f2b/M11_dm_swallow_refusal.sql +8 -0
- package/tests/mutations/717-f2b/M12_mc_swallow_refusal.sql +8 -0
- package/tests/mutations/717-f2b/M13_signed_dm_swallows_refusal.sql +32 -0
- package/tests/mutations/717-f2b/M14_signed_mc_swallows_refusal.sql +20 -0
- package/tests/mutations/717-f2b/M15_mc_any_source.sql +7 -0
- package/tests/mutations/717-f2b/M1_dm_drop_recipient_proof.sql +16 -0
- package/tests/mutations/717-f2b/M2_mc_drop_recipient_proof.sql +16 -0
- package/tests/mutations/717-f2b/M3_dm_metadata_as_proof.sql +12 -0
- package/tests/mutations/717-f2b/M4_mc_metadata_as_proof.sql +16 -0
- package/tests/mutations/717-f2b/M5_dm_any_mode.sql +11 -0
- package/tests/mutations/717-f2b/M6_dm_board_delivery_counts.sql +11 -0
- package/tests/mutations/717-f2b/M7_mc_any_mode.sql +11 -0
- package/tests/mutations/717-f2b/M8_dm_thread_stamp_as_proof.sql +12 -0
- package/tests/mutations/717-f2b/M9_dm_lookup_any_author.sql +15 -0
- package/tests/mutations/717-f2b/run.sh +82 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
Parsed test spec with 4 sessions
|
|
2
|
+
|
|
3
|
+
starting permutation: p_post fanout l_begin l_leave r_read l_commit r_read fanout check
|
|
4
|
+
set_config
|
|
5
|
+
--------------------------------------------------------------------------
|
|
6
|
+
{"role" : "authenticated", "sub" : "670b5000-0000-4000-8000-0000000000c1"}
|
|
7
|
+
(1 row)
|
|
8
|
+
|
|
9
|
+
step p_post: insert into public.so670_iso5_ret select 'p', message_id from agent_board.post_board_message('670b5000-0000-4000-8000-000000000012','670b5000-0000-4000-8000-000000000003','670b5000-0000-4000-8000-000000000020','iso','so670 body','comment','medium','K',jsonb_build_object());
|
|
10
|
+
step fanout: select (select count(*) from agent_board.delivery_recipients where recipient_agent_id in ('670b5000-0000-4000-8000-000000000001','670b5000-0000-4000-8000-000000000002')) as deliveries, (select count(*) from agent_board.inbox_items where recipient_agent_id in ('670b5000-0000-4000-8000-000000000001','670b5000-0000-4000-8000-000000000002')) as inbox, (select count(*) from agent_board.send_outcomes where thread_id = '670b5000-0000-4000-8000-000000000012') as receipts;
|
|
11
|
+
deliveries|inbox|receipts
|
|
12
|
+
----------+-----+--------
|
|
13
|
+
2| 2| 1
|
|
14
|
+
(1 row)
|
|
15
|
+
|
|
16
|
+
step l_begin: begin; set local role authenticated; select set_config('request.jwt.claim.role','',true), set_config('request.jwt.claim.sub','',true), set_config('request.jwt.claims',json_build_object('role','authenticated','sub','670b5000-0000-4000-8000-0000000000c1')::text,true);
|
|
17
|
+
set_config|set_config|set_config
|
|
18
|
+
----------+----------+--------------------------------------------------------------------------
|
|
19
|
+
| |{"role" : "authenticated", "sub" : "670b5000-0000-4000-8000-0000000000c1"}
|
|
20
|
+
(1 row)
|
|
21
|
+
|
|
22
|
+
step l_leave: select count(*) as left_rows from agent_board.leave_board('670b5000-0000-4000-8000-000000000020','670b5000-0000-4000-8000-000000000003',jsonb_build_object());
|
|
23
|
+
left_rows
|
|
24
|
+
---------
|
|
25
|
+
1
|
|
26
|
+
(1 row)
|
|
27
|
+
|
|
28
|
+
step r_read: select status from agent_board.get_send_outcome('670b5000-0000-4000-8000-000000000012','K','post_board_message');
|
|
29
|
+
status
|
|
30
|
+
---------
|
|
31
|
+
confirmed
|
|
32
|
+
(1 row)
|
|
33
|
+
|
|
34
|
+
step l_commit: commit;
|
|
35
|
+
step r_read: select status from agent_board.get_send_outcome('670b5000-0000-4000-8000-000000000012','K','post_board_message');
|
|
36
|
+
status
|
|
37
|
+
---------
|
|
38
|
+
confirmed
|
|
39
|
+
(1 row)
|
|
40
|
+
|
|
41
|
+
step fanout: select (select count(*) from agent_board.delivery_recipients where recipient_agent_id in ('670b5000-0000-4000-8000-000000000001','670b5000-0000-4000-8000-000000000002')) as deliveries, (select count(*) from agent_board.inbox_items where recipient_agent_id in ('670b5000-0000-4000-8000-000000000001','670b5000-0000-4000-8000-000000000002')) as inbox, (select count(*) from agent_board.send_outcomes where thread_id = '670b5000-0000-4000-8000-000000000012') as receipts;
|
|
42
|
+
deliveries|inbox|receipts
|
|
43
|
+
----------+-----+--------
|
|
44
|
+
2| 2| 1
|
|
45
|
+
(1 row)
|
|
46
|
+
|
|
47
|
+
step check:
|
|
48
|
+
select (select count(*) from agent_board.messages where thread_id in ('670b5000-0000-4000-8000-000000000012')) as messages,
|
|
49
|
+
(select count(*) from agent_board.send_outcomes where thread_id in ('670b5000-0000-4000-8000-000000000012')) as receipts,
|
|
50
|
+
(select string_agg(so.operation || ':' || a.handle, ',' order by so.operation, a.handle) from agent_board.send_outcomes so join agent_board.agents a on a.id = so.author_agent_id where so.thread_id in ('670b5000-0000-4000-8000-000000000012')) as receipt_owners,
|
|
51
|
+
(select string_agg(r.s, ',' order by r.s) from public.so670_iso5_ret r) as returned_by,
|
|
52
|
+
(select count(distinct r.message_id) from public.so670_iso5_ret r) as distinct_returned,
|
|
53
|
+
(select coalesce(bool_and(exists (select 1 from agent_board.send_outcomes so where so.message_id = r.message_id)), false) from public.so670_iso5_ret r) as every_returned_has_receipt;
|
|
54
|
+
|
|
55
|
+
messages|receipts|receipt_owners |returned_by|distinct_returned|every_returned_has_receipt
|
|
56
|
+
--------+--------+---------------------------------+-----------+-----------------+--------------------------
|
|
57
|
+
1| 1|post_board_message:so670-iso5-x-m|p | 1|t
|
|
58
|
+
(1 row)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
starting permutation: p_post fanout d_begin d_delete r_read d_commit r_read fanout check
|
|
62
|
+
set_config
|
|
63
|
+
--------------------------------------------------------------------------
|
|
64
|
+
{"role" : "authenticated", "sub" : "670b5000-0000-4000-8000-0000000000c1"}
|
|
65
|
+
(1 row)
|
|
66
|
+
|
|
67
|
+
step p_post: insert into public.so670_iso5_ret select 'p', message_id from agent_board.post_board_message('670b5000-0000-4000-8000-000000000012','670b5000-0000-4000-8000-000000000003','670b5000-0000-4000-8000-000000000020','iso','so670 body','comment','medium','K',jsonb_build_object());
|
|
68
|
+
step fanout: select (select count(*) from agent_board.delivery_recipients where recipient_agent_id in ('670b5000-0000-4000-8000-000000000001','670b5000-0000-4000-8000-000000000002')) as deliveries, (select count(*) from agent_board.inbox_items where recipient_agent_id in ('670b5000-0000-4000-8000-000000000001','670b5000-0000-4000-8000-000000000002')) as inbox, (select count(*) from agent_board.send_outcomes where thread_id = '670b5000-0000-4000-8000-000000000012') as receipts;
|
|
69
|
+
deliveries|inbox|receipts
|
|
70
|
+
----------+-----+--------
|
|
71
|
+
2| 2| 1
|
|
72
|
+
(1 row)
|
|
73
|
+
|
|
74
|
+
step d_begin: begin;
|
|
75
|
+
step d_delete: delete from agent_board.messages where thread_id = '670b5000-0000-4000-8000-000000000012';
|
|
76
|
+
step r_read: select status from agent_board.get_send_outcome('670b5000-0000-4000-8000-000000000012','K','post_board_message');
|
|
77
|
+
status
|
|
78
|
+
---------
|
|
79
|
+
confirmed
|
|
80
|
+
(1 row)
|
|
81
|
+
|
|
82
|
+
step d_commit: commit;
|
|
83
|
+
step r_read: select status from agent_board.get_send_outcome('670b5000-0000-4000-8000-000000000012','K','post_board_message');
|
|
84
|
+
status
|
|
85
|
+
-------
|
|
86
|
+
unknown
|
|
87
|
+
(1 row)
|
|
88
|
+
|
|
89
|
+
step fanout: select (select count(*) from agent_board.delivery_recipients where recipient_agent_id in ('670b5000-0000-4000-8000-000000000001','670b5000-0000-4000-8000-000000000002')) as deliveries, (select count(*) from agent_board.inbox_items where recipient_agent_id in ('670b5000-0000-4000-8000-000000000001','670b5000-0000-4000-8000-000000000002')) as inbox, (select count(*) from agent_board.send_outcomes where thread_id = '670b5000-0000-4000-8000-000000000012') as receipts;
|
|
90
|
+
deliveries|inbox|receipts
|
|
91
|
+
----------+-----+--------
|
|
92
|
+
0| 0| 0
|
|
93
|
+
(1 row)
|
|
94
|
+
|
|
95
|
+
step check:
|
|
96
|
+
select (select count(*) from agent_board.messages where thread_id in ('670b5000-0000-4000-8000-000000000012')) as messages,
|
|
97
|
+
(select count(*) from agent_board.send_outcomes where thread_id in ('670b5000-0000-4000-8000-000000000012')) as receipts,
|
|
98
|
+
(select string_agg(so.operation || ':' || a.handle, ',' order by so.operation, a.handle) from agent_board.send_outcomes so join agent_board.agents a on a.id = so.author_agent_id where so.thread_id in ('670b5000-0000-4000-8000-000000000012')) as receipt_owners,
|
|
99
|
+
(select string_agg(r.s, ',' order by r.s) from public.so670_iso5_ret r) as returned_by,
|
|
100
|
+
(select count(distinct r.message_id) from public.so670_iso5_ret r) as distinct_returned,
|
|
101
|
+
(select coalesce(bool_and(exists (select 1 from agent_board.send_outcomes so where so.message_id = r.message_id)), false) from public.so670_iso5_ret r) as every_returned_has_receipt;
|
|
102
|
+
|
|
103
|
+
messages|receipts|receipt_owners|returned_by|distinct_returned|every_returned_has_receipt
|
|
104
|
+
--------+--------+--------------+-----------+-----------------+--------------------------
|
|
105
|
+
0| 0| |p | 1|f
|
|
106
|
+
(1 row)
|
|
107
|
+
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
Parsed test spec with 4 sessions
|
|
2
|
+
|
|
3
|
+
starting permutation: p_begin p_private b_begin b_board p_end b_end check
|
|
4
|
+
step p_begin: begin; set local role authenticated; select set_config('request.jwt.claim.role','',true), set_config('request.jwt.claim.sub','',true), set_config('request.jwt.claims',json_build_object('role','authenticated','sub','71740000-0000-4000-8000-0000000000a1')::text,true);
|
|
5
|
+
set_config|set_config|set_config
|
|
6
|
+
----------+----------+--------------------------------------------------------------------------
|
|
7
|
+
| |{"role" : "authenticated", "sub" : "71740000-0000-4000-8000-0000000000a1"}
|
|
8
|
+
(1 row)
|
|
9
|
+
|
|
10
|
+
step p_private: select delivered_recipient_count, inbox_item_count, callback_outbox_count from agent_board.create_tasking_delivery('71740000-0000-4000-8000-000000000010','71740000-0000-4000-8000-000000000001','iso private',null,array['71740000-0000-4000-8000-000000000003']::uuid[],null,'medium','distributed','f2717-kc',jsonb_build_object());
|
|
11
|
+
delivered_recipient_count|inbox_item_count|callback_outbox_count
|
|
12
|
+
-------------------------+----------------+---------------------
|
|
13
|
+
1| 1| 1
|
|
14
|
+
(1 row)
|
|
15
|
+
|
|
16
|
+
step b_begin: begin; set local role authenticated; select set_config('request.jwt.claim.role','',true), set_config('request.jwt.claim.sub','',true), set_config('request.jwt.claims',json_build_object('role','authenticated','sub','71740000-0000-4000-8000-0000000000a1')::text,true);
|
|
17
|
+
set_config|set_config|set_config
|
|
18
|
+
----------+----------+--------------------------------------------------------------------------
|
|
19
|
+
| |{"role" : "authenticated", "sub" : "71740000-0000-4000-8000-0000000000a1"}
|
|
20
|
+
(1 row)
|
|
21
|
+
|
|
22
|
+
step b_board: select delivered_recipient_count, inbox_item_count, callback_outbox_count from agent_board.create_tasking_delivery('71740000-0000-4000-8000-000000000010','71740000-0000-4000-8000-000000000001','iso board',null,null,'71740000-0000-4000-8000-000000000020','medium','distributed','f2717-kc',jsonb_build_object()); <waiting ...>
|
|
23
|
+
step p_end: end;
|
|
24
|
+
step b_board: <... completed>
|
|
25
|
+
ERROR: tasking replay cannot widen delivery scope
|
|
26
|
+
step b_end: end;
|
|
27
|
+
step check:
|
|
28
|
+
select count(*) as tasks,
|
|
29
|
+
(select count(*) from agent_board.task_events te join agent_board.tasks t on t.id = te.task_id where t.thread_id = '71740000-0000-4000-8000-000000000010') as events,
|
|
30
|
+
(select count(*) from agent_board.delivery_recipients dr join agent_board.tasks t on t.id = dr.source_task_id where t.thread_id = '71740000-0000-4000-8000-000000000010' and dr.board_id is null) as private_deliveries,
|
|
31
|
+
(select count(*) from agent_board.delivery_recipients dr join agent_board.tasks t on t.id = dr.source_task_id where t.thread_id = '71740000-0000-4000-8000-000000000010' and dr.board_id is not null) as board_deliveries,
|
|
32
|
+
(select count(*) from agent_board.inbox_items ii join agent_board.tasks t on t.id = ii.source_task_id where t.thread_id = '71740000-0000-4000-8000-000000000010') as inbox,
|
|
33
|
+
(select count(*) from agent_board.callback_outbox_events co join agent_board.tasks t on t.id = co.source_task_id where t.thread_id = '71740000-0000-4000-8000-000000000010') as callbacks,
|
|
34
|
+
string_agg(title, ',' order by title) as titles
|
|
35
|
+
from agent_board.tasks where thread_id = '71740000-0000-4000-8000-000000000010';
|
|
36
|
+
|
|
37
|
+
tasks|events|private_deliveries|board_deliveries|inbox|callbacks|titles
|
|
38
|
+
-----+------+------------------+----------------+-----+---------+-----------
|
|
39
|
+
1| 1| 1| 0| 1| 1|iso private
|
|
40
|
+
(1 row)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
starting permutation: b_begin b_board p_begin p_private b_end p_end check
|
|
44
|
+
step b_begin: begin; set local role authenticated; select set_config('request.jwt.claim.role','',true), set_config('request.jwt.claim.sub','',true), set_config('request.jwt.claims',json_build_object('role','authenticated','sub','71740000-0000-4000-8000-0000000000a1')::text,true);
|
|
45
|
+
set_config|set_config|set_config
|
|
46
|
+
----------+----------+--------------------------------------------------------------------------
|
|
47
|
+
| |{"role" : "authenticated", "sub" : "71740000-0000-4000-8000-0000000000a1"}
|
|
48
|
+
(1 row)
|
|
49
|
+
|
|
50
|
+
step b_board: select delivered_recipient_count, inbox_item_count, callback_outbox_count from agent_board.create_tasking_delivery('71740000-0000-4000-8000-000000000010','71740000-0000-4000-8000-000000000001','iso board',null,null,'71740000-0000-4000-8000-000000000020','medium','distributed','f2717-kc',jsonb_build_object());
|
|
51
|
+
delivered_recipient_count|inbox_item_count|callback_outbox_count
|
|
52
|
+
-------------------------+----------------+---------------------
|
|
53
|
+
0| 0| 0
|
|
54
|
+
(1 row)
|
|
55
|
+
|
|
56
|
+
step p_begin: begin; set local role authenticated; select set_config('request.jwt.claim.role','',true), set_config('request.jwt.claim.sub','',true), set_config('request.jwt.claims',json_build_object('role','authenticated','sub','71740000-0000-4000-8000-0000000000a1')::text,true);
|
|
57
|
+
set_config|set_config|set_config
|
|
58
|
+
----------+----------+--------------------------------------------------------------------------
|
|
59
|
+
| |{"role" : "authenticated", "sub" : "71740000-0000-4000-8000-0000000000a1"}
|
|
60
|
+
(1 row)
|
|
61
|
+
|
|
62
|
+
step p_private: select delivered_recipient_count, inbox_item_count, callback_outbox_count from agent_board.create_tasking_delivery('71740000-0000-4000-8000-000000000010','71740000-0000-4000-8000-000000000001','iso private',null,array['71740000-0000-4000-8000-000000000003']::uuid[],null,'medium','distributed','f2717-kc',jsonb_build_object()); <waiting ...>
|
|
63
|
+
step b_end: end;
|
|
64
|
+
step p_private: <... completed>
|
|
65
|
+
ERROR: tasking replay cannot widen delivery scope
|
|
66
|
+
step p_end: end;
|
|
67
|
+
step check:
|
|
68
|
+
select count(*) as tasks,
|
|
69
|
+
(select count(*) from agent_board.task_events te join agent_board.tasks t on t.id = te.task_id where t.thread_id = '71740000-0000-4000-8000-000000000010') as events,
|
|
70
|
+
(select count(*) from agent_board.delivery_recipients dr join agent_board.tasks t on t.id = dr.source_task_id where t.thread_id = '71740000-0000-4000-8000-000000000010' and dr.board_id is null) as private_deliveries,
|
|
71
|
+
(select count(*) from agent_board.delivery_recipients dr join agent_board.tasks t on t.id = dr.source_task_id where t.thread_id = '71740000-0000-4000-8000-000000000010' and dr.board_id is not null) as board_deliveries,
|
|
72
|
+
(select count(*) from agent_board.inbox_items ii join agent_board.tasks t on t.id = ii.source_task_id where t.thread_id = '71740000-0000-4000-8000-000000000010') as inbox,
|
|
73
|
+
(select count(*) from agent_board.callback_outbox_events co join agent_board.tasks t on t.id = co.source_task_id where t.thread_id = '71740000-0000-4000-8000-000000000010') as callbacks,
|
|
74
|
+
string_agg(title, ',' order by title) as titles
|
|
75
|
+
from agent_board.tasks where thread_id = '71740000-0000-4000-8000-000000000010';
|
|
76
|
+
|
|
77
|
+
tasks|events|private_deliveries|board_deliveries|inbox|callbacks|titles
|
|
78
|
+
-----+------+------------------+----------------+-----+---------+---------
|
|
79
|
+
1| 1| 0| 1| 1| 0|iso board
|
|
80
|
+
(1 row)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
starting permutation: p_begin p_private r_begin r_private p_end r_end check
|
|
84
|
+
step p_begin: begin; set local role authenticated; select set_config('request.jwt.claim.role','',true), set_config('request.jwt.claim.sub','',true), set_config('request.jwt.claims',json_build_object('role','authenticated','sub','71740000-0000-4000-8000-0000000000a1')::text,true);
|
|
85
|
+
set_config|set_config|set_config
|
|
86
|
+
----------+----------+--------------------------------------------------------------------------
|
|
87
|
+
| |{"role" : "authenticated", "sub" : "71740000-0000-4000-8000-0000000000a1"}
|
|
88
|
+
(1 row)
|
|
89
|
+
|
|
90
|
+
step p_private: select delivered_recipient_count, inbox_item_count, callback_outbox_count from agent_board.create_tasking_delivery('71740000-0000-4000-8000-000000000010','71740000-0000-4000-8000-000000000001','iso private',null,array['71740000-0000-4000-8000-000000000003']::uuid[],null,'medium','distributed','f2717-kc',jsonb_build_object());
|
|
91
|
+
delivered_recipient_count|inbox_item_count|callback_outbox_count
|
|
92
|
+
-------------------------+----------------+---------------------
|
|
93
|
+
1| 1| 1
|
|
94
|
+
(1 row)
|
|
95
|
+
|
|
96
|
+
step r_begin: begin; set local role authenticated; select set_config('request.jwt.claim.role','',true), set_config('request.jwt.claim.sub','',true), set_config('request.jwt.claims',json_build_object('role','authenticated','sub','71740000-0000-4000-8000-0000000000a1')::text,true);
|
|
97
|
+
set_config|set_config|set_config
|
|
98
|
+
----------+----------+--------------------------------------------------------------------------
|
|
99
|
+
| |{"role" : "authenticated", "sub" : "71740000-0000-4000-8000-0000000000a1"}
|
|
100
|
+
(1 row)
|
|
101
|
+
|
|
102
|
+
step r_private: select delivered_recipient_count, inbox_item_count, callback_outbox_count from agent_board.create_tasking_delivery('71740000-0000-4000-8000-000000000010','71740000-0000-4000-8000-000000000001','iso private',null,array['71740000-0000-4000-8000-000000000003']::uuid[],null,'medium','distributed','f2717-kc',jsonb_build_object()); <waiting ...>
|
|
103
|
+
step p_end: end;
|
|
104
|
+
step r_private: <... completed>
|
|
105
|
+
delivered_recipient_count|inbox_item_count|callback_outbox_count
|
|
106
|
+
-------------------------+----------------+---------------------
|
|
107
|
+
1| 1| 0
|
|
108
|
+
(1 row)
|
|
109
|
+
|
|
110
|
+
step r_end: end;
|
|
111
|
+
step check:
|
|
112
|
+
select count(*) as tasks,
|
|
113
|
+
(select count(*) from agent_board.task_events te join agent_board.tasks t on t.id = te.task_id where t.thread_id = '71740000-0000-4000-8000-000000000010') as events,
|
|
114
|
+
(select count(*) from agent_board.delivery_recipients dr join agent_board.tasks t on t.id = dr.source_task_id where t.thread_id = '71740000-0000-4000-8000-000000000010' and dr.board_id is null) as private_deliveries,
|
|
115
|
+
(select count(*) from agent_board.delivery_recipients dr join agent_board.tasks t on t.id = dr.source_task_id where t.thread_id = '71740000-0000-4000-8000-000000000010' and dr.board_id is not null) as board_deliveries,
|
|
116
|
+
(select count(*) from agent_board.inbox_items ii join agent_board.tasks t on t.id = ii.source_task_id where t.thread_id = '71740000-0000-4000-8000-000000000010') as inbox,
|
|
117
|
+
(select count(*) from agent_board.callback_outbox_events co join agent_board.tasks t on t.id = co.source_task_id where t.thread_id = '71740000-0000-4000-8000-000000000010') as callbacks,
|
|
118
|
+
string_agg(title, ',' order by title) as titles
|
|
119
|
+
from agent_board.tasks where thread_id = '71740000-0000-4000-8000-000000000010';
|
|
120
|
+
|
|
121
|
+
tasks|events|private_deliveries|board_deliveries|inbox|callbacks|titles
|
|
122
|
+
-----+------+------------------+----------------+-----+---------+-----------
|
|
123
|
+
1| 1| 1| 0| 1| 1|iso private
|
|
124
|
+
(1 row)
|
|
125
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# #667: an artifact may name an empty explicit thread and a task on another
|
|
2
|
+
# thread. The explicit thread must serialize with first association even when a
|
|
3
|
+
# different canonical anchor is also present.
|
|
4
|
+
setup
|
|
5
|
+
{
|
|
6
|
+
insert into agent_board.agents(id,agent_type,handle,display_name,status)
|
|
7
|
+
values ('66780000-0000-4000-8000-000000000001','agent','xb-anchor-order','XB multi anchor','active');
|
|
8
|
+
insert into agent_board.boards(id,slug,name,created_by_agent_id,visibility,status)
|
|
9
|
+
values ('66780000-0000-4000-8000-000000000020','xb-anchor-order-board','XB multi anchor board',
|
|
10
|
+
'66780000-0000-4000-8000-000000000001','private','active');
|
|
11
|
+
insert into agent_board.threads(id,thread_type,created_by_agent_id,subject)
|
|
12
|
+
values ('66780000-0000-4000-8000-000000000010','coordination','66780000-0000-4000-8000-000000000001','explicit empty'),
|
|
13
|
+
('66780000-0000-4000-8000-000000000011','coordination','66780000-0000-4000-8000-000000000001','task parent');
|
|
14
|
+
insert into agent_board.tasks(id,thread_id,created_by_agent_id,title)
|
|
15
|
+
values ('66780000-0000-4000-8000-000000000030','66780000-0000-4000-8000-000000000011','66780000-0000-4000-8000-000000000001','parent one'),
|
|
16
|
+
('66780000-0000-4000-8000-000000000031','66780000-0000-4000-8000-000000000010','66780000-0000-4000-8000-000000000001','parent two');
|
|
17
|
+
}
|
|
18
|
+
teardown
|
|
19
|
+
{
|
|
20
|
+
delete from agent_board.artifacts where thread_id in ('66780000-0000-4000-8000-000000000010','66780000-0000-4000-8000-000000000011');
|
|
21
|
+
delete from agent_board.task_events where task_id in ('66780000-0000-4000-8000-000000000030','66780000-0000-4000-8000-000000000031');
|
|
22
|
+
delete from agent_board.tasks where id in ('66780000-0000-4000-8000-000000000030','66780000-0000-4000-8000-000000000031');
|
|
23
|
+
delete from agent_board.messages where thread_id='66780000-0000-4000-8000-000000000010';
|
|
24
|
+
delete from agent_board.threads where id in ('66780000-0000-4000-8000-000000000010','66780000-0000-4000-8000-000000000011');
|
|
25
|
+
delete from agent_board.boards where id='66780000-0000-4000-8000-000000000020';
|
|
26
|
+
delete from agent_board.agents where id='66780000-0000-4000-8000-000000000001';
|
|
27
|
+
}
|
|
28
|
+
session "a"
|
|
29
|
+
step "a_begin" { begin; set local statement_timeout='2s'; select set_config('request.jwt.claim.role','service_role',true); }
|
|
30
|
+
step "a_artifact" { select count(*) from agent_board.add_artifact('66780000-0000-4000-8000-000000000001','https://example.test/first',p_thread_id=>'66780000-0000-4000-8000-000000000010',p_task_id=>'66780000-0000-4000-8000-000000000030'); }
|
|
31
|
+
step "a_commit" { commit; }
|
|
32
|
+
session "b"
|
|
33
|
+
step "b_begin" { begin; select set_config('request.jwt.claim.role','service_role',true); }
|
|
34
|
+
step "b_artifact" { select count(*) from agent_board.add_artifact('66780000-0000-4000-8000-000000000001','https://example.test/second',p_thread_id=>'66780000-0000-4000-8000-000000000011',p_task_id=>'66780000-0000-4000-8000-000000000031'); }
|
|
35
|
+
step "b_commit" { commit; }
|
|
36
|
+
session "hold"
|
|
37
|
+
step "hold_high" { begin; select id from agent_board.threads where id='66780000-0000-4000-8000-000000000011' for no key update; }
|
|
38
|
+
step "release_high" { commit; }
|
|
39
|
+
session "probe"
|
|
40
|
+
step "probe_low" { begin; select id from agent_board.threads where id='66780000-0000-4000-8000-000000000010' for no key update; }
|
|
41
|
+
step "probe_commit" { commit; }
|
|
42
|
+
session "check"
|
|
43
|
+
step "check" { select count(*) as artifacts, count(distinct thread_id) as explicit_threads, count(distinct task_id) as task_anchors from agent_board.artifacts where thread_id in ('66780000-0000-4000-8000-000000000010','66780000-0000-4000-8000-000000000011'); }
|
|
44
|
+
permutation "a_begin" "a_artifact" "b_begin" "b_artifact" "a_commit" "b_commit" "check"
|
|
45
|
+
permutation "b_begin" "b_artifact" "a_begin" "a_artifact" "b_commit" "a_commit" "check"
|
|
46
|
+
permutation "hold_high" "a_begin" "a_artifact" "probe_low" "release_high" "a_commit" "probe_commit" "check"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Two first-association senders choose different boards. The loser must re-read
|
|
2
|
+
# the winning stamp after its wait and leave neither its message nor delivery.
|
|
3
|
+
setup
|
|
4
|
+
{
|
|
5
|
+
insert into agent_board.agents(id,agent_type,handle,display_name,status)
|
|
6
|
+
values ('66790000-0000-4000-8000-000000000001','agent','xb-board-race','XB board race','active');
|
|
7
|
+
insert into agent_board.boards(id,slug,name,created_by_agent_id,visibility,status)
|
|
8
|
+
values ('66790000-0000-4000-8000-000000000020','xb-race-one','XB race one','66790000-0000-4000-8000-000000000001','private','active'),
|
|
9
|
+
('66790000-0000-4000-8000-000000000021','xb-race-two','XB race two','66790000-0000-4000-8000-000000000001','private','active');
|
|
10
|
+
insert into agent_board.threads(id,thread_type,created_by_agent_id,subject)
|
|
11
|
+
values ('66790000-0000-4000-8000-000000000010','coordination','66790000-0000-4000-8000-000000000001','board race');
|
|
12
|
+
create function agent_board_test.xb_667_board_race(p_board uuid,p_text text) returns text language plpgsql as $$
|
|
13
|
+
begin
|
|
14
|
+
perform agent_board.post_board_message('66790000-0000-4000-8000-000000000010','66790000-0000-4000-8000-000000000001',p_board,'subject',p_text);
|
|
15
|
+
return 'allowed';
|
|
16
|
+
exception when others then return sqlstate || ':' || sqlerrm; end $$;
|
|
17
|
+
}
|
|
18
|
+
teardown
|
|
19
|
+
{
|
|
20
|
+
drop function agent_board_test.xb_667_board_race(uuid,text);
|
|
21
|
+
delete from agent_board.messages where thread_id='66790000-0000-4000-8000-000000000010';
|
|
22
|
+
delete from agent_board.threads where id='66790000-0000-4000-8000-000000000010';
|
|
23
|
+
delete from agent_board.boards where id in ('66790000-0000-4000-8000-000000000020','66790000-0000-4000-8000-000000000021');
|
|
24
|
+
delete from agent_board.agents where id='66790000-0000-4000-8000-000000000001';
|
|
25
|
+
}
|
|
26
|
+
session "a"
|
|
27
|
+
step "a_begin" { begin; select set_config('request.jwt.claim.role','service_role',true); }
|
|
28
|
+
step "a_post" { select agent_board_test.xb_667_board_race('66790000-0000-4000-8000-000000000020','first') as outcome; }
|
|
29
|
+
step "a_commit" { commit; }
|
|
30
|
+
session "b"
|
|
31
|
+
step "b_begin" { begin; select set_config('request.jwt.claim.role','service_role',true); }
|
|
32
|
+
step "b_post" { select agent_board_test.xb_667_board_race('66790000-0000-4000-8000-000000000021','second') as outcome; }
|
|
33
|
+
step "b_commit" { commit; }
|
|
34
|
+
session "check"
|
|
35
|
+
step "check" { select t.board_id, (select count(*) from agent_board.messages m where m.thread_id=t.id) as messages, (select count(*) from agent_board.messages m where m.thread_id=t.id and m.body='first') as first_messages, (select count(*) from agent_board.messages m where m.thread_id=t.id and m.body='second') as second_messages, (select count(*) from agent_board.delivery_recipients d join agent_board.messages m on m.id=d.source_message_id where m.thread_id=t.id) as deliveries from agent_board.threads t where t.id='66790000-0000-4000-8000-000000000010'; }
|
|
36
|
+
permutation "a_begin" "a_post" "b_begin" "b_post" "a_commit" "b_commit" "check"
|
|
37
|
+
permutation "b_begin" "b_post" "a_begin" "a_post" "b_commit" "a_commit" "check"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# #667: sequence UPDATE waits for association. The posting gate must be read
|
|
2
|
+
# after that wait. A nonmember thread creator is denied; a board member succeeds.
|
|
3
|
+
setup
|
|
4
|
+
{
|
|
5
|
+
insert into auth.users(id) values ('66750000-0000-4000-8000-0000000000b1'),('66750000-0000-4000-8000-0000000000c1');
|
|
6
|
+
insert into agent_board.agents(id,agent_type,handle,display_name,status,auth_user_id,owner_user_id)
|
|
7
|
+
values ('66750000-0000-4000-8000-000000000001','agent','xb-post-owner','XB owner','active',null,null),
|
|
8
|
+
('66750000-0000-4000-8000-000000000002','agent','xb-post-denied','XB denied','active','66750000-0000-4000-8000-0000000000b1','66750000-0000-4000-8000-0000000000b1'),
|
|
9
|
+
('66750000-0000-4000-8000-000000000003','agent','xb-post-member','XB member','active','66750000-0000-4000-8000-0000000000c1','66750000-0000-4000-8000-0000000000c1');
|
|
10
|
+
insert into agent_board.boards(id,slug,name,created_by_agent_id,visibility,status)
|
|
11
|
+
values ('66750000-0000-4000-8000-000000000020','xb-post-board','XB post board','66750000-0000-4000-8000-000000000001','private','active');
|
|
12
|
+
select set_config('request.jwt.claim.role','service_role',false);
|
|
13
|
+
insert into agent_board.board_memberships(board_id,agent_id,membership_state,created_by_agent_id,role)
|
|
14
|
+
values ('66750000-0000-4000-8000-000000000020','66750000-0000-4000-8000-000000000003','joined','66750000-0000-4000-8000-000000000001','member');
|
|
15
|
+
insert into agent_board.threads(id,thread_type,created_by_agent_id,subject)
|
|
16
|
+
values ('66750000-0000-4000-8000-000000000010','coordination','66750000-0000-4000-8000-000000000002','denied thread'),
|
|
17
|
+
('66750000-0000-4000-8000-000000000011','coordination','66750000-0000-4000-8000-000000000003','member thread');
|
|
18
|
+
}
|
|
19
|
+
teardown
|
|
20
|
+
{
|
|
21
|
+
delete from agent_board.inbox_items where board_id='66750000-0000-4000-8000-000000000020';
|
|
22
|
+
delete from agent_board.delivery_recipients where board_id='66750000-0000-4000-8000-000000000020';
|
|
23
|
+
delete from agent_board.messages where thread_id in ('66750000-0000-4000-8000-000000000010','66750000-0000-4000-8000-000000000011');
|
|
24
|
+
delete from agent_board.threads where id in ('66750000-0000-4000-8000-000000000010','66750000-0000-4000-8000-000000000011');
|
|
25
|
+
delete from agent_board.board_membership_events where board_id='66750000-0000-4000-8000-000000000020';
|
|
26
|
+
delete from agent_board.board_memberships where board_id='66750000-0000-4000-8000-000000000020';
|
|
27
|
+
delete from agent_board.boards where id='66750000-0000-4000-8000-000000000020';
|
|
28
|
+
delete from agent_board.agents where id in ('66750000-0000-4000-8000-000000000001','66750000-0000-4000-8000-000000000002','66750000-0000-4000-8000-000000000003');
|
|
29
|
+
delete from auth.users where id in ('66750000-0000-4000-8000-0000000000b1','66750000-0000-4000-8000-0000000000c1');
|
|
30
|
+
}
|
|
31
|
+
session "a"
|
|
32
|
+
step "a_begin" { begin; select set_config('request.jwt.claim.role','service_role',true); }
|
|
33
|
+
step "a_post_denied" { select count(*) from agent_board.post_board_message('66750000-0000-4000-8000-000000000010','66750000-0000-4000-8000-000000000001','66750000-0000-4000-8000-000000000020','s','b'); }
|
|
34
|
+
step "a_post_member" { select count(*) from agent_board.post_board_message('66750000-0000-4000-8000-000000000011','66750000-0000-4000-8000-000000000001','66750000-0000-4000-8000-000000000020','s','b'); }
|
|
35
|
+
step "a_commit" { commit; }
|
|
36
|
+
session "b"
|
|
37
|
+
step "b_begin" { begin; set local role authenticated; select set_config('request.jwt.claim.role','authenticated',true); select set_config('request.jwt.claim.sub','66750000-0000-4000-8000-0000000000b1',true); }
|
|
38
|
+
step "b_post" { select count(*) from agent_board.post_message('66750000-0000-4000-8000-000000000010','66750000-0000-4000-8000-000000000002','private after wait'); }
|
|
39
|
+
step "b_end" { end; }
|
|
40
|
+
session "c"
|
|
41
|
+
step "c_begin" { begin; set local role authenticated; select set_config('request.jwt.claim.role','authenticated',true); select set_config('request.jwt.claim.sub','66750000-0000-4000-8000-0000000000c1',true); }
|
|
42
|
+
step "c_post" { select count(*) from agent_board.post_message('66750000-0000-4000-8000-000000000011','66750000-0000-4000-8000-000000000003','member after wait'); }
|
|
43
|
+
step "c_end" { end; }
|
|
44
|
+
session "check"
|
|
45
|
+
step "check_denied" { select count(*) as messages, max(message_sequence) as max_sequence from agent_board.messages where thread_id='66750000-0000-4000-8000-000000000010'; }
|
|
46
|
+
step "check_member" { select count(*) as messages, max(message_sequence) as max_sequence from agent_board.messages where thread_id='66750000-0000-4000-8000-000000000011'; }
|
|
47
|
+
permutation "a_begin" "a_post_denied" "b_begin" "b_post" "a_commit" "b_end" "check_denied"
|
|
48
|
+
permutation "a_begin" "a_post_member" "c_begin" "c_post" "a_commit" "c_end" "check_member"
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# #667: fixed-snapshot first association refuses before stamping, even after a
|
|
2
|
+
# writer commits; already-associated board tasks remain allowed at stronger isolation.
|
|
3
|
+
setup
|
|
4
|
+
{
|
|
5
|
+
insert into agent_board.agents(id,agent_type,handle,display_name,status)
|
|
6
|
+
values ('66770000-0000-4000-8000-000000000001','agent','xb-strong-history','XB strong isolation','active');
|
|
7
|
+
insert into agent_board.boards(id,slug,name,created_by_agent_id,visibility,status)
|
|
8
|
+
values ('66770000-0000-4000-8000-000000000020','xb-strong-history-board','XB strong board',
|
|
9
|
+
'66770000-0000-4000-8000-000000000001','private','active');
|
|
10
|
+
insert into agent_board.threads(id,thread_type,created_by_agent_id,subject)
|
|
11
|
+
values ('66770000-0000-4000-8000-000000000010','coordination',
|
|
12
|
+
'66770000-0000-4000-8000-000000000001','strong isolation');
|
|
13
|
+
create function agent_board_test.xb_667_try_stale_artifact() returns text language plpgsql as $$
|
|
14
|
+
begin
|
|
15
|
+
perform agent_board.add_artifact('66770000-0000-4000-8000-000000000001','https://example.test/stale',p_thread_id=>'66770000-0000-4000-8000-000000000010');
|
|
16
|
+
return 'allowed';
|
|
17
|
+
exception when others then return sqlstate || ':' || sqlerrm; end $$;
|
|
18
|
+
create function agent_board_test.xb_667_try_history_association() returns text language plpgsql as $$
|
|
19
|
+
begin
|
|
20
|
+
perform agent_board.post_board_message('66770000-0000-4000-8000-000000000010','66770000-0000-4000-8000-000000000001','66770000-0000-4000-8000-000000000020','s','b');
|
|
21
|
+
return 'allowed';
|
|
22
|
+
exception when others then return sqlstate || ':' || sqlerrm; end $$;
|
|
23
|
+
}
|
|
24
|
+
teardown
|
|
25
|
+
{
|
|
26
|
+
drop function agent_board_test.xb_667_try_history_association();
|
|
27
|
+
drop function agent_board_test.xb_667_try_stale_artifact();
|
|
28
|
+
delete from agent_board.artifacts where thread_id='66770000-0000-4000-8000-000000000010';
|
|
29
|
+
delete from agent_board.conflicts where thread_id='66770000-0000-4000-8000-000000000010';
|
|
30
|
+
delete from agent_board.task_events where thread_id='66770000-0000-4000-8000-000000000010';
|
|
31
|
+
delete from agent_board.tasks where thread_id='66770000-0000-4000-8000-000000000010';
|
|
32
|
+
delete from agent_board.messages where thread_id='66770000-0000-4000-8000-000000000010';
|
|
33
|
+
delete from agent_board.threads where id='66770000-0000-4000-8000-000000000010';
|
|
34
|
+
delete from agent_board.boards where id='66770000-0000-4000-8000-000000000020';
|
|
35
|
+
delete from agent_board.agents where id='66770000-0000-4000-8000-000000000001';
|
|
36
|
+
}
|
|
37
|
+
session "w"
|
|
38
|
+
step "w_begin" { begin; select set_config('request.jwt.claim.role','service_role',true); }
|
|
39
|
+
step "w_artifact" { select count(*) from agent_board.add_artifact('66770000-0000-4000-8000-000000000001','https://example.test/strong',p_thread_id=>'66770000-0000-4000-8000-000000000010'); }
|
|
40
|
+
step "w_stale_artifact" { select agent_board_test.xb_667_try_stale_artifact() as outcome; }
|
|
41
|
+
step "w_conflict" { select count(*) from agent_board.raise_conflict('66770000-0000-4000-8000-000000000010','66770000-0000-4000-8000-000000000001','private conflict'); }
|
|
42
|
+
step "w_rr" { begin isolation level repeatable read; select set_config('request.jwt.claim.role','service_role',true); select count(*) from agent_board.threads where id='66770000-0000-4000-8000-000000000010'; }
|
|
43
|
+
step "w_commit" { commit; }
|
|
44
|
+
session "a"
|
|
45
|
+
step "a_ru" { begin isolation level read uncommitted; select set_config('request.jwt.claim.role','service_role',true); select count(*) from agent_board.threads where id='66770000-0000-4000-8000-000000000010'; }
|
|
46
|
+
step "a_rr" { begin isolation level repeatable read; select set_config('request.jwt.claim.role','service_role',true); select count(*) from agent_board.threads where id='66770000-0000-4000-8000-000000000010'; }
|
|
47
|
+
step "a_ser" { begin isolation level serializable; select set_config('request.jwt.claim.role','service_role',true); select count(*) from agent_board.threads where id='66770000-0000-4000-8000-000000000010'; }
|
|
48
|
+
step "a_post" { select agent_board_test.xb_667_try_history_association() as outcome; }
|
|
49
|
+
step "a_task" { select count(*) from agent_board.create_task('66770000-0000-4000-8000-000000000010','66770000-0000-4000-8000-000000000001','board task'); }
|
|
50
|
+
step "a_end" { end; }
|
|
51
|
+
session "p"
|
|
52
|
+
step "p_begin" { begin; select set_config('request.jwt.claim.role','service_role',true); }
|
|
53
|
+
step "p_post" { select count(*) from agent_board.post_board_message('66770000-0000-4000-8000-000000000010','66770000-0000-4000-8000-000000000001','66770000-0000-4000-8000-000000000020','s','b'); }
|
|
54
|
+
step "p_commit" { commit; }
|
|
55
|
+
session "check"
|
|
56
|
+
step "check" { select (t.board_id is not null) as stamped, (select count(*) from agent_board.artifacts where thread_id=t.id) as artifacts, (select count(*) from agent_board.conflicts where thread_id=t.id) as conflicts, (select count(*) from agent_board.messages where thread_id=t.id) as messages from agent_board.threads t where t.id='66770000-0000-4000-8000-000000000010'; }
|
|
57
|
+
permutation "a_rr" "w_begin" "w_artifact" "a_post" "w_commit" "a_end" "check"
|
|
58
|
+
permutation "a_ser" "w_begin" "w_artifact" "a_post" "w_commit" "a_end" "check"
|
|
59
|
+
permutation "a_rr" "w_begin" "w_conflict" "a_post" "w_commit" "a_end" "check"
|
|
60
|
+
permutation "a_ser" "w_begin" "w_conflict" "a_post" "w_commit" "a_end" "check"
|
|
61
|
+
permutation "w_rr" "p_begin" "p_post" "w_stale_artifact" "p_commit" "w_commit" "check"
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# #667: fixed-snapshot first association refuses before stamping, even after a
|
|
2
|
+
# writer commits; already-associated board tasks remain allowed at stronger isolation.
|
|
3
|
+
setup
|
|
4
|
+
{
|
|
5
|
+
insert into agent_board.agents(id,agent_type,handle,display_name,status)
|
|
6
|
+
values ('66740000-0000-4000-8000-000000000001','agent','xb-strong','XB strong isolation','active');
|
|
7
|
+
insert into agent_board.boards(id,slug,name,created_by_agent_id,visibility,status)
|
|
8
|
+
values ('66740000-0000-4000-8000-000000000020','xb-strong-board','XB strong board',
|
|
9
|
+
'66740000-0000-4000-8000-000000000001','private','active');
|
|
10
|
+
insert into agent_board.threads(id,thread_type,created_by_agent_id,subject)
|
|
11
|
+
values ('66740000-0000-4000-8000-000000000010','coordination',
|
|
12
|
+
'66740000-0000-4000-8000-000000000001','strong isolation');
|
|
13
|
+
create function agent_board_test.xb_667_try_association() returns text language plpgsql as $$
|
|
14
|
+
begin
|
|
15
|
+
perform agent_board.post_board_message('66740000-0000-4000-8000-000000000010','66740000-0000-4000-8000-000000000001','66740000-0000-4000-8000-000000000020','s','b');
|
|
16
|
+
return 'allowed';
|
|
17
|
+
exception when others then return sqlstate || ':' || sqlerrm; end $$;
|
|
18
|
+
}
|
|
19
|
+
teardown
|
|
20
|
+
{
|
|
21
|
+
drop function agent_board_test.xb_667_try_association();
|
|
22
|
+
delete from agent_board.task_events where thread_id='66740000-0000-4000-8000-000000000010';
|
|
23
|
+
delete from agent_board.tasks where thread_id='66740000-0000-4000-8000-000000000010';
|
|
24
|
+
delete from agent_board.messages where thread_id='66740000-0000-4000-8000-000000000010';
|
|
25
|
+
delete from agent_board.threads where id='66740000-0000-4000-8000-000000000010';
|
|
26
|
+
delete from agent_board.boards where id='66740000-0000-4000-8000-000000000020';
|
|
27
|
+
delete from agent_board.agents where id='66740000-0000-4000-8000-000000000001';
|
|
28
|
+
}
|
|
29
|
+
session "w"
|
|
30
|
+
step "w_begin" { begin; select set_config('request.jwt.claim.role','service_role',true); }
|
|
31
|
+
step "w_task" { select count(*) from agent_board.create_task('66740000-0000-4000-8000-000000000010','66740000-0000-4000-8000-000000000001','private task'); }
|
|
32
|
+
step "w_commit" { commit; }
|
|
33
|
+
session "a"
|
|
34
|
+
step "a_ru" { begin isolation level read uncommitted; select set_config('request.jwt.claim.role','service_role',true); select count(*) from agent_board.threads where id='66740000-0000-4000-8000-000000000010'; }
|
|
35
|
+
step "a_rr" { begin isolation level repeatable read; select set_config('request.jwt.claim.role','service_role',true); select count(*) from agent_board.threads where id='66740000-0000-4000-8000-000000000010'; }
|
|
36
|
+
step "a_ser" { begin isolation level serializable; select set_config('request.jwt.claim.role','service_role',true); select count(*) from agent_board.threads where id='66740000-0000-4000-8000-000000000010'; }
|
|
37
|
+
step "a_post" { select agent_board_test.xb_667_try_association() as outcome; }
|
|
38
|
+
step "a_task" { select count(*) from agent_board.create_task('66740000-0000-4000-8000-000000000010','66740000-0000-4000-8000-000000000001','board task'); }
|
|
39
|
+
step "a_end" { end; }
|
|
40
|
+
session "p"
|
|
41
|
+
step "p_begin" { begin; select set_config('request.jwt.claim.role','service_role',true); }
|
|
42
|
+
step "p_post" { select count(*) from agent_board.post_board_message('66740000-0000-4000-8000-000000000010','66740000-0000-4000-8000-000000000001','66740000-0000-4000-8000-000000000020','s','b'); }
|
|
43
|
+
step "p_commit" { commit; }
|
|
44
|
+
session "check"
|
|
45
|
+
step "check" { select (t.board_id is not null) as stamped, (select count(*) from agent_board.tasks where thread_id=t.id) as tasks, (select count(*) from agent_board.messages where thread_id=t.id) as messages from agent_board.threads t where t.id='66740000-0000-4000-8000-000000000010'; }
|
|
46
|
+
permutation "a_ru" "a_post" "a_end" "check"
|
|
47
|
+
permutation "a_rr" "w_begin" "w_task" "a_post" "w_commit" "a_end" "check"
|
|
48
|
+
permutation "a_ser" "w_begin" "w_task" "a_post" "w_commit" "a_end" "check"
|
|
49
|
+
permutation "p_begin" "p_post" "p_commit" "a_rr" "a_task" "a_end" "check"
|
|
50
|
+
permutation "p_begin" "p_post" "p_commit" "a_ser" "a_task" "a_end" "check"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# #667: thread-only artifact, thread-only claim and taskless escalation each
|
|
2
|
+
# serialize with first association. Each writer and the association win once.
|
|
3
|
+
setup
|
|
4
|
+
{
|
|
5
|
+
insert into agent_board.agents(id,agent_type,handle,display_name,status)
|
|
6
|
+
values ('66720000-0000-4000-8000-000000000001','agent','xb-art-claim-esc','XB art claim escalation','active');
|
|
7
|
+
insert into agent_board.boards(id,slug,name,created_by_agent_id,visibility,status)
|
|
8
|
+
values ('66720000-0000-4000-8000-000000000020','xb-art-claim-esc-board','XB art claim escalation board',
|
|
9
|
+
'66720000-0000-4000-8000-000000000001','private','active');
|
|
10
|
+
insert into agent_board.threads(id,thread_type,created_by_agent_id,subject)
|
|
11
|
+
values ('66720000-0000-4000-8000-000000000010','coordination',
|
|
12
|
+
'66720000-0000-4000-8000-000000000001','artifact claim escalation race');
|
|
13
|
+
}
|
|
14
|
+
teardown
|
|
15
|
+
{
|
|
16
|
+
delete from agent_board.artifacts where thread_id='66720000-0000-4000-8000-000000000010';
|
|
17
|
+
delete from agent_board.claims where thread_id='66720000-0000-4000-8000-000000000010';
|
|
18
|
+
delete from agent_board.escalations where thread_id='66720000-0000-4000-8000-000000000010';
|
|
19
|
+
delete from agent_board.messages where thread_id='66720000-0000-4000-8000-000000000010';
|
|
20
|
+
delete from agent_board.threads where id='66720000-0000-4000-8000-000000000010';
|
|
21
|
+
delete from agent_board.boards where id='66720000-0000-4000-8000-000000000020';
|
|
22
|
+
delete from agent_board.agents where id='66720000-0000-4000-8000-000000000001';
|
|
23
|
+
}
|
|
24
|
+
session "w"
|
|
25
|
+
step "w_begin" { begin; select set_config('request.jwt.claim.role','service_role',true); }
|
|
26
|
+
step "w_artifact" { select count(*) from agent_board.add_artifact('66720000-0000-4000-8000-000000000001','https://example.test/xb',p_thread_id=>'66720000-0000-4000-8000-000000000010'); }
|
|
27
|
+
step "w_claim" { select count(*) from agent_board.acquire_claim('66720000-0000-4000-8000-000000000001','custom','xb-race-key',now()+interval '1 hour',p_thread_id=>'66720000-0000-4000-8000-000000000010'); }
|
|
28
|
+
step "w_escalation" { select count(*) from agent_board.raise_escalation('66720000-0000-4000-8000-000000000010','66720000-0000-4000-8000-000000000001','private escalation'); }
|
|
29
|
+
step "w_commit" { commit; }
|
|
30
|
+
session "a"
|
|
31
|
+
step "a_begin" { begin; select set_config('request.jwt.claim.role','service_role',true); }
|
|
32
|
+
step "a_post" { select count(*) from agent_board.post_board_message('66720000-0000-4000-8000-000000000010','66720000-0000-4000-8000-000000000001','66720000-0000-4000-8000-000000000020','s','b'); }
|
|
33
|
+
step "a_end" { end; }
|
|
34
|
+
session "check"
|
|
35
|
+
step "check" { select (t.board_id is not null) as stamped, (select count(*) from agent_board.artifacts where thread_id=t.id) as artifacts, (select count(*) from agent_board.claims where thread_id=t.id) as claims, (select count(*) from agent_board.escalations where thread_id=t.id) as escalations, (select count(*) from agent_board.messages where thread_id=t.id) as messages from agent_board.threads t where t.id='66720000-0000-4000-8000-000000000010'; }
|
|
36
|
+
permutation "w_begin" "w_artifact" "a_begin" "a_post" "w_commit" "a_end" "check"
|
|
37
|
+
permutation "a_begin" "a_post" "w_begin" "w_artifact" "a_end" "w_commit" "check"
|
|
38
|
+
permutation "w_begin" "w_claim" "a_begin" "a_post" "w_commit" "a_end" "check"
|
|
39
|
+
permutation "a_begin" "a_post" "w_begin" "w_claim" "a_end" "w_commit" "check"
|
|
40
|
+
permutation "w_begin" "w_escalation" "a_begin" "a_post" "w_commit" "a_end" "check"
|
|
41
|
+
permutation "a_begin" "a_post" "w_begin" "w_escalation" "a_end" "w_commit" "check"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# #667: a heartbeat retaining its old thread and a first board association
|
|
2
|
+
# serialize on the thread. The second permutation covers an empty association
|
|
3
|
+
# winning before a heartbeat explicitly supplies that thread.
|
|
4
|
+
setup
|
|
5
|
+
{
|
|
6
|
+
insert into agent_board.agents(id, agent_type, handle, display_name, status)
|
|
7
|
+
values ('66700000-0000-4000-8000-000000000001', 'agent', 'xb-heartbeat', 'XB heartbeat', 'active');
|
|
8
|
+
select set_config('request.jwt.claim.role','service_role',false);
|
|
9
|
+
insert into agent_board.boards(id,slug,name,created_by_agent_id,visibility,status)
|
|
10
|
+
values ('66700000-0000-4000-8000-000000000020','xb-heartbeat-board','XB heartbeat board',
|
|
11
|
+
'66700000-0000-4000-8000-000000000001','private','active');
|
|
12
|
+
insert into agent_board.threads(id,thread_type,created_by_agent_id,subject)
|
|
13
|
+
values ('66700000-0000-4000-8000-000000000010','coordination',
|
|
14
|
+
'66700000-0000-4000-8000-000000000001','heartbeat race');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
teardown
|
|
18
|
+
{
|
|
19
|
+
delete from agent_board.callback_outbox_events where source_message_id in (select id from agent_board.messages where thread_id='66700000-0000-4000-8000-000000000010');
|
|
20
|
+
delete from agent_board.inbox_items where source_message_id in (select id from agent_board.messages where thread_id='66700000-0000-4000-8000-000000000010');
|
|
21
|
+
delete from agent_board.delivery_recipients where source_message_id in (select id from agent_board.messages where thread_id='66700000-0000-4000-8000-000000000010');
|
|
22
|
+
delete from agent_board.messages where thread_id='66700000-0000-4000-8000-000000000010';
|
|
23
|
+
delete from agent_board.presence where agent_id='66700000-0000-4000-8000-000000000001';
|
|
24
|
+
delete from agent_board.threads where id='66700000-0000-4000-8000-000000000010';
|
|
25
|
+
delete from agent_board.board_membership_events where board_id in (select id from agent_board.boards where slug='xb-heartbeat-board');
|
|
26
|
+
delete from agent_board.board_memberships where board_id in (select id from agent_board.boards where slug='xb-heartbeat-board');
|
|
27
|
+
delete from agent_board.boards where slug='xb-heartbeat-board';
|
|
28
|
+
delete from agent_board.agents where id='66700000-0000-4000-8000-000000000001';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
session "h"
|
|
32
|
+
step "h_prime" { select set_config('request.jwt.claim.role','service_role',false); select count(*) from agent_board.heartbeat('66700000-0000-4000-8000-000000000001','66700000-0000-4000-8000-000000000010',p_activity_summary => 'initial'); }
|
|
33
|
+
step "h_begin" { begin; select set_config('request.jwt.claim.role','service_role',true); }
|
|
34
|
+
step "h_retain" { select count(*) from agent_board.heartbeat('66700000-0000-4000-8000-000000000001',null,p_activity_summary => 'retained',p_metadata => jsonb_build_object('note','private')); }
|
|
35
|
+
step "h_attach" { select count(*) from agent_board.heartbeat('66700000-0000-4000-8000-000000000001','66700000-0000-4000-8000-000000000010',p_activity_summary => 'after association'); }
|
|
36
|
+
step "h_commit" { commit; }
|
|
37
|
+
|
|
38
|
+
session "a"
|
|
39
|
+
step "a_begin" { begin; select set_config('request.jwt.claim.role','service_role',true); }
|
|
40
|
+
step "a_post" { select count(*) from agent_board.post_board_message('66700000-0000-4000-8000-000000000010','66700000-0000-4000-8000-000000000001',(select id from agent_board.boards where slug='xb-heartbeat-board'),'s','b'); }
|
|
41
|
+
step "a_end" { end; }
|
|
42
|
+
|
|
43
|
+
session "check"
|
|
44
|
+
step "check" { select (t.board_id is not null) as stamped, p.thread_id is not null as presence_has_thread, p.activity_summary from agent_board.threads t left join agent_board.presence p on p.agent_id='66700000-0000-4000-8000-000000000001' where t.id='66700000-0000-4000-8000-000000000010'; }
|
|
45
|
+
|
|
46
|
+
permutation "h_prime" "h_begin" "h_retain" "a_begin" "a_post" "h_commit" "a_end" "check"
|
|
47
|
+
permutation "a_begin" "a_post" "h_begin" "h_attach" "a_end" "h_commit" "check"
|