@consiliency/agent-board-schema 1.53.0 → 1.55.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 +615 -607
- package/migrations/20261004000100_agent_board_callback_consumer_intent.sql +52 -0
- package/migrations/20261005000100_agent_board_enroll_token_single_use.sql +886 -0
- package/package.json +1 -1
- package/schema-manifest.json +21 -3
- package/src/tooling.test.mjs +5 -2
- package/tests/agent_board_atomic_fleet_onboarding.test.sql +35 -35
- package/tests/agent_board_atomic_fleet_onboarding_backfill.test.sql +5 -5
- package/tests/agent_board_atomic_fleet_onboarding_runtime.test.sql +32 -32
- package/tests/agent_board_enroll_federated_identity.test.sql +11 -10
- package/tests/agent_board_enroll_pop_binding.test.sql +12 -12
- package/tests/agent_board_enroll_resumption.test.sql +1 -1
- package/tests/agent_board_enroll_token_single_use.test.sql +538 -0
- package/tests/agent_board_enrollment_audit_content.test.sql +3 -3
- package/tests/agent_board_federated_lock_order_class.test.sql +5 -5
- package/tests/agent_board_fedsession.test.sql +1 -1
- package/tests/agent_board_fk_lock_edges.test.sql +23 -0
- package/tests/agent_board_identity_providers.test.sql +3 -2
- package/tests/agent_board_portal_offline_invariant.test.sql +1 -1
- package/tests/agent_board_roomlink.test.sql +2 -2
- package/tests/agent_board_write_enforcement_class.test.sql +5 -2
- package/tests/catalog/function_execute_privileges.json +12 -3
- package/tests/catalog/p_metadata_parameters.json +6 -2
- package/tests/isolation/expected/atomic_fedsession_fleet_lock_order.out +1 -1
- package/tests/isolation/expected/atomic_fleet_authority_races.out +8 -8
- package/tests/isolation/expected/atomic_fleet_binding_revoke.out +2 -2
- package/tests/isolation/expected/atomic_fleet_board_archive.out +2 -2
- package/tests/isolation/expected/atomic_fleet_human_fresh_revoke.out +2 -2
- package/tests/isolation/expected/atomic_fleet_identity_disposition.out +2 -2
- package/tests/isolation/expected/atomic_fleet_lifecycle_races.out +22 -22
- package/tests/isolation/expected/atomic_fleet_onboarding.out +2 -2
- package/tests/isolation/expected/atomic_fleet_subtree_lock_order.out +1 -1
- package/tests/isolation/expected/enroll_identity_board_owner_lock_order.out +1 -1
- package/tests/isolation/expected/enroll_token_fleet_abort.out +81 -0
- package/tests/isolation/expected/enroll_token_pk_backstop.out +36 -0
- package/tests/isolation/expected/enroll_token_placement.out +86 -0
- package/tests/isolation/expected/enroll_token_rollback_unstrands.out +59 -0
- package/tests/isolation/expected/enroll_token_route_race_fleet_first.out +72 -0
- package/tests/isolation/expected/enroll_token_route_race_identity_first.out +72 -0
- package/tests/isolation/expected/enroll_token_same_key_fleet_then_identity.out +73 -0
- package/tests/isolation/expected/enroll_token_same_key_identity_then_fleet.out +73 -0
- package/tests/isolation/expected/enroll_token_same_key_resume.out +59 -0
- package/tests/isolation/expected/enroll_token_same_token_race.out +58 -0
- package/tests/isolation/expected/onboarding_ceiling_lock_order.out +2 -2
- package/tests/isolation/specs/atomic_fedsession_fleet_lock_order.spec +1 -1
- package/tests/isolation/specs/atomic_fleet_authority_races.spec +2 -2
- package/tests/isolation/specs/atomic_fleet_binding_revoke.spec +2 -2
- package/tests/isolation/specs/atomic_fleet_board_archive.spec +2 -2
- package/tests/isolation/specs/atomic_fleet_human_fresh_revoke.spec +2 -2
- package/tests/isolation/specs/atomic_fleet_identity_disposition.spec +2 -2
- package/tests/isolation/specs/atomic_fleet_lifecycle_races.spec +2 -2
- package/tests/isolation/specs/atomic_fleet_onboarding.spec +2 -2
- package/tests/isolation/specs/atomic_fleet_subtree_lock_order.spec +2 -2
- package/tests/isolation/specs/enroll_identity_board_owner_lock_order.spec +1 -1
- package/tests/isolation/specs/enroll_token_fleet_abort.spec +138 -0
- package/tests/isolation/specs/enroll_token_pk_backstop.spec +37 -0
- package/tests/isolation/specs/enroll_token_placement.spec +136 -0
- package/tests/isolation/specs/enroll_token_rollback_unstrands.spec +71 -0
- package/tests/isolation/specs/enroll_token_route_race_fleet_first.spec +119 -0
- package/tests/isolation/specs/enroll_token_route_race_identity_first.spec +120 -0
- package/tests/isolation/specs/enroll_token_same_key_fleet_then_identity.spec +112 -0
- package/tests/isolation/specs/enroll_token_same_key_identity_then_fleet.spec +113 -0
- package/tests/isolation/specs/enroll_token_same_key_resume.spec +70 -0
- package/tests/isolation/specs/enroll_token_same_token_race.spec +80 -0
- package/tests/isolation/specs/onboarding_ceiling_lock_order.spec +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Parsed test spec with 4 sessions
|
|
2
|
+
|
|
3
|
+
starting permutation: hold_begin hold_handle a_begin a_onboard b_begin b_onboard hold_rollback a_rollback b_commit check
|
|
4
|
+
count
|
|
5
|
+
-----
|
|
6
|
+
1
|
|
7
|
+
(1 row)
|
|
8
|
+
|
|
9
|
+
step hold_begin: BEGIN;
|
|
10
|
+
step hold_handle:
|
|
11
|
+
insert into agent_board.agents(id, agent_type, kind, handle, display_name, status)
|
|
12
|
+
values ('52100000-0000-0000-0000-0000000000ff', 'agent', 'agent', 'tok521-wrong-handle', 'Tok521 Hold', 'active');
|
|
13
|
+
|
|
14
|
+
step a_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
|
|
15
|
+
step a_onboard:
|
|
16
|
+
select agent_handle, identity_disposition
|
|
17
|
+
from agent_board.onboard_federated_fleet_agent(
|
|
18
|
+
'https://tok521-iso.test', 'message-board', 'tok521-human',
|
|
19
|
+
jsonb_build_object('iss','https://tok521-iso.test','aud','message-board','sub','tok521-human'),
|
|
20
|
+
'tok521-wrong-handle',
|
|
21
|
+
public.test_pubkey('tok521-k1'), 'raw_ed25519_base64url',
|
|
22
|
+
public.test_key_fingerprint('tok521-k1'),
|
|
23
|
+
true, repeat('a', 64), now() + interval '1 hour', null, 'agent',
|
|
24
|
+
ARRAY['board:send'], ARRAY[]::text[],
|
|
25
|
+
(select code from agent_board.board_invite_tokens where created_by_agent_id='52100000-0000-0000-0000-000000000001'),
|
|
26
|
+
(select id from agent_board.boards where slug='tok521-board'),
|
|
27
|
+
'52100000-0000-0000-0000-000000000003', 'codex', 'phase-loop',
|
|
28
|
+
'message-board', 'sha256:tok521-repo', 'worker', 'phase_worker',
|
|
29
|
+
'tok521-agent'
|
|
30
|
+
);
|
|
31
|
+
<waiting ...>
|
|
32
|
+
step b_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
|
|
33
|
+
step b_onboard:
|
|
34
|
+
select agent_handle, identity_disposition
|
|
35
|
+
from agent_board.onboard_federated_fleet_agent(
|
|
36
|
+
'https://tok521-iso.test', 'message-board', 'tok521-human',
|
|
37
|
+
jsonb_build_object('iss','https://tok521-iso.test','aud','message-board','sub','tok521-human'),
|
|
38
|
+
'tok521-agent',
|
|
39
|
+
public.test_pubkey('tok521-k2'), 'raw_ed25519_base64url',
|
|
40
|
+
public.test_key_fingerprint('tok521-k2'),
|
|
41
|
+
true, repeat('a', 64), now() + interval '1 hour', null, 'agent',
|
|
42
|
+
ARRAY['board:send'], ARRAY[]::text[],
|
|
43
|
+
(select code from agent_board.board_invite_tokens where created_by_agent_id='52100000-0000-0000-0000-000000000001'),
|
|
44
|
+
(select id from agent_board.boards where slug='tok521-board'),
|
|
45
|
+
'52100000-0000-0000-0000-000000000003', 'codex', 'phase-loop',
|
|
46
|
+
'message-board', 'sha256:tok521-repo', 'worker', 'phase_worker',
|
|
47
|
+
'tok521-agent'
|
|
48
|
+
);
|
|
49
|
+
<waiting ...>
|
|
50
|
+
step hold_rollback: ROLLBACK;
|
|
51
|
+
step a_onboard: <... completed>
|
|
52
|
+
ERROR: server-assigned handle does not match the authorized handle
|
|
53
|
+
step b_onboard: <... completed>
|
|
54
|
+
agent_handle|identity_disposition
|
|
55
|
+
------------+--------------------
|
|
56
|
+
tok521-agent|created
|
|
57
|
+
(1 row)
|
|
58
|
+
|
|
59
|
+
step a_rollback: ROLLBACK;
|
|
60
|
+
step b_commit: COMMIT;
|
|
61
|
+
step check:
|
|
62
|
+
select
|
|
63
|
+
(select count(*) from agent_board.agents where handle like 'tok521-agent%') as agents,
|
|
64
|
+
(select count(*) from agent_board.agent_signing_keys where fingerprint = public.test_key_fingerprint('tok521-k1')) as k1_keys,
|
|
65
|
+
(select count(*) from agent_board.agent_signing_keys where fingerprint = public.test_key_fingerprint('tok521-k2')) as k2_keys,
|
|
66
|
+
(select count(*) from agent_board.enroll_token_uses) as token_rows,
|
|
67
|
+
(select case u.agent_public_key_fingerprint
|
|
68
|
+
when public.test_key_fingerprint('tok521-k1') then 'K1'
|
|
69
|
+
when public.test_key_fingerprint('tok521-k2') then 'K2'
|
|
70
|
+
else 'other' end
|
|
71
|
+
from agent_board.enroll_token_uses u where u.token_sha256 = repeat('a', 64)) as token_bound_to,
|
|
72
|
+
(select count(*) from agent_board.fleet_harness_registrations where machine_id='52100000-0000-0000-0000-000000000003') as harnesses,
|
|
73
|
+
(select count(*) from agent_board.fleet_repo_scopes r join agent_board.fleet_harness_registrations h on h.id = r.harness_registration_id
|
|
74
|
+
where h.machine_id='52100000-0000-0000-0000-000000000003') as repo_scopes,
|
|
75
|
+
(select count(*) from agent_board.fleet_machine_agents where machine_id='52100000-0000-0000-0000-000000000003') as bindings;
|
|
76
|
+
|
|
77
|
+
agents|k1_keys|k2_keys|token_rows|token_bound_to|harnesses|repo_scopes|bindings
|
|
78
|
+
------+-------+-------+----------+--------------+---------+-----------+--------
|
|
79
|
+
1| 0| 1| 1|K2 | 1| 1| 1
|
|
80
|
+
(1 row)
|
|
81
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Parsed test spec with 3 sessions
|
|
2
|
+
|
|
3
|
+
starting permutation: a_begin a_bind b_begin b_bind a_commit b_rollback check
|
|
4
|
+
?column?
|
|
5
|
+
--------
|
|
6
|
+
1
|
|
7
|
+
(1 row)
|
|
8
|
+
|
|
9
|
+
step a_begin: BEGIN;
|
|
10
|
+
step a_bind: select agent_board._enroll_token_bind(repeat('a', 64), now() + interval '1 hour', 'sha256:tok521-fp-a');
|
|
11
|
+
_enroll_token_bind
|
|
12
|
+
------------------
|
|
13
|
+
|
|
14
|
+
(1 row)
|
|
15
|
+
|
|
16
|
+
step b_begin: BEGIN;
|
|
17
|
+
step b_bind:
|
|
18
|
+
do $$ begin
|
|
19
|
+
perform agent_board._enroll_token_bind(repeat('a', 64), now() + interval '1 hour', 'sha256:tok521-fp-b');
|
|
20
|
+
exception when others then
|
|
21
|
+
raise exception 'SQLSTATE %: %', sqlstate, sqlerrm using errcode = sqlstate;
|
|
22
|
+
end $$;
|
|
23
|
+
<waiting ...>
|
|
24
|
+
step a_commit: COMMIT;
|
|
25
|
+
step b_bind: <... completed>
|
|
26
|
+
ERROR: SQLSTATE 23505: duplicate key value violates unique constraint "enroll_token_uses_pkey"
|
|
27
|
+
step b_rollback: ROLLBACK;
|
|
28
|
+
step check:
|
|
29
|
+
select token_sha256 = repeat('a', 64) as is_t, agent_public_key_fingerprint
|
|
30
|
+
from agent_board.enroll_token_uses order by 1, 2;
|
|
31
|
+
|
|
32
|
+
is_t|agent_public_key_fingerprint
|
|
33
|
+
----+----------------------------
|
|
34
|
+
t |sha256:tok521-fp-a
|
|
35
|
+
(1 row)
|
|
36
|
+
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Parsed test spec with 4 sessions
|
|
2
|
+
|
|
3
|
+
starting permutation: guard_begin guard_lock fleet_begin fleet_onboard ident_begin ident_enroll guard_commit fleet_commit ident_rollback check
|
|
4
|
+
count
|
|
5
|
+
-----
|
|
6
|
+
1
|
|
7
|
+
(1 row)
|
|
8
|
+
|
|
9
|
+
step guard_begin: BEGIN;
|
|
10
|
+
step guard_lock:
|
|
11
|
+
select 1 as locked from agent_board.board_memberships bm
|
|
12
|
+
where bm.board_id = (select id from agent_board.boards where slug='tok521-board')
|
|
13
|
+
and bm.agent_id = '52100000-0000-0000-0000-000000000001'
|
|
14
|
+
for update;
|
|
15
|
+
|
|
16
|
+
locked
|
|
17
|
+
------
|
|
18
|
+
1
|
|
19
|
+
(1 row)
|
|
20
|
+
|
|
21
|
+
step fleet_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
|
|
22
|
+
step fleet_onboard:
|
|
23
|
+
select agent_handle, identity_disposition
|
|
24
|
+
from agent_board.onboard_federated_fleet_agent(
|
|
25
|
+
'https://tok521-iso.test', 'message-board', 'tok521-human',
|
|
26
|
+
jsonb_build_object('iss','https://tok521-iso.test','aud','message-board','sub','tok521-human'),
|
|
27
|
+
'tok521-agent',
|
|
28
|
+
public.test_pubkey('tok521-k2'), 'raw_ed25519_base64url',
|
|
29
|
+
public.test_key_fingerprint('tok521-k2'),
|
|
30
|
+
true, repeat('a', 64), now() + interval '1 hour', null, 'agent',
|
|
31
|
+
ARRAY['board:send'], ARRAY[]::text[],
|
|
32
|
+
(select code from agent_board.board_invite_tokens where created_by_agent_id='52100000-0000-0000-0000-000000000001'),
|
|
33
|
+
(select id from agent_board.boards where slug='tok521-board'),
|
|
34
|
+
'52100000-0000-0000-0000-000000000003', 'codex', 'phase-loop',
|
|
35
|
+
'message-board', 'sha256:tok521-repo', 'worker', 'phase_worker',
|
|
36
|
+
'tok521-agent'
|
|
37
|
+
);
|
|
38
|
+
<waiting ...>
|
|
39
|
+
step ident_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
|
|
40
|
+
step ident_enroll:
|
|
41
|
+
do $$ begin
|
|
42
|
+
perform agent_board.enroll_federated_identity(
|
|
43
|
+
'https://tok521-iso.test', 'message-board', 'tok521-human',
|
|
44
|
+
jsonb_build_object('iss','https://tok521-iso.test','aud','message-board','sub','tok521-human'),
|
|
45
|
+
'tok521-agent',
|
|
46
|
+
public.test_pubkey('tok521-k1'), 'raw_ed25519_base64url',
|
|
47
|
+
public.test_key_fingerprint('tok521-k1'),
|
|
48
|
+
true, repeat('a', 64), now() + interval '1 hour', null, 'agent',
|
|
49
|
+
ARRAY['board:send'], ARRAY[]::text[], null
|
|
50
|
+
);
|
|
51
|
+
exception when others then
|
|
52
|
+
raise exception 'SQLSTATE %: %', sqlstate, sqlerrm using errcode = sqlstate;
|
|
53
|
+
end $$;
|
|
54
|
+
<waiting ...>
|
|
55
|
+
step guard_commit: COMMIT;
|
|
56
|
+
step fleet_onboard: <... completed>
|
|
57
|
+
agent_handle|identity_disposition
|
|
58
|
+
------------+--------------------
|
|
59
|
+
tok521-agent|created
|
|
60
|
+
(1 row)
|
|
61
|
+
|
|
62
|
+
step fleet_commit: COMMIT;
|
|
63
|
+
step ident_enroll: <... completed>
|
|
64
|
+
ERROR: SQLSTATE MBT01: enroll token already bound to a different key
|
|
65
|
+
step ident_rollback: ROLLBACK;
|
|
66
|
+
step check:
|
|
67
|
+
select
|
|
68
|
+
(select count(*) from agent_board.agents where handle like 'tok521-agent%') as agents,
|
|
69
|
+
(select count(*) from agent_board.agent_signing_keys where fingerprint = public.test_key_fingerprint('tok521-k1')) as k1_keys,
|
|
70
|
+
(select count(*) from agent_board.agent_signing_keys where fingerprint = public.test_key_fingerprint('tok521-k2')) as k2_keys,
|
|
71
|
+
(select count(*) from agent_board.enroll_token_uses) as token_rows,
|
|
72
|
+
(select case u.agent_public_key_fingerprint
|
|
73
|
+
when public.test_key_fingerprint('tok521-k1') then 'K1'
|
|
74
|
+
when public.test_key_fingerprint('tok521-k2') then 'K2'
|
|
75
|
+
else 'other' end
|
|
76
|
+
from agent_board.enroll_token_uses u where u.token_sha256 = repeat('a', 64)) as token_bound_to,
|
|
77
|
+
(select count(*) from agent_board.fleet_harness_registrations where machine_id='52100000-0000-0000-0000-000000000003') as harnesses,
|
|
78
|
+
(select count(*) from agent_board.fleet_repo_scopes r join agent_board.fleet_harness_registrations h on h.id = r.harness_registration_id
|
|
79
|
+
where h.machine_id='52100000-0000-0000-0000-000000000003') as repo_scopes,
|
|
80
|
+
(select count(*) from agent_board.fleet_machine_agents where machine_id='52100000-0000-0000-0000-000000000003') as bindings;
|
|
81
|
+
|
|
82
|
+
agents|k1_keys|k2_keys|token_rows|token_bound_to|harnesses|repo_scopes|bindings
|
|
83
|
+
------+-------+-------+----------+--------------+---------+-----------+--------
|
|
84
|
+
1| 0| 1| 1|K2 | 1| 1| 1
|
|
85
|
+
(1 row)
|
|
86
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Parsed test spec with 3 sessions
|
|
2
|
+
|
|
3
|
+
starting permutation: a_begin a_enroll b_begin b_enroll a_rollback b_commit check
|
|
4
|
+
step a_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
|
|
5
|
+
step a_enroll:
|
|
6
|
+
select agent_handle
|
|
7
|
+
from agent_board.enroll_federated_identity(
|
|
8
|
+
'https://tok521-iso.test', 'message-board', 'tok521-human',
|
|
9
|
+
jsonb_build_object('iss','https://tok521-iso.test','aud','message-board','sub','tok521-human'),
|
|
10
|
+
'tok521-agent',
|
|
11
|
+
public.test_pubkey('tok521-k1'), 'raw_ed25519_base64url',
|
|
12
|
+
public.test_key_fingerprint('tok521-k1'),
|
|
13
|
+
true, repeat('a', 64), now() + interval '1 hour', null, 'agent',
|
|
14
|
+
ARRAY['board:send'], ARRAY[]::text[], null
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
agent_handle
|
|
18
|
+
------------
|
|
19
|
+
tok521-agent
|
|
20
|
+
(1 row)
|
|
21
|
+
|
|
22
|
+
step b_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
|
|
23
|
+
step b_enroll:
|
|
24
|
+
select agent_handle
|
|
25
|
+
from agent_board.enroll_federated_identity(
|
|
26
|
+
'https://tok521-iso.test', 'message-board', 'tok521-human',
|
|
27
|
+
jsonb_build_object('iss','https://tok521-iso.test','aud','message-board','sub','tok521-human'),
|
|
28
|
+
'tok521-agent',
|
|
29
|
+
public.test_pubkey('tok521-k2'), 'raw_ed25519_base64url',
|
|
30
|
+
public.test_key_fingerprint('tok521-k2'),
|
|
31
|
+
true, repeat('a', 64), now() + interval '1 hour', null, 'agent',
|
|
32
|
+
ARRAY['board:send'], ARRAY[]::text[], null
|
|
33
|
+
);
|
|
34
|
+
<waiting ...>
|
|
35
|
+
step a_rollback: ROLLBACK;
|
|
36
|
+
step b_enroll: <... completed>
|
|
37
|
+
agent_handle
|
|
38
|
+
------------
|
|
39
|
+
tok521-agent
|
|
40
|
+
(1 row)
|
|
41
|
+
|
|
42
|
+
step b_commit: COMMIT;
|
|
43
|
+
step check:
|
|
44
|
+
select
|
|
45
|
+
(select count(*) from agent_board.agents where handle like 'tok521-agent%') as agents,
|
|
46
|
+
(select count(*) from agent_board.agent_signing_keys where fingerprint = public.test_key_fingerprint('tok521-k1')) as k1_keys,
|
|
47
|
+
(select count(*) from agent_board.agent_signing_keys where fingerprint = public.test_key_fingerprint('tok521-k2')) as k2_keys,
|
|
48
|
+
(select count(*) from agent_board.enroll_token_uses) as token_rows,
|
|
49
|
+
(select case u.agent_public_key_fingerprint
|
|
50
|
+
when public.test_key_fingerprint('tok521-k1') then 'K1'
|
|
51
|
+
when public.test_key_fingerprint('tok521-k2') then 'K2'
|
|
52
|
+
else 'other' end
|
|
53
|
+
from agent_board.enroll_token_uses u where u.token_sha256 = repeat('a', 64)) as token_bound_to;
|
|
54
|
+
|
|
55
|
+
agents|k1_keys|k2_keys|token_rows|token_bound_to
|
|
56
|
+
------+-------+-------+----------+--------------
|
|
57
|
+
1| 0| 1| 1|K2
|
|
58
|
+
(1 row)
|
|
59
|
+
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
Parsed test spec with 3 sessions
|
|
2
|
+
|
|
3
|
+
starting permutation: fleet_begin fleet_onboard ident_begin ident_enroll fleet_commit ident_rollback check
|
|
4
|
+
count
|
|
5
|
+
-----
|
|
6
|
+
1
|
|
7
|
+
(1 row)
|
|
8
|
+
|
|
9
|
+
step fleet_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
|
|
10
|
+
step fleet_onboard:
|
|
11
|
+
select agent_handle, identity_disposition
|
|
12
|
+
from agent_board.onboard_federated_fleet_agent(
|
|
13
|
+
'https://tok521-iso.test', 'message-board', 'tok521-human',
|
|
14
|
+
jsonb_build_object('iss','https://tok521-iso.test','aud','message-board','sub','tok521-human'),
|
|
15
|
+
'tok521-agent',
|
|
16
|
+
public.test_pubkey('tok521-k1'), 'raw_ed25519_base64url',
|
|
17
|
+
public.test_key_fingerprint('tok521-k1'),
|
|
18
|
+
true, repeat('a', 64), now() + interval '1 hour', null, 'agent',
|
|
19
|
+
ARRAY['board:send'], ARRAY[]::text[],
|
|
20
|
+
(select code from agent_board.board_invite_tokens where created_by_agent_id='52100000-0000-0000-0000-000000000001'),
|
|
21
|
+
(select id from agent_board.boards where slug='tok521-board'),
|
|
22
|
+
'52100000-0000-0000-0000-000000000003', 'codex', 'phase-loop',
|
|
23
|
+
'message-board', 'sha256:tok521-repo', 'worker', 'phase_worker',
|
|
24
|
+
'tok521-agent'
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
agent_handle|identity_disposition
|
|
28
|
+
------------+--------------------
|
|
29
|
+
tok521-agent|created
|
|
30
|
+
(1 row)
|
|
31
|
+
|
|
32
|
+
step ident_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
|
|
33
|
+
step ident_enroll:
|
|
34
|
+
do $$ begin
|
|
35
|
+
perform agent_board.enroll_federated_identity(
|
|
36
|
+
'https://tok521-iso.test', 'message-board', 'tok521-human',
|
|
37
|
+
jsonb_build_object('iss','https://tok521-iso.test','aud','message-board','sub','tok521-human'),
|
|
38
|
+
'tok521-agent',
|
|
39
|
+
public.test_pubkey('tok521-k2'), 'raw_ed25519_base64url',
|
|
40
|
+
public.test_key_fingerprint('tok521-k2'),
|
|
41
|
+
true, repeat('a', 64), now() + interval '1 hour', null, 'agent',
|
|
42
|
+
ARRAY['board:send'], ARRAY[]::text[], null
|
|
43
|
+
);
|
|
44
|
+
exception when others then
|
|
45
|
+
raise exception 'SQLSTATE %: %', sqlstate, sqlerrm using errcode = sqlstate;
|
|
46
|
+
end $$;
|
|
47
|
+
<waiting ...>
|
|
48
|
+
step fleet_commit: COMMIT;
|
|
49
|
+
step ident_enroll: <... completed>
|
|
50
|
+
ERROR: SQLSTATE MBT01: enroll token already bound to a different key
|
|
51
|
+
step ident_rollback: ROLLBACK;
|
|
52
|
+
step check:
|
|
53
|
+
select
|
|
54
|
+
(select count(*) from agent_board.agents where handle like 'tok521-agent%') as agents,
|
|
55
|
+
(select count(*) from agent_board.agent_signing_keys where fingerprint = public.test_key_fingerprint('tok521-k1')) as k1_keys,
|
|
56
|
+
(select count(*) from agent_board.agent_signing_keys where fingerprint = public.test_key_fingerprint('tok521-k2')) as k2_keys,
|
|
57
|
+
(select count(*) from agent_board.enroll_token_uses) as token_rows,
|
|
58
|
+
(select case u.agent_public_key_fingerprint
|
|
59
|
+
when public.test_key_fingerprint('tok521-k1') then 'K1'
|
|
60
|
+
when public.test_key_fingerprint('tok521-k2') then 'K2'
|
|
61
|
+
else 'other' end
|
|
62
|
+
from agent_board.enroll_token_uses u where u.token_sha256 = repeat('a', 64)) as token_bound_to,
|
|
63
|
+
(select count(*) from agent_board.fleet_harness_registrations where machine_id='52100000-0000-0000-0000-000000000003') as harnesses,
|
|
64
|
+
(select count(*) from agent_board.fleet_repo_scopes r join agent_board.fleet_harness_registrations h on h.id = r.harness_registration_id
|
|
65
|
+
where h.machine_id='52100000-0000-0000-0000-000000000003') as repo_scopes,
|
|
66
|
+
(select count(*) from agent_board.fleet_machine_agents where machine_id='52100000-0000-0000-0000-000000000003') as bindings;
|
|
67
|
+
|
|
68
|
+
agents|k1_keys|k2_keys|token_rows|token_bound_to|harnesses|repo_scopes|bindings
|
|
69
|
+
------+-------+-------+----------+--------------+---------+-----------+--------
|
|
70
|
+
1| 1| 0| 1|K1 | 1| 1| 1
|
|
71
|
+
(1 row)
|
|
72
|
+
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
Parsed test spec with 3 sessions
|
|
2
|
+
|
|
3
|
+
starting permutation: ident_begin ident_enroll fleet_begin fleet_onboard ident_commit fleet_rollback check
|
|
4
|
+
count
|
|
5
|
+
-----
|
|
6
|
+
1
|
|
7
|
+
(1 row)
|
|
8
|
+
|
|
9
|
+
step ident_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
|
|
10
|
+
step ident_enroll:
|
|
11
|
+
select agent_handle
|
|
12
|
+
from agent_board.enroll_federated_identity(
|
|
13
|
+
'https://tok521-iso.test', 'message-board', 'tok521-human',
|
|
14
|
+
jsonb_build_object('iss','https://tok521-iso.test','aud','message-board','sub','tok521-human'),
|
|
15
|
+
'tok521-agent',
|
|
16
|
+
public.test_pubkey('tok521-k1'), 'raw_ed25519_base64url',
|
|
17
|
+
public.test_key_fingerprint('tok521-k1'),
|
|
18
|
+
true, repeat('a', 64), now() + interval '1 hour', null, 'agent',
|
|
19
|
+
ARRAY['board:send'], ARRAY[]::text[], null
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
agent_handle
|
|
23
|
+
------------
|
|
24
|
+
tok521-agent
|
|
25
|
+
(1 row)
|
|
26
|
+
|
|
27
|
+
step fleet_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
|
|
28
|
+
step fleet_onboard:
|
|
29
|
+
do $$ begin
|
|
30
|
+
perform agent_board.onboard_federated_fleet_agent(
|
|
31
|
+
'https://tok521-iso.test', 'message-board', 'tok521-human',
|
|
32
|
+
jsonb_build_object('iss','https://tok521-iso.test','aud','message-board','sub','tok521-human'),
|
|
33
|
+
'tok521-agent',
|
|
34
|
+
public.test_pubkey('tok521-k2'), 'raw_ed25519_base64url',
|
|
35
|
+
public.test_key_fingerprint('tok521-k2'),
|
|
36
|
+
true, repeat('a', 64), now() + interval '1 hour', null, 'agent',
|
|
37
|
+
ARRAY['board:send'], ARRAY[]::text[],
|
|
38
|
+
(select code from agent_board.board_invite_tokens where created_by_agent_id='52100000-0000-0000-0000-000000000001'),
|
|
39
|
+
(select id from agent_board.boards where slug='tok521-board'),
|
|
40
|
+
'52100000-0000-0000-0000-000000000003', 'codex', 'phase-loop',
|
|
41
|
+
'message-board', 'sha256:tok521-repo', 'worker', 'phase_worker',
|
|
42
|
+
'tok521-agent'
|
|
43
|
+
);
|
|
44
|
+
exception when others then
|
|
45
|
+
raise exception 'SQLSTATE %: %', sqlstate, sqlerrm using errcode = sqlstate;
|
|
46
|
+
end $$;
|
|
47
|
+
<waiting ...>
|
|
48
|
+
step ident_commit: COMMIT;
|
|
49
|
+
step fleet_onboard: <... completed>
|
|
50
|
+
ERROR: SQLSTATE MBT01: enroll token already bound to a different key
|
|
51
|
+
step fleet_rollback: ROLLBACK;
|
|
52
|
+
step check:
|
|
53
|
+
select
|
|
54
|
+
(select count(*) from agent_board.agents where handle like 'tok521-agent%') as agents,
|
|
55
|
+
(select count(*) from agent_board.agent_signing_keys where fingerprint = public.test_key_fingerprint('tok521-k1')) as k1_keys,
|
|
56
|
+
(select count(*) from agent_board.agent_signing_keys where fingerprint = public.test_key_fingerprint('tok521-k2')) as k2_keys,
|
|
57
|
+
(select count(*) from agent_board.enroll_token_uses) as token_rows,
|
|
58
|
+
(select case u.agent_public_key_fingerprint
|
|
59
|
+
when public.test_key_fingerprint('tok521-k1') then 'K1'
|
|
60
|
+
when public.test_key_fingerprint('tok521-k2') then 'K2'
|
|
61
|
+
else 'other' end
|
|
62
|
+
from agent_board.enroll_token_uses u where u.token_sha256 = repeat('a', 64)) as token_bound_to,
|
|
63
|
+
(select count(*) from agent_board.fleet_harness_registrations where machine_id='52100000-0000-0000-0000-000000000003') as harnesses,
|
|
64
|
+
(select count(*) from agent_board.fleet_repo_scopes r join agent_board.fleet_harness_registrations h on h.id = r.harness_registration_id
|
|
65
|
+
where h.machine_id='52100000-0000-0000-0000-000000000003') as repo_scopes,
|
|
66
|
+
(select count(*) from agent_board.fleet_machine_agents where machine_id='52100000-0000-0000-0000-000000000003') as bindings;
|
|
67
|
+
|
|
68
|
+
agents|k1_keys|k2_keys|token_rows|token_bound_to|harnesses|repo_scopes|bindings
|
|
69
|
+
------+-------+-------+----------+--------------+---------+-----------+--------
|
|
70
|
+
1| 1| 0| 1|K1 | 0| 0| 0
|
|
71
|
+
(1 row)
|
|
72
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Parsed test spec with 3 sessions
|
|
2
|
+
|
|
3
|
+
starting permutation: fleet_begin fleet_onboard ident_begin ident_enroll fleet_commit ident_commit check
|
|
4
|
+
count
|
|
5
|
+
-----
|
|
6
|
+
1
|
|
7
|
+
(1 row)
|
|
8
|
+
|
|
9
|
+
step fleet_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
|
|
10
|
+
step fleet_onboard:
|
|
11
|
+
select agent_handle, identity_disposition
|
|
12
|
+
from agent_board.onboard_federated_fleet_agent(
|
|
13
|
+
'https://tok521-iso.test', 'message-board', 'tok521-human',
|
|
14
|
+
jsonb_build_object('iss','https://tok521-iso.test','aud','message-board','sub','tok521-human'),
|
|
15
|
+
'tok521-agent',
|
|
16
|
+
public.test_pubkey('tok521-k1'), 'raw_ed25519_base64url',
|
|
17
|
+
public.test_key_fingerprint('tok521-k1'),
|
|
18
|
+
true, repeat('a', 64), now() + interval '1 hour', null, 'agent',
|
|
19
|
+
ARRAY['board:send'], ARRAY[]::text[],
|
|
20
|
+
(select code from agent_board.board_invite_tokens where created_by_agent_id='52100000-0000-0000-0000-000000000001'),
|
|
21
|
+
(select id from agent_board.boards where slug='tok521-board'),
|
|
22
|
+
'52100000-0000-0000-0000-000000000003', 'codex', 'phase-loop',
|
|
23
|
+
'message-board', 'sha256:tok521-repo', 'worker', 'phase_worker',
|
|
24
|
+
'tok521-agent'
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
agent_handle|identity_disposition
|
|
28
|
+
------------+--------------------
|
|
29
|
+
tok521-agent|created
|
|
30
|
+
(1 row)
|
|
31
|
+
|
|
32
|
+
step ident_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
|
|
33
|
+
step ident_enroll:
|
|
34
|
+
select agent_handle
|
|
35
|
+
from agent_board.enroll_federated_identity(
|
|
36
|
+
'https://tok521-iso.test', 'message-board', 'tok521-human',
|
|
37
|
+
jsonb_build_object('iss','https://tok521-iso.test','aud','message-board','sub','tok521-human'),
|
|
38
|
+
'tok521-agent',
|
|
39
|
+
public.test_pubkey('tok521-k1'), 'raw_ed25519_base64url',
|
|
40
|
+
public.test_key_fingerprint('tok521-k1'),
|
|
41
|
+
true, repeat('a', 64), now() + interval '1 hour', null, 'agent',
|
|
42
|
+
ARRAY['board:send'], ARRAY[]::text[], null
|
|
43
|
+
);
|
|
44
|
+
<waiting ...>
|
|
45
|
+
step fleet_commit: COMMIT;
|
|
46
|
+
step ident_enroll: <... completed>
|
|
47
|
+
agent_handle
|
|
48
|
+
------------
|
|
49
|
+
tok521-agent
|
|
50
|
+
(1 row)
|
|
51
|
+
|
|
52
|
+
step ident_commit: COMMIT;
|
|
53
|
+
step check:
|
|
54
|
+
select
|
|
55
|
+
(select count(*) from agent_board.agents where handle like 'tok521-agent%') as agents,
|
|
56
|
+
(select count(*) from agent_board.agent_signing_keys where fingerprint = public.test_key_fingerprint('tok521-k1')) as k1_keys,
|
|
57
|
+
(select count(*) from agent_board.agent_signing_keys where fingerprint = public.test_key_fingerprint('tok521-k2')) as k2_keys,
|
|
58
|
+
(select count(*) from agent_board.enroll_token_uses) as token_rows,
|
|
59
|
+
(select case u.agent_public_key_fingerprint
|
|
60
|
+
when public.test_key_fingerprint('tok521-k1') then 'K1'
|
|
61
|
+
when public.test_key_fingerprint('tok521-k2') then 'K2'
|
|
62
|
+
else 'other' end
|
|
63
|
+
from agent_board.enroll_token_uses u where u.token_sha256 = repeat('a', 64)) as token_bound_to,
|
|
64
|
+
(select count(*) from agent_board.fleet_harness_registrations where machine_id='52100000-0000-0000-0000-000000000003') as harnesses,
|
|
65
|
+
(select count(*) from agent_board.fleet_repo_scopes r join agent_board.fleet_harness_registrations h on h.id = r.harness_registration_id
|
|
66
|
+
where h.machine_id='52100000-0000-0000-0000-000000000003') as repo_scopes,
|
|
67
|
+
(select count(*) from agent_board.fleet_machine_agents where machine_id='52100000-0000-0000-0000-000000000003') as bindings;
|
|
68
|
+
|
|
69
|
+
agents|k1_keys|k2_keys|token_rows|token_bound_to|harnesses|repo_scopes|bindings
|
|
70
|
+
------+-------+-------+----------+--------------+---------+-----------+--------
|
|
71
|
+
1| 1| 0| 1|K1 | 1| 1| 1
|
|
72
|
+
(1 row)
|
|
73
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Parsed test spec with 3 sessions
|
|
2
|
+
|
|
3
|
+
starting permutation: ident_begin ident_enroll fleet_begin fleet_onboard ident_commit fleet_commit check
|
|
4
|
+
count
|
|
5
|
+
-----
|
|
6
|
+
1
|
|
7
|
+
(1 row)
|
|
8
|
+
|
|
9
|
+
step ident_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
|
|
10
|
+
step ident_enroll:
|
|
11
|
+
select agent_handle
|
|
12
|
+
from agent_board.enroll_federated_identity(
|
|
13
|
+
'https://tok521-iso.test', 'message-board', 'tok521-human',
|
|
14
|
+
jsonb_build_object('iss','https://tok521-iso.test','aud','message-board','sub','tok521-human'),
|
|
15
|
+
'tok521-agent',
|
|
16
|
+
public.test_pubkey('tok521-k1'), 'raw_ed25519_base64url',
|
|
17
|
+
public.test_key_fingerprint('tok521-k1'),
|
|
18
|
+
true, repeat('a', 64), now() + interval '1 hour', null, 'agent',
|
|
19
|
+
ARRAY['board:send'], ARRAY[]::text[], null
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
agent_handle
|
|
23
|
+
------------
|
|
24
|
+
tok521-agent
|
|
25
|
+
(1 row)
|
|
26
|
+
|
|
27
|
+
step fleet_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
|
|
28
|
+
step fleet_onboard:
|
|
29
|
+
select agent_handle, identity_disposition
|
|
30
|
+
from agent_board.onboard_federated_fleet_agent(
|
|
31
|
+
'https://tok521-iso.test', 'message-board', 'tok521-human',
|
|
32
|
+
jsonb_build_object('iss','https://tok521-iso.test','aud','message-board','sub','tok521-human'),
|
|
33
|
+
'tok521-agent',
|
|
34
|
+
public.test_pubkey('tok521-k1'), 'raw_ed25519_base64url',
|
|
35
|
+
public.test_key_fingerprint('tok521-k1'),
|
|
36
|
+
true, repeat('a', 64), now() + interval '1 hour', null, 'agent',
|
|
37
|
+
ARRAY['board:send'], ARRAY[]::text[],
|
|
38
|
+
(select code from agent_board.board_invite_tokens where created_by_agent_id='52100000-0000-0000-0000-000000000001'),
|
|
39
|
+
(select id from agent_board.boards where slug='tok521-board'),
|
|
40
|
+
'52100000-0000-0000-0000-000000000003', 'codex', 'phase-loop',
|
|
41
|
+
'message-board', 'sha256:tok521-repo', 'worker', 'phase_worker',
|
|
42
|
+
'tok521-agent'
|
|
43
|
+
);
|
|
44
|
+
<waiting ...>
|
|
45
|
+
step ident_commit: COMMIT;
|
|
46
|
+
step fleet_onboard: <... completed>
|
|
47
|
+
agent_handle|identity_disposition
|
|
48
|
+
------------+--------------------
|
|
49
|
+
tok521-agent|reused
|
|
50
|
+
(1 row)
|
|
51
|
+
|
|
52
|
+
step fleet_commit: COMMIT;
|
|
53
|
+
step check:
|
|
54
|
+
select
|
|
55
|
+
(select count(*) from agent_board.agents where handle like 'tok521-agent%') as agents,
|
|
56
|
+
(select count(*) from agent_board.agent_signing_keys where fingerprint = public.test_key_fingerprint('tok521-k1')) as k1_keys,
|
|
57
|
+
(select count(*) from agent_board.agent_signing_keys where fingerprint = public.test_key_fingerprint('tok521-k2')) as k2_keys,
|
|
58
|
+
(select count(*) from agent_board.enroll_token_uses) as token_rows,
|
|
59
|
+
(select case u.agent_public_key_fingerprint
|
|
60
|
+
when public.test_key_fingerprint('tok521-k1') then 'K1'
|
|
61
|
+
when public.test_key_fingerprint('tok521-k2') then 'K2'
|
|
62
|
+
else 'other' end
|
|
63
|
+
from agent_board.enroll_token_uses u where u.token_sha256 = repeat('a', 64)) as token_bound_to,
|
|
64
|
+
(select count(*) from agent_board.fleet_harness_registrations where machine_id='52100000-0000-0000-0000-000000000003') as harnesses,
|
|
65
|
+
(select count(*) from agent_board.fleet_repo_scopes r join agent_board.fleet_harness_registrations h on h.id = r.harness_registration_id
|
|
66
|
+
where h.machine_id='52100000-0000-0000-0000-000000000003') as repo_scopes,
|
|
67
|
+
(select count(*) from agent_board.fleet_machine_agents where machine_id='52100000-0000-0000-0000-000000000003') as bindings;
|
|
68
|
+
|
|
69
|
+
agents|k1_keys|k2_keys|token_rows|token_bound_to|harnesses|repo_scopes|bindings
|
|
70
|
+
------+-------+-------+----------+--------------+---------+-----------+--------
|
|
71
|
+
1| 1| 0| 1|K1 | 1| 1| 1
|
|
72
|
+
(1 row)
|
|
73
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Parsed test spec with 3 sessions
|
|
2
|
+
|
|
3
|
+
starting permutation: a_begin a_enroll b_begin b_enroll a_commit b_commit check
|
|
4
|
+
step a_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
|
|
5
|
+
step a_enroll:
|
|
6
|
+
select agent_handle
|
|
7
|
+
from agent_board.enroll_federated_identity(
|
|
8
|
+
'https://tok521-iso.test', 'message-board', 'tok521-human',
|
|
9
|
+
jsonb_build_object('iss','https://tok521-iso.test','aud','message-board','sub','tok521-human'),
|
|
10
|
+
'tok521-agent',
|
|
11
|
+
public.test_pubkey('tok521-k1'), 'raw_ed25519_base64url',
|
|
12
|
+
public.test_key_fingerprint('tok521-k1'),
|
|
13
|
+
true, repeat('a', 64), now() + interval '1 hour', null, 'agent',
|
|
14
|
+
ARRAY['board:send'], ARRAY[]::text[], null
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
agent_handle
|
|
18
|
+
------------
|
|
19
|
+
tok521-agent
|
|
20
|
+
(1 row)
|
|
21
|
+
|
|
22
|
+
step b_begin: BEGIN; SET LOCAL "request.jwt.claim.role" = 'service_role';
|
|
23
|
+
step b_enroll:
|
|
24
|
+
select agent_handle
|
|
25
|
+
from agent_board.enroll_federated_identity(
|
|
26
|
+
'https://tok521-iso.test', 'message-board', 'tok521-human',
|
|
27
|
+
jsonb_build_object('iss','https://tok521-iso.test','aud','message-board','sub','tok521-human'),
|
|
28
|
+
'tok521-agent',
|
|
29
|
+
public.test_pubkey('tok521-k1'), 'raw_ed25519_base64url',
|
|
30
|
+
public.test_key_fingerprint('tok521-k1'),
|
|
31
|
+
true, repeat('a', 64), now() + interval '1 hour', null, 'agent',
|
|
32
|
+
ARRAY['board:send'], ARRAY[]::text[], null
|
|
33
|
+
);
|
|
34
|
+
<waiting ...>
|
|
35
|
+
step a_commit: COMMIT;
|
|
36
|
+
step b_enroll: <... completed>
|
|
37
|
+
agent_handle
|
|
38
|
+
------------
|
|
39
|
+
tok521-agent
|
|
40
|
+
(1 row)
|
|
41
|
+
|
|
42
|
+
step b_commit: COMMIT;
|
|
43
|
+
step check:
|
|
44
|
+
select
|
|
45
|
+
(select count(*) from agent_board.agents where handle like 'tok521-agent%') as agents,
|
|
46
|
+
(select count(*) from agent_board.agent_signing_keys where fingerprint = public.test_key_fingerprint('tok521-k1')) as k1_keys,
|
|
47
|
+
(select count(*) from agent_board.agent_signing_keys where fingerprint = public.test_key_fingerprint('tok521-k2')) as k2_keys,
|
|
48
|
+
(select count(*) from agent_board.enroll_token_uses) as token_rows,
|
|
49
|
+
(select case u.agent_public_key_fingerprint
|
|
50
|
+
when public.test_key_fingerprint('tok521-k1') then 'K1'
|
|
51
|
+
when public.test_key_fingerprint('tok521-k2') then 'K2'
|
|
52
|
+
else 'other' end
|
|
53
|
+
from agent_board.enroll_token_uses u where u.token_sha256 = repeat('a', 64)) as token_bound_to;
|
|
54
|
+
|
|
55
|
+
agents|k1_keys|k2_keys|token_rows|token_bound_to
|
|
56
|
+
------+-------+-------+----------+--------------
|
|
57
|
+
1| 1| 0| 1|K1
|
|
58
|
+
(1 row)
|
|
59
|
+
|