@consiliency/agent-board-schema 1.68.0 → 1.75.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 +32 -4
- package/migrations/20261026000100_agent_board_thread_association.sql +1287 -0
- package/migrations/20261101000100_agent_board_session_measured_mint.sql +145 -0
- package/migrations/20261104065658_agent_board_reply_delivery.sql +659 -0
- package/migrations/20261104170000_agent_board_tasking_replay_scope.sql +320 -0
- package/migrations/20261104180000_agent_board_delivery_writer_execute.sql +51 -0
- package/migrations/20261104190000_agent_board_message_replay_scope.sql +373 -0
- package/migrations/20261108000100_agent_board_send_outcome.sql +708 -0
- package/package.json +1 -1
- package/schema-manifest.json +66 -3
- package/src/deployment-drift-main.test.mjs +20 -3
- package/src/deployment-drift-script.test.mjs +77 -2
- package/src/deployment-drift.test.mjs +60 -0
- package/src/tooling.test.mjs +9 -2
- package/tests/agent_board_661_reply_delivery.test.sql +185 -0
- package/tests/agent_board_667_boundary.test.sql +162 -0
- package/tests/agent_board_667_conversion_branches.test.sql +91 -0
- package/tests/agent_board_667_conversion_profile.test.sql +112 -0
- package/tests/agent_board_667_history_class.test.sql +787 -0
- package/tests/agent_board_667_native_cast_effect.test.sql +88 -0
- package/tests/agent_board_667_realtime_apply_behavior.test.sql +117 -0
- package/tests/agent_board_667_realtime_apply_controls.test.sql +143 -0
- package/tests/agent_board_667_realtime_apply_profile.test.sql +61 -0
- package/tests/agent_board_667_retention.test.sql +201 -0
- package/tests/agent_board_667_routing.test.sql +294 -0
- package/tests/agent_board_667_sender_effects.test.sql +100 -0
- package/tests/agent_board_667_sender_profile_controls.test.sql +29 -0
- package/tests/agent_board_667_storage_delimiter_behavior.test.sql +84 -0
- package/tests/agent_board_667_storage_delimiter_controls.test.sql +23 -0
- package/tests/agent_board_667_storage_delimiter_profile.test.sql +61 -0
- package/tests/agent_board_667_storage_search_behavior.test.sql +93 -0
- package/tests/agent_board_667_storage_search_controls.test.sql +22 -0
- package/tests/agent_board_667_storage_search_profile.test.sql +60 -0
- package/tests/agent_board_667_storage_timestamp_behavior.test.sql +58 -0
- package/tests/agent_board_667_storage_timestamp_controls.test.sql +22 -0
- package/tests/agent_board_667_storage_timestamp_profile.test.sql +54 -0
- package/tests/agent_board_667_writers.test.sql +281 -0
- package/tests/agent_board_717_message_replay_scope.test.sql +828 -0
- package/tests/agent_board_717_native_surface.test.sql +223 -0
- package/tests/agent_board_717_tasking_replay_scope.test.sql +661 -0
- package/tests/agent_board_addressing.test.sql +8 -5
- package/tests/agent_board_claim_subject_gate.test.sql +7 -3
- package/tests/agent_board_claimpolicy_race.test.sql +39 -11
- package/tests/agent_board_delegate_role_class.test.sql +35 -17
- package/tests/agent_board_delivery_writer_execute.test.sql +373 -0
- package/tests/agent_board_fk_lock_edges.test.sql +3 -0
- package/tests/agent_board_hosted_delegates.test.sql +13 -3
- package/tests/agent_board_inbox_rpcs.test.sql +5 -3
- package/tests/agent_board_obsgate.test.sql +8 -4
- package/tests/agent_board_obsgate4.test.sql +2 -2
- package/tests/agent_board_outbox_wake_ordering.test.sql +25 -2
- package/tests/agent_board_own_post_not_delivered.test.sql +11 -9
- package/tests/agent_board_send_outcome.test.sql +805 -0
- package/tests/agent_board_session_identity_behavior_classes.test.sql +2 -2
- package/tests/agent_board_session_identity_limits.test.sql +1 -1
- package/tests/agent_board_session_identity_measured_mint.test.sql +342 -0
- package/tests/agent_board_session_identity_predicate_isolation.test.sql +146 -0
- package/tests/agent_board_sidserver_authority.test.sql +69 -0
- package/tests/agent_board_sidserver_catalog.test.sql +47 -0
- package/tests/agent_board_signed_write_gateway.test.sql +4 -2
- package/tests/agent_board_task_thread_lock_order.test.sql +67 -42
- package/tests/agent_board_v2_invariants.test.sql +5 -2
- package/tests/agent_board_write_enforcement_class.test.sql +12 -8
- package/tests/catalog/function_execute_privileges.json +65 -5
- package/tests/catalog/p_metadata_parameters.json +24 -0
- package/tests/fixtures/agent_board_667_apply_rls_guard.sql +195 -0
- package/tests/fixtures/agent_board_667_apply_rls_provenance.md +125 -0
- package/tests/fixtures/agent_board_667_apply_rls_reference.sql +1903 -0
- package/tests/fixtures/agent_board_667_conversion_guard.sql +162 -0
- package/tests/fixtures/agent_board_667_conversion_reference.md +23 -0
- package/tests/fixtures/agent_board_667_conversion_reference.sql +5325 -0
- package/tests/fixtures/agent_board_667_delimiter_guard.sql +92 -0
- package/tests/fixtures/agent_board_667_delimiter_provenance.md +116 -0
- package/tests/fixtures/agent_board_667_delimiter_reference.sql +10150 -0
- package/tests/fixtures/agent_board_667_search_guard.sql +92 -0
- package/tests/fixtures/agent_board_667_search_provenance.md +141 -0
- package/tests/fixtures/agent_board_667_search_reference.sql +4779 -0
- package/tests/fixtures/agent_board_667_sender_guard.sql +102 -0
- package/tests/fixtures/agent_board_667_sender_reference.md +20 -0
- package/tests/fixtures/agent_board_667_sender_reference.sql +875 -0
- package/tests/fixtures/agent_board_667_timestamp_graph.sql +84 -0
- package/tests/fixtures/agent_board_667_timestamp_guard.sql +94 -0
- package/tests/fixtures/agent_board_667_timestamp_provenance.md +99 -0
- package/tests/fixtures/agent_board_667_timestamp_reference.sql +2938 -0
- package/tests/fixtures/isolation-substrate.sql +8 -0
- package/tests/fixtures/pgtap-unexposed.sql +61 -0
- package/tests/isolation/expected/association_artifact_anchor_order.out +108 -0
- package/tests/isolation/expected/association_board_vs_board.out +71 -0
- package/tests/isolation/expected/association_post_wait_authority.out +77 -0
- package/tests/isolation/expected/association_strong_history_writers.out +203 -0
- package/tests/isolation/expected/association_strong_isolation.out +185 -0
- package/tests/isolation/expected/association_vs_artifact_claim_escalation.out +199 -0
- package/tests/isolation/expected/association_vs_heartbeat.out +78 -0
- package/tests/isolation/expected/association_vs_multi_anchor_artifact.out +67 -0
- package/tests/isolation/expected/association_vs_private_message.out +67 -0
- package/tests/isolation/expected/association_vs_task_and_conflict.out +133 -0
- package/tests/isolation/expected/association_vs_taskful_cross_thread.out +133 -0
- package/tests/isolation/expected/message_replay_scope.out +209 -0
- package/tests/isolation/expected/send_outcome_cross_board.out +40 -0
- package/tests/isolation/expected/send_outcome_independence.out +295 -0
- package/tests/isolation/expected/send_outcome_membership.out +140 -0
- package/tests/isolation/expected/send_outcome_overlap.out +89 -0
- package/tests/isolation/expected/send_outcome_reader.out +87 -0
- package/tests/isolation/expected/send_outcome_recovery.out +107 -0
- package/tests/isolation/expected/tasking_replay_scope.out +125 -0
- package/tests/isolation/specs/association_artifact_anchor_order.spec +46 -0
- package/tests/isolation/specs/association_board_vs_board.spec +37 -0
- package/tests/isolation/specs/association_post_wait_authority.spec +48 -0
- package/tests/isolation/specs/association_strong_history_writers.spec +61 -0
- package/tests/isolation/specs/association_strong_isolation.spec +50 -0
- package/tests/isolation/specs/association_vs_artifact_claim_escalation.spec +41 -0
- package/tests/isolation/specs/association_vs_heartbeat.spec +47 -0
- package/tests/isolation/specs/association_vs_multi_anchor_artifact.spec +38 -0
- package/tests/isolation/specs/association_vs_private_message.spec +33 -0
- package/tests/isolation/specs/association_vs_task_and_conflict.spec +38 -0
- package/tests/isolation/specs/association_vs_taskful_cross_thread.spec +42 -0
- package/tests/isolation/specs/message_replay_scope.spec +77 -0
- package/tests/isolation/specs/send_outcome_cross_board.spec +66 -0
- package/tests/isolation/specs/send_outcome_independence.spec +95 -0
- package/tests/isolation/specs/send_outcome_membership.spec +73 -0
- package/tests/isolation/specs/send_outcome_overlap.spec +69 -0
- package/tests/isolation/specs/send_outcome_reader.spec +61 -0
- package/tests/isolation/specs/send_outcome_recovery.spec +68 -0
- package/tests/isolation/specs/tasking_replay_scope.spec +72 -0
- package/tests/mutations/670/E1_helper_author_from_message.sql +7 -0
- package/tests/mutations/670/E2_helper_no_null_check.sql +13 -0
- package/tests/mutations/670/M10_lock_removed.sql +10 -0
- package/tests/mutations/670/M11_table_granted_to_authenticated.sql +2 -0
- package/tests/mutations/670/M12_helper_granted_to_service_role.sql +2 -0
- package/tests/mutations/670/M13_message_fk_no_cascade.sql +8 -0
- package/tests/mutations/670/M14_post_message_mints_from_metadata.sql +11 -0
- package/tests/mutations/670/M15_second_receipt_writer.sql +9 -0
- package/tests/mutations/670/M16_read_no_btrim.sql +7 -0
- package/tests/mutations/670/M17_read_volatile.sql +2 -0
- package/tests/mutations/670/M1_helper_no_service_role_guard.sql +13 -0
- package/tests/mutations/670/M3_helper_on_replay_branch.sql +10 -0
- package/tests/mutations/670/M4_read_checks_thread_existence.sql +10 -0
- package/tests/mutations/670/M5a_read_requires_thread_access.sql +10 -0
- package/tests/mutations/670/M5b_read_requires_board_membership.sql +11 -0
- package/tests/mutations/670/M6_read_admits_service_role.sql +14 -0
- package/tests/mutations/670/M7_confirmed_adds_message_sequence.sql +12 -0
- package/tests/mutations/670/M8_delivery_swallows_errors.sql +19 -0
- package/tests/mutations/670/M9_lock_key_includes_board.sql +10 -0
- package/tests/mutations/670/run.sh +84 -0
- package/tests/mutations/717-f1/M0_prefix_main_acl_and_comments.sql +11 -0
- package/tests/mutations/717-f1/M10_wrapper_stops_delegating.sql +7 -0
- package/tests/mutations/717-f1/M11_transitive_recipient_content.sql +8 -0
- package/tests/mutations/717-f1/M12_transitive_recipient_visibility.sql +8 -0
- package/tests/mutations/717-f1/M13_transitive_worker_content.sql +15 -0
- package/tests/mutations/717-f1/M1a_regrant_upsert_delivery_recipient.sql +1 -0
- package/tests/mutations/717-f1/M1b_regrant_upsert_inbox_item.sql +1 -0
- package/tests/mutations/717-f1/M1c_regrant_queue_inbox_callbacks.sql +1 -0
- package/tests/mutations/717-f1/M1d_regrant_queue_board_post_callbacks.sql +1 -0
- package/tests/mutations/717-f1/M1e_regrant_next_thread_message_sequence.sql +1 -0
- package/tests/mutations/717-f1/M2_blanket_schema_grant.sql +1 -0
- package/tests/mutations/717-f1/M3_new_overload_of_sink.sql +10 -0
- package/tests/mutations/717-f1/M4_new_route_calling_sink.sql +7 -0
- package/tests/mutations/717-f1/M5_actor_trusts_supplied_id.sql +5 -0
- package/tests/mutations/717-f1/M6_signed_route_granted_to_authenticated.sql +1 -0
- package/tests/mutations/717-f1/M7_worker_granted_to_authenticated.sql +1 -0
- package/tests/mutations/717-f1/M8_recipient_state_rewrites_visibility.sql +5 -0
- package/tests/mutations/717-f1/M9_public_route_revoked_from_service_role.sql +1 -0
- package/tests/mutations/717-f1/outbox_wake_ordering/W1_regrant_queue_inbox_callbacks.sql +1 -0
- package/tests/mutations/717-f1/outbox_wake_ordering/W2_revoke_worker_from_service_role.sql +1 -0
- package/tests/mutations/717-f1/outbox_wake_ordering/W3_invoker_caller_of_sink.sql +1 -0
- package/tests/mutations/717-f1/outbox_wake_ordering/W4_public_regrant_board_post_sink.sql +1 -0
- package/tests/mutations/717-f1/run.sh +17 -0
- package/tests/mutations/717-f2b/C1_new_delivery_route.sql +4 -0
- package/tests/mutations/717-f2b/C2_new_replay_lookup.sql +3 -0
- package/tests/mutations/717-f2b/C3_internal_regranted.sql +2 -0
- package/tests/mutations/717-f2b/C4_wrapper_writes_delivery.sql +9 -0
- package/tests/mutations/717-f2b/C5_class_member_dynamic_sql.sql +9 -0
- package/tests/mutations/717-f2b/C6_drop_board_scope_constraint.sql +2 -0
- package/tests/mutations/717-f2b/C7_state_private_helper_content.sql +14 -0
- package/tests/mutations/717-f2b/L1_dm_lock_split_by_recipient.sql +8 -0
- package/tests/mutations/717-f2b/L2_dm_lock_removed.sql +12 -0
- package/tests/mutations/717-f2b/L3_mc_lock_split_by_recipients.sql +8 -0
- package/tests/mutations/717-f2b/L4_mc_lock_removed.sql +12 -0
- package/tests/mutations/717-f2b/M0_prefix_definitions.sql +17 -0
- package/tests/mutations/717-f2b/M10_mc_lookup_any_author.sql +15 -0
- package/tests/mutations/717-f2b/M11_dm_swallow_refusal.sql +8 -0
- package/tests/mutations/717-f2b/M12_mc_swallow_refusal.sql +8 -0
- package/tests/mutations/717-f2b/M13_signed_dm_swallows_refusal.sql +32 -0
- package/tests/mutations/717-f2b/M14_signed_mc_swallows_refusal.sql +20 -0
- package/tests/mutations/717-f2b/M15_mc_any_source.sql +7 -0
- package/tests/mutations/717-f2b/M1_dm_drop_recipient_proof.sql +16 -0
- package/tests/mutations/717-f2b/M2_mc_drop_recipient_proof.sql +16 -0
- package/tests/mutations/717-f2b/M3_dm_metadata_as_proof.sql +12 -0
- package/tests/mutations/717-f2b/M4_mc_metadata_as_proof.sql +16 -0
- package/tests/mutations/717-f2b/M5_dm_any_mode.sql +11 -0
- package/tests/mutations/717-f2b/M6_dm_board_delivery_counts.sql +11 -0
- package/tests/mutations/717-f2b/M7_mc_any_mode.sql +11 -0
- package/tests/mutations/717-f2b/M8_dm_thread_stamp_as_proof.sql +12 -0
- package/tests/mutations/717-f2b/M9_dm_lookup_any_author.sql +15 -0
- package/tests/mutations/717-f2b/run.sh +82 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@consiliency/agent-board-schema",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.75.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",
|
package/schema-manifest.json
CHANGED
|
@@ -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.
|
|
5
|
+
"packageVersion": "1.75.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":
|
|
50
|
-
"aggregateSha256": "
|
|
49
|
+
"migrationCount": 173,
|
|
50
|
+
"aggregateSha256": "2662d0eb9f18cf195aa15014cdff9084faf6b5a3eb244a48548e4196a441b2e7",
|
|
51
51
|
"migrations": [
|
|
52
52
|
{
|
|
53
53
|
"order": 0,
|
|
@@ -1542,6 +1542,69 @@
|
|
|
1542
1542
|
"sourceRef": "message-board",
|
|
1543
1543
|
"bytes": 7396,
|
|
1544
1544
|
"sha256": "bfeb7bda1eb41bc431416502db69c33156ff72acfd79cefdfd556d933f79d809"
|
|
1545
|
+
},
|
|
1546
|
+
{
|
|
1547
|
+
"order": 166,
|
|
1548
|
+
"id": "20261026000100_agent_board_thread_association",
|
|
1549
|
+
"filename": "20261026000100_agent_board_thread_association.sql",
|
|
1550
|
+
"origin": "message-board-forward",
|
|
1551
|
+
"sourceRef": "message-board",
|
|
1552
|
+
"bytes": 70992,
|
|
1553
|
+
"sha256": "93c3ffc694f5dbd3a5d34d5ef392462707f959119e8c0ff52677c74720dd2c6d"
|
|
1554
|
+
},
|
|
1555
|
+
{
|
|
1556
|
+
"order": 167,
|
|
1557
|
+
"id": "20261101000100_agent_board_session_measured_mint",
|
|
1558
|
+
"filename": "20261101000100_agent_board_session_measured_mint.sql",
|
|
1559
|
+
"origin": "message-board-forward",
|
|
1560
|
+
"sourceRef": "message-board",
|
|
1561
|
+
"bytes": 12087,
|
|
1562
|
+
"sha256": "b18323397aaacfb7be138f5befedb8cb9b6a0247b868bc22a2ed3481b5f17c06"
|
|
1563
|
+
},
|
|
1564
|
+
{
|
|
1565
|
+
"order": 168,
|
|
1566
|
+
"id": "20261104065658_agent_board_reply_delivery",
|
|
1567
|
+
"filename": "20261104065658_agent_board_reply_delivery.sql",
|
|
1568
|
+
"origin": "message-board-forward",
|
|
1569
|
+
"sourceRef": "message-board",
|
|
1570
|
+
"bytes": 27537,
|
|
1571
|
+
"sha256": "0f785d8c2b6dd389fec88851d88370095c2de5d07764b7c8ced277388a471660"
|
|
1572
|
+
},
|
|
1573
|
+
{
|
|
1574
|
+
"order": 169,
|
|
1575
|
+
"id": "20261104170000_agent_board_tasking_replay_scope",
|
|
1576
|
+
"filename": "20261104170000_agent_board_tasking_replay_scope.sql",
|
|
1577
|
+
"origin": "message-board-forward",
|
|
1578
|
+
"sourceRef": "message-board",
|
|
1579
|
+
"bytes": 13932,
|
|
1580
|
+
"sha256": "dc77bd6b017e067ab20aa5ecea7d31377420d8593d33e2731059c0cbba52e4c0"
|
|
1581
|
+
},
|
|
1582
|
+
{
|
|
1583
|
+
"order": 170,
|
|
1584
|
+
"id": "20261104180000_agent_board_delivery_writer_execute",
|
|
1585
|
+
"filename": "20261104180000_agent_board_delivery_writer_execute.sql",
|
|
1586
|
+
"origin": "message-board-forward",
|
|
1587
|
+
"sourceRef": "message-board",
|
|
1588
|
+
"bytes": 4567,
|
|
1589
|
+
"sha256": "732cd0b61706f1f901eeb88f3e3a30e91a34723b8df4cc972218ebca0859e07a"
|
|
1590
|
+
},
|
|
1591
|
+
{
|
|
1592
|
+
"order": 171,
|
|
1593
|
+
"id": "20261104190000_agent_board_message_replay_scope",
|
|
1594
|
+
"filename": "20261104190000_agent_board_message_replay_scope.sql",
|
|
1595
|
+
"origin": "message-board-forward",
|
|
1596
|
+
"sourceRef": "message-board",
|
|
1597
|
+
"bytes": 15050,
|
|
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"
|
|
1545
1608
|
}
|
|
1546
1609
|
],
|
|
1547
1610
|
"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
|
-
|
|
21
|
-
|
|
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
|
-
|
|
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
|
+
});
|
package/src/tooling.test.mjs
CHANGED
|
@@ -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) 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 =
|
|
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)', () => {
|
|
45
45
|
expect(manifest.migrationCount).toBe(manifest.migrations.length);
|
|
46
|
-
expect(manifest.migrationCount).toBe(
|
|
46
|
+
expect(manifest.migrationCount).toBe(173);
|
|
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,
|
|
@@ -368,6 +368,13 @@ describe('manifest integrity', () => {
|
|
|
368
368
|
'20261015000200_agent_board_request_preserve_removed.sql',
|
|
369
369
|
'20261015000300_agent_board_rls_correlation.sql',
|
|
370
370
|
'20261015000400_agent_board_resolution_authority.sql',
|
|
371
|
+
'20261026000100_agent_board_thread_association.sql',
|
|
372
|
+
'20261101000100_agent_board_session_measured_mint.sql',
|
|
373
|
+
'20261104065658_agent_board_reply_delivery.sql',
|
|
374
|
+
'20261104170000_agent_board_tasking_replay_scope.sql',
|
|
375
|
+
'20261104180000_agent_board_delivery_writer_execute.sql',
|
|
376
|
+
'20261104190000_agent_board_message_replay_scope.sql',
|
|
377
|
+
'20261108000100_agent_board_send_outcome.sql',
|
|
371
378
|
]) {
|
|
372
379
|
expect(names.has(f)).toBe(true);
|
|
373
380
|
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
create extension if not exists pgtap with schema extensions;
|
|
2
|
+
set search_path=extensions,public,agent_board;
|
|
3
|
+
begin;
|
|
4
|
+
select no_plan();
|
|
5
|
+
create temp table f(a uuid,b uuid,ua uuid,ub uuid,board uuid,thread uuid, outsider uuid, uo uuid, private_thread uuid);
|
|
6
|
+
grant select on f to authenticated;
|
|
7
|
+
do $$
|
|
8
|
+
declare a uuid:=gen_random_uuid(); b uuid:=gen_random_uuid(); ua uuid; ub uuid; board uuid:=gen_random_uuid(); t uuid:=gen_random_uuid(); o uuid:=gen_random_uuid(); uo uuid; pt uuid:=gen_random_uuid();
|
|
9
|
+
begin
|
|
10
|
+
ua:=public.ensure_github_user('661a-'||a,'661a-'||a||'@example.test','661a-'||a,'A');
|
|
11
|
+
ub:=public.ensure_github_user('661b-'||b,'661b-'||b||'@example.test','661b-'||b,'B');
|
|
12
|
+
insert into agent_board.agents(id,agent_type,handle,display_name,status,auth_user_id,owner_user_id) values(a,'agent','661a-'||a,'A','active',ua,ua),(b,'agent','661b-'||b,'B','active',ub,ub);
|
|
13
|
+
insert into agent_board.boards(id,slug,name,created_by_agent_id,visibility) values(board,'661-'||board,'661',a,'private');
|
|
14
|
+
insert into agent_board.board_memberships(board_id,agent_id,membership_state,role) values(board,a,'joined','owner'),(board,b,'joined','member');
|
|
15
|
+
insert into agent_board.threads(id,thread_type,created_by_agent_id,subject,board_id) values(t,'coordination',a,'661 reply',board);
|
|
16
|
+
uo:=public.ensure_github_user('661o-'||o,'661o-'||o||'@example.test','661o-'||o,'Outsider');
|
|
17
|
+
insert into agent_board.agents(id,agent_type,handle,display_name,status,auth_user_id,owner_user_id) values(o,'agent','661o-'||o,'Outsider','active',uo,uo);
|
|
18
|
+
insert into agent_board.threads(id,thread_type,created_by_agent_id,subject) values(pt,'coordination',a,'Private');
|
|
19
|
+
insert into agent_board.callback_endpoints(id,owner_agent_id,endpoint_url,endpoint_status) values(o,b,'https://example.test/661','verified');
|
|
20
|
+
insert into agent_board.callback_subscriptions(endpoint_id,agent_id,subscription_scope,event_category) values(o,b,'own_inbox','inbox.item.delivered');
|
|
21
|
+
insert into agent_board.callback_endpoints(id,owner_agent_id,endpoint_url,endpoint_status) values(a,a,'https://example.test/661-author','verified');
|
|
22
|
+
insert into agent_board.callback_subscriptions(endpoint_id,agent_id,subscription_scope,event_category) values(a,a,'own_inbox','inbox.item.delivered');
|
|
23
|
+
insert into agent_board.callback_subscriptions(endpoint_id,agent_id,subscription_scope,event_category,board_id,board_membership_id)
|
|
24
|
+
select o,b,'board','board.post.delivered',board,bm.id from agent_board.board_memberships bm where bm.board_id=board and bm.agent_id=b;
|
|
25
|
+
insert into f values(a,b,ua,ub,board,t,o,uo,pt);
|
|
26
|
+
end $$;
|
|
27
|
+
select set_config('request.jwt.claim.role','authenticated',true);
|
|
28
|
+
select set_config('request.jwt.claim.sub',(select ua::text from f),true);
|
|
29
|
+
set local role authenticated;
|
|
30
|
+
select lives_ok($$select * from agent_board.post_message((select thread from f),(select a from f),'661 reply')$$,'661 author posts reply');
|
|
31
|
+
select is((select count(*) from agent_board.messages where thread_id=(select thread from f)),1::bigint,'661 author reads persisted reply');
|
|
32
|
+
reset role;
|
|
33
|
+
select is((select count(*) from agent_board.delivery_recipients where board_id=(select board from f)),2::bigint,'661 reply has member and feed-only author deliveries');
|
|
34
|
+
select is((select count(*) from agent_board.inbox_items where board_id=(select board from f) and visible_in_inbox),1::bigint,'661 reply creates recipient inbox');
|
|
35
|
+
select set_config('request.jwt.claim.sub',(select ub::text from f),true);
|
|
36
|
+
set local role authenticated;
|
|
37
|
+
select is((select count(*) from agent_board.threads where id=(select thread from f)),1::bigint,'661 second principal reads thread');
|
|
38
|
+
select is((select count(*) from agent_board.messages where thread_id=(select thread from f)),1::bigint,'661 second principal reads reply');
|
|
39
|
+
reset role;
|
|
40
|
+
|
|
41
|
+
select is((select count(*) from agent_board.inbox_items where board_id=(select board from f) and recipient_agent_id=(select a from f) and not visible_in_inbox),1::bigint,'661 author has feed-only self delivery');
|
|
42
|
+
select is((select count(*) from agent_board.callback_outbox_events where source_message_id in (select id from agent_board.messages where thread_id=(select thread from f)) and event_category='inbox.item.delivered'),1::bigint,'661 recipient inbox callback queued once');
|
|
43
|
+
select is((select count(*) from agent_board.callback_outbox_events where source_message_id in (select id from agent_board.messages where thread_id=(select thread from f)) and event_category='board.post.delivered'),1::bigint,'661 board callback queued once');
|
|
44
|
+
select set_config('request.jwt.claim.sub',(select ub::text from f),true);
|
|
45
|
+
set local role authenticated;
|
|
46
|
+
select lives_ok($$select * from agent_board.post_message((select thread from f),null,'661 response')$$,'661 second principal replies with session-derived author');
|
|
47
|
+
reset role;
|
|
48
|
+
select is((select author_agent_id from agent_board.messages where thread_id=(select thread from f) and body='661 response'),(select b from f),'661 null caller author resolves from second session');
|
|
49
|
+
select set_config('request.jwt.claim.sub',(select ua::text from f),true);
|
|
50
|
+
set local role authenticated;
|
|
51
|
+
select is((select count(*) from agent_board.messages where thread_id=(select thread from f) and body='661 response'),1::bigint,'661 first principal reads second principal response');
|
|
52
|
+
select throws_ok($$select * from agent_board.post_message((select thread from f),(select b from f),'spoof')$$,'42501',null,'661 spoofed author denied');
|
|
53
|
+
select lives_ok($$select * from agent_board.post_message((select private_thread from f),null,'661 private')$$,'661 non-board posting succeeds');
|
|
54
|
+
select lives_ok($$select * from agent_board.send_direct_message((select thread from f),null,(select b from f),'private direct','661 direct')$$,'661 private direct send on board thread succeeds');
|
|
55
|
+
select lives_ok($$select * from agent_board.send_multicast_message((select thread from f),null,array[(select b from f)],'private multi','661 multi')$$,'661 private multicast send on board thread succeeds');
|
|
56
|
+
reset role;
|
|
57
|
+
select is((select count(*) from agent_board.delivery_recipients d join agent_board.messages m on m.id=d.source_message_id where m.thread_id=(select private_thread from f)),0::bigint,'661 non-board message retains no implicit deliveries');
|
|
58
|
+
select is((select count(*) from agent_board.delivery_recipients d join agent_board.messages m on m.id=d.source_message_id where m.body in ('661 direct','661 multi') and m.thread_id=(select thread from f) and d.board_id is null and d.recipient_agent_id=(select b from f)),2::bigint,'661 private sends deliver only explicit recipient with null board');
|
|
59
|
+
select is((select count(*) from agent_board.delivery_recipients d join agent_board.messages m on m.id=d.source_message_id where m.body in ('661 direct','661 multi') and m.thread_id=(select thread from f) and d.board_id is not null),0::bigint,'661 private sends never fan out to board');
|
|
60
|
+
select set_config('request.jwt.claim.sub',(select uo::text from f),true);
|
|
61
|
+
set local role authenticated;
|
|
62
|
+
select is((select count(*) from agent_board.messages where thread_id=(select thread from f)),0::bigint,'661 nonmember cannot read board messages');
|
|
63
|
+
select throws_ok($$select * from agent_board.post_message((select thread from f),null,'outsider')$$,'42501',null,'661 nonmember cannot post');
|
|
64
|
+
reset role;
|
|
65
|
+
update agent_board.board_memberships set membership_state='removed',left_at=now() where board_id=(select board from f) and agent_id=(select b from f);
|
|
66
|
+
select set_config('request.jwt.claim.sub',(select ub::text from f),true);
|
|
67
|
+
set local role authenticated;
|
|
68
|
+
select throws_ok($$select * from agent_board.post_message((select thread from f),null,'removed')$$,'42501',null,'661 removed member cannot post');
|
|
69
|
+
reset role;
|
|
70
|
+
select set_config('request.jwt.claim.sub',(select ua::text from f),true);
|
|
71
|
+
set local role authenticated;
|
|
72
|
+
select lives_ok($$select * from agent_board.post_message((select thread from f),null,'661 after removal')$$,'661 remaining member can reply after removal');
|
|
73
|
+
reset role;
|
|
74
|
+
select is((select count(*) from agent_board.delivery_recipients d join agent_board.messages m on m.id=d.source_message_id where m.body='661 after removal' and m.thread_id=(select thread from f) and d.recipient_agent_id=(select b from f)),0::bigint,'661 removed member receives no new delivery');
|
|
75
|
+
select is((select count(*) from agent_board.delivery_recipients d join agent_board.messages m on m.id=d.source_message_id where m.body='661 after removal' and m.thread_id=(select thread from f)),1::bigint,'661 author-only board preserves feed anchor');
|
|
76
|
+
update agent_board.board_memberships set membership_state='subscribed',role='observer',left_at=null where board_id=(select board from f) and agent_id=(select b from f);
|
|
77
|
+
select set_config('request.jwt.claim.sub',(select ub::text from f),true);
|
|
78
|
+
set local role authenticated;
|
|
79
|
+
select throws_ok($$select * from agent_board.post_message((select thread from f),null,'observer')$$,'42501',null,'661 observer cannot post');
|
|
80
|
+
reset role;
|
|
81
|
+
select set_config('request.jwt.claim.sub',(select ua::text from f),true);
|
|
82
|
+
set local role authenticated;
|
|
83
|
+
select lives_ok($$select * from agent_board.post_message((select thread from f),null,'661 subscribed')$$,'661 reply with subscribed recipient succeeds');
|
|
84
|
+
reset role;
|
|
85
|
+
select is((select count(*) from agent_board.delivery_recipients d join agent_board.messages m on m.id=d.source_message_id where m.body='661 subscribed' and m.thread_id=(select thread from f) and d.recipient_agent_id=(select b from f)),1::bigint,'661 subscribed member receives reply');
|
|
86
|
+
select is((select board_id from agent_board.threads where id=(select thread from f)),(select board from f),'661 replies preserve board association');
|
|
87
|
+
select is((select visibility from agent_board.boards where id=(select board from f)),'private','661 replies preserve private board');
|
|
88
|
+
-- Catalog census: new direct writers or overloads name themselves. Internal
|
|
89
|
+
-- helpers have no API grants; their callers must remain the reviewed routes.
|
|
90
|
+
select is((select string_agg(p.oid::regprocedure::text,', ' order by p.oid::regprocedure::text) from pg_proc p where p.pronamespace='agent_board'::regnamespace and agent_board_test.stripped_body(p.oid) ~ agent_board_test.stmt_re('insert into','messages')),
|
|
91
|
+
'_insert_thread_message(uuid,uuid,text,text,uuid,jsonb)','661 catalog message insertion has one authorized primitive');
|
|
92
|
+
select is((select string_agg(p.oid::regprocedure::text,', ' order by p.oid::regprocedure::text) from pg_proc p where p.pronamespace='agent_board'::regnamespace and agent_board_test.stripped_body(p.oid) ~ agent_board_test.call_re('_insert_thread_message')),
|
|
93
|
+
'post_board_message(uuid,uuid,uuid,text,text,text,text,text,jsonb), post_message(uuid,uuid,text,text,uuid,jsonb), send_direct_message(uuid,uuid,uuid,text,text,text,text,text,jsonb), send_multicast_message(uuid,uuid,uuid[],text,text,text,text,text,jsonb)',
|
|
94
|
+
'661 catalog insertion callers name every route and overload');
|
|
95
|
+
select is((select string_agg(p.oid::regprocedure::text,', ' order by p.oid::regprocedure::text) from pg_proc p where p.pronamespace='agent_board'::regnamespace and agent_board_test.stripped_body(p.oid) ~ agent_board_test.call_re('_deliver_board_message')),
|
|
96
|
+
'post_board_message(uuid,uuid,uuid,text,text,text,text,text,jsonb), post_message(uuid,uuid,text,text,uuid,jsonb)',
|
|
97
|
+
'661 catalog fan-out callers are canonical board post and reply');
|
|
98
|
+
select is((select string_agg(p.oid::regprocedure::text||':'||r,', ' order by p.oid,r) from pg_proc p cross join unnest(array['anon','authenticated','service_role','agent_board_delegate']) r where p.pronamespace='agent_board'::regnamespace and p.proname in ('_insert_thread_message','_deliver_board_message') and has_function_privilege(r,p.oid,'execute')),null::text,'661 internal insertion and delivery helpers are not API callable');
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
-- Existing metadata keys are data, never an internal delivery bypass switch.
|
|
102
|
+
select set_config('request.jwt.claim.sub',(select ua::text from f),true);
|
|
103
|
+
set local role authenticated;
|
|
104
|
+
select lives_ok($$select * from agent_board.post_message((select thread from f),null,'661 forged metadata',p_metadata=>'{"rpcName":"send_direct_message","boardId":"forged","delegate":{"delegate":true}}')$$,'661 caller metadata cannot select private routing');
|
|
105
|
+
reset role;
|
|
106
|
+
select is((select count(*) from agent_board.delivery_recipients d join agent_board.messages m on m.id=d.source_message_id where m.thread_id=(select thread from f) and m.body='661 forged metadata' and d.board_id=(select board from f)),2::bigint,'661 forged rpcName still receives canonical board delivery');
|
|
107
|
+
select ok((select not (metadata ? 'delegate') from agent_board.messages where thread_id=(select thread from f) and body='661 forged metadata'),'661 nondelegate cannot forge hosted attribution');
|
|
108
|
+
insert into agent_board.board_memberships(board_id,agent_id,membership_state,role) select board,outsider,'joined','member' from f;
|
|
109
|
+
select set_config('request.jwt.claim.sub',(select uo::text from f),true);
|
|
110
|
+
set local role authenticated;
|
|
111
|
+
select is((select count(*) from agent_board.messages where thread_id=(select thread from f) and body in ('661 direct','661 multi')),0::bigint,'661 unrelated board member cannot read private sends');
|
|
112
|
+
select is((select count(*) from agent_board.messages where thread_id=(select thread from f) and body='661 forged metadata'),1::bigint,'661 current board member can read delivered board reply');
|
|
113
|
+
reset role;
|
|
114
|
+
create temp table result661(id uuid);
|
|
115
|
+
grant insert on result661 to authenticated;
|
|
116
|
+
select set_config('request.jwt.claim.sub',(select ua::text from f),true);
|
|
117
|
+
set local role authenticated;
|
|
118
|
+
select lives_ok($$insert into result661 select message_id from agent_board.post_board_message((select thread from f),null,(select board from f),'Canonical','661 canonical',p_idempotency_key=>'661-key')$$,'661 canonical board post succeeds');
|
|
119
|
+
select lives_ok($$insert into result661 select message_id from agent_board.post_board_message((select thread from f),null,(select board from f),'Canonical','661 replay preview',p_idempotency_key=>'661-key')$$,'661 canonical board replay succeeds');
|
|
120
|
+
reset role;
|
|
121
|
+
select is((select count(distinct id) from result661),1::bigint,'661 canonical replay reuses message');
|
|
122
|
+
select is((select count(*) from agent_board.delivery_recipients where source_message_id in(select id from result661)),3::bigint,'661 canonical post uses one fan-out without duplicate delivery');
|
|
123
|
+
select is((select count(*) from agent_board.inbox_items where source_message_id in(select id from result661) and visible_in_inbox),2::bigint,'661 canonical post retains recipient count excluding sender');
|
|
124
|
+
select is((select array_agg(distinct p.proname||'('||oidvectortypes(p.proargtypes)||')' order by p.proname||'('||oidvectortypes(p.proargtypes)||')')
|
|
125
|
+
from agent_board_test.fn_call_closure() c join pg_proc p on p.oid=c.root_oid
|
|
126
|
+
where c.reached_name='_insert_thread_message' and (has_function_privilege('authenticated',p.oid,'execute') or has_function_privilege('service_role',p.oid,'execute') or has_function_privilege('agent_board_delegate',p.oid,'execute'))),
|
|
127
|
+
array[
|
|
128
|
+
'post_board_message(uuid, uuid, text, text, text, text, text, text, text, jsonb)',
|
|
129
|
+
'post_board_message(uuid, uuid, uuid, text, text, text, text, text, jsonb)',
|
|
130
|
+
'post_message(uuid, uuid, text, text, uuid, jsonb)',
|
|
131
|
+
'send_direct_message(uuid, uuid, jsonb, text, text, text, text, text, text, jsonb)',
|
|
132
|
+
'send_direct_message(uuid, uuid, uuid, text, text, text, text, text, jsonb)',
|
|
133
|
+
'send_multicast_message(uuid, uuid, jsonb, text, text, text, text, text, text, jsonb)',
|
|
134
|
+
'send_multicast_message(uuid, uuid, uuid[], text, text, text, text, text, jsonb)',
|
|
135
|
+
'signed_post_board_message(jsonb, jsonb)',
|
|
136
|
+
'signed_send_direct_message(jsonb, jsonb)',
|
|
137
|
+
'signed_send_multicast_message(jsonb, jsonb)']::text[],
|
|
138
|
+
'661 catalog transitive message entrypoints name every overload and signed route');
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
create temp table task661(id uuid);
|
|
142
|
+
insert into task661 values(gen_random_uuid());
|
|
143
|
+
insert into agent_board.tasks(id,thread_id,created_by_agent_id,title) select t.id,f.thread,f.a,'661 task' from task661 t cross join f;
|
|
144
|
+
grant select on task661 to authenticated;
|
|
145
|
+
create temp table reply661(message_id uuid,thread_id uuid,task_id uuid,message_sequence bigint,created_at timestamptz);
|
|
146
|
+
grant insert on reply661 to authenticated;
|
|
147
|
+
set local role authenticated;
|
|
148
|
+
select lives_ok($$insert into reply661 select * from agent_board.post_message((select thread from f),null,'661 task reply',p_task_id=>(select id from task661),p_metadata=>'{"custom":"kept"}')$$,'661 task reply retains public return shape');
|
|
149
|
+
reset role;
|
|
150
|
+
select ok((select r.task_id=t.id and r.thread_id=f.thread and r.message_sequence=m.message_sequence and r.created_at=m.created_at from reply661 r cross join task661 t cross join f join agent_board.messages m on m.thread_id=f.thread and m.body='661 task reply'),'661 reply result preserves task thread sequence and timestamp');
|
|
151
|
+
select is((select metadata->>'custom' from agent_board.messages where id=(select message_id from reply661)),'kept','661 reply preserves caller application metadata');
|
|
152
|
+
select is((select count(*) from agent_board.inbox_items where source_message_id=(select message_id from reply661) and subject='661 reply' and priority='medium'),3::bigint,'661 reply inbox uses thread subject and medium priority');
|
|
153
|
+
create function pg_temp.fail661() returns trigger language plpgsql as $$
|
|
154
|
+
begin
|
|
155
|
+
if new.preview='661 atomic' then raise exception '661 injected inbox failure'; end if;
|
|
156
|
+
return new;
|
|
157
|
+
end $$;
|
|
158
|
+
create trigger fail661 before insert on agent_board.inbox_items for each row execute function pg_temp.fail661();
|
|
159
|
+
set local role authenticated;
|
|
160
|
+
select throws_ok($$select * from agent_board.post_message((select thread from f),null,'661 atomic')$$,'P0001','661 injected inbox failure','661 downstream delivery failure reaches caller');
|
|
161
|
+
reset role;
|
|
162
|
+
select is((select count(*) from agent_board.messages where thread_id=(select thread from f) and body='661 atomic'),0::bigint,'661 delivery failure rolls back persisted reply');
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
-- Dormant restricted state is seeded by the operator, never made public by a reply.
|
|
166
|
+
create temp table restricted661(id uuid);
|
|
167
|
+
insert into restricted661 values(gen_random_uuid());
|
|
168
|
+
grant select on restricted661 to authenticated;
|
|
169
|
+
insert into agent_board.threads(id,thread_type,created_by_agent_id,subject,board_id,access_mode)
|
|
170
|
+
select r.id,'coordination',f.a,'Restricted',f.board,'restricted' from restricted661 r cross join f;
|
|
171
|
+
insert into agent_board.thread_memberships(thread_id,agent_id,role,granted_by_agent_id)
|
|
172
|
+
select r.id,f.a,'member',f.a from restricted661 r cross join f;
|
|
173
|
+
set local role authenticated;
|
|
174
|
+
select lives_ok($$select * from agent_board.post_message((select id from restricted661),null,'661 restricted')$$,'661 authorized restricted-thread reply succeeds');
|
|
175
|
+
reset role;
|
|
176
|
+
select is((select count(*) from agent_board.messages where thread_id=(select id from restricted661)),1::bigint,'661 restricted reply persists');
|
|
177
|
+
select is((select count(*) from agent_board.delivery_recipients d join agent_board.messages m on m.id=d.source_message_id where m.thread_id=(select id from restricted661)),0::bigint,'661 restricted reply does not implicitly broadcast to board');
|
|
178
|
+
select set_config('request.jwt.claim.sub',(select ub::text from f),true);
|
|
179
|
+
set local role authenticated;
|
|
180
|
+
select is((select count(*) from agent_board.messages where thread_id=(select id from restricted661)),0::bigint,'661 board membership does not disclose restricted reply');
|
|
181
|
+
reset role;
|
|
182
|
+
select is((select count(*) from agent_board.inbox_items where source_message_id in(select id from result661) and preview='661 replay preview'),3::bigint,'661 canonical retry retains caller-body preview semantics');
|
|
183
|
+
select ok((select access_mode='restricted' from agent_board.threads where id=(select id from restricted661)) and (select access_mode='inherit' from agent_board.threads where id=(select thread from f)),'661 replies preserve both access modes');
|
|
184
|
+
select * from finish();
|
|
185
|
+
rollback;
|