@ours.network/tg-connector 0.1.7 → 0.1.8-nightly.2
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/dist/connector.js +74 -0
- package/dist/mufl_code/D812C6070397B0EB11D66D6D33D931C35E9442ACC141C35C51A7904A082B19E0.muflo +0 -0
- package/dist/mufl_code/actor.mu +27 -0
- package/dist/mufl_code/core/COMMERCIAL-LICENCE.md +25 -0
- package/dist/mufl_code/core/COMPATIBILITY.md +221 -0
- package/dist/mufl_code/core/CONTRIBUTING.md +37 -0
- package/dist/mufl_code/core/LICENSE +1 -1
- package/dist/mufl_code/core/NOTIFICATIONS_CONTRACT.md +290 -0
- package/dist/mufl_code/core/README.md +64 -49
- package/dist/mufl_code/core/SECURITY.md +40 -0
- package/dist/mufl_code/core/TRADEMARKS.md +24 -0
- package/dist/mufl_code/core/a2a_capabilities.mm +76 -1
- package/dist/mufl_code/core/a2a_control.mm +2 -1
- package/dist/mufl_code/core/a2a_messaging.mm +1677 -25
- package/dist/mufl_code/core/a2a_notifications.mm +1102 -0
- package/dist/mufl_code/core/a2a_protocol.mm +16 -1
- package/dist/mufl_code/core/a2a_versions.mm +801 -0
- package/dist/mufl_code/core/config.mufl +2 -0
- package/dist/mufl_code/core/docs/.vitepress/config.mts +58 -0
- package/dist/mufl_code/core/docs/citations.json +688 -0
- package/dist/mufl_code/core/docs/guide/01-vendor-the-core.md +50 -0
- package/dist/mufl_code/core/docs/guide/02-configure-and-compile.md +100 -0
- package/dist/mufl_code/core/docs/guide/03-wire-the-host.md +154 -0
- package/dist/mufl_code/core/docs/guide/04-connect-and-message.md +156 -0
- package/dist/mufl_code/core/docs/guide/05-test-your-app.md +75 -0
- package/dist/mufl_code/core/docs/guide/index.md +63 -0
- package/dist/mufl_code/core/docs/how-it-works/capabilities-and-control.md +77 -0
- package/dist/mufl_code/core/docs/how-it-works/cluster.md +65 -0
- package/dist/mufl_code/core/docs/how-it-works/identity.md +56 -0
- package/dist/mufl_code/core/docs/how-it-works/invites-and-contacts.md +76 -0
- package/dist/mufl_code/core/docs/how-it-works/messaging.md +55 -0
- package/dist/mufl_code/core/docs/how-it-works/monitoring-and-config.md +72 -0
- package/dist/mufl_code/core/docs/how-it-works/overview.md +45 -0
- package/dist/mufl_code/core/docs/how-it-works/versioning.md +116 -0
- package/dist/mufl_code/core/docs/index.md +27 -0
- package/dist/mufl_code/core/docs/package-lock.json +3467 -0
- package/dist/mufl_code/core/docs/package.json +15 -0
- package/dist/mufl_code/core/docs/reference/contributing.md +26 -0
- package/dist/mufl_code/core/docs/reference/glossary.md +108 -0
- package/dist/mufl_code/core/docs/reference/implementations.md +23 -0
- package/dist/mufl_code/core/docs/reference/modules.md +19 -0
- package/dist/mufl_code/core/docs/scripts/check-citations.mjs +36 -0
- package/dist/mufl_code/core/docs/scripts/check-denylist.mjs +30 -0
- package/dist/mufl_code/core/docs/scripts/gen-llms.mjs +32 -0
- package/dist/mufl_code/core/docs/workflows/cluster.md +89 -0
- package/dist/mufl_code/core/docs/workflows/contact-exchange.md +60 -0
- package/dist/mufl_code/core/docs/workflows/contact-restore.md +60 -0
- package/dist/mufl_code/core/docs/workflows/control-verbs.md +70 -0
- package/dist/mufl_code/core/docs/workflows/index.md +57 -0
- package/dist/mufl_code/core/docs/workflows/introductions.md +60 -0
- package/dist/mufl_code/core/docs/workflows/messaging.md +75 -0
- package/dist/mufl_code/core/docs/workflows/monitoring.md +84 -0
- package/dist/mufl_code/core/docs/workflows/notifications.md +109 -0
- package/dist/mufl_code/core/release-notes/0.1.md +60 -0
- package/dist/mufl_code/core/release-notes/0.3.md +22 -0
- package/dist/mufl_code/core/release-notes/0.4.md +97 -0
- package/dist/mufl_code/core/tests/README.md +17 -0
- package/dist/mufl_code/core/tests/corpus.mjs +139 -0
- package/dist/mufl_code/core/tests/corpus_actor.mu +242 -0
- package/dist/mufl_code/core/tests/fatcompile_actor.mu +52 -0
- package/dist/mufl_code/core/tests/mig.mjs +664 -0
- package/dist/mufl_code/core/tests/mig_actor.mu +466 -0
- package/dist/mufl_code/core/tests/migapp.mjs +431 -0
- package/dist/mufl_code/core/tests/migapp_actor.mu +294 -0
- package/dist/mufl_code/core/tests/mufl_semantics/run.sh +69 -0
- package/dist/mufl_code/core/tests/mufl_semantics/t11_three_version.mufl +47 -0
- package/dist/mufl_code/core/tests/mufl_semantics/t2_extra_fields.mufl +11 -0
- package/dist/mufl_code/core/tests/mufl_semantics/t7_runtime.mufl +30 -0
- package/dist/mufl_code/core/tests/mufl_semantics/t9_passthrough.mufl +19 -0
- package/dist/mufl_code/core/tests/mufl_semantics/t_str_order.mufl +19 -0
- package/dist/mufl_code/core/tests/notif.mjs +689 -0
- package/dist/mufl_code/core/tests/notif_actor.mu +458 -0
- package/dist/mufl_code/core/tests/protocol_container.mm +18 -0
- package/dist/mufl_code/core/tests/run.sh +8 -10
- package/dist/mufl_code/core/tests/run_corpus.sh +51 -0
- package/dist/mufl_code/core/tests/run_fatcompile.sh +40 -0
- package/dist/mufl_code/core/tests/run_mig.sh +51 -0
- package/dist/mufl_code/core/tests/run_migapp.sh +51 -0
- package/dist/mufl_code/core/tests/run_notif.sh +55 -0
- package/dist/mufl_code/core/tests/test.mjs +291 -49
- package/dist/mufl_code/core/tests/test_actor.mu +240 -7
- package/dist/mufl_code/core/tests/test_common.mjs +93 -0
- package/dist/mufl_code/core/version.mm +1 -1
- package/package.json +4 -4
- package/dist/mufl_code/2DA1D5F860E42C605D92F1E24E2466C70EFDDBF057BBCBA52F0ECC639EFCA387.muflo +0 -0
- package/dist/mufl_code/core/CLUSTER_API.md +0 -640
- package/dist/mufl_code/core/CLUSTER_CONTRACT.md +0 -121
- package/dist/mufl_code/core/CLUSTER_INTRODUCTION_PLAN.md +0 -200
- package/dist/mufl_code/core/CONFIGURATION_DESIGN.md +0 -35
- package/dist/mufl_code/core/CONFIGURATION_PLAN.md +0 -394
- package/dist/mufl_code/core/DEVELOPMENT.md +0 -168
- package/dist/mufl_code/core/EPHEMERAL_INVITE_PLAN.md +0 -465
- package/dist/mufl_code/core/GROUP_CHAT_DESIGN.md +0 -520
- package/dist/mufl_code/core/release-notes/2.0.md +0 -268
- package/dist/mufl_code/core/release-notes/2.1.md +0 -92
- package/dist/mufl_code/core/release-notes/2.2.md +0 -94
- package/dist/mufl_code/core/release-notes/3.0.md +0 -162
- package/dist/mufl_code/core/release-notes/3.1.md +0 -43
- package/dist/mufl_code/core/release-notes/README.md +0 -32
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Phase-A migration store + export/import gate: compile the test actor against THIS core, boot a
|
|
3
|
+
# local broker, run ONLY tests/migapp.mjs (single packet, no peer traffic).
|
|
4
|
+
# Same env knobs as run.sh: ADAPT_TOOLKIT / OURS_SDK_NODE_MODULES / DEV_BROKER / PORT.
|
|
5
|
+
set -u
|
|
6
|
+
HERE=$(cd "$(dirname "$0")" && pwd)
|
|
7
|
+
CORE_DIR=$(cd "$HERE/.." && pwd)
|
|
8
|
+
AT=${ADAPT_TOOLKIT:-/home/shakhvit/work/adapt/adapt-toolkit}
|
|
9
|
+
STDLIB=${MUFL_STDLIB_OVERRIDE:-$AT/mufl_stdlib} # Phase-B: point at the adapt worktree stdlib to pick up e2e.mm staged API
|
|
10
|
+
SDK_NM=${OURS_SDK_NODE_MODULES:-/home/shakhvit/work/adapt/ours/ours-mcp/node_modules}
|
|
11
|
+
DEV_BROKER=${DEV_BROKER:-/home/shakhvit/work/adapt/ours/ours-mcp/scripts/dev-broker.mjs}
|
|
12
|
+
PORT=${PORT:-9798}
|
|
13
|
+
COMPILE="$AT/build.linux.release/mufl-compile"
|
|
14
|
+
|
|
15
|
+
for p in "$COMPILE" "$STDLIB" "$SDK_NM/@adapt-toolkit" "$DEV_BROKER"; do
|
|
16
|
+
[ -e "$p" ] || { echo "MISSING: $p (set ADAPT_TOOLKIT / OURS_SDK_NODE_MODULES / DEV_BROKER)"; exit 2; }
|
|
17
|
+
done
|
|
18
|
+
|
|
19
|
+
BUILD=$(mktemp -d)
|
|
20
|
+
trap 'rm -rf "$BUILD"' EXIT
|
|
21
|
+
mkdir -p "$BUILD/core"
|
|
22
|
+
cp "$CORE_DIR"/*.mm "$CORE_DIR"/config.mufl "$BUILD/core/"
|
|
23
|
+
cp "$HERE/migapp_actor.mu" "$HERE/migapp.mjs" "$HERE/protocol_container.mm" "$BUILD/"
|
|
24
|
+
ln -sfn "$SDK_NM" "$BUILD/node_modules"
|
|
25
|
+
cat > "$BUILD/config.mufl" <<'CFG'
|
|
26
|
+
config script
|
|
27
|
+
{
|
|
28
|
+
stdlib_config = (config_load #$MUFL_STDLIB_PATH).
|
|
29
|
+
core_config = (config_load #"core").
|
|
30
|
+
(
|
|
31
|
+
$imports -> ( $libraries -> (stdlib_config $exports $libraries)'(core_config $exports $libraries)'($protocol_container -> #"protocol_container.mm"), ),
|
|
32
|
+
$exports -> ( $libraries -> (,), $applications -> (,) )
|
|
33
|
+
).
|
|
34
|
+
}
|
|
35
|
+
CFG
|
|
36
|
+
|
|
37
|
+
cd "$BUILD"
|
|
38
|
+
echo "compiling test actor against $CORE_DIR core…"
|
|
39
|
+
MUFL_STDLIB_PATH="$STDLIB" "$COMPILE" -mp "$AT/meta" -mp "$AT/transactions" migapp_actor.mu 2>&1 \
|
|
40
|
+
| grep -vE "Unused symbol|browser_attestation|identity_proof_document_impl" | tail -4
|
|
41
|
+
ls ./*.muflo >/dev/null 2>&1 || { echo "COMPILE FAILED"; exit 1; }
|
|
42
|
+
|
|
43
|
+
node "$DEV_BROKER" --host 127.0.0.1 --port "$PORT" --test_mode >broker.log 2>&1 &
|
|
44
|
+
BPID=$!
|
|
45
|
+
sleep 2.5
|
|
46
|
+
kill -0 "$BPID" 2>/dev/null || { echo "BROKER FAILED TO START:"; cat broker.log; exit 3; }
|
|
47
|
+
|
|
48
|
+
BROKER_URL="ws://127.0.0.1:$PORT" node migapp.mjs 2> >(grep -E 'DRIVER ERR' >&2)
|
|
49
|
+
RC=$?
|
|
50
|
+
kill "$BPID" 2>/dev/null
|
|
51
|
+
exit $RC
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# a2a_notifications N-series gate: compile the notif test actor (loads BOTH
|
|
3
|
+
# a2a_messaging AND a2a_notifications) against THIS core, boot a local broker, and
|
|
4
|
+
# run tests/notif.mjs. Split from run.sh because notif_actor.mu is its own compiled
|
|
5
|
+
# unit (test_actor.mu dropped a2a_notifications to stay under the per-unit
|
|
6
|
+
# meta-reduction fuel ceiling). Same env knobs as run.sh:
|
|
7
|
+
# ADAPT_TOOLKIT / OURS_SDK_NODE_MODULES / DEV_BROKER / PORT.
|
|
8
|
+
set -u
|
|
9
|
+
HERE=$(cd "$(dirname "$0")" && pwd)
|
|
10
|
+
CORE_DIR=$(cd "$HERE/.." && pwd)
|
|
11
|
+
AT=${ADAPT_TOOLKIT:-/home/shakhvit/work/adapt/adapt-toolkit}
|
|
12
|
+
STDLIB=${MUFL_STDLIB_OVERRIDE:-$AT/mufl_stdlib} # Phase-B: point at the adapt worktree stdlib to pick up e2e.mm staged API
|
|
13
|
+
SDK_NM=${OURS_SDK_NODE_MODULES:-/home/shakhvit/work/adapt/ours/ours-mcp/node_modules}
|
|
14
|
+
DEV_BROKER=${DEV_BROKER:-/home/shakhvit/work/adapt/ours/ours-mcp/scripts/dev-broker.mjs}
|
|
15
|
+
PORT=${PORT:-9798}
|
|
16
|
+
COMPILE="$AT/build.linux.release/mufl-compile"
|
|
17
|
+
|
|
18
|
+
for p in "$COMPILE" "$STDLIB" "$SDK_NM/@adapt-toolkit" "$DEV_BROKER"; do
|
|
19
|
+
[ -e "$p" ] || { echo "MISSING: $p (set ADAPT_TOOLKIT / OURS_SDK_NODE_MODULES / DEV_BROKER)"; exit 2; }
|
|
20
|
+
done
|
|
21
|
+
|
|
22
|
+
BUILD=$(mktemp -d)
|
|
23
|
+
trap 'rm -rf "$BUILD"' EXIT
|
|
24
|
+
mkdir -p "$BUILD/core"
|
|
25
|
+
cp "$CORE_DIR"/*.mm "$CORE_DIR"/config.mufl "$BUILD/core/"
|
|
26
|
+
# notif.mjs imports ./test_common.mjs, so copy it alongside into the build dir.
|
|
27
|
+
cp "$HERE/notif_actor.mu" "$HERE/notif.mjs" "$HERE/test_common.mjs" "$HERE/protocol_container.mm" "$BUILD/"
|
|
28
|
+
ln -sfn "$SDK_NM" "$BUILD/node_modules"
|
|
29
|
+
cat > "$BUILD/config.mufl" <<'CFG'
|
|
30
|
+
config script
|
|
31
|
+
{
|
|
32
|
+
stdlib_config = (config_load #$MUFL_STDLIB_PATH).
|
|
33
|
+
core_config = (config_load #"core").
|
|
34
|
+
(
|
|
35
|
+
$imports -> ( $libraries -> (stdlib_config $exports $libraries)'(core_config $exports $libraries)'($protocol_container -> #"protocol_container.mm"), ),
|
|
36
|
+
$exports -> ( $libraries -> (,), $applications -> (,) )
|
|
37
|
+
).
|
|
38
|
+
}
|
|
39
|
+
CFG
|
|
40
|
+
|
|
41
|
+
cd "$BUILD"
|
|
42
|
+
echo "compiling notif test actor against $CORE_DIR core…"
|
|
43
|
+
MUFL_STDLIB_PATH="$STDLIB" "$COMPILE" -mp "$AT/meta" -mp "$AT/transactions" notif_actor.mu 2>&1 \
|
|
44
|
+
| grep -vE "Unused symbol|browser_attestation|identity_proof_document_impl" | tail -4
|
|
45
|
+
ls ./*.muflo >/dev/null 2>&1 || { echo "COMPILE FAILED"; exit 1; }
|
|
46
|
+
|
|
47
|
+
node "$DEV_BROKER" --host 127.0.0.1 --port "$PORT" --test_mode >broker.log 2>&1 &
|
|
48
|
+
BPID=$!
|
|
49
|
+
sleep 2.5
|
|
50
|
+
kill -0 "$BPID" 2>/dev/null || { echo "BROKER FAILED TO START:"; cat broker.log; exit 3; }
|
|
51
|
+
|
|
52
|
+
BROKER_URL="ws://127.0.0.1:$PORT" node notif.mjs 2> >(grep -E 'inbound rejected|DRIVER ERR' >&2)
|
|
53
|
+
RC=$?
|
|
54
|
+
kill "$BPID" 2>/dev/null
|
|
55
|
+
exit $RC
|
|
@@ -1,59 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// M2 loopback test suite for the core-3.0 ephemeral-invite redeem flow.
|
|
3
3
|
// Asserts RECEIVER-SIDE outcomes (state), per the Critic requirement.
|
|
4
|
+
//
|
|
5
|
+
// T/V/RC-series only — the a2a_notifications N-series moved to notif.mjs (its own
|
|
6
|
+
// compiled unit, notif_actor.mu). The shared wrapper/packet bootstrap + the
|
|
7
|
+
// mk/wire/mutate/ro/binv/mkPacket/sleep/log helpers live in ./test_common.mjs.
|
|
4
8
|
import { resolve } from 'node:path';
|
|
5
9
|
import * as fs from 'node:fs';
|
|
6
|
-
import {
|
|
7
|
-
import { PacketWrapperConfigurator } from '@adapt-toolkit/sdk/wrappers';
|
|
8
|
-
import { object_to_adapt_value } from '@adapt-toolkit/sdk/wrapper';
|
|
10
|
+
import { createHarness, mk } from './test_common.mjs';
|
|
9
11
|
|
|
10
12
|
const BROKER_URL = process.env.BROKER_URL || 'ws://127.0.0.1:9790';
|
|
11
13
|
const UNIT_DIR = resolve('.');
|
|
12
|
-
const unitHash = fs.readdirSync(UNIT_DIR).find((f) => f.endsWith('.muflo')).slice(0, -'.muflo'.length);
|
|
13
|
-
const UNIT = new Uint8Array(fs.readFileSync(resolve(UNIT_DIR, `${unitHash}.muflo`)));
|
|
14
|
-
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
15
|
-
const log = (...a) => process.stderr.write(`[t] ${a.join(' ')}\n`);
|
|
16
14
|
const scorecard = [];
|
|
17
15
|
let CUR = '';
|
|
18
16
|
const ok = (c, m) => { if (!c) { scorecard.push(`✗ [${CUR}] ${m}`); console.log(` ✗ FAIL: ${m}`); } else { console.log(` ✓ ${m}`); } };
|
|
19
17
|
const isT = (s) => /true/i.test(String(s));
|
|
20
18
|
|
|
21
|
-
let wrapper;
|
|
22
|
-
function mk(name) { return { name, pw: null, cid: '', pending: [], rejects: [], events: [] }; }
|
|
23
|
-
function wire(id) {
|
|
24
|
-
id.pw.on_return_data = (d) => {
|
|
25
|
-
const kind = d.Reduce('kind').Visualize();
|
|
26
|
-
if (kind === 'notify_agent') { id.events.push(d.Reduce('payload').Reduce('event').Visualize()); return; }
|
|
27
|
-
if (kind === 'save_state') return;
|
|
28
|
-
const p = id.pending.shift(); if (!p) return;
|
|
29
|
-
clearTimeout(p.timer); p.resolve(d.Reduce('payload'));
|
|
30
|
-
};
|
|
31
|
-
id.pw.on_transaction_failure = (msg) => {
|
|
32
|
-
const p = id.pending.shift();
|
|
33
|
-
if (p) { clearTimeout(p.timer); p.reject(new Error(msg)); }
|
|
34
|
-
else { id.rejects.push(String(msg)); log(`${id.name} inbound rejected:`, String(msg).split('\n')[0]); }
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function mutate(id, name, targ) {
|
|
38
|
-
return new Promise((res, rej) => {
|
|
39
|
-
const timer = setTimeout(() => rej(new Error(`${id.name}.${name} timed out`)), 20000);
|
|
40
|
-
id.pending.push({ resolve: res, reject: rej, timer });
|
|
41
|
-
id.pw.add_client_message(object_to_adapt_value({ name, targ }));
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
const ro = (id, name, targ) => id.pw.packet.ExecuteTransaction(object_to_adapt_value({ name, targ }));
|
|
45
|
-
const binv = (id, buf) => id.pw.packet.NewBinaryFromBuffer(Buffer.from(buf));
|
|
46
|
-
async function mkPacket(id, seed) {
|
|
47
|
-
const cfg = new PacketWrapperConfigurator();
|
|
48
|
-
cfg.process_arguments(['--unit_hash', unitHash, '--seed_phrase', seed, '--unit_dir_path', UNIT_DIR]);
|
|
49
|
-
await new Promise((res, rej) => {
|
|
50
|
-
const t = setTimeout(() => rej(new Error(`${id.name} create timeout`)), 30000);
|
|
51
|
-
wrapper.packet_manager.create_packet(cfg, (pw) => {
|
|
52
|
-
clearTimeout(t); id.pw = pw; id.cid = pw.packet.GetContainerID().Visualize(); wire(id);
|
|
53
|
-
log(`${id.name} cid ${id.cid.slice(0, 12)}…`); res();
|
|
54
|
-
}, UNIT);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
19
|
+
let wrapper, mutate, ro, binv, mkPacket, sleep, log;
|
|
57
20
|
const st = (id) => { const s = ro(id, '::actor::qa_state', undefined); return {
|
|
58
21
|
c: +s.Reduce('n_contacts').Visualize(), p: +s.Reduce('n_peer_ads').Visualize(),
|
|
59
22
|
pi: +s.Reduce('n_pending_invites').Visualize(), pr: +s.Reduce('n_pending_redemptions').Visualize(),
|
|
@@ -71,14 +34,19 @@ async function delegate(root, role, roleName) {
|
|
|
71
34
|
const prof = await mutate(root, '::actor::export_root_profile', {});
|
|
72
35
|
const profBlob = Buffer.from(prof.Reduce('profile').GetBinary());
|
|
73
36
|
const rootAd = Buffer.from(ro(root, '::actor::export_address_document', undefined).GetBinary());
|
|
74
|
-
|
|
37
|
+
// Also mint the v1-AD-bound cert: the root signs a delegation over the role's
|
|
38
|
+
// DOWN-LEVELLED (bundle-less) AD, so a cross-version (0.11.2) peer that hashes
|
|
39
|
+
// the v1 AD it receives finds a matching $role_ad_hash. This is the daemon's
|
|
40
|
+
// real sa() flow — sign_delegation takes any AD blob, so we hand it the v1 one.
|
|
41
|
+
const roleAdV1 = Buffer.from((await mutate(role, '::actor::export_v1_address_document', {})).Reduce('ad').GetBinary());
|
|
42
|
+
const signedV1 = await mutate(root, '::actor::sign_delegation', { role_ad: binv(root, roleAdV1), role_id: roleName });
|
|
43
|
+
const certV1 = Buffer.from(signedV1.Reduce('cert').GetBinary());
|
|
44
|
+
await mutate(role, '::actor::set_delegation', { cert: binv(role, cert), root_ad: binv(role, rootAd), root_profile: binv(role, profBlob), cert_v1: binv(role, certV1) });
|
|
75
45
|
}
|
|
76
46
|
|
|
77
47
|
async function main() {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
wrapper.start();
|
|
81
|
-
await sleep(1500);
|
|
48
|
+
const h = await createHarness({ brokerUrl: BROKER_URL, unitDir: UNIT_DIR, logTag: 't' });
|
|
49
|
+
({ wrapper, mutate, ro, binv, mkPacket, sleep, log } = h);
|
|
82
50
|
|
|
83
51
|
const I = mk('I'); const R = mk('R'); const F = mk('F');
|
|
84
52
|
await mkPacket(I, 'eph-t-I-01'); await mkPacket(R, 'eph-t-R-02'); await mkPacket(F, 'eph-t-F-03');
|
|
@@ -302,7 +270,7 @@ async function main() {
|
|
|
302
270
|
await mutate(I2, '::actor::import_state', adData);
|
|
303
271
|
const s10 = st(I2);
|
|
304
272
|
ok(s10.c >= 1 && s10.p >= 1, `import restored contacts + peer_ads (c=${s10.c},peer_ads=${s10.p})`);
|
|
305
|
-
ok(s10.pi === 0, `import reset pending_invites to empty (migration
|
|
273
|
+
ok(s10.pi === 0, `import reset pending_invites to empty (migration) → ${s10.pi}`);
|
|
306
274
|
ok(new RegExp(R.cid).test(lc(I2)), `imported state includes the original contact (responder)`);
|
|
307
275
|
// version-0 path: strip the stamp from a re-exported blob → still imports.
|
|
308
276
|
const exp0 = ro(I2, '::actor::export_state', undefined);
|
|
@@ -458,6 +426,280 @@ async function main() {
|
|
|
458
426
|
ok(/post-T11e-I-to-R/.test(ro(R, '::actor::list_incoming_messages', undefined).Visualize()), `channel healthy after the T11e restore race`);
|
|
459
427
|
}
|
|
460
428
|
|
|
429
|
+
// ================= V-series: versioned type registry (core 0.5.0) =========
|
|
430
|
+
// Cross-version leg-1 shapes against a 0.5.0 inviter (fresh packet pair so
|
|
431
|
+
// earlier scenarios' contacts cannot mask the registration outcomes).
|
|
432
|
+
const VI = mk('VI'); const VL = mk('VL');
|
|
433
|
+
await mkPacket(VI, 'eph-t-VI-04'); await mkPacket(VL, 'eph-t-VL-05');
|
|
434
|
+
await sleep(1200);
|
|
435
|
+
await setName(VI, 'VerInviter'); await setName(VL, 'VerLegacy');
|
|
436
|
+
const pvOf = (id, cid) => ro(id, '::actor::qa_contact_pv_of', { cid }).Reduce('pv').Visualize();
|
|
437
|
+
const capsOf = (id, cid) => ro(id, '::actor::qa_contact_pv_of', { cid }).Reduce('caps').Visualize();
|
|
438
|
+
const nameOfContact = (id, cid) => ro(id, '::actor::qa_contact_name', { cid }).Reduce('name').Visualize();
|
|
439
|
+
|
|
440
|
+
// ---------- V1 legacy v2 leg-1 (the 0.2.0 incident shape: no $name) ----------
|
|
441
|
+
CUR = 'V1 legacy-v2-leg1';
|
|
442
|
+
console.log('\n=== V1 legacy v2 leg-1 (no $name — THE incident shape) ===');
|
|
443
|
+
m = await mutate(VI, '::a2a_messaging::generate_invite', {}); // NO assigned name — the incident precondition
|
|
444
|
+
const blobV1 = Buffer.from(m.Reduce('invite').GetBinary());
|
|
445
|
+
{
|
|
446
|
+
const before = st(VI); const rejB = VI.rejects.length; const legRejB = VL.rejects.length;
|
|
447
|
+
await mutate(VL, '::actor::qa_send_versioned_leg1', { invite: binv(VL, blobV1), shape: 'v2', name: '' });
|
|
448
|
+
await sleep(4000);
|
|
449
|
+
const after = st(VI);
|
|
450
|
+
ok(VI.rejects.length === rejB, `v2 leg-1: inviter did NOT abort (no EVAL_ERROR reject) — the incident is dead`);
|
|
451
|
+
ok(after.pi === before.pi - 1, `v2 leg-1: invite consumed (pi ${before.pi}→${after.pi})`);
|
|
452
|
+
ok(after.c === before.c + 1, `v2 leg-1: responder registered as contact (c ${before.c}→${after.c})`);
|
|
453
|
+
ok(nameOfContact(VI, VL.cid) === VL.cid, `v2 leg-1: no $name → contact named by sender cid (typed v2 branch)`);
|
|
454
|
+
ok(pvOf(VI, VL.cid) === '2', `v2 leg-1: contact_pv learned as 2 (shape-inferred)`);
|
|
455
|
+
ok(VL.rejects.slice(legRejB).some((x) => /Unsolicited completion|Redemption ephemeral key/.test(x)),
|
|
456
|
+
`v2 leg-1: inviter DID send leg-3 (arrived at the emulated legacy responder)`);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// ---------- V2 legacy v3 leg-1 ($name honored) ----------
|
|
460
|
+
CUR = 'V2 legacy-v3-leg1';
|
|
461
|
+
console.log('\n=== V2 legacy v3 leg-1 ($name, no $pv) ===');
|
|
462
|
+
m = await mutate(VI, '::a2a_messaging::generate_invite', {});
|
|
463
|
+
const blobV2 = Buffer.from(m.Reduce('invite').GetBinary());
|
|
464
|
+
{
|
|
465
|
+
const rejB = VI.rejects.length;
|
|
466
|
+
await mutate(VL, '::actor::qa_send_versioned_leg1', { invite: binv(VL, blobV2), shape: 'v3', name: 'LegacyBob' });
|
|
467
|
+
await sleep(4000);
|
|
468
|
+
ok(VI.rejects.length === rejB, `v3 leg-1: no abort at inviter`);
|
|
469
|
+
ok(nameOfContact(VI, VL.cid) === 'LegacyBob', `v3 leg-1: $name honored (typed v3 branch)`);
|
|
470
|
+
ok(pvOf(VI, VL.cid) === '3', `v3 leg-1: contact_pv learned as 3 (shape-inferred)`);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// ---------- V3 v5 leg-1 ($pv stamped + $caps piggyback) ----------
|
|
474
|
+
CUR = 'V3 v5-leg1';
|
|
475
|
+
console.log('\n=== V3 v5 leg-1 ($pv + $caps) ===');
|
|
476
|
+
m = await mutate(VI, '::a2a_messaging::generate_invite', {});
|
|
477
|
+
const blobV3 = Buffer.from(m.Reduce('invite').GetBinary());
|
|
478
|
+
{
|
|
479
|
+
const rejB = VI.rejects.length;
|
|
480
|
+
await mutate(VL, '::actor::qa_send_versioned_leg1', { invite: binv(VL, blobV3), shape: 'v5', name: 'NewCarol' });
|
|
481
|
+
await sleep(4000);
|
|
482
|
+
ok(VI.rejects.length === rejB, `v5 leg-1: no abort at inviter`);
|
|
483
|
+
ok(nameOfContact(VI, VL.cid) === 'NewCarol', `v5 leg-1: $name honored (typed v5 branch)`);
|
|
484
|
+
ok(pvOf(VI, VL.cid) === '5', `v5 leg-1: contact_pv learned as 5 ($pv stamped)`);
|
|
485
|
+
ok(/core\.notifications/.test(String(capsOf(VI, VL.cid))), `v5 leg-1: piggybacked $caps learned into contact_caps`);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// ---------- V4 Additions A+B: below-floor leg-1 → error-as-data to inviter ----------
|
|
489
|
+
CUR = 'V4 too-old-leg1 (Additions A/B)';
|
|
490
|
+
console.log('\n=== V4 below-floor leg-1 ($pv=1) → inviter error-as-data, invite NOT consumed ===');
|
|
491
|
+
m = await mutate(VI, '::a2a_messaging::generate_invite', {});
|
|
492
|
+
const blobV4 = Buffer.from(m.Reduce('invite').GetBinary());
|
|
493
|
+
{
|
|
494
|
+
const before = st(VI); const rejB = VI.rejects.length; const errB = VI.errEvents.length;
|
|
495
|
+
await mutate(VL, '::actor::qa_send_versioned_leg1', { invite: binv(VL, blobV4), shape: 'too_old', name: '' });
|
|
496
|
+
await sleep(4000);
|
|
497
|
+
const after = st(VI);
|
|
498
|
+
ok(VI.rejects.length === rejB, `A: inviter did NOT abort/rollback on a below-floor peer (no reject)`);
|
|
499
|
+
const errs = VI.errEvents.slice(errB);
|
|
500
|
+
ok(errs.length === 1, `A: exactly one $protocol_error event surfaced to the inviter's client`);
|
|
501
|
+
const e = errs[0] ?? {};
|
|
502
|
+
ok(e.code === 'peer_version_unsupported', `A: error-as-data code is peer_version_unsupported (got ${e.code})`);
|
|
503
|
+
ok(e.surface === 'sir' && e.peerVersion === '1' && e.minSupported === '2',
|
|
504
|
+
`A: typed error carries surface=sir peer_version=1 min_supported=2`);
|
|
505
|
+
ok(e.context === 'invite_redeem', `B: context marks the invite second phase (invite_redeem)`);
|
|
506
|
+
ok(/An invite you created was accepted by a peer running an unsupported \(too old\) protocol version/.test(e.message)
|
|
507
|
+
&& /update their client/.test(e.message),
|
|
508
|
+
`B: inviter-facing message is the clear human-readable wording`);
|
|
509
|
+
ok(after.pi === before.pi && after.c === before.c && after.p === before.p,
|
|
510
|
+
`B: NO state consumed (invite intact, no contact registered)`);
|
|
511
|
+
// The same invite redeems fine once the peer "updates" (proves not consumed).
|
|
512
|
+
await mutate(VL, '::actor::qa_send_versioned_leg1', { invite: binv(VL, blobV4), shape: 'v3', name: 'UpdatedPeer' });
|
|
513
|
+
await sleep(4000);
|
|
514
|
+
ok(st(VI).pi === before.pi - 1, `B: SAME invite redeems after the peer updates (invite was not consumed)`);
|
|
515
|
+
ok(nameOfContact(VI, VL.cid) === 'UpdatedPeer', `B: post-update redeem registered the contact normally`);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// NOTE: V5 CAP-1 (the notify client's capability gate — notify_register denied
|
|
519
|
+
// on positive missing-cap evidence) exercises the a2a_notifications library and
|
|
520
|
+
// the alice/nsvc notify nodes, so it moved to notif.mjs with the N-series (this
|
|
521
|
+
// messaging-only unit no longer loads a2a_notifications).
|
|
522
|
+
|
|
523
|
+
// ---------- V6 $pv stamping on message traffic + passive learning ----------
|
|
524
|
+
// Uses the T1 pair (I↔R, MUTUAL contacts from the real 0.5.0 redeem): both
|
|
525
|
+
// legs of that redeem were the stamped v5 shapes, and message $targs carry
|
|
526
|
+
// $pv — so both sides must have learned dialect 5, and a fresh stamped
|
|
527
|
+
// message must deliver normally.
|
|
528
|
+
CUR = 'V6 pv-stamp';
|
|
529
|
+
console.log('\n=== V6 $pv stamp on send_message + passive learning at the receiver ===');
|
|
530
|
+
{
|
|
531
|
+
await mutate(I, '::a2a_messaging::send_message', { contact: R.cid, text: 'v5-stamped-msg' });
|
|
532
|
+
await sleep(2500);
|
|
533
|
+
ok(/v5-stamped-msg/.test(ro(R, '::actor::list_incoming_messages', undefined).Visualize()),
|
|
534
|
+
`stamped $targ delivers normally (receiver tolerant of the added $pv)`);
|
|
535
|
+
ok(pvOf(R, I.cid) === '8', `responder learned contact_pv=8 (wire-8 leg-3 + stamped messages)`);
|
|
536
|
+
ok(pvOf(I, R.cid) === '8', `inviter learned contact_pv=8 (real current-build leg-1)`);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// ---------- V7 upgrade-later + monotonic learning (owner scenario) ----------
|
|
540
|
+
// A contact was v2 at invite time (V1 proves a real v2 leg-1 learns
|
|
541
|
+
// contact_pv=2; the emulated legacy responder has no reverse channel, so that
|
|
542
|
+
// v2-era state is ARRANGED here on the channel-connected T1 pair). Then the
|
|
543
|
+
// peer "upgrades": its first v5-STAMPED ordinary message must re-learn
|
|
544
|
+
// contact_pv 2→5 through handle_receive_message (ongoing learning, not
|
|
545
|
+
// invite-time-only). Finally a stale/replayed v2-SHAPE (unstamped) legacy
|
|
546
|
+
// message must NOT downgrade the learned pv nor clobber learned v5 caps.
|
|
547
|
+
CUR = 'V7 upgrade+monotonic';
|
|
548
|
+
console.log('\n=== V7 upgrade-later re-learn + monotonic (no downgrade by legacy traffic) ===');
|
|
549
|
+
{
|
|
550
|
+
await mutate(I, '::actor::qa_set_contact_pv', { cid: R.cid, pv: 2 });
|
|
551
|
+
await mutate(I, '::actor::qa_set_contact_caps', { cid: R.cid, caps: [] }); // v2-era: nothing advertised
|
|
552
|
+
ok(pvOf(I, R.cid) === '2', `arranged: contact recorded as v2-era (the state a real v2 leg-1 yields, per V1)`);
|
|
553
|
+
// The upgrade: the peer's next ORDINARY message is v5-stamped.
|
|
554
|
+
await mutate(R, '::a2a_messaging::send_message', { contact: I.cid, text: 'post-upgrade-hello' });
|
|
555
|
+
await sleep(2500);
|
|
556
|
+
ok(/post-upgrade-hello/.test(ro(I, '::actor::list_incoming_messages', undefined).Visualize()),
|
|
557
|
+
`post-upgrade stamped message delivered`);
|
|
558
|
+
ok(pvOf(I, R.cid) === '8', `UPGRADE: first stamped ordinary message re-learned contact_pv 2→8 (ongoing learning)`);
|
|
559
|
+
// Learned v5 caps (as the next bundle exchange would set), then stale legacy traffic.
|
|
560
|
+
await mutate(I, '::actor::qa_set_contact_caps', { cid: R.cid, caps: ['core.notifications'] });
|
|
561
|
+
await mutate(R, '::actor::qa_send_legacy_message', { target: I.cid, text: 'stale-legacy-msg' });
|
|
562
|
+
await sleep(2500);
|
|
563
|
+
ok(/stale-legacy-msg/.test(ro(I, '::actor::list_incoming_messages', undefined).Visualize()),
|
|
564
|
+
`legacy (pre-wire_id, unstamped) message still delivers`);
|
|
565
|
+
ok(pvOf(I, R.cid) === '8', `MONOTONIC: unstamped v2-shape message did NOT downgrade the learned pv`);
|
|
566
|
+
ok(/core\.notifications/.test(String(capsOf(I, R.cid))),
|
|
567
|
+
`MONOTONIC: learned v5 caps NOT clobbered by legacy traffic`);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
// ================= RC-series: receipts (core 0.7.0, Rev 2 spec) ==========
|
|
571
|
+
// Uses the I/R mutual pair. Gate polarity: fail-CLOSED on unknown caps.
|
|
572
|
+
const rlog = (id) => ro(id, '::actor::qa_receipts_log', undefined).Visualize();
|
|
573
|
+
const rcount = (id) => (String(rlog(id)).match(/"kind"/g) || []).length;
|
|
574
|
+
|
|
575
|
+
CUR = 'RC1 receipts-off baseline';
|
|
576
|
+
console.log('\n=== RC1 receipts baseline (no caps → zero receipt traffic, zero failures) ===');
|
|
577
|
+
{
|
|
578
|
+
const rejI = I.rejects.length; const rejR = R.rejects.length; const c0 = rcount(I);
|
|
579
|
+
await mutate(I, '::a2a_messaging::send_message', { contact: R.cid, text: 'rc1-no-receipts' });
|
|
580
|
+
await sleep(2500);
|
|
581
|
+
ok(/rc1-no-receipts/.test(ro(R, '::actor::list_incoming_messages', undefined).Visualize()), 'RC1: message delivered');
|
|
582
|
+
ok(rcount(I) === c0, 'RC1: NO receipt emitted (peer caps absent → gate closed, the new↔old cell)');
|
|
583
|
+
ok(I.rejects.length === rejI && R.rejects.length === rejR, 'RC1: zero failures either side');
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
CUR = 'RC2 delivered receipt';
|
|
587
|
+
console.log('\n=== RC2 delivered receipt (both caps positive) ===');
|
|
588
|
+
let rcWid = '';
|
|
589
|
+
{
|
|
590
|
+
await mutate(R, '::actor::qa_init_caps', { advertise: ['core.receipts.emit', 'core.receipts.receive'] });
|
|
591
|
+
await mutate(R, '::actor::qa_set_contact_caps', { cid: I.cid, caps: ['core.receipts.receive'] });
|
|
592
|
+
const c0 = rcount(I); const rejI = I.rejects.length;
|
|
593
|
+
const sm = await mutate(I, '::a2a_messaging::send_message', { contact: R.cid, text: 'rc2-confirm-me' });
|
|
594
|
+
rcWid = sm.Reduce('wire_id').Visualize();
|
|
595
|
+
await sleep(3000);
|
|
596
|
+
ok(rcount(I) === c0 + 1, 'RC2: exactly ONE delivered receipt arrived at the sender');
|
|
597
|
+
const lg = String(rlog(I)).replace(/\s/g, '');
|
|
598
|
+
ok(lg.includes('"kind"->"delivered"'), 'RC2: receipt kind is "delivered"');
|
|
599
|
+
ok(lg.includes(rcWid), 'RC2: receipt carries the message wire_id');
|
|
600
|
+
ok(I.rejects.length === rejI, 'RC2: receipt ingest clean (no rejects at sender)');
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
CUR = 'RC3 expectation';
|
|
604
|
+
console.log('\n=== RC3 sender-side expectation (derived, unknown ≠ failed) ===');
|
|
605
|
+
{
|
|
606
|
+
await mutate(I, '::actor::qa_set_contact_caps', { cid: R.cid, caps: ['core.receipts.emit'] });
|
|
607
|
+
ok(ro(I, '::actor::qa_receipt_expectation', { cid: R.cid }).Reduce('state').Visualize() === 'expected',
|
|
608
|
+
'RC3: peer advertising emit → "expected"');
|
|
609
|
+
ok(ro(I, '::actor::qa_receipt_expectation', { cid: VL.cid }).Reduce('state').Visualize() === 'unknown',
|
|
610
|
+
'RC3: peer without emit cap → "unknown" (never failed)');
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
CUR = 'RC4 read receipt';
|
|
614
|
+
console.log('\n=== RC4 read receipt (auto on the get/mark-read path) ===');
|
|
615
|
+
{
|
|
616
|
+
const c0 = rcount(I);
|
|
617
|
+
await mutate(R, '::actor::qa_mark_read', { contact: I.cid, wire_ids: [rcWid] });
|
|
618
|
+
await sleep(2500);
|
|
619
|
+
ok(rcount(I) === c0 + 1, 'RC4: read receipt arrived');
|
|
620
|
+
ok(String(rlog(I)).replace(/\s/g, '').includes('"kind"->"read"'), 'RC4: kind is "read"');
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
CUR = 'RC5 file receipt';
|
|
624
|
+
console.log('\n=== RC5 file delivery receipt (shared wire_id namespace) ===');
|
|
625
|
+
{
|
|
626
|
+
const c0 = rcount(I);
|
|
627
|
+
const sf = await mutate(I, '::a2a_messaging::send_file',
|
|
628
|
+
{ contact: R.cid, filename: 'rc5.bin', mime: 'application/octet-stream', data: binv(I, Buffer.from('RC5')) });
|
|
629
|
+
const fwid = sf.Reduce('wire_id').Visualize();
|
|
630
|
+
await sleep(3000);
|
|
631
|
+
ok(rcount(I) === c0 + 1 && String(rlog(I)).includes(fwid), 'RC5: delivered receipt for the FILE wire_id');
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
CUR = 'RC6 emit toggle off';
|
|
635
|
+
console.log('\n=== RC6 emit toggle off (dynamic user policy) ===');
|
|
636
|
+
{
|
|
637
|
+
await mutate(R, '::actor::qa_init_caps', { advertise: ['core.receipts.receive'] }); // emit dropped
|
|
638
|
+
const c0 = rcount(I);
|
|
639
|
+
await mutate(I, '::a2a_messaging::send_message', { contact: R.cid, text: 'rc6-silent' });
|
|
640
|
+
await sleep(2500);
|
|
641
|
+
ok(/rc6-silent/.test(ro(R, '::actor::list_incoming_messages', undefined).Visualize()), 'RC6: message still delivered');
|
|
642
|
+
ok(rcount(I) === c0, 'RC6: no receipt after the emitter toggled off');
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
CUR = 'RC7 forward-compat + tolerance';
|
|
646
|
+
console.log('\n=== RC7 unknown kind + malformed shape are ignored (never load-bearing) ===');
|
|
647
|
+
{
|
|
648
|
+
const c0 = rcount(I); const rejI = I.rejects.length;
|
|
649
|
+
await mutate(R, '::actor::qa_send_raw_receipt', { target: I.cid, kind: 'typing', wire_ids: [rcWid] });
|
|
650
|
+
await sleep(2000);
|
|
651
|
+
await mutate(R, '::actor::qa_send_raw_receipt', { target: I.cid, kind: 42, wire_ids: [rcWid] });
|
|
652
|
+
await sleep(2000);
|
|
653
|
+
await mutate(R, '::actor::qa_send_raw_receipt', { target: I.cid, kind: 'delivered', wire_ids: 'not-a-list' });
|
|
654
|
+
await sleep(2000);
|
|
655
|
+
ok(rcount(I) === c0, 'RC7: unknown kind / mistyped kind / scalar wire_ids — nothing reached the hook');
|
|
656
|
+
ok(I.rejects.length === rejI, 'RC7: and nothing aborted (ignore-success, forward-compat)');
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
CUR = 'RC8 stale-caps self-heal';
|
|
660
|
+
console.log('\n=== RC8 hybrid gate: stale caps + learned pv>=7 → receipts fire (the upgrade fix) ===');
|
|
661
|
+
{
|
|
662
|
+
await mutate(R, '::actor::qa_init_caps', { advertise: ['core.receipts.emit', 'core.receipts.receive'] });
|
|
663
|
+
await mutate(R, '::actor::qa_set_contact_caps', { cid: I.cid, caps: ['core.notifications'] }); // stale pre-receipts caps (no opinion)
|
|
664
|
+
await mutate(R, '::actor::qa_set_contact_pv', { cid: I.cid, pv: 7 });
|
|
665
|
+
const c0 = rcount(I);
|
|
666
|
+
await mutate(I, '::a2a_messaging::send_message', { contact: R.cid, text: 'rc8-selfheal' });
|
|
667
|
+
await sleep(3000);
|
|
668
|
+
ok(rcount(I) === c0 + 1, 'RC8: delivered receipt fired despite stale caps (pv>=7 implied receive)');
|
|
669
|
+
await mutate(I, '::actor::qa_set_contact_caps', { cid: R.cid, caps: [] });
|
|
670
|
+
await mutate(I, '::actor::qa_set_contact_pv', { cid: R.cid, pv: 7 });
|
|
671
|
+
ok(ro(I, '::actor::qa_receipt_expectation', { cid: R.cid }).Reduce('state').Visualize() === 'expected',
|
|
672
|
+
'RC8: expectation = expected via pv>=7 (caps silent)');
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
CUR = 'RC9 explicit opt-out';
|
|
676
|
+
console.log('\n=== RC9 hybrid gate: caps WITH receipts opinion but no receive → strict opt-out ===');
|
|
677
|
+
{
|
|
678
|
+
await mutate(R, '::actor::qa_set_contact_caps', { cid: I.cid, caps: ['core.receipts.emit'] }); // opinion, no receive
|
|
679
|
+
await mutate(R, '::actor::qa_set_contact_pv', { cid: I.cid, pv: 7 });
|
|
680
|
+
const c0 = rcount(I);
|
|
681
|
+
await mutate(I, '::a2a_messaging::send_message', { contact: R.cid, text: 'rc9-optout' });
|
|
682
|
+
await sleep(2500);
|
|
683
|
+
ok(rcount(I) === c0, 'RC9: NO receipt — explicit caps opinion without receive wins over pv (opt-out respected)');
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
CUR = 'RC10 old peer stays silent';
|
|
687
|
+
console.log('\n=== RC10 hybrid gate: no caps opinion + pv 5 (old peer) → silent ===');
|
|
688
|
+
{
|
|
689
|
+
await mutate(R, '::actor::qa_set_contact_caps', { cid: I.cid, caps: [] });
|
|
690
|
+
const c0 = rcount(I);
|
|
691
|
+
// the OLD peer's message must itself carry the old dialect: the receiver
|
|
692
|
+
// learns pv from THIS message before gating (that's the self-heal), so a
|
|
693
|
+
// current-build send_message (stamps 7) cannot emulate a pv-5 peer.
|
|
694
|
+
await mutate(I, '::actor::qa_send_stamped_message', { target: R.cid, text: 'rc10-oldpeer', pv: 5, wire_id: 'rc10-w1' });
|
|
695
|
+
await sleep(2500);
|
|
696
|
+
ok(rcount(I) === c0, 'RC10: NO receipt toward a pv-5 peer (old clients stay silent, zero noise)');
|
|
697
|
+
await mutate(I, '::actor::qa_set_contact_caps', { cid: R.cid, caps: [] });
|
|
698
|
+
await mutate(I, '::actor::qa_set_contact_pv', { cid: R.cid, pv: 5 });
|
|
699
|
+
ok(ro(I, '::actor::qa_receipt_expectation', { cid: R.cid }).Reduce('state').Visualize() === 'unknown',
|
|
700
|
+
'RC10: expectation = unknown toward a pv-5 peer');
|
|
701
|
+
}
|
|
702
|
+
|
|
461
703
|
console.log('\n================ SCORECARD ================');
|
|
462
704
|
if (scorecard.length === 0) console.log('ALL TESTS PASSED');
|
|
463
705
|
else { console.log(`${scorecard.length} FAILURE(S):`); scorecard.forEach((s) => console.log(' ' + s)); }
|