@consiliency/agent-board-schema 1.35.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.
- package/fixtures/already-applied.json +12 -0
- package/migrations/20260917000100_agent_board_invite_no_downgrade.sql +398 -0
- package/migrations/20260918000100_agent_board_signed_write_enforced_repoint.sql +139 -0
- package/migrations/20260919000100_agent_board_signed_write_model_key.sql +107 -0
- package/package.json +1 -1
- package/schema-manifest.json +30 -3
- package/src/deployment-drift-script.test.mjs +424 -0
- package/src/deployment-drift.test.mjs +301 -0
- package/src/tooling.test.mjs +38 -2
- package/tests/agent_board_bundle_endpoint_compat.test.sql +73 -18
- package/tests/agent_board_consent_substrate.test.sql +8 -1
- package/tests/agent_board_invite_no_downgrade.test.sql +689 -0
- package/tests/agent_board_signed_write_enforced.test.sql +366 -0
- package/tests/agent_board_source_strip_helper.test.sql +100 -1
- package/tests/agent_board_write_enforcement_class.test.sql +1016 -0
- package/tests/fixtures/isolation-substrate.sql +1 -1
- package/tests/fixtures/test-prereqs.sql +22 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
-- Minimal Supabase substrate for the two-session ISOLATION harness only.
|
|
2
2
|
--
|
|
3
3
|
-- The pgTAP runner applies the agent_board bundle onto the DB that `supabase
|
|
4
|
-
-- start` provisions (
|
|
4
|
+
-- start` provisions (24322/postgres), which already carries GoTrue's `auth`
|
|
5
5
|
-- schema, the `extensions` schema, pgcrypto, and the base roles. The isolation
|
|
6
6
|
-- harness instead builds a THROWAWAY template database (specs COMMIT across
|
|
7
7
|
-- sessions and cannot share the live DB), so it must self-provision the same
|
|
@@ -470,6 +470,7 @@ declare
|
|
|
470
470
|
v_def text;
|
|
471
471
|
v_src text;
|
|
472
472
|
v_at int;
|
|
473
|
+
v_hits int;
|
|
473
474
|
begin
|
|
474
475
|
select pg_get_functiondef(p.oid),
|
|
475
476
|
coalesce(nullif(p.prosrc, ''), pg_catalog.pg_get_function_sqlbody(p.oid))
|
|
@@ -488,6 +489,27 @@ begin
|
|
|
488
489
|
raise exception
|
|
489
490
|
'agent_board_test.stripped_def: body not found verbatim inside pg_get_functiondef for oid % -- refusing to guess', p_fn;
|
|
490
491
|
end if;
|
|
492
|
+
-- AMBIGUITY (message-board#304). `position()` returns the FIRST match, and
|
|
493
|
+
-- pg_get_functiondef emits AUTHOR-CONTROLLED text -- the function name, every
|
|
494
|
+
-- argument name, the SET clauses -- BEFORE the body. When a short body also
|
|
495
|
+
-- occurs in that header, the splice lands on the HEADER occurrence: the header
|
|
496
|
+
-- is corrupted and the real body is returned UNSTRIPPED, so a positive or
|
|
497
|
+
-- negative assertion over the result reads text that was never stripped. Not
|
|
498
|
+
-- hypothetical: a `mint_harden` assertion was already defeated once by an
|
|
499
|
+
-- argument named `p_raw_key_fingerprint` (the #196 lint's rule 3), so header
|
|
500
|
+
-- text is a live surface. The BEGIN ATOMIC arm above makes this MORE likely,
|
|
501
|
+
-- not less: a deparsed body is short and normalized (`RETURN (p + 1)`).
|
|
502
|
+
--
|
|
503
|
+
-- Anchoring on the last occurrence instead would still be a GUESS about which
|
|
504
|
+
-- match is the body. The `v_at = 0` arm already refuses to guess when the body
|
|
505
|
+
-- is not found; ambiguity gets the same answer, matching strip_sql's
|
|
506
|
+
-- fail-closed behaviour on an unterminated construct. `replace` counts
|
|
507
|
+
-- non-overlapping occurrences, which is the count that matters for a splice.
|
|
508
|
+
v_hits := (length(v_def) - length(replace(v_def, v_src, ''))) / length(v_src);
|
|
509
|
+
if v_hits > 1 then
|
|
510
|
+
raise exception
|
|
511
|
+
'agent_board_test.stripped_def: body occurs % times inside pg_get_functiondef for oid % — ambiguous splice, refusing to guess which occurrence is the body (a match in the author-controlled header would corrupt it and return the body unstripped)', v_hits, p_fn;
|
|
512
|
+
end if;
|
|
491
513
|
return substr(v_def, 1, v_at - 1)
|
|
492
514
|
|| agent_board_test.strip_sql(v_src, p_keep_literals)
|
|
493
515
|
|| substr(v_def, v_at + length(v_src));
|