@consiliency/agent-board-schema 1.28.0 → 1.38.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 (43) hide show
  1. package/fixtures/already-applied.json +40 -0
  2. package/migrations/20260910000100_agent_board_ceiling_lock_comment_truth.sql +89 -0
  3. package/migrations/20260911000100_agent_board_ledger_revoked_board_creation.sql +330 -0
  4. package/migrations/20260912000100_agent_board_receipt_subject_gate.sql +348 -0
  5. package/migrations/20260913000100_agent_board_task_thread_lock_order.sql +292 -0
  6. package/migrations/20260914000100_agent_board_claim_subject_gate.sql +500 -0
  7. package/migrations/20260915000100_agent_board_fedsession_stored_identity_gate.sql +353 -0
  8. package/migrations/20260916000100_agent_board_federated_identity_injective_slug.sql +1646 -0
  9. package/migrations/20260917000100_agent_board_invite_no_downgrade.sql +398 -0
  10. package/migrations/20260918000100_agent_board_signed_write_enforced_repoint.sql +139 -0
  11. package/migrations/20260919000100_agent_board_signed_write_model_key.sql +107 -0
  12. package/package.json +1 -1
  13. package/schema-manifest.json +93 -3
  14. package/src/deployment-drift-script.test.mjs +424 -0
  15. package/src/deployment-drift.test.mjs +301 -0
  16. package/src/tooling.test.mjs +83 -2
  17. package/tests/agent_board_atomic_fleet_onboarding.test.sql +144 -29
  18. package/tests/agent_board_bundle_endpoint_compat.test.sql +73 -18
  19. package/tests/agent_board_claim_subject_gate.test.sql +1025 -0
  20. package/tests/agent_board_consent_substrate.test.sql +8 -1
  21. package/tests/agent_board_enroll_resumption.test.sql +7 -1
  22. package/tests/agent_board_federated_identity_injective_slug.test.sql +388 -0
  23. package/tests/agent_board_fedsession.test.sql +17 -2
  24. package/tests/agent_board_fedsession_stored_identity_gate.test.sql +606 -0
  25. package/tests/agent_board_fk_lock_edges.test.sql +422 -0
  26. package/tests/agent_board_invite_no_downgrade.test.sql +689 -0
  27. package/tests/agent_board_ledger_authority.test.sql +142 -71
  28. package/tests/agent_board_receipt_subject_gate.test.sql +624 -0
  29. package/tests/agent_board_signed_write_enforced.test.sql +366 -0
  30. package/tests/agent_board_signer_lifecycle.test.sql +23 -6
  31. package/tests/agent_board_source_strip_helper.test.sql +256 -1
  32. package/tests/agent_board_task_thread_lock_order.test.sql +337 -0
  33. package/tests/agent_board_write_enforcement_class.test.sql +1016 -0
  34. package/tests/catalog/p_metadata_parameters.json +12 -0
  35. package/tests/fixtures/isolation-substrate.sql +1 -1
  36. package/tests/fixtures/test-prereqs.sql +442 -11
  37. package/tests/isolation/expected/ledger_authority_revoke.out +219 -1
  38. package/tests/isolation/expected/task_thread_lock_order.out +203 -0
  39. package/tests/isolation/specs/enroll_identity_board_owner_lock_order.spec +5 -4
  40. package/tests/isolation/specs/fedsession_provider_absent_owner_lock.spec +4 -4
  41. package/tests/isolation/specs/ledger_authority_revoke.spec +115 -0
  42. package/tests/isolation/specs/task_thread_lock_order.spec +197 -0
  43. package/tests/seeds/20260916000100_agent_board_federated_identity_injective_slug.sql.pre.sql +196 -0
@@ -1,5 +1,5 @@
1
1
  begin;
2
- select plan(12);
2
+ select plan(21);
3
3
 
4
4
  -- objects exist
5
5
  select has_table('agent_board', 'bundle_installation', 'bundle_installation table exists');
@@ -25,27 +25,47 @@ select is((agent_board.get_bundle_compatibility() ->> 'ready'), 'false',
25
25
  select is((agent_board.get_bundle_compatibility() ->> 'schema_version'), '8',
26
26
  'compatibility reports schema version 8');
27
27
 
28
- -- Post-MBSESSION the 8 core sends are re-granted to authenticated, so the LIVE
29
- -- baseline posture is signed_write_enforced=false. Exercise BOTH branches in this
30
- -- rolled-back txn. Enforced branch: revoke EXECUTE from authenticated on ALL
31
- -- eight gated-write overloads (the probe checks by routine name, so any single
32
- -- remaining overload grant keeps enforcement false) -> reports active=true.
33
- revoke execute on function agent_board.send_direct_message(uuid, uuid, uuid, text, text, text, text, text, jsonb) from authenticated;
34
- revoke execute on function agent_board.send_direct_message(uuid, uuid, jsonb, text, text, text, text, text, text, jsonb) from authenticated;
28
+ -- #310: this block used to exercise the flag's two branches by revoking and re-granting the
29
+ -- EIGHT send overloads, because the predicate asked whether `authenticated` could execute them.
30
+ -- That predicate encoded the model 20260718000800 deliberately abandoned, and it reported
31
+ -- `false` for a system that WAS enforcing. 20260918000100 re-points it at the signed gateway's
32
+ -- grants, so the same two branches are now driven from a `signed_*` function instead.
33
+ --
34
+ -- Both branches still run inside this rolled-back txn, and driving BOTH is the point: an
35
+ -- assertion that only ever sees `true` cannot tell "the flag is right" from "the flag is stuck".
36
+ select is((agent_board.get_bundle_compatibility() ->> 'signed_write_enforced'), 'true',
37
+ 'signed-write enforcement reports active on the shipped posture — the signed gateway exists and no signed_* is executable by authenticated or anon (#310)');
38
+
39
+ -- Enforcement-off branch: EXECUTE on any ONE signed_* gateway reaching `authenticated` is
40
+ -- enough. The probe iterates pg_proc rows, so this holds for every gateway and every overload,
41
+ -- not just the one named here.
42
+ grant execute on function agent_board.signed_post_board_message(jsonb, jsonb) to authenticated;
43
+ select is((agent_board.get_bundle_compatibility() ->> 'signed_write_enforced'), 'false',
44
+ 'enforcement flips to false when a single signed_* gateway becomes executable by authenticated');
45
+
46
+ revoke execute on function agent_board.signed_post_board_message(jsonb, jsonb) from authenticated;
47
+
48
+ -- `anon` is checked too, and separately: the retired predicate looked only at `authenticated`,
49
+ -- so an anon grant on the signed path would have left it reporting enforced.
50
+ grant execute on function agent_board.signed_send_direct_message(jsonb, jsonb) to anon;
51
+ select is((agent_board.get_bundle_compatibility() ->> 'signed_write_enforced'), 'false',
52
+ 'enforcement flips to false for an ANON grant as well — the retired predicate only looked at authenticated');
53
+
54
+ revoke execute on function agent_board.signed_send_direct_message(jsonb, jsonb) from anon;
55
+ select is((agent_board.get_bundle_compatibility() ->> 'signed_write_enforced'), 'true',
56
+ 'and back to true once the grant is withdrawn — the flag tracks the grant rather than latching');
57
+
58
+ -- The re-granted SEND path must NOT move the flag -- #310's defect stated as an assertion.
59
+ -- This REVOKES and RE-GRANTS a send overload so it observes a genuine state change; the earlier
60
+ -- draft asserted the same value twice with nothing happening in between, which documented the
61
+ -- claim rather than probing it.
35
62
  revoke execute on function agent_board.send_multicast_message(uuid, uuid, uuid[], text, text, text, text, text, jsonb) from authenticated;
36
- revoke execute on function agent_board.send_multicast_message(uuid, uuid, jsonb, text, text, text, text, text, text, jsonb) from authenticated;
37
- revoke execute on function agent_board.post_board_message(uuid, uuid, uuid, text, text, text, text, text, jsonb) from authenticated;
38
- revoke execute on function agent_board.post_board_message(uuid, uuid, text, text, text, text, text, text, text, jsonb) from authenticated;
39
- revoke execute on function agent_board.create_tasking_delivery(uuid, uuid, text, text, uuid[], uuid, text, text, text, jsonb) from authenticated;
40
- revoke execute on function agent_board.create_tasking_delivery(uuid, uuid, text, text, jsonb, text, text, text, text, text, jsonb) from authenticated;
41
63
  select is((agent_board.get_bundle_compatibility() ->> 'signed_write_enforced'), 'true',
42
- 'signed-write enforcement reports active when all gated write RPCs are revoked from authenticated');
64
+ '#310: REVOKING a send RPC from authenticated does not move the flag — the retired predicate would have flipped to true here, which is precisely what it got wrong');
43
65
 
44
- -- Re-grant branch: re-granting EXECUTE on any one gated write RPC (as MBSESSION
45
- -- does at 20260718000800) flips enforcement back to false.
46
66
  grant execute on function agent_board.send_multicast_message(uuid, uuid, uuid[], text, text, text, text, text, jsonb) to authenticated;
47
- select is((agent_board.get_bundle_compatibility() ->> 'signed_write_enforced'), 'false',
48
- 'enforcement flips to false when any gated write RPC is re-granted to authenticated');
67
+ select is((agent_board.get_bundle_compatibility() ->> 'signed_write_enforced'), 'true',
68
+ '#310: and RE-GRANTING it does not move the flag either — authenticated holding EXECUTE on the unsigned send path is the shipped model, not a lapse');
49
69
 
50
70
  -- after the materializer records an install: ready + bundle identity present,
51
71
  -- and no credential/row content leaks (only whitelisted keys)
@@ -57,5 +77,40 @@ select is(
57
77
  'true:1.1.0:deadbeef',
58
78
  'ready + bundle identity reported after install record');
59
79
 
80
+ -- ===========================================================================
81
+ -- SIGNEDWRITEMODEL (message-board#326)
82
+ --
83
+ -- `signed_write_enforced` has the right VALUE and the wrong NAME: it is called
84
+ -- "signed write enforced" and it tests "the signed path is operator-only". The
85
+ -- sibling below NAMES the proposition, so a reader decodes the boolean without
86
+ -- consulting the 1.37.0 version boundary.
87
+ -- ===========================================================================
88
+ select is((agent_board.get_bundle_compatibility() ->> 'signed_write_model'),
89
+ 'operator-only-gateway',
90
+ 'MB326-1: the handshake NAMES the model its boolean is answering, so the flag decodes without a version boundary');
91
+
92
+ -- The key is a CONSTANT about this bundle, not a derivation from the database.
93
+ -- Driving the boolean to its other branch must not move it: a model that flipped
94
+ -- with the state it describes would be a second boolean, not a label.
95
+ grant execute on function agent_board.signed_post_board_message(jsonb, jsonb) to authenticated;
96
+ select is(
97
+ (agent_board.get_bundle_compatibility() ->> 'signed_write_model') || ':' ||
98
+ (agent_board.get_bundle_compatibility() ->> 'signed_write_enforced'),
99
+ 'operator-only-gateway:false',
100
+ 'MB326-2: the model NAME is a constant about the bundle — it stays put while the boolean it labels flips to false');
101
+ revoke execute on function agent_board.signed_post_board_message(jsonb, jsonb) from authenticated;
102
+
103
+ -- ADDITIVE, which is the whole argument for adding rather than renaming.
104
+ -- packages/agent-board-client/src/compatibility.ts recognises a health response
105
+ -- with `"schema_version" in value && "signed_write_enforced" in value && "ready"
106
+ -- in value`. Asserted as PRESENCE of each of the three, one at a time, because
107
+ -- that is what the guard tests -- a combined check would pass on two of three.
108
+ select ok(agent_board.get_bundle_compatibility() ? 'schema_version',
109
+ 'MB326-3: the deployed client type guard''s first key is still PRESENT');
110
+ select ok(agent_board.get_bundle_compatibility() ? 'signed_write_enforced',
111
+ 'MB326-4: ...its second key, the one a rename or retirement would have removed, is still PRESENT');
112
+ select ok(agent_board.get_bundle_compatibility() ? 'ready',
113
+ 'MB326-5: ...and its third');
114
+
60
115
  select * from finish();
61
116
  rollback;