@consiliency/agent-board-schema 1.74.0 → 1.76.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 (96) hide show
  1. package/fixtures/already-applied.json +8 -0
  2. package/migrations/20261108000100_agent_board_send_outcome.sql +708 -0
  3. package/migrations/20261109000100_agent_board_step_up_groundwork.sql +343 -0
  4. package/package.json +1 -1
  5. package/schema-manifest.json +21 -3
  6. package/src/deployment-drift-main.test.mjs +20 -3
  7. package/src/deployment-drift-script.test.mjs +77 -2
  8. package/src/deployment-drift.test.mjs +60 -0
  9. package/src/tooling.test.mjs +4 -2
  10. package/tests/agent_board_667_history_class.test.sql +2 -0
  11. package/tests/agent_board_717_native_surface.test.sql +223 -0
  12. package/tests/agent_board_delegate_role_class.test.sql +2 -2
  13. package/tests/agent_board_delivery_writer_execute.test.sql +4 -2
  14. package/tests/agent_board_enrollment_audit_content.test.sql +6 -1
  15. package/tests/agent_board_hosted_delegates.test.sql +8 -1
  16. package/tests/agent_board_send_outcome.test.sql +805 -0
  17. package/tests/agent_board_step_up_helper.test.sql +711 -0
  18. package/tests/agent_board_write_enforcement_class.test.sql +12 -5
  19. package/tests/catalog/function_execute_privileges.json +96 -0
  20. package/tests/catalog/p_metadata_parameters.json +40 -0
  21. package/tests/fixtures/isolation-substrate.sql +8 -0
  22. package/tests/fixtures/pgtap-unexposed.sql +61 -0
  23. package/tests/isolation/expected/send_outcome_cross_board.out +40 -0
  24. package/tests/isolation/expected/send_outcome_independence.out +295 -0
  25. package/tests/isolation/expected/send_outcome_membership.out +140 -0
  26. package/tests/isolation/expected/send_outcome_overlap.out +89 -0
  27. package/tests/isolation/expected/send_outcome_reader.out +87 -0
  28. package/tests/isolation/expected/send_outcome_recovery.out +107 -0
  29. package/tests/isolation/specs/send_outcome_cross_board.spec +66 -0
  30. package/tests/isolation/specs/send_outcome_independence.spec +95 -0
  31. package/tests/isolation/specs/send_outcome_membership.spec +73 -0
  32. package/tests/isolation/specs/send_outcome_overlap.spec +69 -0
  33. package/tests/isolation/specs/send_outcome_reader.spec +61 -0
  34. package/tests/isolation/specs/send_outcome_recovery.spec +68 -0
  35. package/tests/mutations/669/M10_service_role_blanket.sql +10 -0
  36. package/tests/mutations/669/M12a_no_parse_wrapper.sql +17 -0
  37. package/tests/mutations/669/M12b_no_session_wrapper.sql +23 -0
  38. package/tests/mutations/669/M12c_no_claim_type_guard.sql +13 -0
  39. package/tests/mutations/669/M12d_no_amr_element_guards.sql +15 -0
  40. package/tests/mutations/669/M14_now_not_clock.sql +9 -0
  41. package/tests/mutations/669/M15_classifier_reads_metadata.sql +17 -0
  42. package/tests/mutations/669/M17_skip_ledger.sql +15 -0
  43. package/tests/mutations/669/M18_service_role_sub_insensitive.sql +9 -0
  44. package/tests/mutations/669/M18b_drop_uid_conjunct.sql +9 -0
  45. package/tests/mutations/669/M23_definer_wrapper_over_writer.sql +5 -0
  46. package/tests/mutations/669/M3_age_from_iat.sql +9 -0
  47. package/tests/mutations/669/M4_window_900.sql +9 -0
  48. package/tests/mutations/669/M4b_lt_to_le.sql +9 -0
  49. package/tests/mutations/669/M5_no_skew_bound.sql +9 -0
  50. package/tests/mutations/669/M6a_user_metadata_amr.sql +9 -0
  51. package/tests/mutations/669/M6b_app_metadata_claim.sql +9 -0
  52. package/tests/mutations/669/M6c_legacy_guc.sql +9 -0
  53. package/tests/mutations/669/M7_either_claim_any_human.sql +9 -0
  54. package/tests/mutations/669/M8_any_amr_method.sql +9 -0
  55. package/tests/mutations/669/M8b_accept_aal2.sql +9 -0
  56. package/tests/mutations/669/M9_every_kind.sql +9 -0
  57. package/tests/mutations/669/MAL_allowlist_nonempty.sql +9 -0
  58. package/tests/mutations/669/MAR_writer_arg_renamed.sql +14 -0
  59. package/tests/mutations/669/MAU_audit_mode_retyped.sql +2 -0
  60. package/tests/mutations/669/MA_helper_always_raises.sql +10 -0
  61. package/tests/mutations/669/MDX_dynamic_execute_definer.sql +5 -0
  62. package/tests/mutations/669/MD_detail_carries_value.sql +12 -0
  63. package/tests/mutations/669/MEC0_caller_of_helper.sql +4 -0
  64. package/tests/mutations/669/MEC0b_overload_caller.sql +4 -0
  65. package/tests/mutations/669/MG1_helper_granted_authenticated.sql +2 -0
  66. package/tests/mutations/669/MG2_ledger_insert_authenticated.sql +2 -0
  67. package/tests/mutations/669/MG3_ledger_policy.sql +2 -0
  68. package/tests/mutations/669/MR1_writer_no_class_check.sql +9 -0
  69. package/tests/mutations/669/MR2_writer_wide_window.sql +9 -0
  70. package/tests/mutations/669/MR3_writer_prunes_everyone.sql +11 -0
  71. package/tests/mutations/669/MR4_writer_lower_exclusive.sql +9 -0
  72. package/tests/mutations/669/MR5_writer_upper_exclusive.sql +9 -0
  73. package/tests/mutations/669/MR6_writer_upper_61.sql +9 -0
  74. package/tests/mutations/669/MW2_second_ledger_writer.sql +4 -0
  75. package/tests/mutations/669/MXS_cross_schema_wrapper.sql +4 -0
  76. package/tests/mutations/669/run.sh +72 -0
  77. package/tests/mutations/670/E1_helper_author_from_message.sql +7 -0
  78. package/tests/mutations/670/E2_helper_no_null_check.sql +13 -0
  79. package/tests/mutations/670/M10_lock_removed.sql +10 -0
  80. package/tests/mutations/670/M11_table_granted_to_authenticated.sql +2 -0
  81. package/tests/mutations/670/M12_helper_granted_to_service_role.sql +2 -0
  82. package/tests/mutations/670/M13_message_fk_no_cascade.sql +8 -0
  83. package/tests/mutations/670/M14_post_message_mints_from_metadata.sql +11 -0
  84. package/tests/mutations/670/M15_second_receipt_writer.sql +9 -0
  85. package/tests/mutations/670/M16_read_no_btrim.sql +7 -0
  86. package/tests/mutations/670/M17_read_volatile.sql +2 -0
  87. package/tests/mutations/670/M1_helper_no_service_role_guard.sql +13 -0
  88. package/tests/mutations/670/M3_helper_on_replay_branch.sql +10 -0
  89. package/tests/mutations/670/M4_read_checks_thread_existence.sql +10 -0
  90. package/tests/mutations/670/M5a_read_requires_thread_access.sql +10 -0
  91. package/tests/mutations/670/M5b_read_requires_board_membership.sql +11 -0
  92. package/tests/mutations/670/M6_read_admits_service_role.sql +14 -0
  93. package/tests/mutations/670/M7_confirmed_adds_message_sequence.sql +12 -0
  94. package/tests/mutations/670/M8_delivery_swallows_errors.sql +19 -0
  95. package/tests/mutations/670/M9_lock_key_includes_board.sql +10 -0
  96. package/tests/mutations/670/run.sh +84 -0
@@ -0,0 +1,343 @@
1
+ -- #669 STEPUP PR-A: authority-neutral groundwork for server-side step-up (X4).
2
+ --
3
+ -- Ruling: plans/STEPUP-669-plan.md R1 (§14 binding errata E-0..E-6 supersede conflicting text),
4
+ -- president rulings R1 (D1-D16) and R2 (PERMIT-WITH-ERRATA). This migration is PR-A (§11.1 as
5
+ -- amended by E-4/E-6(d)): it adds the step-up helper, the pure freshness predicate, the window,
6
+ -- skew and amr-allowlist functions, and the Portal proof ledger with its single writer.
7
+ --
8
+ -- AUTHORITY-NEUTRAL (E-6(d)). No chokepoint body changes: NOTHING calls
9
+ -- _require_human_step_up, so no gated function can raise MBS01 (EC-SU-0 asserts it from the
10
+ -- catalog). What PR-A does change, stated rather than implied:
11
+ -- * /portal-session may put agent_board_step_up_at into the MB token (Edge Function change);
12
+ -- * portal_step_up_proofs rows persist (written by /portal-session through
13
+ -- record_portal_step_up; nothing reads them until PR-B);
14
+ -- * the /portal-session mint log gains `step_up: boolean`.
15
+ -- The allowlist starts EMPTY (§11.1): nothing calls it, and empty is fail-closed if anything did.
16
+ -- None of these functions is executable by an API role (anon, authenticated,
17
+ -- agent_board_delegate); record_portal_step_up is EXECUTE-able by service_role only.
18
+ --
19
+ -- Writes no agent_board.schema_version (stays 8).
20
+
21
+ -- =============================================================================
22
+ -- 1. The window (D9, §4): IMMUTABLE, no table, GUC or argument. A change takes a migration.
23
+ -- =============================================================================
24
+ create or replace function agent_board._step_up_max_age_seconds()
25
+ returns numeric
26
+ language sql
27
+ immutable
28
+ parallel safe
29
+ set search_path = ''
30
+ as $$
31
+ select 300::numeric
32
+ $$;
33
+
34
+ revoke all on function agent_board._step_up_max_age_seconds()
35
+ from public, anon, authenticated, service_role, agent_board_delegate;
36
+ comment on function agent_board._step_up_max_age_seconds() is
37
+ '#669 D9: the step-up freshness window, 300 seconds. A proof is fresh while now - proof < this value. IMMUTABLE; changing it takes a reviewed migration. No API-role EXECUTE.';
38
+
39
+ create or replace function agent_board._step_up_future_skew_seconds()
40
+ returns numeric
41
+ language sql
42
+ immutable
43
+ parallel safe
44
+ set search_path = ''
45
+ as $$
46
+ select 30::numeric
47
+ $$;
48
+
49
+ revoke all on function agent_board._step_up_future_skew_seconds()
50
+ from public, anon, authenticated, service_role, agent_board_delegate;
51
+ comment on function agent_board._step_up_future_skew_seconds() is
52
+ '#669 D9: the tolerated future clock skew for a step-up proof, 30 seconds (proof - now <= this value). IMMUTABLE. No API-role EXECUTE.';
53
+
54
+ -- =============================================================================
55
+ -- 2. The pure predicate (D9). Boundary semantics are pinned on this function with exact
56
+ -- numerics (P-1..P-4), because integer-second claims against a moving clock cannot pin
57
+ -- `<` against `<=`. NULL in, false out.
58
+ -- =============================================================================
59
+ create or replace function agent_board._step_up_is_fresh(p_proof numeric, p_now numeric)
60
+ returns boolean
61
+ language sql
62
+ immutable
63
+ parallel safe
64
+ set search_path = ''
65
+ as $$
66
+ select coalesce(
67
+ p_now - p_proof < agent_board._step_up_max_age_seconds()
68
+ and p_proof - p_now <= agent_board._step_up_future_skew_seconds(),
69
+ false)
70
+ $$;
71
+
72
+ revoke all on function agent_board._step_up_is_fresh(numeric, numeric)
73
+ from public, anon, authenticated, service_role, agent_board_delegate;
74
+ comment on function agent_board._step_up_is_fresh(numeric, numeric) is
75
+ '#669 D9: pure step-up freshness predicate. True iff p_now - p_proof < _step_up_max_age_seconds() and p_proof - p_now <= _step_up_future_skew_seconds(); false (never NULL) otherwise. IMMUTABLE. The helper calls it with extract(epoch from clock_timestamp()). No API-role EXECUTE.';
76
+
77
+ -- =============================================================================
78
+ -- 3. The LOCALAUTH amr allowlist (D11, Q3). EMPTY in PR-A (§11.1): a string is admitted only
79
+ -- when the owner's Q3 answer admits it AND the §10.5 GoTrue measurement has seen that exact
80
+ -- string on the pinned image. PR-B freezes the measured list.
81
+ -- =============================================================================
82
+ create or replace function agent_board._step_up_amr_methods()
83
+ returns text[]
84
+ language sql
85
+ immutable
86
+ parallel safe
87
+ set search_path = ''
88
+ as $$
89
+ select '{}'::text[]
90
+ $$;
91
+
92
+ revoke all on function agent_board._step_up_amr_methods()
93
+ from public, anon, authenticated, service_role, agent_board_delegate;
94
+ comment on function agent_board._step_up_amr_methods() is
95
+ '#669 D11: GoTrue amr methods that count as a fresh LOCALAUTH step-up. EMPTY until PR-B freezes the Q3 candidates (otp, totp, passkey, mfa/webauthn, mfa/phone) intersected with the strings measured on the pinned GoTrue image (plan §10.5). password, magiclink, recovery, mfa/recovery_code, oauth, sso, token_refresh and unseen strings are never admitted. IMMUTABLE. No API-role EXECUTE.';
96
+
97
+ -- =============================================================================
98
+ -- 4. The Portal proof ledger (D8, §9.1). Service-written evidence that /portal-session verified
99
+ -- a Portal token carrying agent_board_step_up_at = proof_at for this agent. RLS on, zero
100
+ -- policies, no privilege for any role but the owner: record_portal_step_up is its only
101
+ -- writer.
102
+ -- =============================================================================
103
+ create table agent_board.portal_step_up_proofs (
104
+ agent_id uuid not null,
105
+ proof_at bigint not null,
106
+ recorded_at timestamptz not null default clock_timestamp(),
107
+ constraint portal_step_up_proofs_pkey primary key (agent_id, proof_at)
108
+ );
109
+
110
+ alter table agent_board.portal_step_up_proofs enable row level security;
111
+ revoke all on table agent_board.portal_step_up_proofs
112
+ from public, anon, authenticated, service_role, agent_board_delegate;
113
+
114
+ comment on table agent_board.portal_step_up_proofs is
115
+ '#669 D8: service-only ledger of Portal step-up proofs. One row per (agent, proof instant) that /portal-session verified in a Portal RS256 token and copied into an MB token. Written only by record_portal_step_up (service_role); RLS on with zero policies and no API-role privilege. A Portal-class human''s agent_board_step_up_at claim counts only with a matching row. Rows older than one day are pruned per agent on write.';
116
+
117
+ -- =============================================================================
118
+ -- 5. The class binding (§3.3). A `portal` human is kind='human' with a service-written
119
+ -- enrollment_federation_audit row in mode 'fedsession'. agents.metadata is NOT evidence
120
+ -- (caller metadata is merged into it). Shared by the helper and the ledger writer so the two
121
+ -- can never disagree about the class.
122
+ -- =============================================================================
123
+ create or replace function agent_board._step_up_is_portal_human(p_agent_id uuid)
124
+ returns boolean
125
+ language sql
126
+ stable
127
+ security invoker
128
+ set search_path = ''
129
+ as $$
130
+ select exists (
131
+ select 1
132
+ from agent_board.agents a
133
+ where a.id = p_agent_id
134
+ and a.kind = 'human'::agent_board.agent_kind
135
+ and exists (
136
+ select 1
137
+ from agent_board.enrollment_federation_audit f
138
+ where f.agent_id = a.id
139
+ and f.mode = 'fedsession'))
140
+ $$;
141
+
142
+ revoke all on function agent_board._step_up_is_portal_human(uuid)
143
+ from public, anon, authenticated, service_role, agent_board_delegate;
144
+ comment on function agent_board._step_up_is_portal_human(uuid) is
145
+ '#669 §3.3: true iff the agent is kind=human AND has a service-written enrollment_federation_audit row with mode=fedsession (a Portal-federated human). agents.metadata is never consulted. No API-role EXECUTE.';
146
+
147
+ -- =============================================================================
148
+ -- 6a. The writer's instant window (§9.1), as a pure predicate so its boundaries are pinned with
149
+ -- exact numerics (inclusive: [now - 330, now + 60]), as D9 does for the freshness window.
150
+ -- =============================================================================
151
+ create or replace function agent_board._step_up_proof_recordable(p_proof numeric, p_now numeric)
152
+ returns boolean
153
+ language sql
154
+ immutable
155
+ parallel safe
156
+ set search_path = ''
157
+ as $$
158
+ select coalesce(p_proof >= p_now - 330 and p_proof <= p_now + 60, false)
159
+ $$;
160
+
161
+ revoke all on function agent_board._step_up_proof_recordable(numeric, numeric)
162
+ from public, anon, authenticated, service_role, agent_board_delegate;
163
+ comment on function agent_board._step_up_proof_recordable(numeric, numeric) is
164
+ '#669 §9.1: true iff p_now - 330 <= p_proof <= p_now + 60 (inclusive); false, never NULL, otherwise. The ledger writer accepts a proof instant only inside this window. IMMUTABLE. No API-role EXECUTE.';
165
+
166
+ -- =============================================================================
167
+ -- 6. The ledger writer (D8, §9.1). service_role only; the only caller is /portal-session, which
168
+ -- passes the agent it provisioned from the subject of the Portal token it verified. Returns
169
+ -- false, never an error, when a bound fails.
170
+ -- =============================================================================
171
+ create or replace function agent_board.record_portal_step_up(p_agent_id uuid, p_proof_at bigint)
172
+ returns boolean
173
+ language plpgsql
174
+ security definer
175
+ set search_path = ''
176
+ as $$
177
+ declare
178
+ v_now numeric := extract(epoch from clock_timestamp());
179
+ begin
180
+ if p_agent_id is null or p_proof_at is null then
181
+ return false;
182
+ end if;
183
+
184
+ -- Re-validate the class: only a Portal-federated human can hold a Portal proof.
185
+ if agent_board._step_up_is_portal_human(p_agent_id) is not true then
186
+ return false;
187
+ end if;
188
+
189
+ -- The instant must be about the present: [clock - 330, clock + 60].
190
+ if agent_board._step_up_proof_recordable(p_proof_at::numeric, v_now) is not true then
191
+ return false;
192
+ end if;
193
+
194
+ insert into agent_board.portal_step_up_proofs(agent_id, proof_at)
195
+ values (p_agent_id, p_proof_at)
196
+ on conflict (agent_id, proof_at) do nothing;
197
+
198
+ -- Prune this agent's proofs older than one day. A fresh proof is at most 300 s old.
199
+ delete from agent_board.portal_step_up_proofs p
200
+ where p.agent_id = p_agent_id
201
+ and p.proof_at::numeric < v_now - 86400;
202
+
203
+ return true;
204
+ end;
205
+ $$;
206
+
207
+ revoke all on function agent_board.record_portal_step_up(uuid, bigint)
208
+ from public, anon, authenticated, service_role, agent_board_delegate;
209
+ grant execute on function agent_board.record_portal_step_up(uuid, bigint) to service_role;
210
+ comment on function agent_board.record_portal_step_up(uuid, bigint) is
211
+ '#669 D8: the only writer of portal_step_up_proofs. EXECUTE for service_role only; its only caller is /portal-session, which passes the agent it provisioned from a verified Portal token. Returns false (no error) unless the agent is a Portal-class human and p_proof_at lies in [clock - 330, clock + 60]; otherwise inserts (on conflict do nothing), prunes that agent''s rows older than one day, and returns true.';
212
+
213
+ -- =============================================================================
214
+ -- 7. The helper (D2, D3, D8, D10; §6.1). NOT CALLED BY ANY FUNCTION IN PR-A (EC-SU-0).
215
+ --
216
+ -- No actor parameter: its inputs are _is_service_role(), auth.uid(), current_agent_id() and
217
+ -- request.jwt.claims only. Exempt: (a) the operator key -- service_role with no principal and
218
+ -- no sub; (b) an agent or system principal. Every other caller must present a fresh proof of
219
+ -- its class, or gets MBS01:
220
+ -- portal human: top-level JSON-number agent_board_step_up_at T, fresh by
221
+ -- _step_up_is_fresh(T, clock), AND a ledger row (actor, T);
222
+ -- local human: top-level amr array; the max timestamp over object elements whose method
223
+ -- is an allowlisted string and whose timestamp is a JSON number, fresh.
224
+ -- Never consulted: aal, iat, auth_time, user_metadata, app_metadata, agents.metadata and the
225
+ -- legacy request.jwt.claim.* GUCs (for freshness). One guard per statement; the only raise
226
+ -- is MBS01, with the operation name (never a value) as DETAIL. Plain SELECTs, no row locks.
227
+ -- =============================================================================
228
+ create or replace function agent_board._require_human_step_up(p_operation text)
229
+ returns void
230
+ language plpgsql
231
+ volatile
232
+ security invoker
233
+ set search_path = ''
234
+ as $$
235
+ declare
236
+ v_raw text;
237
+ v_claims jsonb;
238
+ v_service boolean;
239
+ v_uid uuid;
240
+ v_actor uuid;
241
+ v_kind text;
242
+ v_now numeric;
243
+ v_t jsonb;
244
+ v_proof numeric;
245
+ v_amr jsonb;
246
+ v_methods text[];
247
+ v_e jsonb;
248
+ v_ts numeric;
249
+ v_best numeric;
250
+ begin
251
+ -- Claims: parsed in their own guarded block. Unparseable claims are no claims.
252
+ v_raw := current_setting('request.jwt.claims', true);
253
+ if v_raw is not null and v_raw <> '' then
254
+ begin
255
+ v_claims := v_raw::jsonb;
256
+ exception when others then
257
+ v_claims := null;
258
+ end;
259
+ end if;
260
+ if jsonb_typeof(v_claims) is distinct from 'object' then
261
+ v_claims := null;
262
+ end if;
263
+
264
+ -- The session. These readers cast the raw claims themselves; any failure is no proof.
265
+ begin
266
+ v_service := agent_board._is_service_role();
267
+ v_uid := auth.uid();
268
+ v_actor := agent_board.current_agent_id();
269
+ exception when others then
270
+ raise exception 'step_up_required' using errcode = 'MBS01', detail = p_operation;
271
+ end;
272
+
273
+ -- (a) The operator key: service_role, no principal, no sub (§5.4 tightening).
274
+ if v_service is true and v_actor is null and v_uid is null then
275
+ return;
276
+ end if;
277
+
278
+ if v_actor is null then
279
+ raise exception 'step_up_required' using errcode = 'MBS01', detail = p_operation;
280
+ end if;
281
+
282
+ select a.kind::text into v_kind
283
+ from agent_board.agents a
284
+ where a.id = v_actor;
285
+
286
+ -- (b) An agent or system principal.
287
+ if v_kind in ('agent', 'system') then
288
+ return;
289
+ end if;
290
+
291
+ if v_kind is distinct from 'human' then
292
+ raise exception 'step_up_required' using errcode = 'MBS01', detail = p_operation;
293
+ end if;
294
+
295
+ v_now := extract(epoch from clock_timestamp());
296
+
297
+ if agent_board._step_up_is_portal_human(v_actor) is true then
298
+ -- Portal class: claim AND ledger row (D8). Type check in its own statement.
299
+ v_t := v_claims -> 'agent_board_step_up_at';
300
+ if jsonb_typeof(v_t) is distinct from 'number' then
301
+ raise exception 'step_up_required' using errcode = 'MBS01', detail = p_operation;
302
+ end if;
303
+ v_proof := (v_claims ->> 'agent_board_step_up_at')::numeric;
304
+ if agent_board._step_up_is_fresh(v_proof, v_now) is not true then
305
+ raise exception 'step_up_required' using errcode = 'MBS01', detail = p_operation;
306
+ end if;
307
+ if not exists (
308
+ select 1
309
+ from agent_board.portal_step_up_proofs p
310
+ where p.agent_id = v_actor
311
+ and p.proof_at::numeric = v_proof
312
+ ) then
313
+ raise exception 'step_up_required' using errcode = 'MBS01', detail = p_operation;
314
+ end if;
315
+ return;
316
+ end if;
317
+
318
+ -- Local class: GoTrue top-level amr (D10), filtered by the allowlist (D11).
319
+ v_amr := v_claims -> 'amr';
320
+ if jsonb_typeof(v_amr) is distinct from 'array' then
321
+ raise exception 'step_up_required' using errcode = 'MBS01', detail = p_operation;
322
+ end if;
323
+ v_methods := agent_board._step_up_amr_methods();
324
+ for v_e in select e.value from jsonb_array_elements(v_amr) as e(value) loop
325
+ continue when jsonb_typeof(v_e) is distinct from 'object';
326
+ continue when jsonb_typeof(v_e -> 'method') is distinct from 'string';
327
+ continue when ((v_e ->> 'method') = any (v_methods)) is not true;
328
+ continue when jsonb_typeof(v_e -> 'timestamp') is distinct from 'number';
329
+ v_ts := (v_e ->> 'timestamp')::numeric;
330
+ if v_best is null or v_ts > v_best then
331
+ v_best := v_ts;
332
+ end if;
333
+ end loop;
334
+ if agent_board._step_up_is_fresh(v_best, v_now) is not true then
335
+ raise exception 'step_up_required' using errcode = 'MBS01', detail = p_operation;
336
+ end if;
337
+ end;
338
+ $$;
339
+
340
+ revoke all on function agent_board._require_human_step_up(text)
341
+ from public, anon, authenticated, service_role, agent_board_delegate;
342
+ comment on function agent_board._require_human_step_up(text) is
343
+ '#669 D2/D3: raises MBS01 step_up_required (DETAIL = the operation name) unless the session is the operator key (service_role, no principal, no sub), an agent/system principal, or a human with a fresh proof of its class: Portal humans need a fresh top-level agent_board_step_up_at AND a matching portal_step_up_proofs row; local humans need a fresh allowlisted top-level amr entry. No actor parameter. Not called by any function until PR-B. No API-role EXECUTE.';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@consiliency/agent-board-schema",
3
- "version": "1.74.0",
3
+ "version": "1.76.0",
4
4
  "description": "Canonical, immutable, exact-pinnable agent_board schema bundle: ordered SQL migrations, digest + compatibility manifest, and deterministic materialize/plan/check tooling for adopters.",
5
5
  "repository": "https://github.com/Consiliency/message-board.git",
6
6
  "type": "module",
@@ -2,7 +2,7 @@
2
2
  "schema": "agent_board_schema_manifest.v1",
3
3
  "interface": "IF-0-MBPLANE-BUNDLE-1",
4
4
  "package": "@consiliency/agent-board-schema",
5
- "packageVersion": "1.74.0",
5
+ "packageVersion": "1.76.0",
6
6
  "schemaVersion": 8,
7
7
  "minClientVersion": "1.1.0",
8
8
  "source": {
@@ -46,8 +46,8 @@
46
46
  "usage": "upsert (retention/monitoring defaults; on conflict do nothing)"
47
47
  }
48
48
  ],
49
- "migrationCount": 172,
50
- "aggregateSha256": "1787dd0d972779bbdc1645b67460fc2f2c7b910f128414cf39b6dfb2b00b3b42",
49
+ "migrationCount": 174,
50
+ "aggregateSha256": "ede0ebd43adaf97e8f0fb5669eb25eb2153b7d045b39b5d2c9036099903dc56a",
51
51
  "migrations": [
52
52
  {
53
53
  "order": 0,
@@ -1596,6 +1596,24 @@
1596
1596
  "sourceRef": "message-board",
1597
1597
  "bytes": 15050,
1598
1598
  "sha256": "dbfd60300e8ce8ed78df8ae851f3990f58bcb43a7f9d53c2e25499a22e775a67"
1599
+ },
1600
+ {
1601
+ "order": 172,
1602
+ "id": "20261108000100_agent_board_send_outcome",
1603
+ "filename": "20261108000100_agent_board_send_outcome.sql",
1604
+ "origin": "message-board-forward",
1605
+ "sourceRef": "message-board",
1606
+ "bytes": 31049,
1607
+ "sha256": "f3e14b1bf7e8aa9f4a89a8ae0723dd63f21383477d321070d0736ff1e6912e8a"
1608
+ },
1609
+ {
1610
+ "order": 173,
1611
+ "id": "20261109000100_agent_board_step_up_groundwork",
1612
+ "filename": "20261109000100_agent_board_step_up_groundwork.sql",
1613
+ "origin": "message-board-forward",
1614
+ "sourceRef": "message-board",
1615
+ "bytes": 16604,
1616
+ "sha256": "ce1a878aa752f2f7047958984019030ac7d4c2244c114113e52c8a2abc6dd9d9"
1599
1617
  }
1600
1618
  ],
1601
1619
  "excludedBridge": {
@@ -3,7 +3,7 @@ import { afterEach, describe, expect, it } from "vitest";
3
3
  import { spawnSync } from "node:child_process";
4
4
  import { chmodSync, copyFileSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
5
5
  import { tmpdir } from "node:os";
6
- import { join } from "node:path";
6
+ import { dirname, join, posix } from "node:path";
7
7
  import { fileURLToPath, pathToFileURL } from "node:url";
8
8
 
9
9
  const ROOT = fileURLToPath(new URL("../../../", import.meta.url));
@@ -16,9 +16,26 @@ function git(cwd, args, env = {}) {
16
16
  if (r.status !== 0) throw new Error(`fixture git failed: ${r.stderr}`);
17
17
  return r.stdout.trim();
18
18
  }
19
+ // The checker plus its RELATIVE-IMPORT CLOSURE, derived from the sources rather than listed: a
20
+ // hand list of two files broke the day the checker imported release-dist-tag.mjs (#796), and
21
+ // it would break silently-in-a-different-way the next time. Bare and node: imports are builtins
22
+ // here (the checker's job never installs).
23
+ function importClosure(entry) {
24
+ const seen = new Set();
25
+ const visit = (rel) => {
26
+ if (seen.has(rel)) return;
27
+ seen.add(rel);
28
+ const src = readFileSync(join(ROOT, "scripts", rel), "utf8");
29
+ for (const m of src.matchAll(/^\s*import\s[^;]*?from\s+"(\.{1,2}\/[^"]+)";/gms)) {
30
+ visit(posix.normalize(posix.join(posix.dirname(rel), m[1])));
31
+ }
32
+ };
33
+ visit(entry);
34
+ return [...seen];
35
+ }
19
36
  function installChecker(dir) {
20
- mkdirSync(join(dir, "scripts/lib"), { recursive: true });
21
- for (const file of ["check-deployment-drift.mjs", "lib/drift-evaluate.mjs"]) {
37
+ for (const file of importClosure("check-deployment-drift.mjs")) {
38
+ mkdirSync(dirname(join(dir, "scripts", file)), { recursive: true });
22
39
  copyFileSync(join(ROOT, "scripts", file), join(dir, "scripts", file));
23
40
  }
24
41
  }
@@ -76,11 +76,14 @@ beforeAll(() => {
76
76
 
77
77
  writeFileSync(
78
78
  join(SHIMS, "npm"),
79
- `#!/bin/sh\n${logArgv}\n[ -n "\${FAKE_NPM_VERSION:-}" ] || exit 1\nprintf "%s\\n" "$FAKE_NPM_VERSION"\n`,
79
+ // `npm view <pkg> dist-tags --json` and `npm view <pkg> time --json` (message-board#796)
80
+ // answer FAKE_NPM_DIST_TAGS / FAKE_NPM_TIME, or fail; every other call answers
81
+ // FAKE_NPM_VERSION as before.
82
+ `#!/bin/sh\n${logArgv}\ncase " $* " in\n *" dist-tags "*) [ -n "\${FAKE_NPM_DIST_TAGS:-}" ] || exit 1; printf "%s\\n" "$FAKE_NPM_DIST_TAGS"; exit 0 ;;\n *" time "*) [ -n "\${FAKE_NPM_TIME:-}" ] || exit 1; printf "%s\\n" "$FAKE_NPM_TIME"; exit 0 ;;\nesac\n[ -n "\${FAKE_NPM_VERSION:-}" ] || exit 1\nprintf "%s\\n" "$FAKE_NPM_VERSION"\n`,
80
83
  );
81
84
  writeFileSync(
82
85
  join(SHIMS, "git"),
83
- `#!/bin/sh\n${logArgv}\ncase " $* " in\n *" --is-shallow-repository "*) printf "%s\n" "\${FAKE_SHALLOW:-false}" ;;\n *" cat-file "*) exit 0 ;;\n *" show "*"/package.json "*) cat "$DRIFT_SHIMS/package.json" ;;\n *" show "*"/schema-manifest.json "*) cat "$DRIFT_SHIMS/manifest.json" ;;\n *" log "*) [ -n "\${FAKE_BUMP_ISO:-}" ] || exit 1; printf "%s\n" "$FAKE_BUMP_ISO" ;;\n *) exit 1 ;;\nesac\n`,
86
+ `#!/bin/sh\n${logArgv}\ncase " $* " in\n *" --is-shallow-repository "*) printf "%s\n" "\${FAKE_SHALLOW:-false}" ;;\n *" cat-file "*) exit 0 ;;\n *" show "*"/package.json "*) cat "$DRIFT_SHIMS/package.json" ;;\n *" show "*"/schema-manifest.json "*) cat "$DRIFT_SHIMS/manifest.json" ;;\n *" show "*":release-dist-tags.json "*) [ -n "\${FAKE_RELEASE_DIST_TAGS:-}" ] || exit 1; printf "%s\n" "$FAKE_RELEASE_DIST_TAGS" ;;\n *" show "*":CHANGELOG.md "*) [ -n "\${FAKE_CHANGELOG:-}" ] || exit 1; printf "%s\n" "$FAKE_CHANGELOG" ;;\n *" log "*) [ -n "\${FAKE_BUMP_ISO:-}" ] || exit 1; printf "%s\n" "$FAKE_BUMP_ISO" ;;\n *) exit 1 ;;\nesac\n`,
84
87
  );
85
88
  chmodSync(join(SHIMS, "npm"), 0o755);
86
89
  chmodSync(join(SHIMS, "git"), 0o755);
@@ -435,3 +438,75 @@ describe("the script under test is the one that ships", () => {
435
438
  );
436
439
  });
437
440
  });
441
+
442
+ // message-board#796, end to end through the shipped script: main's committed
443
+ // release-dist-tags.json and CHANGELOG.md (served by the git shim at the authoritative commit)
444
+ // declare the channel and pass the canonical validator, the registry (npm shim) names merged on
445
+ // it and says when it got there, and the stale gap that `latest` alone reports stops being DRIFT
446
+ // — for --max-days. Every other combination keeps the strict answer.
447
+ describe("dist-tag-aware published leg, through the script (#796)", () => {
448
+ const DAY = 86_400_000;
449
+ const STALE_BUMP = new Date(Date.now() - 15 * DAY).toISOString();
450
+ const DECLARES_NEXT = JSON.stringify({ releases: { "v9.9.9": { distTag: "next", reason: "held back on a canary for this fixture" } } });
451
+ const CHANGELOG_NEXT = "# Changelog\n\n## v9.9.9 — fixture\n\nnpm dist-tag: `next`\n";
452
+ const timeOnRegistry = (msAgo) => JSON.stringify({ created: "2020-01-01T00:00:00.000Z", [MERGED]: new Date(Date.now() - msAgo).toISOString() });
453
+ const held = (env = {}) =>
454
+ runScript([], {
455
+ FAKE_NPM_VERSION: minorsBelow(MERGED, 1),
456
+ FAKE_BUMP_ISO: STALE_BUMP,
457
+ FAKE_RELEASE_DIST_TAGS: DECLARES_NEXT,
458
+ FAKE_CHANGELOG: CHANGELOG_NEXT,
459
+ FAKE_NPM_DIST_TAGS: JSON.stringify({ latest: minorsBelow(MERGED, 1), next: MERGED }),
460
+ FAKE_NPM_TIME: timeOnRegistry(2 * DAY),
461
+ ...env,
462
+ });
463
+
464
+ it("#796-ok: exits 0 when merged has been on a declared channel for 2 days, though latest is behind and the bump stale", () => {
465
+ writeFileSync(ARGV_LOG, ""); // this case's calls only
466
+ const r = held();
467
+ expect(r.status).toBe(0);
468
+ expect(r.out).toMatch(/published under the declared dist-tag `next`/);
469
+ // The dist-tags and publish times were read for the package, and only because a channel was declared.
470
+ const log = readFileSync(ARGV_LOG, "utf8");
471
+ expect(log).toMatch(/\nview\n@consiliency\/agent-board-schema\ndist-tags\n--json\n/);
472
+ expect(log).toMatch(/\nview\n@consiliency\/agent-board-schema\ntime\n--json\n/);
473
+ });
474
+
475
+ it("#796-bound: exits 1 when merged has sat on the channel for 15 days without reaching latest", () => {
476
+ const r = held({ FAKE_NPM_TIME: timeOnRegistry(15 * DAY) });
477
+ expect(r.status).toBe(1);
478
+ expect(r.out).toMatch(/held on the declared dist-tag `next` for 15d/);
479
+ });
480
+
481
+ it("#796-strict: exits 1 when the channel version's publish time cannot be read", () => {
482
+ expect(held({ FAKE_NPM_TIME: "" }).status).toBe(1);
483
+ });
484
+
485
+ it("#796-strict: exits 1 when main's release-dist-tags.json declares no channel", () => {
486
+ expect(held({ FAKE_RELEASE_DIST_TAGS: JSON.stringify({ releases: {} }) }).status).toBe(1);
487
+ });
488
+
489
+ it("#796-strict: exits 1 when the file cannot be read at main", () => {
490
+ expect(held({ FAKE_RELEASE_DIST_TAGS: "" }).status).toBe(1);
491
+ });
492
+
493
+ it("#796-validate: exits 1 when main's release-dist-tags.json is malformed (an entry with no reason)", () => {
494
+ expect(held({ FAKE_RELEASE_DIST_TAGS: JSON.stringify({ releases: { "v9.9.9": { distTag: "next" } } }) }).status).toBe(1);
495
+ });
496
+
497
+ it("#796-validate: exits 1 when the entry's CHANGELOG section lacks its `npm dist-tag:` line", () => {
498
+ expect(held({ FAKE_CHANGELOG: "# Changelog\n\n## v9.9.9 — fixture\n\nno declaration here\n" }).status).toBe(1);
499
+ });
500
+
501
+ it("#796-strict: exits 1 when the declared channel names a different version", () => {
502
+ expect(held({ FAKE_NPM_DIST_TAGS: JSON.stringify({ latest: minorsBelow(MERGED, 1), next: minorsBelow(MERGED, 2) }) }).status).toBe(1);
503
+ });
504
+
505
+ it("#796-strict: exits 1 when the registry's dist-tags cannot be read", () => {
506
+ expect(held({ FAKE_NPM_DIST_TAGS: "" }).status).toBe(1);
507
+ });
508
+
509
+ it("#796-strict: exits 1 when merged sits on an UNDECLARED tag", () => {
510
+ expect(held({ FAKE_NPM_DIST_TAGS: JSON.stringify({ latest: minorsBelow(MERGED, 1), beta: MERGED }) }).status).toBe(1);
511
+ });
512
+ });
@@ -299,3 +299,63 @@ describe("branches a mutation must not survive", () => {
299
299
  expect(r.findings.some((f) => f.level === OK && /is 1 schema version\(s\) behind main/.test(f.msg))).toBe(true);
300
300
  });
301
301
  });
302
+
303
+ // message-board#796. A release held back on a dist-tag that main's release-dist-tags.json
304
+ // declares (v1.68.0 under `next`) has PUBLISHED main's schema version; `latest` alone said it
305
+ // had not, and the 7-day clock would have turned every PR red. The grace is BOUNDED: it lasts
306
+ // --max-days from the channel version's REGISTRY publish time, and the version-count limit still
307
+ // applies. A forgotten `next` must not keep this required check green forever (review seat, #798).
308
+ describe("dist-tag-aware published leg (#796)", () => {
309
+ const STALE = "2026-08-01T17:00:00Z"; // main's bump: 15 days before NOW, past --max-days
310
+ const daysAgo = (d) => new Date(NOW - d * 86_400_000).toISOString();
311
+ const onNext = (version, publishedIso) => ({ next: { version, publishedIso } });
312
+ const held = (over = {}) => base({ merged: "1.36.0", published: "1.35.0", bumpIso: STALE, ...over });
313
+
314
+ it("#796-ok: merged on a declared channel for 2 days is OK, though latest is behind and main's bump is stale", () => {
315
+ const r = run(held({ channels: onNext("1.36.0", daysAgo(2)) }));
316
+ expect(r.status).toBe(OK);
317
+ expect(r.findings.some((f) => f.level === OK && /published under the declared dist-tag `next` \(latest is 1\.35\.0\), 2d on the channel/.test(f.msg))).toBe(true);
318
+ });
319
+
320
+ it("#796-bound: merged held on the channel for 15 days (> --max-days) is DRIFT — a forgotten `next` does not stay green", () => {
321
+ const r = run(held({ channels: onNext("1.36.0", daysAgo(15)) }));
322
+ expect(r.status).toBe(DRIFT);
323
+ expect(r.findings.some((f) => f.level === DRIFT && /held on the declared dist-tag `next` for 15d \(> 7d\) without reaching latest/.test(f.msg))).toBe(true);
324
+ });
325
+
326
+ it("#796-bound: the expiry does not depend on main's bump date — a stale channel with a FRESH bump is still DRIFT", () => {
327
+ expect(run(held({ bumpIso: daysAgo(1), channels: onNext("1.36.0", daysAgo(15)) })).status).toBe(DRIFT);
328
+ });
329
+
330
+ it("#796-bound: the boundary is exactly --max-days (7d OK, 8d DRIFT)", () => {
331
+ expect(run(held({ channels: onNext("1.36.0", daysAgo(7)) })).status).toBe(OK);
332
+ expect(run(held({ channels: onNext("1.36.0", daysAgo(8)) })).status).toBe(DRIFT);
333
+ });
334
+
335
+ it("#796-count: the version-count limit still applies on a fresh channel", () => {
336
+ expect(run(held({ merged: "1.40.0", channels: onNext("1.40.0", daysAgo(1)) })).status).toBe(DRIFT);
337
+ });
338
+
339
+ it("#796-strict: an unknown channel publish time grants no grace", () => {
340
+ expect(run(held({ channels: onNext("1.36.0", null) })).status).toBe(DRIFT);
341
+ expect(run(held({ channels: onNext("1.36.0", "not-a-date") })).status).toBe(DRIFT);
342
+ });
343
+
344
+ it("#796-strict: a channel naming an OLDER version than merged is still DRIFT (main moved past the held release)", () => {
345
+ expect(run(held({ channels: onNext("1.35.5", daysAgo(1)) })).status).toBe(DRIFT);
346
+ });
347
+
348
+ it("#796-strict: no declared channel (none passed, or the registry unread) is still DRIFT", () => {
349
+ expect(run(held({ channels: {} })).status).toBe(DRIFT);
350
+ expect(run(held({ channels: null })).status).toBe(DRIFT);
351
+ });
352
+
353
+ it("#796-strict: `latest` passed as a channel is never a channel", () => {
354
+ expect(run(held({ channels: { latest: { version: "1.36.0", publishedIso: daysAgo(1) } } })).status).toBe(DRIFT);
355
+ });
356
+
357
+ it("#796-strict: an unreadable latest stays UNKNOWN, and a registry ahead stays DRIFT, whatever the channel says", () => {
358
+ expect(run(held({ published: null, channels: onNext("1.36.0", daysAgo(1)) })).status).toBe(UNKNOWN);
359
+ expect(run(held({ merged: "1.34.0", published: "1.35.0", channels: onNext("1.34.0", daysAgo(1)) })).status).toBe(DRIFT);
360
+ });
361
+ });
@@ -41,9 +41,9 @@ describe('manifest integrity', () => {
41
41
  expect(manifest.schemaVersion).toBe(8);
42
42
  expect(manifest.minClientVersion).toMatch(/^\d+\.\d+\.\d+$/);
43
43
  });
44
- it('registers the four MBAUTHZ + four MBSENDAUTHZ + four MBSESSION + four MBDELEG + three MBFED + three MBHARDEN + two MBPORTALGATE + two MBPORTAL-PR32 + two ROOMOWN + two ROOMLINK + one ROOMDELEG + one LOCALAUTH + one ROOMUIAPI + one FEDSESSION + one FEDSESSION-AUTOJOIN + one GATENULL + one MEMBSTATE + one AGENTSDIR + one LEAVEIDEM + one ROLERESET + one MBROWID + one MBHYGIENE + one MBCONSENT-A + one MBCONSENT-B(a) + one MBCONSENT-B(i) + one MBCONSENT-B(ii) + one MBCONSENT-B(iii) + one MBHARDEN-#97 + one MBHARDEN-#118 + one INVITEPOLICY + one OBSGATE + one OBSGATE-2 + one OBSGATE-3 + one OBSGATE-4 + one FLEETMACHINERLS + one RESOLVENOOP + one ROOMDELEG-LANEB + one CLAIMKEY + two MINTHARDEN + one FLEETMACHINEHIJACK + one CLAIMGATE-SHADOW + one CLAIMGATE-ENFORCE + one FLEETMACHINEREACTIVATION + one DELEGCAPCEILING + one FLEETMACHINERECLAIM + one DELEGSOLEWRITER + one FLEETDOMAINRECLAIM + five ATOMICFLEETONBOARDING (onboarding + ceiling-lock + revocation-evidence + fedsession-gate + fedsession-lock-order) + one OUTBOXWAKE + one ENROLLLOCKORDER + one FEDPROVIDERABSENCE + one WAKERECOVERY + one CONSENTRECONCILE + one ENROLLRESUMPTION + one SIGNEDAUTHORITY + one SIGNERLIFECYCLE + one LEDGERAUTHORITY + one CEILINGLOCKCOMMENT + one LEDGERBOARDCREATE + one RECEIPTSUBJECTGATE + one TASKTHREADLOCKORDER + one CLAIMSUBJECTGATE + one FEDSESSIONIDENTITYGATE + one FEDIDENTITYSLUG + one INVITENODOWNGRADE + one SIGNEDWRITEFLAG + one SIGNEDWRITEMODEL + one RTCREDCLAIM + one ORIGINPOSTURE + one BOARDCLAIMPOLICY + one HEARTBEATPRESERVE + one LIVENESSDENOM + one OWNERLESSRENEWTTL + one OWNERLESSQUOTACENSUS + one FLEETDOMAINNODOWNGRADE + one OWNERLESSQUOTACONVERGE + one ADVISORYREVERTRESET + one CLAIMPOLICYRACE + one CLAIMPOLICYLOCKGRANT + one SESSIONCHALLENGESUPERSEDE + one ROOMCONTRACT + one CALLBACKCONSUMER + one ENROLLTOKENSINGLEUSE + one ROOMCONTRACT-ACTIVEFIRST + one ONBOARD + one HOSTED + one HOSTED-FOLLOWUPS + one OWNPOST + one SIDSCHEMA + one SIDOWNER + one GRANTTARGETROLE (#674) + one LASTOWNER (Consiliency/message-board#675) + one SESSIONPROVENANCE (Consiliency/message-board#665) + one REQUESTREMOVED (Consiliency/message-board#680) + one RLSCORRELATION (Consiliency/message-board#589) + one RESOLUTIONAUTHORITY (Consiliency/message-board#668) + one THREADASSOCIATION checkpoint (#667) + one SIDSERVER-MEASUREDMINT (Consiliency/message-board#653) + one REPLYDELIVERY (#661) + one DELIVERYWRITEREXEC (#717 F1) + one REPLAYSCOPE (#717 F2) + one MESSAGEREPLAYSCOPE (#717 F2b) forward migrations (migrationCount = prior 113 + 5 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 172)', () => {
44
+ it('registers the four MBAUTHZ + four MBSENDAUTHZ + four MBSESSION + four MBDELEG + three MBFED + three MBHARDEN + two MBPORTALGATE + two MBPORTAL-PR32 + two ROOMOWN + two ROOMLINK + one ROOMDELEG + one LOCALAUTH + one ROOMUIAPI + one FEDSESSION + one FEDSESSION-AUTOJOIN + one GATENULL + one MEMBSTATE + one AGENTSDIR + one LEAVEIDEM + one ROLERESET + one MBROWID + one MBHYGIENE + one MBCONSENT-A + one MBCONSENT-B(a) + one MBCONSENT-B(i) + one MBCONSENT-B(ii) + one MBCONSENT-B(iii) + one MBHARDEN-#97 + one MBHARDEN-#118 + one INVITEPOLICY + one OBSGATE + one OBSGATE-2 + one OBSGATE-3 + one OBSGATE-4 + one FLEETMACHINERLS + one RESOLVENOOP + one ROOMDELEG-LANEB + one CLAIMKEY + two MINTHARDEN + one FLEETMACHINEHIJACK + one CLAIMGATE-SHADOW + one CLAIMGATE-ENFORCE + one FLEETMACHINEREACTIVATION + one DELEGCAPCEILING + one FLEETMACHINERECLAIM + one DELEGSOLEWRITER + one FLEETDOMAINRECLAIM + five ATOMICFLEETONBOARDING (onboarding + ceiling-lock + revocation-evidence + fedsession-gate + fedsession-lock-order) + one OUTBOXWAKE + one ENROLLLOCKORDER + one FEDPROVIDERABSENCE + one WAKERECOVERY + one CONSENTRECONCILE + one ENROLLRESUMPTION + one SIGNEDAUTHORITY + one SIGNERLIFECYCLE + one LEDGERAUTHORITY + one CEILINGLOCKCOMMENT + one LEDGERBOARDCREATE + one RECEIPTSUBJECTGATE + one TASKTHREADLOCKORDER + one CLAIMSUBJECTGATE + one FEDSESSIONIDENTITYGATE + one FEDIDENTITYSLUG + one INVITENODOWNGRADE + one SIGNEDWRITEFLAG + one SIGNEDWRITEMODEL + one RTCREDCLAIM + one ORIGINPOSTURE + one BOARDCLAIMPOLICY + one HEARTBEATPRESERVE + one LIVENESSDENOM + one OWNERLESSRENEWTTL + one OWNERLESSQUOTACENSUS + one FLEETDOMAINNODOWNGRADE + one OWNERLESSQUOTACONVERGE + one ADVISORYREVERTRESET + one CLAIMPOLICYRACE + one CLAIMPOLICYLOCKGRANT + one SESSIONCHALLENGESUPERSEDE + one ROOMCONTRACT + one CALLBACKCONSUMER + one ENROLLTOKENSINGLEUSE + one ROOMCONTRACT-ACTIVEFIRST + one ONBOARD + one HOSTED + one HOSTED-FOLLOWUPS + one OWNPOST + one SIDSCHEMA + one SIDOWNER + one GRANTTARGETROLE (#674) + one LASTOWNER (Consiliency/message-board#675) + one SESSIONPROVENANCE (Consiliency/message-board#665) + one REQUESTREMOVED (Consiliency/message-board#680) + one RLSCORRELATION (Consiliency/message-board#589) + one RESOLUTIONAUTHORITY (Consiliency/message-board#668) + one THREADASSOCIATION checkpoint (#667) + one SIDSERVER-MEASUREDMINT (Consiliency/message-board#653) + one REPLYDELIVERY (#661) + one DELIVERYWRITEREXEC (#717 F1) + one REPLAYSCOPE (#717 F2) + one MESSAGEREPLAYSCOPE (#717 F2b) + one SENDOUTCOME (#670) + one STEPUP-PR-A (#669) forward migrations (migrationCount = prior 113 + 5 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 174)', () => {
45
45
  expect(manifest.migrationCount).toBe(manifest.migrations.length);
46
- expect(manifest.migrationCount).toBe(172);
46
+ expect(manifest.migrationCount).toBe(174);
47
47
  // MBSESSION switched enforcement on (scoped-send re-grant): the client-visible
48
48
  // schema version bumped to 8. MBDELEG tightens delegation and MBFED adds only
49
49
  // enrollment-only additive surface (identity_providers registry, enrollment audit,
@@ -374,6 +374,8 @@ describe('manifest integrity', () => {
374
374
  '20261104170000_agent_board_tasking_replay_scope.sql',
375
375
  '20261104180000_agent_board_delivery_writer_execute.sql',
376
376
  '20261104190000_agent_board_message_replay_scope.sql',
377
+ '20261108000100_agent_board_send_outcome.sql',
378
+ '20261109000100_agent_board_step_up_groundwork.sql',
377
379
  ]) {
378
380
  expect(names.has(f)).toBe(true);
379
381
  }
@@ -115,6 +115,7 @@ insert into xb_onehop_reviewed values
115
115
  ('agent_board.inbox_items'::regclass,'agent_board.messages'::regclass,'inbox_items_source_message_id_fkey'),
116
116
  ('agent_board.inbox_items'::regclass,'agent_board.tasks'::regclass,'inbox_items_source_task_id_fkey'),
117
117
  ('agent_board.messages'::regclass,'agent_board.tasks'::regclass,'messages_task_id_fkey'),
118
+ ('agent_board.send_outcomes'::regclass,'agent_board.messages'::regclass,'send_outcomes_message_id_fkey'),
118
119
  ('agent_board.signature_evidence'::regclass,'agent_board.artifacts'::regclass,'signature_evidence_source_artifact_id_fkey'),
119
120
  ('agent_board.signature_evidence'::regclass,'agent_board.messages'::regclass,'signature_evidence_source_message_id_fkey'),
120
121
  ('agent_board.signature_evidence'::regclass,'agent_board.task_events'::regclass,'signature_evidence_source_task_event_id_fkey'),
@@ -532,6 +533,7 @@ create temp table xb_onehop_insert_reviewed(fn oid,relid oid,anchors text[],prim
532
533
  insert into xb_onehop_insert_reviewed values
533
534
  ('agent_board._queue_board_post_callbacks(uuid,uuid,text,text,text,jsonb)'::regprocedure,'agent_board.callback_outbox_events'::regclass,array['source_message_id']),
534
535
  ('agent_board._queue_inbox_callbacks(uuid,text)'::regprocedure,'agent_board.callback_outbox_events'::regclass,array['source_message_id','source_task_id']),
536
+ ('agent_board._record_send_outcome(text,uuid,text,uuid)'::regprocedure,'agent_board.send_outcomes'::regclass,array['message_id']),
535
537
  ('agent_board._record_signed_write_evidence(text,uuid,text,jsonb,jsonb)'::regprocedure,'agent_board.signature_evidence'::regclass,array['source_message_id','source_task_event_id']),
536
538
  ('agent_board._upsert_delivery_recipient(text,uuid,text,uuid,uuid,uuid,uuid,uuid,jsonb)'::regprocedure,'agent_board.delivery_recipients'::regclass,array['source_message_id','source_task_id']),
537
539
  ('agent_board._upsert_inbox_item(uuid,uuid,uuid,text,text,uuid,uuid,uuid,text,text,text,boolean,boolean,jsonb,jsonb)'::regprocedure,'agent_board.inbox_items'::regclass,array['source_message_id','source_task_id']),