@consiliency/agent-board-schema 1.57.0 → 1.59.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 (36) hide show
  1. package/fixtures/already-applied.json +8 -0
  2. package/migrations/20261008000100_agent_board_hosted_delegates.sql +3152 -0
  3. package/migrations/20261009000100_agent_board_hosted_followups.sql +665 -0
  4. package/package.json +1 -1
  5. package/schema-manifest.json +21 -3
  6. package/src/tooling.test.mjs +9 -2
  7. package/tests/agent_board_atomic_fleet_onboarding.test.sql +13 -0
  8. package/tests/agent_board_consent_emission.test.sql +4 -2
  9. package/tests/agent_board_delegate_role_class.test.sql +736 -0
  10. package/tests/agent_board_federated_identity_injective_slug.test.sql +5 -2
  11. package/tests/agent_board_fedsession_stored_identity_gate.test.sql +71 -14
  12. package/tests/agent_board_fk_lock_edges.test.sql +9 -0
  13. package/tests/agent_board_hosted_delegates.test.sql +1278 -0
  14. package/tests/agent_board_ledger_authority.test.sql +34 -5
  15. package/tests/agent_board_signer_lifecycle.test.sql +3 -0
  16. package/tests/agent_board_write_enforcement_class.test.sql +8 -3
  17. package/tests/catalog/function_execute_privileges.json +269 -2
  18. package/tests/catalog/p_metadata_parameters.json +44 -0
  19. package/tests/isolation/expected/hosted_delegate_add_tombstone_race.out +105 -0
  20. package/tests/isolation/expected/hosted_delegate_exchange_agent_revoke_race.out +66 -0
  21. package/tests/isolation/expected/hosted_delegate_exchange_race.out +93 -0
  22. package/tests/isolation/expected/hosted_delegate_first_exchange_race.out +129 -0
  23. package/tests/isolation/expected/hosted_delegate_owner_provisioning_race.out +91 -0
  24. package/tests/isolation/expected/hosted_delegate_owner_revoke_race.out +137 -0
  25. package/tests/isolation/expected/hosted_delegate_revoke_race.out +87 -0
  26. package/tests/isolation/expected/hosted_delegate_tombstone_revoke_race.out +170 -0
  27. package/tests/isolation/expected/hosted_delegate_withdraw_evict_race.out +235 -0
  28. package/tests/isolation/specs/hosted_delegate_add_tombstone_race.spec +102 -0
  29. package/tests/isolation/specs/hosted_delegate_exchange_agent_revoke_race.spec +92 -0
  30. package/tests/isolation/specs/hosted_delegate_exchange_race.spec +64 -0
  31. package/tests/isolation/specs/hosted_delegate_first_exchange_race.spec +72 -0
  32. package/tests/isolation/specs/hosted_delegate_owner_provisioning_race.spec +73 -0
  33. package/tests/isolation/specs/hosted_delegate_owner_revoke_race.spec +93 -0
  34. package/tests/isolation/specs/hosted_delegate_revoke_race.spec +59 -0
  35. package/tests/isolation/specs/hosted_delegate_tombstone_revoke_race.spec +158 -0
  36. package/tests/isolation/specs/hosted_delegate_withdraw_evict_race.spec +145 -0
@@ -0,0 +1,66 @@
1
+ Parsed test spec with 4 sessions
2
+
3
+ starting permutation: h_begin x_begin x_gen2 r_begin r_agent h_commit x_commit r_commit check
4
+ count
5
+ -----
6
+ 1
7
+ (1 row)
8
+
9
+ step h_begin:
10
+ BEGIN;
11
+ select (ac.id is not null) as held
12
+ from agent_board.agent_credentials ac
13
+ join agent_board.delegate_instances di on di.agent_id = ac.agent_id
14
+ where di.instance_id = 'iso_xa_instance_00001'
15
+ order by ac.created_at desc, ac.id desc
16
+ limit 1
17
+ for update of ac;
18
+
19
+ held
20
+ ----
21
+ t
22
+ (1 row)
23
+
24
+ step x_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
25
+ step x_gen2:
26
+ select count(*) as issued from agent_board.exchange_delegate_credential(jsonb_build_object(
27
+ 'iss', 'https://iso-xa.test', 'sub', 'iso-xa-owner', 'slot_resource', null,
28
+ 'agent_board_delegate_instance', jsonb_build_object(
29
+ 'instance_id', 'iso_xa_instance_00001', 'grant_id', 'iso_grant_0000000002', 'generation', 2,
30
+ 'owner_sub', 'iso-xa-owner', 'client_id', 'iso-client', 'status', 'active', 'client_change', null)));
31
+ <waiting ...>
32
+ step r_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
33
+ step r_agent:
34
+ select revoked_agent_count from agent_board.revoke_agent_subtree(
35
+ (select agent_id from agent_board.delegate_instances where instance_id = 'iso_xa_instance_00001'),
36
+ '16591400-0000-4000-8000-000000000001', 'iso exchange revoke race');
37
+ <waiting ...>
38
+ step h_commit: COMMIT;
39
+ step x_gen2: <... completed>
40
+ issued
41
+ ------
42
+ 1
43
+ (1 row)
44
+
45
+ step x_commit: COMMIT;
46
+ step r_agent: <... completed>
47
+ revoked_agent_count
48
+ -------------------
49
+ 1
50
+ (1 row)
51
+
52
+ step r_commit: COMMIT;
53
+ step check:
54
+ select a.status as delegate_status,
55
+ (select count(*) from agent_board.agent_credentials ac where ac.agent_id = a.id) as credentials,
56
+ (select count(*) from agent_board.agent_credentials ac where ac.agent_id = a.id and ac.generation = 2) as generation_2,
57
+ (select count(*) from agent_board.agent_credentials ac where ac.agent_id = a.id and ac.revoked_at is null) as live
58
+ from agent_board.agents a
59
+ join agent_board.delegate_instances di on di.agent_id = a.id
60
+ where di.instance_id = 'iso_xa_instance_00001';
61
+
62
+ delegate_status|credentials|generation_2|live
63
+ ---------------+-----------+------------+----
64
+ revoked | 3| 1| 0
65
+ (1 row)
66
+
@@ -0,0 +1,93 @@
1
+ Parsed test spec with 3 sessions
2
+
3
+ starting permutation: new_begin new_exchange old_begin old_exchange new_commit old_commit check
4
+ count
5
+ -----
6
+ 1
7
+ (1 row)
8
+
9
+ step new_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
10
+ step new_exchange:
11
+ select count(*) as issued from agent_board.exchange_delegate_credential(jsonb_build_object(
12
+ 'iss', 'https://iso-portal.test', 'sub', 'iso-owner', 'slot_resource', null,
13
+ 'agent_board_delegate_instance', jsonb_build_object(
14
+ 'instance_id', 'iso_exchange_race_0001', 'grant_id', 'iso_grant_0000000003', 'generation', 3,
15
+ 'owner_sub', 'iso-owner', 'client_id', 'iso-client', 'status', 'active', 'client_change', null)));
16
+
17
+ issued
18
+ ------
19
+ 1
20
+ (1 row)
21
+
22
+ step old_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
23
+ step old_exchange:
24
+ select count(*) as issued from agent_board.exchange_delegate_credential(jsonb_build_object(
25
+ 'iss', 'https://iso-portal.test', 'sub', 'iso-owner', 'slot_resource', null,
26
+ 'agent_board_delegate_instance', jsonb_build_object(
27
+ 'instance_id', 'iso_exchange_race_0001', 'grant_id', 'iso_grant_0000000002', 'generation', 2,
28
+ 'owner_sub', 'iso-owner', 'client_id', 'iso-client', 'status', 'active', 'client_change', null)));
29
+ <waiting ...>
30
+ step new_commit: COMMIT;
31
+ step old_exchange: <... completed>
32
+ ERROR: generation_superseded
33
+ step old_commit: COMMIT;
34
+ step check:
35
+ select di.generation as recorded_generation, di.grant_id as recorded_grant,
36
+ (select string_agg(ac.generation::text, ',' order by ac.generation)
37
+ from agent_board.agent_credentials ac where ac.agent_id = di.agent_id and ac.revoked_at is null) as live_generations,
38
+ (select count(*) from agent_board.agents a where a.handle like 'delegate-%') as delegate_agents
39
+ from agent_board.delegate_instances di where di.instance_id = 'iso_exchange_race_0001';
40
+
41
+ recorded_generation|recorded_grant |live_generations|delegate_agents
42
+ -------------------+--------------------+----------------+---------------
43
+ 3|iso_grant_0000000003| 3| 1
44
+ (1 row)
45
+
46
+
47
+ starting permutation: old_begin old_exchange new_begin new_exchange old_commit new_commit check
48
+ count
49
+ -----
50
+ 1
51
+ (1 row)
52
+
53
+ step old_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
54
+ step old_exchange:
55
+ select count(*) as issued from agent_board.exchange_delegate_credential(jsonb_build_object(
56
+ 'iss', 'https://iso-portal.test', 'sub', 'iso-owner', 'slot_resource', null,
57
+ 'agent_board_delegate_instance', jsonb_build_object(
58
+ 'instance_id', 'iso_exchange_race_0001', 'grant_id', 'iso_grant_0000000002', 'generation', 2,
59
+ 'owner_sub', 'iso-owner', 'client_id', 'iso-client', 'status', 'active', 'client_change', null)));
60
+
61
+ issued
62
+ ------
63
+ 1
64
+ (1 row)
65
+
66
+ step new_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
67
+ step new_exchange:
68
+ select count(*) as issued from agent_board.exchange_delegate_credential(jsonb_build_object(
69
+ 'iss', 'https://iso-portal.test', 'sub', 'iso-owner', 'slot_resource', null,
70
+ 'agent_board_delegate_instance', jsonb_build_object(
71
+ 'instance_id', 'iso_exchange_race_0001', 'grant_id', 'iso_grant_0000000003', 'generation', 3,
72
+ 'owner_sub', 'iso-owner', 'client_id', 'iso-client', 'status', 'active', 'client_change', null)));
73
+ <waiting ...>
74
+ step old_commit: COMMIT;
75
+ step new_exchange: <... completed>
76
+ issued
77
+ ------
78
+ 1
79
+ (1 row)
80
+
81
+ step new_commit: COMMIT;
82
+ step check:
83
+ select di.generation as recorded_generation, di.grant_id as recorded_grant,
84
+ (select string_agg(ac.generation::text, ',' order by ac.generation)
85
+ from agent_board.agent_credentials ac where ac.agent_id = di.agent_id and ac.revoked_at is null) as live_generations,
86
+ (select count(*) from agent_board.agents a where a.handle like 'delegate-%') as delegate_agents
87
+ from agent_board.delegate_instances di where di.instance_id = 'iso_exchange_race_0001';
88
+
89
+ recorded_generation|recorded_grant |live_generations|delegate_agents
90
+ -------------------+--------------------+----------------+---------------
91
+ 3|iso_grant_0000000003| 3| 1
92
+ (1 row)
93
+
@@ -0,0 +1,129 @@
1
+ Parsed test spec with 4 sessions
2
+
3
+ starting permutation: a_begin a_exchange b_begin b_exchange a_commit b_commit check
4
+ step a_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
5
+ step a_exchange:
6
+ select count(*) as issued from agent_board.exchange_delegate_credential(jsonb_build_object(
7
+ 'iss', 'https://iso-portal.test', 'sub', 'iso-owner', 'slot_resource', null,
8
+ 'agent_board_delegate_instance', jsonb_build_object(
9
+ 'instance_id', 'iso_first_exchange_01', 'grant_id', 'iso_grant_0000000001', 'generation', 1,
10
+ 'owner_sub', 'iso-owner', 'client_id', 'iso-client', 'status', 'active', 'client_change', null)));
11
+
12
+ issued
13
+ ------
14
+ 1
15
+ (1 row)
16
+
17
+ step b_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
18
+ step b_exchange:
19
+ select count(*) as issued from agent_board.exchange_delegate_credential(jsonb_build_object(
20
+ 'iss', 'https://iso-portal.test', 'sub', 'iso-owner', 'slot_resource', null,
21
+ 'agent_board_delegate_instance', jsonb_build_object(
22
+ 'instance_id', 'iso_first_exchange_01', 'grant_id', 'iso_grant_0000000001', 'generation', 1,
23
+ 'owner_sub', 'iso-owner', 'client_id', 'iso-client', 'status', 'active', 'client_change', null)));
24
+ <waiting ...>
25
+ step a_commit: COMMIT;
26
+ step b_exchange: <... completed>
27
+ issued
28
+ ------
29
+ 1
30
+ (1 row)
31
+
32
+ step b_commit: COMMIT;
33
+ step check:
34
+ select (select count(*) from agent_board.delegate_instances where instance_id = 'iso_first_exchange_01') as instances,
35
+ (select count(*) from agent_board.agents where handle like 'delegate-%') as delegate_agents,
36
+ (select count(*) from auth.users where email like 'agent+delegate-%') as delegate_auth_users,
37
+ (select count(*) from agent_board.agent_credentials ac
38
+ join agent_board.delegate_instances di on di.agent_id = ac.agent_id
39
+ where di.instance_id = 'iso_first_exchange_01' and ac.revoked_at is null) as live_credentials;
40
+
41
+ instances|delegate_agents|delegate_auth_users|live_credentials
42
+ ---------+---------------+-------------------+----------------
43
+ 1| 1| 1| 2
44
+ (1 row)
45
+
46
+
47
+ starting permutation: b_begin b_exchange a_begin a_exchange b_commit a_commit check
48
+ step b_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
49
+ step b_exchange:
50
+ select count(*) as issued from agent_board.exchange_delegate_credential(jsonb_build_object(
51
+ 'iss', 'https://iso-portal.test', 'sub', 'iso-owner', 'slot_resource', null,
52
+ 'agent_board_delegate_instance', jsonb_build_object(
53
+ 'instance_id', 'iso_first_exchange_01', 'grant_id', 'iso_grant_0000000001', 'generation', 1,
54
+ 'owner_sub', 'iso-owner', 'client_id', 'iso-client', 'status', 'active', 'client_change', null)));
55
+
56
+ issued
57
+ ------
58
+ 1
59
+ (1 row)
60
+
61
+ step a_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
62
+ step a_exchange:
63
+ select count(*) as issued from agent_board.exchange_delegate_credential(jsonb_build_object(
64
+ 'iss', 'https://iso-portal.test', 'sub', 'iso-owner', 'slot_resource', null,
65
+ 'agent_board_delegate_instance', jsonb_build_object(
66
+ 'instance_id', 'iso_first_exchange_01', 'grant_id', 'iso_grant_0000000001', 'generation', 1,
67
+ 'owner_sub', 'iso-owner', 'client_id', 'iso-client', 'status', 'active', 'client_change', null)));
68
+ <waiting ...>
69
+ step b_commit: COMMIT;
70
+ step a_exchange: <... completed>
71
+ issued
72
+ ------
73
+ 1
74
+ (1 row)
75
+
76
+ step a_commit: COMMIT;
77
+ step check:
78
+ select (select count(*) from agent_board.delegate_instances where instance_id = 'iso_first_exchange_01') as instances,
79
+ (select count(*) from agent_board.agents where handle like 'delegate-%') as delegate_agents,
80
+ (select count(*) from auth.users where email like 'agent+delegate-%') as delegate_auth_users,
81
+ (select count(*) from agent_board.agent_credentials ac
82
+ join agent_board.delegate_instances di on di.agent_id = ac.agent_id
83
+ where di.instance_id = 'iso_first_exchange_01' and ac.revoked_at is null) as live_credentials;
84
+
85
+ instances|delegate_agents|delegate_auth_users|live_credentials
86
+ ---------+---------------+-------------------+----------------
87
+ 1| 1| 1| 2
88
+ (1 row)
89
+
90
+
91
+ starting permutation: a_begin a_exchange i_begin i_exchange a_commit i_commit check
92
+ step a_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
93
+ step a_exchange:
94
+ select count(*) as issued from agent_board.exchange_delegate_credential(jsonb_build_object(
95
+ 'iss', 'https://iso-portal.test', 'sub', 'iso-owner', 'slot_resource', null,
96
+ 'agent_board_delegate_instance', jsonb_build_object(
97
+ 'instance_id', 'iso_first_exchange_01', 'grant_id', 'iso_grant_0000000001', 'generation', 1,
98
+ 'owner_sub', 'iso-owner', 'client_id', 'iso-client', 'status', 'active', 'client_change', null)));
99
+
100
+ issued
101
+ ------
102
+ 1
103
+ (1 row)
104
+
105
+ step i_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
106
+ step i_exchange:
107
+ select count(*) as issued from agent_board.exchange_delegate_credential(jsonb_build_object(
108
+ 'iss', 'https://iso-portal.test', 'sub', 'iso-other-owner', 'slot_resource', null,
109
+ 'agent_board_delegate_instance', jsonb_build_object(
110
+ 'instance_id', 'iso_first_exchange_01', 'grant_id', 'iso_grant_0000000009', 'generation', 1,
111
+ 'owner_sub', 'iso-other-owner', 'client_id', 'iso-client', 'status', 'active', 'client_change', null)));
112
+ <waiting ...>
113
+ step a_commit: COMMIT;
114
+ step i_exchange: <... completed>
115
+ ERROR: owner_mismatch
116
+ step i_commit: COMMIT;
117
+ step check:
118
+ select (select count(*) from agent_board.delegate_instances where instance_id = 'iso_first_exchange_01') as instances,
119
+ (select count(*) from agent_board.agents where handle like 'delegate-%') as delegate_agents,
120
+ (select count(*) from auth.users where email like 'agent+delegate-%') as delegate_auth_users,
121
+ (select count(*) from agent_board.agent_credentials ac
122
+ join agent_board.delegate_instances di on di.agent_id = ac.agent_id
123
+ where di.instance_id = 'iso_first_exchange_01' and ac.revoked_at is null) as live_credentials;
124
+
125
+ instances|delegate_agents|delegate_auth_users|live_credentials
126
+ ---------+---------------+-------------------+----------------
127
+ 1| 1| 1| 1
128
+ (1 row)
129
+
@@ -0,0 +1,91 @@
1
+ Parsed test spec with 3 sessions
2
+
3
+ starting permutation: h_begin h_enroll x_begin x_exchange h_commit x_commit check
4
+ step h_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
5
+ step h_enroll:
6
+ select status from agent_board.enroll_federated_human(
7
+ 'https://iso-prov.test', 'message-board', 'iso-prov-owner',
8
+ jsonb_build_object('sub', 'iso-prov-owner'), 'Iso Prov Owner');
9
+
10
+ status
11
+ ------
12
+ active
13
+ (1 row)
14
+
15
+ step x_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
16
+ step x_exchange:
17
+ select count(*) as issued from agent_board.exchange_delegate_credential(jsonb_build_object(
18
+ 'iss', 'https://iso-prov.test', 'sub', 'iso-prov-owner', 'slot_resource', null,
19
+ 'agent_board_delegate_instance', jsonb_build_object(
20
+ 'instance_id', 'iso_prov_instance_0001', 'grant_id', 'iso_grant_0000000001', 'generation', 1,
21
+ 'owner_sub', 'iso-prov-owner', 'client_id', 'iso-client', 'status', 'active', 'client_change', null)));
22
+ <waiting ...>
23
+ step h_commit: COMMIT;
24
+ step x_exchange: <... completed>
25
+ issued
26
+ ------
27
+ 1
28
+ (1 row)
29
+
30
+ step x_commit: COMMIT;
31
+ step check:
32
+ select (select count(*) from auth.users
33
+ where email = 'agent+' || agent_board._federated_identity_slug('https://iso-prov.test', 'iso-prov-owner')
34
+ || '@agent-board.local') as owner_auth_users,
35
+ (select count(*) from agent_board.agents
36
+ where handle = agent_board._federated_identity_slug('https://iso-prov.test', 'iso-prov-owner')) as human_rows,
37
+ (select h.auth_user_id = di.owner_user_id
38
+ from agent_board.agents h, agent_board.delegate_instances di
39
+ where h.handle = agent_board._federated_identity_slug('https://iso-prov.test', 'iso-prov-owner')
40
+ and di.instance_id = 'iso_prov_instance_0001') as delegate_owned_by_human;
41
+
42
+ owner_auth_users|human_rows|delegate_owned_by_human
43
+ ----------------+----------+-----------------------
44
+ 1| 1|t
45
+ (1 row)
46
+
47
+
48
+ starting permutation: x_begin x_exchange h_begin h_enroll x_commit h_commit check
49
+ step x_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
50
+ step x_exchange:
51
+ select count(*) as issued from agent_board.exchange_delegate_credential(jsonb_build_object(
52
+ 'iss', 'https://iso-prov.test', 'sub', 'iso-prov-owner', 'slot_resource', null,
53
+ 'agent_board_delegate_instance', jsonb_build_object(
54
+ 'instance_id', 'iso_prov_instance_0001', 'grant_id', 'iso_grant_0000000001', 'generation', 1,
55
+ 'owner_sub', 'iso-prov-owner', 'client_id', 'iso-client', 'status', 'active', 'client_change', null)));
56
+
57
+ issued
58
+ ------
59
+ 1
60
+ (1 row)
61
+
62
+ step h_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
63
+ step h_enroll:
64
+ select status from agent_board.enroll_federated_human(
65
+ 'https://iso-prov.test', 'message-board', 'iso-prov-owner',
66
+ jsonb_build_object('sub', 'iso-prov-owner'), 'Iso Prov Owner');
67
+ <waiting ...>
68
+ step x_commit: COMMIT;
69
+ step h_enroll: <... completed>
70
+ status
71
+ ------
72
+ active
73
+ (1 row)
74
+
75
+ step h_commit: COMMIT;
76
+ step check:
77
+ select (select count(*) from auth.users
78
+ where email = 'agent+' || agent_board._federated_identity_slug('https://iso-prov.test', 'iso-prov-owner')
79
+ || '@agent-board.local') as owner_auth_users,
80
+ (select count(*) from agent_board.agents
81
+ where handle = agent_board._federated_identity_slug('https://iso-prov.test', 'iso-prov-owner')) as human_rows,
82
+ (select h.auth_user_id = di.owner_user_id
83
+ from agent_board.agents h, agent_board.delegate_instances di
84
+ where h.handle = agent_board._federated_identity_slug('https://iso-prov.test', 'iso-prov-owner')
85
+ and di.instance_id = 'iso_prov_instance_0001') as delegate_owned_by_human;
86
+
87
+ owner_auth_users|human_rows|delegate_owned_by_human
88
+ ----------------+----------+-----------------------
89
+ 1| 1|t
90
+ (1 row)
91
+
@@ -0,0 +1,137 @@
1
+ Parsed test spec with 3 sessions
2
+
3
+ starting permutation: x_begin x_new r_begin r_revoke x_commit r_commit check
4
+ count
5
+ -----
6
+ 1
7
+ (1 row)
8
+
9
+ step x_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
10
+ step x_new:
11
+ select count(*) as issued from agent_board.exchange_delegate_credential(jsonb_build_object(
12
+ 'iss', 'https://iso-rev.test', 'sub', 'iso-rev-owner', 'slot_resource', null,
13
+ 'agent_board_delegate_instance', jsonb_build_object(
14
+ 'instance_id', 'iso_rev_new_000000001', 'grant_id', 'iso_grant_0000000001', 'generation', 1,
15
+ 'owner_sub', 'iso-rev-owner', 'client_id', 'iso-client', 'status', 'active', 'client_change', null)));
16
+
17
+ issued
18
+ ------
19
+ 1
20
+ (1 row)
21
+
22
+ step r_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
23
+ step r_revoke:
24
+ select revoked_agent_count from agent_board.revoke_human_subtree(
25
+ (select auth_user_id from agent_board.agents
26
+ where handle = agent_board._federated_identity_slug('https://iso-rev.test', 'iso-rev-owner')),
27
+ '16310000-0000-0000-0000-000000000001', 'iso owner revoke race');
28
+ <waiting ...>
29
+ step x_commit: COMMIT;
30
+ step r_revoke: <... completed>
31
+ revoked_agent_count
32
+ -------------------
33
+ 3
34
+ (1 row)
35
+
36
+ step r_commit: COMMIT;
37
+ step check:
38
+ select (select count(*) from agent_board.fleet_human_revocations where issuer = 'https://iso-rev.test') as markers,
39
+ (select count(*) from agent_board.delegate_instances where instance_id like 'iso\_rev\_%') as instances,
40
+ (select count(*) from agent_board.agents where handle like 'delegate-%' and status = 'active') as active_delegates,
41
+ (select count(*) from agent_board.agent_credentials ac
42
+ join agent_board.delegate_instances di on di.agent_id = ac.agent_id
43
+ where di.instance_id like 'iso\_rev\_%' and ac.revoked_at is null) as live_delegate_credentials;
44
+
45
+ markers|instances|active_delegates|live_delegate_credentials
46
+ -------+---------+----------------+-------------------------
47
+ 1| 2| 0| 0
48
+ (1 row)
49
+
50
+
51
+ starting permutation: r_begin r_revoke x_begin x_new r_commit x_commit check
52
+ count
53
+ -----
54
+ 1
55
+ (1 row)
56
+
57
+ step r_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
58
+ step r_revoke:
59
+ select revoked_agent_count from agent_board.revoke_human_subtree(
60
+ (select auth_user_id from agent_board.agents
61
+ where handle = agent_board._federated_identity_slug('https://iso-rev.test', 'iso-rev-owner')),
62
+ '16310000-0000-0000-0000-000000000001', 'iso owner revoke race');
63
+
64
+ revoked_agent_count
65
+ -------------------
66
+ 2
67
+ (1 row)
68
+
69
+ step x_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
70
+ step x_new:
71
+ select count(*) as issued from agent_board.exchange_delegate_credential(jsonb_build_object(
72
+ 'iss', 'https://iso-rev.test', 'sub', 'iso-rev-owner', 'slot_resource', null,
73
+ 'agent_board_delegate_instance', jsonb_build_object(
74
+ 'instance_id', 'iso_rev_new_000000001', 'grant_id', 'iso_grant_0000000001', 'generation', 1,
75
+ 'owner_sub', 'iso-rev-owner', 'client_id', 'iso-client', 'status', 'active', 'client_change', null)));
76
+ <waiting ...>
77
+ step r_commit: COMMIT;
78
+ step x_new: <... completed>
79
+ ERROR: owner_inactive
80
+ step x_commit: COMMIT;
81
+ step check:
82
+ select (select count(*) from agent_board.fleet_human_revocations where issuer = 'https://iso-rev.test') as markers,
83
+ (select count(*) from agent_board.delegate_instances where instance_id like 'iso\_rev\_%') as instances,
84
+ (select count(*) from agent_board.agents where handle like 'delegate-%' and status = 'active') as active_delegates,
85
+ (select count(*) from agent_board.agent_credentials ac
86
+ join agent_board.delegate_instances di on di.agent_id = ac.agent_id
87
+ where di.instance_id like 'iso\_rev\_%' and ac.revoked_at is null) as live_delegate_credentials;
88
+
89
+ markers|instances|active_delegates|live_delegate_credentials
90
+ -------+---------+----------------+-------------------------
91
+ 1| 1| 0| 0
92
+ (1 row)
93
+
94
+
95
+ starting permutation: r_begin r_revoke x_begin x_existing r_commit x_commit check
96
+ count
97
+ -----
98
+ 1
99
+ (1 row)
100
+
101
+ step r_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
102
+ step r_revoke:
103
+ select revoked_agent_count from agent_board.revoke_human_subtree(
104
+ (select auth_user_id from agent_board.agents
105
+ where handle = agent_board._federated_identity_slug('https://iso-rev.test', 'iso-rev-owner')),
106
+ '16310000-0000-0000-0000-000000000001', 'iso owner revoke race');
107
+
108
+ revoked_agent_count
109
+ -------------------
110
+ 2
111
+ (1 row)
112
+
113
+ step x_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
114
+ step x_existing:
115
+ select count(*) as issued from agent_board.exchange_delegate_credential(jsonb_build_object(
116
+ 'iss', 'https://iso-rev.test', 'sub', 'iso-rev-owner', 'slot_resource', null,
117
+ 'agent_board_delegate_instance', jsonb_build_object(
118
+ 'instance_id', 'iso_rev_existing_00001', 'grant_id', 'iso_grant_0000000001', 'generation', 1,
119
+ 'owner_sub', 'iso-rev-owner', 'client_id', 'iso-client', 'status', 'active', 'client_change', null)));
120
+ <waiting ...>
121
+ step r_commit: COMMIT;
122
+ step x_existing: <... completed>
123
+ ERROR: owner_inactive
124
+ step x_commit: COMMIT;
125
+ step check:
126
+ select (select count(*) from agent_board.fleet_human_revocations where issuer = 'https://iso-rev.test') as markers,
127
+ (select count(*) from agent_board.delegate_instances where instance_id like 'iso\_rev\_%') as instances,
128
+ (select count(*) from agent_board.agents where handle like 'delegate-%' and status = 'active') as active_delegates,
129
+ (select count(*) from agent_board.agent_credentials ac
130
+ join agent_board.delegate_instances di on di.agent_id = ac.agent_id
131
+ where di.instance_id like 'iso\_rev\_%' and ac.revoked_at is null) as live_delegate_credentials;
132
+
133
+ markers|instances|active_delegates|live_delegate_credentials
134
+ -------+---------+----------------+-------------------------
135
+ 1| 1| 0| 0
136
+ (1 row)
137
+
@@ -0,0 +1,87 @@
1
+ Parsed test spec with 3 sessions
2
+
3
+ starting permutation: ex_begin ex_exchange rv_begin rv_tombstone ex_commit rv_commit check
4
+ count
5
+ -----
6
+ 1
7
+ (1 row)
8
+
9
+ step ex_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
10
+ step ex_exchange:
11
+ select count(*) as issued from agent_board.exchange_delegate_credential(jsonb_build_object(
12
+ 'iss', 'https://iso-portal.test', 'sub', 'iso-owner', 'slot_resource', null,
13
+ 'agent_board_delegate_instance', jsonb_build_object(
14
+ 'instance_id', 'iso_revoke_race_00001', 'grant_id', 'iso_grant_0000000002', 'generation', 2,
15
+ 'owner_sub', 'iso-owner', 'client_id', 'iso-client', 'status', 'active', 'client_change', null)));
16
+
17
+ issued
18
+ ------
19
+ 1
20
+ (1 row)
21
+
22
+ step rv_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
23
+ step rv_tombstone:
24
+ select first from agent_board.tombstone_delegate_instance(
25
+ 'iso_revoke_race_00001', 'https://iso-portal.test', 'iso-owner', 'owner_revoked');
26
+ <waiting ...>
27
+ step ex_commit: COMMIT;
28
+ step rv_tombstone: <... completed>
29
+ first
30
+ -----
31
+ t
32
+ (1 row)
33
+
34
+ step rv_commit: COMMIT;
35
+ step check:
36
+ select (di.tombstoned_at is not null) as tombstoned,
37
+ (select count(*) from agent_board.agent_credentials ac where ac.agent_id = di.agent_id and ac.revoked_at is null) as live_credentials,
38
+ (select count(*) from agent_board.agent_credentials ac where ac.agent_id = di.agent_id) as all_credentials,
39
+ (select a.status from agent_board.agents a where a.id = di.agent_id) as agent_status
40
+ from agent_board.delegate_instances di where di.instance_id = 'iso_revoke_race_00001';
41
+
42
+ tombstoned|live_credentials|all_credentials|agent_status
43
+ ----------+----------------+---------------+------------
44
+ t | 0| 2|revoked
45
+ (1 row)
46
+
47
+
48
+ starting permutation: rv_begin rv_tombstone ex_begin ex_exchange rv_commit ex_commit check
49
+ count
50
+ -----
51
+ 1
52
+ (1 row)
53
+
54
+ step rv_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
55
+ step rv_tombstone:
56
+ select first from agent_board.tombstone_delegate_instance(
57
+ 'iso_revoke_race_00001', 'https://iso-portal.test', 'iso-owner', 'owner_revoked');
58
+
59
+ first
60
+ -----
61
+ t
62
+ (1 row)
63
+
64
+ step ex_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
65
+ step ex_exchange:
66
+ select count(*) as issued from agent_board.exchange_delegate_credential(jsonb_build_object(
67
+ 'iss', 'https://iso-portal.test', 'sub', 'iso-owner', 'slot_resource', null,
68
+ 'agent_board_delegate_instance', jsonb_build_object(
69
+ 'instance_id', 'iso_revoke_race_00001', 'grant_id', 'iso_grant_0000000002', 'generation', 2,
70
+ 'owner_sub', 'iso-owner', 'client_id', 'iso-client', 'status', 'active', 'client_change', null)));
71
+ <waiting ...>
72
+ step rv_commit: COMMIT;
73
+ step ex_exchange: <... completed>
74
+ ERROR: instance_revoked
75
+ step ex_commit: COMMIT;
76
+ step check:
77
+ select (di.tombstoned_at is not null) as tombstoned,
78
+ (select count(*) from agent_board.agent_credentials ac where ac.agent_id = di.agent_id and ac.revoked_at is null) as live_credentials,
79
+ (select count(*) from agent_board.agent_credentials ac where ac.agent_id = di.agent_id) as all_credentials,
80
+ (select a.status from agent_board.agents a where a.id = di.agent_id) as agent_status
81
+ from agent_board.delegate_instances di where di.instance_id = 'iso_revoke_race_00001';
82
+
83
+ tombstoned|live_credentials|all_credentials|agent_status
84
+ ----------+----------------+---------------+------------
85
+ t | 0| 1|revoked
86
+ (1 row)
87
+