MAS-WP-0009 T01: independent JS implementation (impl/js), differential test, SCP-9
impl/js (Node, zero deps, written from the specs): parser, v0.2
statute-aware rules, signing, outside master. Passes addresses.json,
statute-aware.json and auth.json unchanged; its master passes the 11
slave-setup mode flows against the Python email side (ExternalMaster).
Differential testing vs mas_core found two unstated stand-in rules, now
SCP-9 in the v0.2 draft with fixtures si-011..013, dt-109; ABNF comments
no longer say v0.1. Runner: external masters, step errors fail the flow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 5787@bnt-lap001
Assistant-Session: 5db26b82-138b-40cc-9856-4d5eb0f752fd
2026-10-19 13:22:22 +02:00
|
|
|
|
"""The independent JS implementation (impl/js, MAS-WP-0009), where node is available."""
|
|
|
|
|
|
import shutil
|
|
|
|
|
|
import subprocess
|
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
pytestmark = pytest.mark.skipif(not shutil.which("node"), reason="node not available")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_js_passes_the_bundles_unchanged():
|
|
|
|
|
|
# addresses.json, statute-aware.json and auth.json, read from the bundles in place
|
|
|
|
|
|
proc = subprocess.run(["node", "--test"], cwd=ROOT / "impl/js", capture_output=True, text=True)
|
|
|
|
|
|
assert proc.returncode == 0, proc.stdout[-2000:] + proc.stderr[-2000:]
|
|
|
|
|
|
assert "# fail 0" in proc.stdout or "ℹ fail 0" in proc.stdout
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_js_outside_master_passes_the_slave_flows():
|
|
|
|
|
|
from mas_modes.external import ExternalMaster
|
|
|
|
|
|
from mas_modes.runner import run_mode_corpus
|
|
|
|
|
|
rep = run_mode_corpus(master_factory=ExternalMaster.js, roles=("slave",))
|
|
|
|
|
|
assert rep.ok, rep.failures
|
MAS-WP-0014 T01: independent JS email side for mode contract v0.1; MCP-1..6; flow a-008
impl/js/src/email.mjs (written from CONTRACT.md + FLOWS.md): both roles,
case store, handoffs, timeouts, one-cap outbox with holding, authorization.
Passes all 22 flows from the bundle; with the JS master all 12 slave
flows (no Python contract party). Writing it found six contract gaps,
folded into the draft as MCP-1..6 (acknowledgement, details convention,
resume names the outcome, opaque case key, error table, transfer
reporting); flows now check outcome tokens, not reference prose. A
mutation check found a missing flow: a-008 (per-type master check).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 5787@bnt-lap001
Assistant-Session: 5db26b82-138b-40cc-9856-4d5eb0f752fd
2026-10-19 13:56:53 +02:00
|
|
|
|
assert rep.passed == 12
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_js_email_side_passes_every_flow():
|
|
|
|
|
|
from mas_modes.external import ExternalEmail
|
|
|
|
|
|
from mas_modes.runner import run_mode_corpus
|
|
|
|
|
|
rep = run_mode_corpus(email_factory=ExternalEmail.js)
|
|
|
|
|
|
assert rep.ok, rep.failures
|
|
|
|
|
|
assert rep.passed == 22
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_js_email_and_js_master_together():
|
|
|
|
|
|
# Neither contract party is Python: only the gateway and the callback stub are.
|
|
|
|
|
|
from mas_modes.external import ExternalEmail, ExternalMaster
|
|
|
|
|
|
from mas_modes.runner import run_mode_corpus
|
|
|
|
|
|
rep = run_mode_corpus(email_factory=ExternalEmail.js, master_factory=ExternalMaster.js, roles=("slave",))
|
|
|
|
|
|
assert rep.ok, rep.failures
|
|
|
|
|
|
assert rep.passed == 12
|