npm notice run @mosaic/business@0.1.0 test
npm notice run node --test tests/
✔ the role file loads and resolves through loadBusiness (9.182992ms)
✔ the shipped file is exactly the approved list (1.152574ms)
✔ the assistant's authority is message.send and record.write within role (2.977925ms)
✔ the assistant talks to the user and the chief of staff only, and no other shipped role is limited (0.968134ms)
✔ a business grant through limits does not widen the role (2.169662ms)
✔ a launch block whose by is the assistant is refused (2.679489ms)
✔ the instance takes no credential references and no tracker (3.774824ms)
✔ an arbiter whose role definition declares messaging lists is refused, for each kind (4.851884ms)
✔ an arbiter without messaging lists is accepted beside the limited assistant (2.066296ms)
✔ the contract passes work to the chief of staff and directs no one (0.61057ms)
✔ REQ-HARN-2: the assistant holds the web grant, and no other role file does (4.467397ms)
✔ config directory and file path follow MOSAIC_CONFIG (2.307066ms)
✔ the fixture business validates and comes back frozen (11.974391ms)
✔ two instances may share a definition (3.442413ms)
✔ top-level refusals (8.884424ms)
✔ arbiters and projects (10.299561ms)
✔ role instances (5.523865ms)
✔ Vikunja bots (8.624167ms)
✔ a role without Vikunja takes no tracker block (2.286207ms)
✔ credential references match the definition's services (2.520946ms)
✔ launch (8.557491ms)
✔ REQ-THREAD-2 REQ-LAUNCH-1 launch.threadIdleSeconds: absent is the default, a positive integer is used, anything else refuses (4.015711ms)
✔ loadBusiness: file checks (2.672263ms)
✔ loadBusiness: not a regular file (37.162926ms)
✔ loading writes nothing (1.07061ms)
✔ names that are Object.prototype properties don't count as declared (2.87897ms)
✔ the shipped example refuses as written and validates once filled in (0.767844ms)
✔ the role file loads and resolves through loadBusiness (11.492997ms)
✔ the shipped file is exactly the approved list (0.444023ms)
✔ the resolved record matches the approved list, so a widened file fails (3.128816ms)
✔ the chief of staff holds role.launch, message.send, role.end, organization.change and record.write; every other action is gated (2.801299ms)
✔ the pm does not hold role.launch (2.521604ms)
✔ a business grant of a gated action through limits does not widen the role (2.688532ms)
✔ a limit that drops role.launch leaves the chief of staff with no launch block (1.923605ms)
✔ a launch block whose by is the pm instance is refused (2.348896ms)
✔ the contract names no duty to talk to the human and the pm contract no launch (0.436535ms)
✔ the instance takes no credential references and no tracker (3.435653ms)
✔ usage errors exit 4 (295.488364ms)
✔ validate: a good business exits 0 and prints instance digests (60.7352ms)
✔ validate: project files (314.530158ms)
✔ validate: missing files and a broken system config (218.418175ms)
✔ validate: credential reference problems exit 2 and name each one (63.122562ms)
✔ validate: a token file inside the repository is refused (70.411519ms)
✖ validate: role definitions come from MOSAIC_ROLES_DIR (205.411846ms)
✔ resolve: prints one instance's record (292.246308ms)
✔ resolve: refusals (408.099272ms)
✔ parse: exactly one of file or env, plus the service's date (3.748124ms)
✔ check: a good file has no problems (1.130474ms)
✔ check never opens the file: a write-only token passes (0.686343ms)
✔ check: file problems (1.7551ms)
✔ check: token files can't live in the repository or dataRoot, even through a linked directory (1.159406ms)
✔ check: dates and environment references (0.622726ms)
✔ each definition loads, with a contract file, and is exactly the approved list (5.14694ms)
✔ an organization file that declares them passes, and each resolves to least privilege (9.085095ms)
✔ the chief of staff launches each one; no other role does (4.212439ms)
✔ a C-suite role can't be made the launcher: launch.by must hold role.launch (3.711809ms)
✔ limits can narrow a C-suite role but never widen it (2.804768ms)
✔ any unknown key, tool, action or version in a role file is refused (1.114697ms)
✔ REQ-WAIT-1: GATED_ONLY is exactly the hard waits; the new actions are in the vocabulary (2.701303ms)
✔ REQ-WAIT-3: every action is routed or a hard wait, never both, and the routed list names only actions (1.04501ms)
✖ REQ-WAIT-2: a role listing a hard wait at either class is refused; the actions that left can be granted (3.8427ms)
✔ REQ-LIMIT-1 schema: every scope unset or zero, adjustable above four, bad values and unknown models refuse (20.622251ms)
✔ REQ-LIMIT-1 counts each exact scope at/over limit, unlimited and old tuple after model reassignment (1.118047ms)
✔ REQ-ROLE-3 writer: atomic validated revision, immutable previous bytes and authenticated actor/old/new receipt (256.939708ms)
✔ REQ-ROLE-3 writer: pre-rename fault leaves old file, post-rename recovery records commit, conflicting recovery refuses (268.325082ms)
✔ REQ-LIMIT-1 / decision145 migration prints only, preserves values, rejects ambiguity, and is idempotent (2.972161ms)
✔ REQ-LIMIT-1 shared settings validates the complete proposed selection and logs exact actor (231.086199ms)
✔ REQ-LIMIT-1 provider is table data: another provider routes separately and aliases share exact counts (1.767747ms)
✔ REQ-ROLE-3 refuses live writer locks, symlink targets and uncertain recovery without changing bytes (144.24011ms)
✔ REQ-PLUG-1 schema: plugins is optional, names known kinds and checked module names (18.763876ms)
✔ REQ-PLUG-1 REQ-ROLE-3 the setter writes plugins through the organization writer and logs old and new names (286.192557ms)
✔ vikunja:19/309 a patch changes only the kinds it names; null removes one kind, explicitly and in the trail (432.920012ms)
✔ vikunja:19/309 an unknown kind (set or removed), a bad module, an empty patch and null on the wrong shape are refused, nothing written (1.522601ms)
✔ REQ-PLUG-1 REQ-ROLE-3 the writer checks the bytes it writes: a Date in plugins is refused there too (35.549874ms)
✔ REQ-PLUG-1 REQ-ROLE-3 a refused setter write throws a code, changes nothing and logs nothing (1.460305ms)
✔ vikunja:19/305 with an exists check, the setter refuses a module no tree file answers to, before anything is written (118.100792ms)
✔ optional project repo is preserved and must be a normalized absolute path (14.705191ms)
✔ loaded business project repo cannot be nested in any declared code checkout (4.211096ms)
✔ path and load (3.257977ms)
✔ refusals (1.908847ms)
✔ record.write is within-role for the eleven approved v2 agents, never gated-only (7.274862ms)
✔ systemVars flattens the validated config (2.094836ms)
✔ precedence: system, business, project, project role, agent (5.988353ms)
✔ limits narrow the definition and never widen it (2.285408ms)
✔ role.launch stays within-role only for the instance the launch block names (4.910713ms)
✔ limits.authority without role.launch leaves the launcher with no launch block (2.228051ms)
✔ limits.authority narrows cross-role actions too (1.052243ms)
✔ classify (1.100298ms)
✔ the record carries what the broker and launcher need (1.174469ms)
✔ digest: key order doesn't matter, any value change does (9.318176ms)
✔ refusals (2.025622ms)
✔ the four shipped version 2 roles load (3.517722ms)
✔ shipped role scopes match addendum B section 2 and the SR runbook (0.965816ms)
✔ shipped authority follows the note's table (0.678908ms)
✔ every role file in roles/ loads through the validator, and a v2 contract exists (1.134579ms)
✔ version 1 files keep loading with no authority (0.863968ms)
✔ the conductor policy isn't a role (0.177668ms)
✔ a missing role file is exit 4, a symbolic link too (0.3644ms)
✔ version 2 refusals (1.251328ms)
✖ authority: closed vocabulary, no gated-only action, no overlap (0.851276ms)
✔ messaging: optional, role definitions and human, never the tester (1.857997ms)
✔ credentials: Gitea scopes (0.705841ms)
✔ credentials: Vikunja scopes are a group-to-verbs map from the grantable list (1.373919ms)
✔ credentials: services (0.483228ms)
✔ contract: a non-empty regular Markdown file beside the role file (0.659945ms)
✔ every key names known layers and a merge rule (1.295719ms)
✔ unknown keys and wrong layers refuse (0.806985ms)
✔ types (2.157826ms)
✔ merge: defaults, then the most specific layer wins (0.385441ms)
✔ merge: limits only narrow, and provenance lists each source (0.587947ms)
✔ merge doesn't change its inputs (0.156159ms)
✔ web.searxng takes https anywhere and http on loopback, so Jason's 127.0.0.1:8888 passes (0.214077ms)
ℹ tests 112
ℹ suites 0
ℹ pass 109
ℹ fail 3
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 2006.532699

✖ failing tests:

test at tests/cli.test.mjs:109:1
✖ validate: role definitions come from MOSAIC_ROLES_DIR (205.411846ms)
  AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
  
  0 !== 2
  
      at TestContext.<anonymous> (file:///home/jwoltje/dewey-scratch/r139/wt/packages/business/tests/cli.test.mjs:122:10)
      at Test.runInAsyncScope (node:async_hooks:226:14)
      at Test.run (node:internal/test_runner/test:1402:25)
      at Test.processPendingSubtests (node:internal/test_runner/test:974:18)
      at Test.postRun (node:internal/test_runner/test:1542:19)
      at Test.run (node:internal/test_runner/test:1467:12)
      at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {
    generatedMessage: true,
    code: 'ERR_ASSERTION',
    actual: 0,
    expected: 2,
    operator: 'strictEqual',
    diff: 'simple'
  }

test at tests/hard-waits.test.mjs:33:1
✖ REQ-WAIT-2: a role listing a hard wait at either class is refused; the actions that left can be granted (3.8427ms)
  AssertionError [ERR_ASSERTION]: Missing expected exception: spend
      at TestContext.<anonymous> (file:///home/jwoltje/dewey-scratch/r139/wt/packages/business/tests/hard-waits.test.mjs:35:12)
      at Test.runInAsyncScope (node:async_hooks:226:14)
      at Test.run (node:internal/test_runner/test:1402:25)
      at Test.processPendingSubtests (node:internal/test_runner/test:974:18)
      at Test.postRun (node:internal/test_runner/test:1542:19)
      at Test.run (node:internal/test_runner/test:1467:12)
      at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {
    generatedMessage: false,
    code: 'ERR_ASSERTION',
    actual: undefined,
    expected: /always gated/,
    operator: 'throws',
    diff: 'simple'
  }

test at tests/role.test.mjs:126:1
✖ authority: closed vocabulary, no gated-only action, no overlap (0.851276ms)
  AssertionError [ERR_ASSERTION]: Missing expected exception.
      at refuses (file:///home/jwoltje/dewey-scratch/r139/wt/packages/business/tests/role.test.mjs:9:10)
      at TestContext.<anonymous> (file:///home/jwoltje/dewey-scratch/r139/wt/packages/business/tests/role.test.mjs:129:5)
      at Test.runInAsyncScope (node:async_hooks:226:14)
      at Test.run (node:internal/test_runner/test:1402:25)
      at Test.processPendingSubtests (node:internal/test_runner/test:974:18)
      at Test.postRun (node:internal/test_runner/test:1542:19)
      at Test.run (node:internal/test_runner/test:1467:12)
      at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {
    generatedMessage: false,
    code: 'ERR_ASSERTION',
    actual: undefined,
    operator: 'throws',
    diff: 'simple'
  }
