taskforce-loop-engineering 0.16.2 → 0.16.3

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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.16.3 - 2026-10-27
6
+
7
+ - Preserve task-scoped human-input gates during reconciliation; keep task acceptance distinct from project completion and unresolved authority blockers.
8
+ - Improve English/Chinese scope inference for coordinated negation, neither/nor, double negatives and unrelated negative context, with paired bounded-task/project regressions. Scope inference remains heuristic.
9
+ - Add opt-in Linux frozen-input verification using Python, bubblewrap and strace with PID-namespace decoding: declared inputs, preserved executable modes, host-owned traces and receipts, and no nonisolated fallback.
10
+ - Audit failed path probes with raw traversal semantics, traced cwd/process inheritance and proven procfs self aliases. Unknown process/fd aliases and unresolved internal symlinks fail closed; this can reject legitimate optional accesses and is not unrestricted syscall emulation.
11
+ - Publish updated repository skill references for scope/gates, isolated verification, runtime requirements and evidence boundaries. Publication does not upgrade existing CLI installations or generated integrations.
12
+
5
13
  ## 0.16.2 - 2026-10-24
6
14
 
7
15
  - Discover OpenClaw diagnostic channel/account pairs from the selected CLI, with explicit source channel, account and target filters. Doctor covers all matching accounts; smoke covers one source per run.
package/README.md CHANGED
@@ -1103,6 +1103,10 @@ commands. It records the branch, worktree path, verification results, `git
1103
1103
  status --short`, `git diff --stat`, and `git diff --name-status` in the run
1104
1104
  artifact, plus untracked file names.
1105
1105
 
1106
+ On Linux, code queues can opt into frozen-input, fail-closed verification via
1107
+ `worktree.isolatedVerification`. See [isolated verification](docs/isolated-verification.md)
1108
+ for the input contract, host requirements, receipt rules, and limits.
1109
+
1106
1110
  Create a starter config:
1107
1111
 
1108
1112
  ```bash
@@ -0,0 +1,81 @@
1
+ # Isolated verification for code queues
2
+
3
+ Linux code queues can opt into fail-closed verification by adding
4
+ `worktree.isolatedVerification` beside `worktree.verifyCommands`:
5
+
6
+ ```json
7
+ {
8
+ "worktree": {
9
+ "enabled": true,
10
+ "verifyCommands": ["python3 -m unittest discover -s tests"],
11
+ "isolatedVerification": {
12
+ "inputs": ["src", "tests", "pyproject.toml"],
13
+ "runtimeFiles": []
14
+ }
15
+ }
16
+ }
17
+ ```
18
+
19
+ `inputs` are exact project files or recursive directories. They are frozen into
20
+ a private read-only snapshot with file permission bits preserved. Input identity
21
+ includes file content, size, and permission bits, so mode-only changes invalidate
22
+ the stability checks and change the digest; symlinks, missing paths, and special files fail
23
+ closed. Do not list generated output directories. Commands run from `/work`,
24
+ with `/out` as their only persistent writable output. The environment has no
25
+ inherited proxy, `NODE_OPTIONS`, home directory, or network access. The host
26
+ must have `python3`, `bwrap`, and `strace`; no nonisolated fallback exists.
27
+
28
+ `runtimeFiles` is an optional list of exact regular files under `/home` or `/opt` (for
29
+ example, a user-local Node binary). Each is mounted read-only at its original
30
+ path and hashed before and after execution. System files under `/usr`, `/bin`,
31
+ `/lib`, `/lib64`, and `/etc` are mounted read-only by the backend. Directory
32
+ toolchains, browser profiles, Docker, Git replay, and networked gates are not
33
+ supported by this generic backend. Use a separately reviewed project-specific
34
+ gate for those, and do not mark its result as this backend's receipt.
35
+
36
+ Each command gets a fresh, unguessable evidence directory containing the input
37
+ snapshot, host-owned trace, output, logs, and `terminal.json`. Loop accepts a
38
+ verification only when its process exits zero **and** the receipt proves a
39
+ zero-exit command, declared reads, unchanged source/snapshot/tool files, and
40
+ process-group cleanup. All commands in one verification group must share the
41
+ same input digest. Failed file accesses are checked against the recorded working
42
+ directory or directory descriptor, including nested paths and resumed calls.
43
+ Swallowing a missing undeclared input error does not make verification pass.
44
+ Missing, malformed, stale, or red receipts fail verification.
45
+ The queue run records the evidence directory and digest in its verification
46
+ artifact. `code-task-run` repeats isolated verification after applying a
47
+ reviewed patch; its evidence lives beside the project root in
48
+ `.loop-isolation-evidence/<task-id>/`.
49
+
50
+ This is a verification backend, not an automatic project dependency inventory
51
+ or a substitute for independent acceptance review. Each project must declare
52
+ its inputs and prove its dynamic dependencies with a real command and negative
53
+ control before making isolation mandatory for that queue.
54
+
55
+ ### File trace compatibility
56
+
57
+ The host strace must support `--decode-pids=pidns`; unavailable support fails
58
+ closed. The supervisor traces process creation, chdir and fchdir as well as file
59
+ syscalls, to resolve relative access/exec probes across child processes and PID
60
+ namespaces. C byte escapes (including octal UTF-8 filenames) are decoded;
61
+ truncated or unresolved failed paths are rejected. Genuinely absent optional
62
+ files are allowed; existing undeclared source paths remain rejected even when
63
+ the verification command swallows the error. Snapshot ancestor directories are
64
+ readable because they contain only the frozen declared descendants.
65
+
66
+ Failed project-path probes retain their original components for source availability checks: a missing or non-directory ancestor before `..` is not collapsed into an available input. Reachable parent-relative undeclared inputs still fail verification.
67
+
68
+
69
+ Failed project-path attempts are walked component by component in the sandbox
70
+ namespace before mapping `/work` to the source. Re-entering `/work` through `..`
71
+ and repeated leading slashes cannot bypass undeclared-input auditing. Missing,
72
+ non-directory, and trailing-slash components retain kernel traversal semantics.
73
+ The supervisor models its explicit mount roots and runtime-file ancestors;
74
+ unresolved traversal through dynamic external mounts or symlink ancestors fails
75
+ closed. This is bounded trace auditing, not unrestricted syscall emulation.
76
+
77
+ Failed `/proc/self/cwd`, `/proc/thread-self/cwd` and self `root` probes are
78
+ resolved using the traced process cwd or the sandbox root before source-input
79
+ auditing. Raw suffix components are retained. Unresolved process/fd aliases
80
+ (including `/dev/fd`) fail closed; optional accesses via unknown dynamic aliases
81
+ may therefore be rejected. This does not claim general procfs emulation.
package/lib/core.mjs CHANGED
@@ -9,6 +9,7 @@ import { createHash, randomUUID } from 'node:crypto';
9
9
  import { contextPolicy, contextRotation, readBoundedJson, validHandoff, handoffCheckpoint } from './context-budget.mjs';
10
10
  import { listSteps } from './execution-ledger.mjs';
11
11
  import { readAndVerifyEvidence } from './production-evidence.mjs';
12
+ import { validateIsolatedVerification, runIsolatedVerification, isolatedEvidenceDir } from './isolated-verification.mjs';
12
13
 
13
14
  export const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
14
15
 
@@ -1335,7 +1336,12 @@ async function gateProjectMetadata(root, task, checkpoint) {
1335
1336
  }
1336
1337
 
1337
1338
  function gateInvalidity(gate, spec) {
1338
- if (!spec) return { code: 'project_not_found', status: 'superseded' };
1339
+ // Human-input gates may be task-scoped and intentionally have no project
1340
+ // binding. Project reconciliation must leave those gates alone; only a gate
1341
+ // that explicitly names a missing project is stale project state.
1342
+ if (!spec) return gate.project_id
1343
+ ? { code: 'project_not_found', status: 'superseded' }
1344
+ : null;
1339
1345
  const backlog = new Map((spec.backlog ?? []).map((item) => [String(item.id), item]));
1340
1346
  for (const id of gate.requirement_ids ?? []) {
1341
1347
  const requirement = backlog.get(String(id));
@@ -3469,7 +3475,36 @@ export function inferTaskScope(task) {
3469
3475
  // win; otherwise phrases such as "do not call the overall project complete"
3470
3476
  // incorrectly turn an accepted milestone into an endlessly requeued project
3471
3477
  // task.
3472
- const boundedMilestone = /(?:only|仅|只)(?:推进|处理|执行|完成|验证)|阶段完成|任务完成|第\s*\d+\s*(?:项|步)|选项\s*\d+|boundary item|backlog item|(?:取消|撤销|移除).{0,40}(?:功能|范围|计划|必做|门槛)|(?:cancel|remove|drop|withdraw).{0,40}(?:feature|scope|requirement|backlog item|completion gate)|(?:product[-_ ]scope|产品范围).{0,20}(?:decision|amendment|决策|修订)/.test(requestText);
3478
+ // Apply the same object-local negation rule to EVERY local-scope cue.
3479
+ // Removing a negated cue also prevents a nested cue ("backlog item" or
3480
+ // "第一步") from overriding the project objective.
3481
+ const cue = /有界.{0,20}?里程碑|bounded.{0,30}?milestone|(?:only\s*|仅|只)(?:推进|处理|执行|完成|验证)|阶段完成|任务完成|第\s*(?:\d+|一)\s*(?:项|步)|选项\s*\d+|boundary item|backlog item|(?:取消|撤销|移除).{0,40}(?:功能|范围|计划|必做|门槛)|(?:cancel|remove|drop|withdraw).{0,40}(?:feature|scope|requirement|backlog item|completion gate)|(?:product[-_ ]scope|产品范围).{0,20}(?:decision|amendment|决策|修订)/g;
3482
+ // Negation governs the following object phrase, including arbitrary modifiers.
3483
+ // End its scope at clause/contrast boundaries or an explicit context object,
3484
+ // not at a whitelist of adjectives (first/initial/one/etc.). Coordinated
3485
+ // comma + or/and phrases share the governing negation.
3486
+ const negatedPrefix = (prefix) => {
3487
+ // Explicit double-negative obligations are affirmative. Do not count every
3488
+ // negative word: unrelated prohibitions can coexist in the same clause.
3489
+ prefix = prefix.replace(/(?:\b(?:not|never)|n['’]t)\s+(?:fail\s+to|avoid(?:\s+doing)?)\b|\bwithout\s+failing\s+to\b|(?:不能不|不得不|不是不)/g, ' ');
3490
+ const negations = [...prefix.matchAll(/(?:不|勿|别)|\b(?:not|never|no|without|neither|nor)\b|n['’]t\b/g)];
3491
+ if (!negations.length) return false;
3492
+ const tail = prefix.slice(negations.at(-1).index);
3493
+ // These boundaries introduce a separate affirmative instruction after a
3494
+ // negated context, e.g. without deploying the project ... implement X.
3495
+ return !/(?:project[-_ ]level\b[^,;.!?]*\b(?:implement|complete|do|execute)\b)|(?:前提下|情况下)|,\s*(?:and|or)\s+(?:implement|complete|execute|do)\b|\bwithout\s+\w+ing\b[^,;.!?]*\b(?:implement|complete|execute|do)\b|\b(?:while|then|however|instead)\b/.test(tail);
3496
+ };
3497
+ const boundedMilestone = requestText.split(/[,,](?!\s*(?:or\b|and\b|nor\b|或|以及))|[。;;.!?\n]|\bbut\b|而是|但是/).some((clause) => {
3498
+ let prefix = '';
3499
+ let offset = 0;
3500
+ for (const match of clause.matchAll(cue)) {
3501
+ prefix += clause.slice(offset, match.index);
3502
+ if (!negatedPrefix(prefix)) return true;
3503
+ // Keep the governing negation for coordinated/nested local cues.
3504
+ offset = match.index + match[0].length;
3505
+ }
3506
+ return false;
3507
+ });
3473
3508
  if (boundedMilestone) return 'scoped_task';
3474
3509
  return /project[-_ ]level|项目级|完整项目|整体项目|single milestone|单(?:一)?里程碑/.test(requestText)
3475
3510
  ? 'project'
@@ -5212,6 +5247,10 @@ function validateWorktreeConfig(worktree) {
5212
5247
  throw new Error('worktree.verifyCommands must be an array of non-empty strings.');
5213
5248
  }
5214
5249
  }
5250
+ validateIsolatedVerification(worktree.isolatedVerification);
5251
+ if (worktree.isolatedVerification && !worktree.verifyCommands?.length) {
5252
+ throw new Error('worktree.isolatedVerification requires verifyCommands.');
5253
+ }
5215
5254
  }
5216
5255
 
5217
5256
  function validateRetryConfig(retry) {
@@ -8002,7 +8041,11 @@ export async function codeTaskRun(root, queue, options = {}) {
8002
8041
  root,
8003
8042
  options.timeoutMs ?? options.config?.timeoutMs,
8004
8043
  progress,
8005
- 'final-verification'
8044
+ 'final-verification',
8045
+ options.config?.worktree?.isolatedVerification ? {
8046
+ ...options.config.worktree.isolatedVerification,
8047
+ evidenceBase: path.join(path.dirname(root), '.loop-isolation-evidence', taskId)
8048
+ } : null
8006
8049
  );
8007
8050
  finalVerification.ok = finalVerification.commands.every((entry) => entry.result.exitCode === 0);
8008
8051
  finalVerification.status = finalVerification.ok ? 'passed' : 'failed';
@@ -9849,9 +9892,10 @@ async function inspectWorktree(worktree) {
9849
9892
  };
9850
9893
  }
9851
9894
 
9852
- async function runVerifyCommands(commands, cwd, timeoutMs, progress = null, phase = 'verification') {
9895
+ async function runVerifyCommands(commands, cwd, timeoutMs, progress = null, phase = 'verification', isolation = null) {
9853
9896
  const results = [];
9854
9897
  const list = commands ?? [];
9898
+ let sharedInputDigest = null;
9855
9899
  for (let index = 0; index < list.length; index++) {
9856
9900
  const cmd = list[index];
9857
9901
  progress?.emit(phase, 'running', `Running verification ${index + 1}/${list.length}`, {
@@ -9860,12 +9904,24 @@ async function runVerifyCommands(commands, cwd, timeoutMs, progress = null, phas
9860
9904
  cmd
9861
9905
  });
9862
9906
  const startedAt = new Date().toISOString();
9863
- const result = await runCommand(cmd, { cwd, timeoutMs });
9907
+ const result = isolation ? await runIsolatedVerification({ cwd, command: cmd,
9908
+ inputs: isolation.inputs, runtimeFiles: isolation.runtimeFiles,
9909
+ evidenceDir: isolatedEvidenceDir(isolation.evidenceBase, index),
9910
+ timeoutMs, runCommand, shellQuote }) : await runCommand(cmd, { cwd, timeoutMs });
9911
+ if (isolation && result.exitCode === 0) {
9912
+ if (sharedInputDigest !== null && sharedInputDigest !== result.isolation.inputDigest) {
9913
+ result.exitCode = 1;
9914
+ result.isolation.status = 'failed_or_unknown';
9915
+ result.isolation.reason = 'verification input digest changed between commands';
9916
+ } else {
9917
+ sharedInputDigest = result.isolation.inputDigest;
9918
+ }
9919
+ }
9864
9920
  results.push({
9865
9921
  cmd,
9866
9922
  startedAt,
9867
9923
  finishedAt: new Date().toISOString(),
9868
- result: compactCommandResult(result)
9924
+ result: { ...compactCommandResult(result), ...(result.isolation ? { isolation: result.isolation } : {}) }
9869
9925
  });
9870
9926
  progress?.emit(phase, result.exitCode === 0 ? 'passed' : 'failed', `Verification ${index + 1}/${list.length} exited ${result.exitCode}`, {
9871
9927
  commandIndex: index + 1,
@@ -10172,7 +10228,11 @@ export async function runQueueOnce(root, options) {
10172
10228
  const recoveryMax = Number(options.retry?.runtimeRecoveryMaxAttempts ?? 2);
10173
10229
  finalStatus = recoveryCount < recoveryMax ? 'runtime_interrupted' : 'runtime_blocked';
10174
10230
  } else if (dispatch?.exitCode === 0 && worktreeEnabled(options)) {
10175
- verification = await runVerifyCommands(options.worktree?.verifyCommands ?? [], worktree.path, timeoutMs, progress);
10231
+ verification = await runVerifyCommands(options.worktree?.verifyCommands ?? [], worktree.path, timeoutMs, progress,
10232
+ 'verification', options.worktree?.isolatedVerification ? {
10233
+ ...options.worktree.isolatedVerification,
10234
+ evidenceBase: path.join(taskRuntimeDirFor(root, queue, task.id), 'verification-evidence')
10235
+ } : null);
10176
10236
  const verifyOk = verification.every((entry) => entry.result.exitCode === 0);
10177
10237
  finalStatus = verifyOk ? 'completed' : 'verify_failed';
10178
10238
  } else {
@@ -0,0 +1,47 @@
1
+ import { createHash, randomUUID } from 'node:crypto';
2
+ import { readFile } from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+
6
+ const runner = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../scripts/isolated-verify.py');
7
+
8
+ export function validateIsolatedVerification(config) {
9
+ if (config === undefined) return;
10
+ if (!config || typeof config !== 'object' || Array.isArray(config) ||
11
+ !Array.isArray(config.inputs) || !config.inputs.length ||
12
+ config.inputs.some((name) => typeof name !== 'string' || !name || path.isAbsolute(name) || name.split(/[\\/]/).includes('..'))) {
13
+ throw new Error('worktree.isolatedVerification.inputs must be nonempty safe relative paths.');
14
+ }
15
+ if (config.runtimeFiles !== undefined && (!Array.isArray(config.runtimeFiles) ||
16
+ config.runtimeFiles.some((name) => typeof name !== 'string' || !/^\/(home|opt)\//.test(name) ||
17
+ name.split('/').includes('..') || path.normalize(name) !== name))) {
18
+ throw new Error('worktree.isolatedVerification.runtimeFiles must be absolute /home or /opt files.');
19
+ }
20
+ }
21
+
22
+ export async function runIsolatedVerification({ cwd, command, inputs, runtimeFiles = [], evidenceDir, timeoutMs, runCommand, shellQuote }) {
23
+ const runnerHash = createHash('sha256').update(await readFile(runner)).digest('hex');
24
+ const commandLine = ['python3', runner, '--root', cwd, '--inputs-json', JSON.stringify(inputs),
25
+ '--runtime-files-json', JSON.stringify(runtimeFiles), '--command', command, '--evidence', evidenceDir,
26
+ '--timeout', String(Math.max(1, Math.ceil((timeoutMs ?? 300000) / 1000)))].map(shellQuote).join(' ');
27
+ const result = await runCommand(commandLine, { cwd, timeoutMs: (timeoutMs ?? 300000) + 10000 });
28
+ let terminal = null;
29
+ try { terminal = JSON.parse(await readFile(path.join(evidenceDir, 'terminal.json'), 'utf8')); } catch { /* no receipt is failure */ }
30
+ const afterHash = createHash('sha256').update(await readFile(runner)).digest('hex');
31
+ const accepted = result.exitCode === 0 && !result.timedOut && runnerHash === afterHash &&
32
+ terminal?.version === 1 && terminal.status === 'passed' && terminal.command === command &&
33
+ /^[0-9a-f]{64}$/.test(terminal.input_digest ?? '') && terminal.exit_code === 0 &&
34
+ terminal.read_trace_verified === true && terminal.snapshot_unchanged === true &&
35
+ terminal.source_unchanged === true && terminal.process_group_gone === true &&
36
+ terminal.host_tools_unchanged === true && terminal.runtime_files_unchanged === true;
37
+ return {
38
+ ...result,
39
+ exitCode: accepted ? 0 : 1,
40
+ isolation: { status: accepted ? 'passed' : 'failed_or_unknown', evidenceDir,
41
+ inputDigest: terminal?.input_digest ?? null, runnerSha256: runnerHash }
42
+ };
43
+ }
44
+
45
+ export function isolatedEvidenceDir(base, index) {
46
+ return path.join(base, `isolation-${index + 1}-${randomUUID()}`);
47
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taskforce-loop-engineering",
3
- "version": "0.16.2",
3
+ "version": "0.16.3",
4
4
  "private": false,
5
5
  "description": "OpenClaw-native loop engineering CLI, templates, and skill for verifiable agent work loops.",
6
6
  "type": "module",
@@ -18,7 +18,8 @@
18
18
  "run-loop-cron.sh": "scripts/run-loop-cron.sh"
19
19
  },
20
20
  "scripts": {
21
- "test": "npm run check:human-gates && npm run check && npm run check:competitive && npm run check:operator-workspace",
21
+ "test": "npm run check:isolation && npm run check:human-gates && npm run check && npm run check:competitive && npm run check:operator-workspace",
22
+ "check:isolation": "node --check lib/isolated-verification.mjs && python3 -c \"import ast; ast.parse(open('scripts/isolated-verify.py').read())\" && python3 scripts/isolated-verify-self-test.py && node scripts/isolated-verification-self-test.mjs",
22
23
  "check:operator-workspace": "node --check scripts/operator-workspace-final-judgement.mjs && node --check scripts/dashboard-autostart-install.mjs && node scripts/dashboard-autostart-self-test.mjs && node scripts/operator-workspace-final-judgement.mjs",
23
24
  "check:competitive": "node --check lib/transactional-state-kernel.mjs && node --check lib/goal-api.mjs && node scripts/competitive-acceptance.mjs",
24
25
  "check:adapters": "node --check lib/runtime-adapter-sdk.mjs && node scripts/runtime-adapter-conformance.mjs && node scripts/agent-team-control-plane-self-test.mjs",
@@ -41,7 +42,8 @@
41
42
  "./quota": "./lib/quota-runtime-decision.mjs",
42
43
  "./todo-control-plane": "./lib/todo-control-plane.mjs",
43
44
  "./human-gate-command": "./lib/human-gate-command.mjs",
44
- "./human-gate-channel-adapter": "./lib/human-gate-channel-adapter.mjs"
45
+ "./human-gate-channel-adapter": "./lib/human-gate-channel-adapter.mjs",
46
+ "./isolated-verification": "./lib/isolated-verification.mjs"
45
47
  },
46
48
  "engines": {
47
49
  "node": ">=22"
@@ -9,6 +9,8 @@ assert.equal(inferTaskScope({ body: '继续同一整体项目,仅推进 T-01
9
9
  assert.equal(inferTaskScope({ body: 'Continue the project, only complete boundary item 2' }), 'scoped_task');
10
10
  assert.equal(inferTaskScope({ body: '继续同一整体项目,取消团队功能并从项目完成门槛中移除,其他 backlog 不变' }), 'scoped_task');
11
11
  assert.equal(inferTaskScope({ body: 'Continue the overall project with a product-scope amendment: remove the team feature from the completion gate.' }), 'scoped_task');
12
+ assert.equal(inferTaskScope({ body: '把外部证据列为项目级 deferred gates。本轮作为有界本地工程里程碑,完成 TECH-01030;不宣称整体项目完成。' }), 'scoped_task');
13
+ assert.equal(inferTaskScope({ body: 'Project-level evidence remains deferred; this round is a bounded local engineering milestone.' }), 'scoped_task');
12
14
 
13
15
  {
14
16
  const devPlan = { checkpoints: [{ id: 'cp1' }] };
@@ -448,3 +450,326 @@ for (const status of ['blocked', 'revise']) {
448
450
  ];
449
451
  assert.deepEqual(selectEffectiveAcceptanceReviews({ checkpoints: [{ id: 'cp1' }] }, { reviews }).map(r => r.checkpointId), ['gate']);
450
452
  }
453
+
454
+ for (const body of [
455
+ '完成完整项目,不要将本轮缩成有界本地里程碑',
456
+ 'Complete the project-level objective, not a bounded milestone',
457
+ 'Complete the project-level objective; do not reduce this round to a bounded local milestone',
458
+ "Complete the project-level objective; don't reduce it to a bounded milestone",
459
+ '完成完整项目;本轮不是有界本地里程碑',
460
+ ]) assert.equal(inferTaskScope({ body }), 'project', body);
461
+
462
+ // Paired negation targets: a project prohibition must not negate a milestone.
463
+ for (const body of [
464
+ '本轮做有界本地里程碑而不是完整项目',
465
+ 'Implement a bounded milestone without completing the project-level objective',
466
+ 'Not the project-level objective, but a bounded milestone',
467
+ '不是完整项目,而是本轮做有界本地里程碑',
468
+ ]) assert.equal(inferTaskScope({ body }), 'scoped_task', body);
469
+ for (const body of [
470
+ '完成完整项目,本轮不做有界本地里程碑',
471
+ '完成完整项目,本轮不应仅做有界本地里程碑',
472
+ 'Complete the project-level objective without reducing it to a bounded milestone',
473
+ 'Complete the project-level objective, never just a bounded milestone',
474
+ ]) assert.equal(inferTaskScope({ body }), 'project', body);
475
+
476
+ // Unrelated prohibitions must not negate the requested object.
477
+ for (const body of [
478
+ '在不部署完整项目的前提下本轮完成有界本地里程碑',
479
+ 'Without deploying the project-level application implement a bounded milestone',
480
+ '完整项目不部署,本轮只完成第一步',
481
+ 'Complete the project-level objective later; only complete a backlog item',
482
+ ]) assert.equal(inferTaskScope({ body }), 'scoped_task', body);
483
+ for (const body of [
484
+ '完成完整项目,不要只完成第一步',
485
+ 'Complete the project-level objective, not merely a bounded milestone or backlog item',
486
+ '完成完整项目,不要仅推进第一步',
487
+ 'Complete the project-level objective, not a backlog item',
488
+ '完成完整项目,不要取消功能',
489
+ ]) assert.equal(inferTaskScope({ body }), 'project', body);
490
+
491
+ for (const body of [
492
+ '完整项目以后做,本轮完成有界可验收里程碑',
493
+ 'Project-level delivery later, implement a bounded local/testable milestone',
494
+ ]) assert.equal(inferTaskScope({ body }), 'scoped_task', body);
495
+
496
+ // Ordinal modifiers and stopping verbs remain local to the negated object.
497
+ for (const body of [
498
+ 'Complete the project-level objective, not just the first bounded milestone',
499
+ 'Complete the project-level objective, without stopping at a bounded milestone',
500
+ 'Complete the project-level objective, do not stop at the first bounded milestone or backlog item',
501
+ 'Complete the project-level objective, not only the next bounded milestone',
502
+ ]) assert.equal(inferTaskScope({ body }), 'project', body);
503
+ for (const body of [
504
+ 'Without deploying the project-level application implement the first bounded milestone',
505
+ 'Do not stop the project-level service while implementing a bounded milestone',
506
+ 'Project-level delivery later; stop at the first bounded milestone',
507
+ 'Complete the first bounded milestone without stopping the project-level service',
508
+ ]) assert.equal(inferTaskScope({ body }), 'scoped_task', body);
509
+
510
+ // Negated object phrases accept modifiers, not a fixed adjective vocabulary.
511
+ for (const modifier of ['initial', 'one', 'second', 'smallest useful', 'independently testable', 'newly requested']) {
512
+ for (const suffix of ['', ', or a backlog item', ', and a backlog item']) {
513
+ const body = `Complete the project-level objective, not merely ${modifier} bounded milestone${suffix}`;
514
+ assert.equal(inferTaskScope({ body }), 'project', body);
515
+ }
516
+ const body = `Project-level delivery later; implement ${modifier} bounded milestone`;
517
+ assert.equal(inferTaskScope({ body }), 'scoped_task', body);
518
+ }
519
+ for (const body of [
520
+ '完成完整项目,不应停留在有界里程碑',
521
+ '完成完整项目,不应仅仅满足于一个有界本地里程碑',
522
+ 'Complete the project-level objective, not a bounded milestone, or a backlog item',
523
+ 'Do not reduce the project-level objective to a bounded milestone',
524
+ 'Complete the project-level objective, not just the initial bounded milestone',
525
+ ]) assert.equal(inferTaskScope({ body }), 'project', body);
526
+ for (const body of [
527
+ 'Do not deploy, implement a bounded milestone for the project-level objective',
528
+ 'Do not stop the service while implementing a bounded milestone for the project-level objective',
529
+ 'Complete the project-level objective later, not today, implement a bounded milestone',
530
+ '完成完整项目之前,在不部署的前提下完成有界里程碑',
531
+ 'Complete the project-level objective later, implement a bounded milestone, or a backlog item',
532
+ ]) assert.equal(inferTaskScope({ body }), 'scoped_task', body);
533
+
534
+ // Independent boundary review: coordination, double negatives and context switches.
535
+ for (const [body, expected] of [
536
+ [
537
+ "Complete the project-level objective, not a bounded milestone, nor a backlog item",
538
+ "project"
539
+ ],
540
+ [
541
+ "Complete the project-level objective, neither a bounded milestone nor a backlog item",
542
+ "project"
543
+ ],
544
+ [
545
+ "Complete the project-level objective, not only a bounded milestone but also not merely a backlog item",
546
+ "project"
547
+ ],
548
+ [
549
+ "Complete the project-level objective, not only a bounded milestone but also the entire delivery",
550
+ "project"
551
+ ],
552
+ [
553
+ "完成完整项目,不仅是有界里程碑,而且不是仅完成第一步",
554
+ "project"
555
+ ],
556
+ [
557
+ "完成完整项目,不做有界里程碑,也不只完成第一步",
558
+ "project"
559
+ ],
560
+ [
561
+ "Project-level delivery later; do not fail to complete a bounded milestone",
562
+ "scoped_task"
563
+ ],
564
+ [
565
+ "Project-level delivery later; do not avoid implementing a bounded milestone",
566
+ "scoped_task"
567
+ ],
568
+ [
569
+ "完整项目以后做,本轮不能不完成有界里程碑",
570
+ "scoped_task"
571
+ ],
572
+ [
573
+ "完整项目以后做,本轮不是不完成有界里程碑",
574
+ "scoped_task"
575
+ ],
576
+ [
577
+ "Project-level delivery later; implement a bounded milestone, not a backlog item",
578
+ "scoped_task"
579
+ ],
580
+ [
581
+ "Complete the project-level objective, not a bounded milestone; implement a backlog item",
582
+ "scoped_task"
583
+ ],
584
+ [
585
+ "Complete the project-level objective, not a bounded milestone, and implement a backlog item",
586
+ "scoped_task"
587
+ ],
588
+ [
589
+ "完成完整项目,不做有界里程碑,改为只完成第一步",
590
+ "scoped_task"
591
+ ],
592
+ [
593
+ "Without deploying anything implement a bounded milestone for the project-level objective",
594
+ "scoped_task"
595
+ ],
596
+ [
597
+ "Do not deploy the service and then implement a bounded milestone for the project-level objective",
598
+ "scoped_task"
599
+ ],
600
+ [
601
+ "Complete the project-level objective, never stop at a bounded milestone, nor a backlog item",
602
+ "project"
603
+ ],
604
+ [
605
+ "Complete the project-level objective, not a bounded milestone, however implement a backlog item",
606
+ "scoped_task"
607
+ ],
608
+ [
609
+ "Complete the project-level objective, not a bounded milestone, nor a backlog item",
610
+ "project"
611
+ ],
612
+ [
613
+ "Complete the project-level objective, not a bounded milestone nor a backlog item",
614
+ "project"
615
+ ],
616
+ [
617
+ "Complete the project-level objective, not a bounded milestone, or a backlog item",
618
+ "project"
619
+ ],
620
+ [
621
+ "Complete the project-level objective, not a bounded milestone or a backlog item",
622
+ "project"
623
+ ],
624
+ [
625
+ "Complete the project-level objective, not a bounded milestone, and a backlog item",
626
+ "project"
627
+ ],
628
+ [
629
+ "Project-level delivery later; implement a bounded milestone",
630
+ "scoped_task"
631
+ ],
632
+ [
633
+ "Project-level delivery later; complete a bounded milestone",
634
+ "scoped_task"
635
+ ],
636
+ [
637
+ "Project-level delivery later; execute a bounded milestone",
638
+ "scoped_task"
639
+ ]
640
+ ]) assert.equal(inferTaskScope({ body }), expected, body);
641
+
642
+ for (const [body, expected] of [
643
+ [
644
+ "Project-level delivery later; do not fail to complete a bounded milestone",
645
+ "scoped_task"
646
+ ],
647
+ [
648
+ "Project-level delivery later; don't fail to complete a bounded milestone",
649
+ "scoped_task"
650
+ ],
651
+ [
652
+ "Project-level delivery later; don’t fail to complete a bounded milestone",
653
+ "scoped_task"
654
+ ],
655
+ [
656
+ "Project-level delivery later; never fail to complete a bounded milestone",
657
+ "scoped_task"
658
+ ],
659
+ [
660
+ "Project-level delivery later; do not avoid complete a bounded milestone",
661
+ "scoped_task"
662
+ ],
663
+ [
664
+ "Project-level delivery later; without failing to complete a bounded milestone",
665
+ "scoped_task"
666
+ ],
667
+ [
668
+ "Complete the project-level objective, neither a bounded milestone, nor a backlog item",
669
+ "project"
670
+ ],
671
+ [
672
+ "Complete the project-level objective, not a bounded milestone, nor a backlog item",
673
+ "project"
674
+ ],
675
+ [
676
+ "Complete the project-level objective, never stop at a bounded milestone, nor a backlog item",
677
+ "project"
678
+ ],
679
+ [
680
+ "Complete the project-level objective later; not a bounded milestone, and implement a bounded milestone",
681
+ "scoped_task"
682
+ ],
683
+ [
684
+ "Complete the project-level objective later; not a bounded milestone, and complete a bounded milestone",
685
+ "scoped_task"
686
+ ],
687
+ [
688
+ "Complete the project-level objective later; not a bounded milestone, and execute a bounded milestone",
689
+ "scoped_task"
690
+ ],
691
+ [
692
+ "Complete the project-level objective, neither a backlog item, nor a backlog item",
693
+ "project"
694
+ ],
695
+ [
696
+ "Complete the project-level objective, not a backlog item, nor a backlog item",
697
+ "project"
698
+ ],
699
+ [
700
+ "Complete the project-level objective, never stop at a backlog item, nor a backlog item",
701
+ "project"
702
+ ],
703
+ [
704
+ "Complete the project-level objective later; not a bounded milestone, and implement a backlog item",
705
+ "scoped_task"
706
+ ],
707
+ [
708
+ "Complete the project-level objective later; not a bounded milestone, and complete a backlog item",
709
+ "scoped_task"
710
+ ],
711
+ [
712
+ "Complete the project-level objective later; not a bounded milestone, and execute a backlog item",
713
+ "scoped_task"
714
+ ],
715
+ [
716
+ "Complete the project-level objective, neither the boundary item, nor a backlog item",
717
+ "project"
718
+ ],
719
+ [
720
+ "Complete the project-level objective, not the boundary item, nor a backlog item",
721
+ "project"
722
+ ],
723
+ [
724
+ "Complete the project-level objective, never stop at the boundary item, nor a backlog item",
725
+ "project"
726
+ ],
727
+ [
728
+ "Complete the project-level objective later; not a bounded milestone, and implement the boundary item",
729
+ "scoped_task"
730
+ ],
731
+ [
732
+ "Complete the project-level objective later; not a bounded milestone, and complete the boundary item",
733
+ "scoped_task"
734
+ ],
735
+ [
736
+ "Complete the project-level objective later; not a bounded milestone, and execute the boundary item",
737
+ "scoped_task"
738
+ ],
739
+ [
740
+ "完整项目以后做,本轮不能不完成有界里程碑",
741
+ "scoped_task"
742
+ ],
743
+ [
744
+ "完整项目以后做,本轮不得不完成有界里程碑",
745
+ "scoped_task"
746
+ ],
747
+ [
748
+ "完整项目以后做,本轮不是不完成有界里程碑",
749
+ "scoped_task"
750
+ ],
751
+ [
752
+ "Complete not only a bounded milestone but also the entire project-level objective",
753
+ "project"
754
+ ],
755
+ [
756
+ "Not only avoid deployment but also implement a bounded milestone for the project-level objective",
757
+ "scoped_task"
758
+ ],
759
+ [
760
+ "本轮不仅完成有界里程碑,而且完成完整项目",
761
+ "project"
762
+ ],
763
+ [
764
+ "完整项目以后做,本轮不仅不部署,而且只完成第一步",
765
+ "scoped_task"
766
+ ],
767
+ [
768
+ "Complete the project-level objective, not a bounded milestone and not a backlog item",
769
+ "project"
770
+ ],
771
+ [
772
+ "Complete the project-level objective, neither a bounded milestone, nor a backlog item",
773
+ "project"
774
+ ]
775
+ ]) assert.equal(inferTaskScope({ body }), expected, body);