@consiliency/agent-board-schema 1.75.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 (52) hide show
  1. package/fixtures/already-applied.json +4 -0
  2. package/migrations/20261109000100_agent_board_step_up_groundwork.sql +343 -0
  3. package/package.json +1 -1
  4. package/schema-manifest.json +12 -3
  5. package/src/tooling.test.mjs +3 -2
  6. package/tests/agent_board_enrollment_audit_content.test.sql +6 -1
  7. package/tests/agent_board_step_up_helper.test.sql +711 -0
  8. package/tests/agent_board_write_enforcement_class.test.sql +5 -2
  9. package/tests/catalog/function_execute_privileges.json +72 -0
  10. package/tests/catalog/p_metadata_parameters.json +32 -0
  11. package/tests/mutations/669/M10_service_role_blanket.sql +10 -0
  12. package/tests/mutations/669/M12a_no_parse_wrapper.sql +17 -0
  13. package/tests/mutations/669/M12b_no_session_wrapper.sql +23 -0
  14. package/tests/mutations/669/M12c_no_claim_type_guard.sql +13 -0
  15. package/tests/mutations/669/M12d_no_amr_element_guards.sql +15 -0
  16. package/tests/mutations/669/M14_now_not_clock.sql +9 -0
  17. package/tests/mutations/669/M15_classifier_reads_metadata.sql +17 -0
  18. package/tests/mutations/669/M17_skip_ledger.sql +15 -0
  19. package/tests/mutations/669/M18_service_role_sub_insensitive.sql +9 -0
  20. package/tests/mutations/669/M18b_drop_uid_conjunct.sql +9 -0
  21. package/tests/mutations/669/M23_definer_wrapper_over_writer.sql +5 -0
  22. package/tests/mutations/669/M3_age_from_iat.sql +9 -0
  23. package/tests/mutations/669/M4_window_900.sql +9 -0
  24. package/tests/mutations/669/M4b_lt_to_le.sql +9 -0
  25. package/tests/mutations/669/M5_no_skew_bound.sql +9 -0
  26. package/tests/mutations/669/M6a_user_metadata_amr.sql +9 -0
  27. package/tests/mutations/669/M6b_app_metadata_claim.sql +9 -0
  28. package/tests/mutations/669/M6c_legacy_guc.sql +9 -0
  29. package/tests/mutations/669/M7_either_claim_any_human.sql +9 -0
  30. package/tests/mutations/669/M8_any_amr_method.sql +9 -0
  31. package/tests/mutations/669/M8b_accept_aal2.sql +9 -0
  32. package/tests/mutations/669/M9_every_kind.sql +9 -0
  33. package/tests/mutations/669/MAL_allowlist_nonempty.sql +9 -0
  34. package/tests/mutations/669/MAR_writer_arg_renamed.sql +14 -0
  35. package/tests/mutations/669/MAU_audit_mode_retyped.sql +2 -0
  36. package/tests/mutations/669/MA_helper_always_raises.sql +10 -0
  37. package/tests/mutations/669/MDX_dynamic_execute_definer.sql +5 -0
  38. package/tests/mutations/669/MD_detail_carries_value.sql +12 -0
  39. package/tests/mutations/669/MEC0_caller_of_helper.sql +4 -0
  40. package/tests/mutations/669/MEC0b_overload_caller.sql +4 -0
  41. package/tests/mutations/669/MG1_helper_granted_authenticated.sql +2 -0
  42. package/tests/mutations/669/MG2_ledger_insert_authenticated.sql +2 -0
  43. package/tests/mutations/669/MG3_ledger_policy.sql +2 -0
  44. package/tests/mutations/669/MR1_writer_no_class_check.sql +9 -0
  45. package/tests/mutations/669/MR2_writer_wide_window.sql +9 -0
  46. package/tests/mutations/669/MR3_writer_prunes_everyone.sql +11 -0
  47. package/tests/mutations/669/MR4_writer_lower_exclusive.sql +9 -0
  48. package/tests/mutations/669/MR5_writer_upper_exclusive.sql +9 -0
  49. package/tests/mutations/669/MR6_writer_upper_61.sql +9 -0
  50. package/tests/mutations/669/MW2_second_ledger_writer.sql +4 -0
  51. package/tests/mutations/669/MXS_cross_schema_wrapper.sql +4 -0
  52. package/tests/mutations/669/run.sh +72 -0
@@ -692,6 +692,10 @@
692
692
  {
693
693
  "id": "20261108000100_agent_board_send_outcome",
694
694
  "sha256": "f3e14b1bf7e8aa9f4a89a8ae0723dd63f21383477d321070d0736ff1e6912e8a"
695
+ },
696
+ {
697
+ "id": "20261109000100_agent_board_step_up_groundwork",
698
+ "sha256": "ce1a878aa752f2f7047958984019030ac7d4c2244c114113e52c8a2abc6dd9d9"
695
699
  }
696
700
  ]
697
701
  }
@@ -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.75.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.75.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": 173,
50
- "aggregateSha256": "2662d0eb9f18cf195aa15014cdff9084faf6b5a3eb244a48548e4196a441b2e7",
49
+ "migrationCount": 174,
50
+ "aggregateSha256": "ede0ebd43adaf97e8f0fb5669eb25eb2153b7d045b39b5d2c9036099903dc56a",
51
51
  "migrations": [
52
52
  {
53
53
  "order": 0,
@@ -1605,6 +1605,15 @@
1605
1605
  "sourceRef": "message-board",
1606
1606
  "bytes": 31049,
1607
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"
1608
1617
  }
1609
1618
  ],
1610
1619
  "excludedBridge": {
@@ -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) + one SENDOUTCOME (#670) 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 = 173)', () => {
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(173);
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,
@@ -375,6 +375,7 @@ describe('manifest integrity', () => {
375
375
  '20261104180000_agent_board_delivery_writer_execute.sql',
376
376
  '20261104190000_agent_board_message_replay_scope.sql',
377
377
  '20261108000100_agent_board_send_outcome.sql',
378
+ '20261109000100_agent_board_step_up_groundwork.sql',
378
379
  ]) {
379
380
  expect(names.has(f)).toBe(true);
380
381
  }
@@ -83,7 +83,12 @@ select is(
83
83
  and p.proname not in (
84
84
  'enroll_federated_identity', 'enroll_federated_human',
85
85
  '_enroll_federated_identity_once', '_enroll_federated_human_after_revocation_gate',
86
- 'revoke_human_subtree'
86
+ 'revoke_human_subtree',
87
+ -- #669 §3.3: the step-up class binding reads the fedsession audit row as service-written
88
+ -- evidence that a human is Portal-federated (existence of mode='fedsession' only). Its
89
+ -- positive claim -- it reads, never writes, the audit, and is the only step-up function
90
+ -- that references it -- is asserted in agent_board_step_up_helper.test.sql (EC-SU-4g).
91
+ '_step_up_is_portal_human'
87
92
  )
88
93
  ) d
89
94
  where d.def ~ agent_board_test.qname_re('enrollment_federation_audit')),