reasonweave 0.0.0-stage → 1.3.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/AGENTS.md +101 -0
- package/INSTALL.md +258 -0
- package/README.md +280 -2
- package/bin/lab.mjs +888 -0
- package/constitution.md +55 -0
- package/docs/CONSUMER-PROMPTS.md +474 -0
- package/docs/backlogs/01-forward-wait-self-detach.md +18 -0
- package/docs/backlogs/02-decouple-wait-and-daemon-for-agent-hosts.md +35 -0
- package/docs/backlogs/03-baton-wait-multi-id-lightweight-pubsub.md +34 -0
- package/docs/backlogs/04-adr-cross-repo-automated-dispatch-boundary.md +19 -0
- package/docs/backlogs/05-feat-units-worktree-isolation-engine.md +23 -0
- package/docs/backlogs/06-feat-blind-audit-automated-clean-runner.md +22 -0
- package/docs/backlogs/07-feat-attention-throttle-silent-pipe.md +23 -0
- package/docs/backlogs/08-future-units-shadow-ledger.md +22 -0
- package/docs/backlogs/09-feat-agent-baton-core-convergence-and-resilience.md +42 -0
- package/docs/backlogs/10-feat-anti-orphan-deterministic-wiring-governance.md +35 -0
- package/docs/backlogs/11-perf-orphan-index-fs-read.md +16 -0
- package/docs/backlogs/12-feat-vibe-security-anti-suppression-and-orphan-deps.md +43 -0
- package/docs/backlogs/13-feat-sdd-reppit-tiered-guardrails.md +40 -0
- package/docs/backlogs/14-feat-universal-cli-contract-and-hermetic-test-fixtures.md +48 -0
- package/docs/backlogs/15-feat-reasonweave-rebranding-and-doc-code-synchronization-invariant.md +44 -0
- package/docs/backlogs/16-feat-micro-engineering-skills-and-sdd-baton-fusion.md +52 -0
- package/docs/codegraph-readiness-check.md +49 -0
- package/group/architecture/adr/0001-handoff-async-wait-and-reactive-wakeup.md +87 -0
- package/group/architecture/adr/0002-de-ritualize-handoff-prompt-for-intra-repo.md +53 -0
- package/group/architecture/adr/0003-attention-throttle-and-workspace-driver.md +65 -0
- package/group/architecture/adr/0004-spec-guard-and-drift-prevention.md +90 -0
- package/group/architecture/adr/0005-global-orphan-scavenger-and-read-only-invariants.md +94 -0
- package/group/architecture/adr/0006-triad-engineering-defense-and-mutation-sensitivity.md +68 -0
- package/group/architecture/adr/0007-agent-baton-state-machine-defense-and-workspace-jail-spec.md +86 -0
- package/group/architecture/adr/0008-agent-baton-core-convergence-and-heterogeneous-session-resilience.md +133 -0
- package/group/architecture/adr/0009-anti-orphan-deterministic-wiring-governance-and-federated-guardrails.md +108 -0
- package/group/architecture/adr/0010-agent-baton-identity-security-cryptographic-credentials-and-prompt-anti-confusion.md +119 -0
- package/group/architecture/adr/0011-vibe-security-anti-suppression-and-dependency-reachability.md +161 -0
- package/group/architecture/adr/0012-spec-driven-development-reppit-and-tiered-guardrails.md +130 -0
- package/group/architecture/adr/0013-universal-cli-contract-hermetic-testing-and-defensive-probes.md +110 -0
- package/group/architecture/adr/0014-reasonweave-rebranding-and-doc-code-synchronization-invariant.md +108 -0
- package/group/architecture/adr/0015-micro-engineering-skills-and-dual-core-gate-invariant.md +127 -0
- package/group/architecture/adr/INDEX.md +29 -0
- package/group/architecture/adr/templates/adr-template.md +33 -0
- package/group/architecture/dependency-graph.md +60 -0
- package/group/contracts/npm-packaging.md +69 -0
- package/group/product/intent.md +24 -0
- package/package.json +93 -4
- package/scripts/sync-all-consumers.mjs +174 -0
- package/specs/RFC-20261110-SPEC-GUARD-UNIT.md +353 -0
- package/specs/templates/01-research.md.template +23 -0
- package/specs/templates/02-proposals.md.template +22 -0
- package/specs/templates/03-spec.md.template +33 -0
- package/specs/templates/04-tasks.md.template +29 -0
- package/specs/templates/05-evidence.md.template +29 -0
- package/specs/templates/README.md +26 -0
- package/units/adr/AGENTS.md +85 -0
- package/units/adr/CHANGELOG.md +20 -0
- package/units/adr/README.md +88 -0
- package/units/adr/VERSION.md +10 -0
- package/units/adr/docs/existing-project-prompt.md +24 -0
- package/units/adr/docs/new-project-prompt.md +36 -0
- package/units/adr/scripts/adr-init.sh +101 -0
- package/units/adr/templates/INDEX.md +19 -0
- package/units/adr/templates/adr-frozen.md +33 -0
- package/units/adr/templates/adr-light.md +56 -0
- package/units/adr/templates/adr-standard.md +61 -0
- package/units/backlog/AGENTS.md +53 -0
- package/units/backlog/AUTONOMOUS-GOVERNANCE.md +98 -0
- package/units/backlog/CHANGELOG.md +37 -0
- package/units/backlog/README.md +124 -0
- package/units/backlog/VERSION.md +11 -0
- package/units/backlog/docs/existing-project-ironrules-prompt.md +31 -0
- package/units/backlog/docs/existing-project-prompt.md +24 -0
- package/units/backlog/docs/new-project-prompt.md +19 -0
- package/units/backlog/templates/entry.md +39 -0
- package/units/backlog/templates/project-ironrules.md +36 -0
- package/units/handoffs/AGENT-GUIDE.md +118 -0
- package/units/handoffs/AGENTS.md +28 -0
- package/units/handoffs/CHANGELOG.md +498 -0
- package/units/handoffs/CLAUDE.md +28 -0
- package/units/handoffs/COMMANDS.md +187 -0
- package/units/handoffs/DESIGN.md +74 -0
- package/units/handoffs/README.md +456 -0
- package/units/handoffs/RESPONSE-TEMPLATE.md +138 -0
- package/units/handoffs/VERSION.md +1 -0
- package/units/handoffs/handoff-status.mjs +1017 -0
- package/units/handoffs/handoff.mjs +5675 -0
- package/units/orphan/CHANGELOG.md +118 -0
- package/units/orphan/DESIGN.md +484 -0
- package/units/orphan/README.md +143 -0
- package/units/orphan/VERSION.md +1 -0
- package/units/orphan/adapters/android/index.mjs +140 -0
- package/units/orphan/adapters/python/index.mjs +232 -0
- package/units/orphan/adapters/web/index.mjs +280 -0
- package/units/orphan/bin/lab-orphan.mjs +298 -0
- package/units/orphan/core/blob-reader.mjs +142 -0
- package/units/orphan/core/classifier.mjs +261 -0
- package/units/orphan/core/cleaner.mjs +166 -0
- package/units/orphan/core/diff-checker.mjs +341 -0
- package/units/orphan/core/inverted-index.mjs +124 -0
- package/units/orphan/core/orphan-deps.mjs +192 -0
- package/units/orphan/core/protocol-s1-s3.mjs +194 -0
- package/units/orphan/core/solver.mjs +217 -0
- package/units/orphan/index.mjs +105 -0
- package/units/orphan/templates/ci/orphan-guard.yml +36 -0
- package/units/orphan/templates/pre-commit.d/30-orphan-guard +34 -0
- package/units/orphan/templates/wiring/README.md +51 -0
- package/units/orphan/templates/wiring/miniprogram-route-guard.js.template +80 -0
- package/units/orphan/templates/wiring/pre-commit-node.sh.template +73 -0
- package/units/orphan/templates/wiring/project-agents-gemini-templates.md +60 -0
- package/units/orphan/templates/wiring/python-parity-test.py.template +100 -0
- package/units/orphan/templates/wiring/rust-exhaustive-match.md +65 -0
- package/units/orphan/templates/wiring/swift-periphery.md +56 -0
- package/units/orphan/tests/adapters.test.mjs +243 -0
- package/units/orphan/tests/orphan-deps.test.mjs +131 -0
- package/units/orphan/tests/phase3-gates.test.mjs +135 -0
- package/units/playbook/README.md +106 -0
- package/units/playbook/ZSPEC-AGENT-GUIDE.md +99 -0
- package/units/playbook/docs/01-architecture.md +99 -0
- package/units/playbook/docs/02-bootstrap.md +126 -0
- package/units/playbook/docs/03-units.md +91 -0
- package/units/playbook/docs/04-constitution.md +113 -0
- package/units/playbook/docs/05-adr.md +33 -0
- package/units/playbook/docs/06-spec-kit.md +76 -0
- package/units/playbook/docs/07-backlog.md +30 -0
- package/units/playbook/docs/08-codegraph.md +79 -0
- package/units/playbook/docs/09-skills.md +101 -0
- package/units/playbook/docs/10-handoff.md +72 -0
- package/units/playbook/docs/11-evidence.md +163 -0
- package/units/playbook/docs/12-gates.md +124 -0
- package/units/playbook/docs/13-parallel.md +115 -0
- package/units/playbook/docs/14-dependency-graph.md +86 -0
- package/units/playbook/docs/15-memory.md +153 -0
- package/units/playbook/docs/16-change-control.md +121 -0
- package/units/playbook/docs/17-prompts.md +121 -0
- package/units/playbook/docs/18-shift-left.md +97 -0
- package/units/playbook/docs/19-anti-orphan-vertical-slicing.md +102 -0
- package/units/playbook/docs/20-vibe-security-and-anti-suppression.md +88 -0
- package/units/playbook/docs/21-spec-driven-reppit-closed-loop.md +88 -0
- package/units/playbook/examples/owisel.md +80 -0
- package/units/playbook/references/Agent-Engineering-Framework-AEF-v1.0.md +2033 -0
- package/units/playbook/references/links.md +103 -0
- package/units/playbook/templates/AGENTS.root.md +44 -0
- package/units/playbook/templates/AGENTS.unit.md +52 -0
- package/units/playbook/templates/adr/INDEX.md +17 -0
- package/units/playbook/templates/adr/NNNN-template.md +56 -0
- package/units/playbook/templates/backlogs/entry.md +30 -0
- package/units/playbook/templates/constitution.md +93 -0
- package/units/playbook/templates/evidence/README.md +36 -0
- package/units/playbook/templates/group/architecture/dependency-graph.md +48 -0
- package/units/playbook/templates/group/architecture/system.md +59 -0
- package/units/playbook/templates/group/contracts/api.md +67 -0
- package/units/playbook/templates/group/product/intent.md +30 -0
- package/units/playbook/templates/group/product/requirements.md +48 -0
- package/units/playbook/templates/unit-skeleton/README.md +35 -0
- package/units/preflight/AGENTS.md +45 -0
- package/units/preflight/CHANGELOG.md +55 -0
- package/units/preflight/INSTALL.md +65 -0
- package/units/preflight/README.md +104 -0
- package/units/preflight/VERSION.md +3 -0
- package/units/preflight/docs/audit-requirements.md +114 -0
- package/units/preflight/docs/existing-project-prompt.md +25 -0
- package/units/preflight/docs/new-project-prompt.md +25 -0
- package/units/preflight/docs/transfers/CONSUMER-INSTALL.md +40 -0
- package/units/preflight/docs/transfers/CONSUMER-SELFCHECK.md +51 -0
- package/units/preflight/docs/transfers/README.md +39 -0
- package/units/preflight/docs/transfers/prospero.md +26 -0
- package/units/preflight/templates/check.sh +43 -0
- package/units/preflight/templates/pre-commit +55 -0
- package/units/preflight/templates/pre-commit.d/20-preflight +15 -0
- package/units/preflight/templates/preflight.conf.example +21 -0
- package/units/preflight/templates/preflight.sh +189 -0
- package/units/preflight/templates/wrap-up.md +9 -0
- package/units/review-gate/AGENTS.md +42 -0
- package/units/review-gate/CHANGELOG.md +58 -0
- package/units/review-gate/README.md +118 -0
- package/units/review-gate/VERSION.md +3 -0
- package/units/review-gate/clean-runner.mjs +350 -0
- package/units/review-gate/docs/existing-project-prompt.md +28 -0
- package/units/review-gate/docs/new-project-prompt.md +38 -0
- package/units/review-gate/docs/transfers/iggle.md +34 -0
- package/units/review-gate/docs/transfers/prospero.md +35 -0
- package/units/review-gate/docs/transfers/swoop.md +36 -0
- package/units/review-gate/docs/transfers/yiqiyihuihua.md +35 -0
- package/units/review-gate/templates/.semgrepignore +37 -0
- package/units/review-gate/templates/pre-commit +130 -0
- package/units/review-gate/templates/scan.sh +158 -0
- package/units/skills/AGENTS.md +17 -0
- package/units/skills/CHANGELOG.md +18 -0
- package/units/skills/README.md +63 -0
- package/units/skills/VERSION.md +1 -0
- package/units/skills/bin/review-package.mjs +99 -0
- package/units/skills/bin/task-brief.mjs +102 -0
- package/units/skills/catalog/brainstorming/SKILL.md +75 -0
- package/units/skills/catalog/brainstorming/references/design-doc-template.md +28 -0
- package/units/skills/catalog/systematic-debugging/SKILL.md +101 -0
- package/units/skills/catalog/systematic-debugging/references/root-cause-tracing.md +23 -0
- package/units/skills/catalog/test-driven-development/SKILL.md +88 -0
- package/units/skills/catalog/test-driven-development/references/writing-good-tests.md +13 -0
- package/units/skills/catalog/verification-before-completion/SKILL.md +73 -0
- package/units/skills/skills.mjs +181 -0
- package/units/skills/tests/pipeline.test.mjs +131 -0
- package/units/skills/tests/skill-contract.test.mjs +67 -0
- package/units/skills/tests/skills-cli.test.mjs +107 -0
- package/units/spec-guard/AGENTS.md +43 -0
- package/units/spec-guard/CHANGELOG.md +88 -0
- package/units/spec-guard/README.md +148 -0
- package/units/spec-guard/VERSION.md +1 -0
- package/units/spec-guard/bin/spec-guard.mjs +431 -0
- package/units/spec-guard/core/adr-parser.mjs +540 -0
- package/units/spec-guard/core/matrix-checker.mjs +587 -0
- package/units/spec-guard/core/mutation-runner.mjs +267 -0
- package/units/spec-guard/core/scanner.mjs +333 -0
- package/units/spec-guard/core/telemetry_authenticator.mjs +484 -0
- package/units/spec-guard/core/wiring_tracer.mjs +306 -0
- package/units/spec-guard/templates/annotations/ContractOnly.kt +19 -0
- package/units/spec-guard/templates/annotations/Invariant.kt +16 -0
- package/units/spec-guard/templates/annotations/invariant.go +19 -0
- package/units/spec-guard/templates/annotations/invariant.py +38 -0
- package/units/spec-guard/templates/annotations/invariant.ts +39 -0
- package/units/spec-guard/templates/ci/spec-guard-audit.yml +23 -0
- package/units/spec-guard/templates/pre-commit.d/15-spec-guard +72 -0
- package/units/spec-guard/templates/spec-matrix.overlay.yml +70 -0
- package/units/spec-guard/tests/spec-guard.test.mjs +716 -0
- package/units/spec-guard/tests/telemetry_authenticator.test.mjs +633 -0
- package/units/worktree/AGENTS.md +22 -0
- package/units/worktree/CHANGELOG.md +14 -0
- package/units/worktree/README.md +65 -0
- package/units/worktree/VERSION.md +1 -0
- package/units/worktree/worktree.mjs +352 -0
- package//344/275/277/347/224/250/350/257/264/346/230/216.md +322 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mutation-runner.mjs
|
|
3
|
+
*
|
|
4
|
+
* 轻量级变异测试契约引擎(Mutation Sensitivity Runner):
|
|
5
|
+
* 1. 防御回音壁假测试(Echo-Chamber Tests):断言恒真、过度 Mock、篡改端点/条件仍全绿的自欺欺人测试
|
|
6
|
+
* 2. 自动化注入变异(端点篡改、布尔倒置、比较取反、返回值破坏)
|
|
7
|
+
* 3. 运行测试套件:变异注入后测试必须爆红(Exit !== 0);若依然全绿(Exit === 0),判定为回音壁假测试并阻断
|
|
8
|
+
* 4. 必须使用 try...finally 严格恢复原始文件,确保测试前后工作区零污染
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import fs from 'node:fs';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import { execSync } from 'node:child_process';
|
|
14
|
+
|
|
15
|
+
export const MutationType = {
|
|
16
|
+
ENDPOINT: 'endpoint',
|
|
17
|
+
BOOLEAN: 'boolean',
|
|
18
|
+
OPERATOR: 'operator',
|
|
19
|
+
RETURN: 'return',
|
|
20
|
+
AUTO: 'auto',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 在目标文本中提取可变异候选点
|
|
25
|
+
* @param {string} content
|
|
26
|
+
* @param {string} [type='auto']
|
|
27
|
+
* @returns {Array<{ type: string, line: number, original: string, replacement: string, lineText: string, index: number }>}
|
|
28
|
+
*/
|
|
29
|
+
export function generateMutants(content, type = 'auto') {
|
|
30
|
+
const lines = content.split('\n');
|
|
31
|
+
const mutants = [];
|
|
32
|
+
|
|
33
|
+
let curIdx = 0;
|
|
34
|
+
for (let lineNo = 1; lineNo <= lines.length; lineNo++) {
|
|
35
|
+
const lineText = lines[lineNo - 1];
|
|
36
|
+
const trimmed = lineText.trim();
|
|
37
|
+
|
|
38
|
+
// 跳过纯注释行
|
|
39
|
+
if (trimmed.startsWith('//') || trimmed.startsWith('#') || trimmed.startsWith('/*') || trimmed.startsWith('*')) {
|
|
40
|
+
curIdx += lineText.length + 1;
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// 1. Endpoint / URL 变异
|
|
45
|
+
if (type === 'auto' || type === 'endpoint') {
|
|
46
|
+
const endpointRegex = /["'](\/(?:[a-zA-Z0-9_.-]+\/)*[a-zA-Z0-9_.-]+|https?:\/\/[^"']+|wss?:\/\/[^"']+)["']/g;
|
|
47
|
+
let epMatch;
|
|
48
|
+
while ((epMatch = endpointRegex.exec(lineText)) !== null) {
|
|
49
|
+
const fullMatch = epMatch[0];
|
|
50
|
+
const quote = fullMatch[0];
|
|
51
|
+
const originalVal = epMatch[1];
|
|
52
|
+
if (originalVal === '/BOGUS_PATH' || originalVal === '/MUTATION_BOGUS_ENDPOINT_MUTANT') continue;
|
|
53
|
+
mutants.push({
|
|
54
|
+
type: 'endpoint',
|
|
55
|
+
line: lineNo,
|
|
56
|
+
original: fullMatch,
|
|
57
|
+
replacement: `${quote}/MUTATION_BOGUS_ENDPOINT_MUTANT${quote}`,
|
|
58
|
+
lineText: trimmed,
|
|
59
|
+
index: curIdx + epMatch.index,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// 2. Return 语句破坏
|
|
65
|
+
if (type === 'auto' || type === 'return') {
|
|
66
|
+
if (/\breturn\s+True\b/.test(lineText)) {
|
|
67
|
+
const idx = lineText.indexOf('return True');
|
|
68
|
+
mutants.push({
|
|
69
|
+
type: 'return',
|
|
70
|
+
line: lineNo,
|
|
71
|
+
original: 'return True',
|
|
72
|
+
replacement: 'return False',
|
|
73
|
+
lineText: trimmed,
|
|
74
|
+
index: curIdx + idx,
|
|
75
|
+
});
|
|
76
|
+
} else if (/\breturn\s+true\b/.test(lineText)) {
|
|
77
|
+
const idx = lineText.indexOf('return true');
|
|
78
|
+
mutants.push({
|
|
79
|
+
type: 'return',
|
|
80
|
+
line: lineNo,
|
|
81
|
+
original: 'return true',
|
|
82
|
+
replacement: 'return false',
|
|
83
|
+
lineText: trimmed,
|
|
84
|
+
index: curIdx + idx,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// 3. Boolean 变异
|
|
90
|
+
if (type === 'auto' || type === 'boolean') {
|
|
91
|
+
const boolRegex = /\b(true|false|True|False)\b/g;
|
|
92
|
+
let bMatch;
|
|
93
|
+
while ((bMatch = boolRegex.exec(lineText)) !== null) {
|
|
94
|
+
const val = bMatch[1];
|
|
95
|
+
let rep = '';
|
|
96
|
+
if (val === 'true') rep = 'false';
|
|
97
|
+
else if (val === 'false') rep = 'true';
|
|
98
|
+
else if (val === 'True') rep = 'False';
|
|
99
|
+
else if (val === 'False') rep = 'True';
|
|
100
|
+
mutants.push({
|
|
101
|
+
type: 'boolean',
|
|
102
|
+
line: lineNo,
|
|
103
|
+
original: val,
|
|
104
|
+
replacement: rep,
|
|
105
|
+
lineText: trimmed,
|
|
106
|
+
index: curIdx + bMatch.index,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// 4. Operator 变异
|
|
112
|
+
if (type === 'auto' || type === 'operator') {
|
|
113
|
+
if (lineText.includes('===') && !lineText.includes('!==')) {
|
|
114
|
+
const idx = lineText.indexOf('===');
|
|
115
|
+
mutants.push({
|
|
116
|
+
type: 'operator',
|
|
117
|
+
line: lineNo,
|
|
118
|
+
original: '===',
|
|
119
|
+
replacement: '!==',
|
|
120
|
+
lineText: trimmed,
|
|
121
|
+
index: curIdx + idx,
|
|
122
|
+
});
|
|
123
|
+
} else if (lineText.includes('==') && !lineText.includes('!=') && !lineText.includes('===')) {
|
|
124
|
+
const idx = lineText.indexOf('==');
|
|
125
|
+
mutants.push({
|
|
126
|
+
type: 'operator',
|
|
127
|
+
line: lineNo,
|
|
128
|
+
original: '==',
|
|
129
|
+
replacement: '!=',
|
|
130
|
+
lineText: trimmed,
|
|
131
|
+
index: curIdx + idx,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
curIdx += lineText.length + 1;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// auto 模式下优先选用最具破坏力的 endpoint 变异或 return 变异
|
|
140
|
+
if (type === 'auto') {
|
|
141
|
+
const endpoints = mutants.filter((m) => m.type === 'endpoint');
|
|
142
|
+
if (endpoints.length > 0) return endpoints;
|
|
143
|
+
const returns = mutants.filter((m) => m.type === 'return');
|
|
144
|
+
if (returns.length > 0) return returns;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return mutants;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* 执行变异测试敏感度反向校验
|
|
152
|
+
* @param {object} options
|
|
153
|
+
* @param {string} [options.repoRoot=process.cwd()]
|
|
154
|
+
* @param {string} options.targetFile 变异目标文件路径
|
|
155
|
+
* @param {string} options.testCmd 待执行的测试命令
|
|
156
|
+
* @param {string} [options.mutator='auto'] 变异类型 ('auto'|'endpoint'|'boolean'|'operator'|'return')
|
|
157
|
+
* @returns {{
|
|
158
|
+
* status: 'MUTATION_KILLED' | 'MUTATION_SURVIVED' | 'BASELINE_FAILED' | 'NO_MUTANTS',
|
|
159
|
+
* exitCode: number,
|
|
160
|
+
* message: string,
|
|
161
|
+
* mutant?: object,
|
|
162
|
+
* killedCount?: number,
|
|
163
|
+
* survivedCount?: number,
|
|
164
|
+
* }}
|
|
165
|
+
*/
|
|
166
|
+
export function runMutationTest(options = {}) {
|
|
167
|
+
const repoRoot = options.repoRoot || process.cwd();
|
|
168
|
+
const targetFile = options.targetFile ? path.resolve(repoRoot, options.targetFile) : '';
|
|
169
|
+
const testCmd = options.testCmd || '';
|
|
170
|
+
const mutator = options.mutator || 'auto';
|
|
171
|
+
|
|
172
|
+
if (!testCmd) {
|
|
173
|
+
throw new Error('Mutation runner requires a test command (--cmd "<command>")');
|
|
174
|
+
}
|
|
175
|
+
if (!targetFile || !fs.existsSync(targetFile)) {
|
|
176
|
+
throw new Error(`Mutation runner target file not found: ${targetFile}`);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const cleanEnv = { ...process.env };
|
|
180
|
+
delete cleanEnv.NODE_TEST_CONTEXT;
|
|
181
|
+
|
|
182
|
+
// 1. 基线检查 (Baseline Check)
|
|
183
|
+
// 基线单测必须能够正常通过 (Exit 0)
|
|
184
|
+
try {
|
|
185
|
+
execSync(testCmd, { cwd: repoRoot, stdio: 'pipe', encoding: 'utf8', env: cleanEnv });
|
|
186
|
+
} catch (err) {
|
|
187
|
+
const stderr = err.stderr ? err.stderr.toString() : err.message;
|
|
188
|
+
return {
|
|
189
|
+
status: 'BASELINE_FAILED',
|
|
190
|
+
exitCode: 1,
|
|
191
|
+
message: `基线单测未通过,无法进行变异有效性校验: ${stderr}`,
|
|
192
|
+
stderr,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// 2. 提取变异体
|
|
197
|
+
const originalContent = fs.readFileSync(targetFile, 'utf8');
|
|
198
|
+
const mutants = generateMutants(originalContent, mutator);
|
|
199
|
+
|
|
200
|
+
if (mutants.length === 0) {
|
|
201
|
+
return {
|
|
202
|
+
status: 'NO_MUTANTS',
|
|
203
|
+
exitCode: 0,
|
|
204
|
+
message: `在 ${path.relative(repoRoot, targetFile)} 中未找到可适用的变异点`,
|
|
205
|
+
mutantsChecked: 0,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// 3. 逐个注入变异并验证测试套件敏感度
|
|
210
|
+
let killedCount = 0;
|
|
211
|
+
const survivedMutants = [];
|
|
212
|
+
|
|
213
|
+
for (const mutant of mutants) {
|
|
214
|
+
const mutatedContent =
|
|
215
|
+
originalContent.slice(0, mutant.index) +
|
|
216
|
+
mutant.replacement +
|
|
217
|
+
originalContent.slice(mutant.index + mutant.original.length);
|
|
218
|
+
|
|
219
|
+
try {
|
|
220
|
+
fs.writeFileSync(targetFile, mutatedContent, 'utf8');
|
|
221
|
+
|
|
222
|
+
let testPassedWithMutant = false;
|
|
223
|
+
try {
|
|
224
|
+
execSync(testCmd, { cwd: repoRoot, stdio: 'pipe', encoding: 'utf8', env: cleanEnv });
|
|
225
|
+
testPassedWithMutant = true;
|
|
226
|
+
} catch {
|
|
227
|
+
// 测试报错 = 变异被消灭 (Killed)
|
|
228
|
+
testPassedWithMutant = false;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (testPassedWithMutant) {
|
|
232
|
+
// 变异体存活 = 假测试!
|
|
233
|
+
survivedMutants.push(mutant);
|
|
234
|
+
} else {
|
|
235
|
+
killedCount++;
|
|
236
|
+
}
|
|
237
|
+
} finally {
|
|
238
|
+
// 必须立刻恢复原文件,保证工作区绝对干净零污染!
|
|
239
|
+
fs.writeFileSync(targetFile, originalContent, 'utf8');
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// 发现任何一个存活变异体,立即熔断报告
|
|
243
|
+
if (survivedMutants.length > 0) {
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if (survivedMutants.length > 0) {
|
|
249
|
+
const s = survivedMutants[0];
|
|
250
|
+
return {
|
|
251
|
+
status: 'MUTATION_SURVIVED',
|
|
252
|
+
exitCode: 1,
|
|
253
|
+
message: `🚨 变异敏感性校验失败:注入变异后测试未红,判定为回音壁假测试!(Mutation Survived: line ${s.line} '${s.original}' -> '${s.replacement}')`,
|
|
254
|
+
mutant: s,
|
|
255
|
+
killedCount,
|
|
256
|
+
survivedCount: survivedMutants.length,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return {
|
|
261
|
+
status: 'MUTATION_KILLED',
|
|
262
|
+
exitCode: 0,
|
|
263
|
+
message: `✅ 变异敏感性自检通过:变异注入后测试精准爆红并被拦截 (Mutations Killed: ${killedCount})`,
|
|
264
|
+
killedCount,
|
|
265
|
+
survivedCount: 0,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scanner.mjs
|
|
3
|
+
*
|
|
4
|
+
* 源码多语言规约与断言扫描器:
|
|
5
|
+
* 1. 扫描 @Invariant 注解与注释,提取 Invariant ID(严格边界正则,防 H-1 误伤 H-10)
|
|
6
|
+
* 2. 扫描 @ContractOnly 契约沙箱标记(保护未接线原型)
|
|
7
|
+
* 3. 区分生产与测试环境(No-Cheat Rule:测试调用严禁计入生产接线)
|
|
8
|
+
* 4. 启发式空壳接线探针(对 void/Unit 副作用函数输出 WARN 级审计,不硬阻断)
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import fs from 'node:fs';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import { makeStrictBoundaryRegex } from './adr-parser.mjs';
|
|
14
|
+
|
|
15
|
+
const TEST_PATH_PATTERNS = [
|
|
16
|
+
/(?:^|[\\/])(?:src[\\/])?test(?:s)?[\\/]/i,
|
|
17
|
+
/(?:^|[\\/])androidTest[\\/]/i,
|
|
18
|
+
/__tests__[\\/]/i,
|
|
19
|
+
/_test\.go$/i,
|
|
20
|
+
/\.(?:test|spec)\.[jt]sx?$/i,
|
|
21
|
+
/^test_.*\.py$/i,
|
|
22
|
+
/.*_test\.py$/i,
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 判断是否为测试文件
|
|
27
|
+
*/
|
|
28
|
+
export function isTestPath(filePath) {
|
|
29
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
30
|
+
return TEST_PATH_PATTERNS.some((pattern) => pattern.test(normalized));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 正则匹配多语言 Invariant 声明
|
|
35
|
+
*/
|
|
36
|
+
const INVARIANT_PATTERNS = [
|
|
37
|
+
// Kotlin/Java/TS: @Invariant("ADR-060:H-1") or @Invariant(id = "ADR-060:H-1")
|
|
38
|
+
/@Invariant\s*\(\s*(?:id\s*=\s*)?["']([^"']+)["']/g,
|
|
39
|
+
// JUnit5 @Tag("INV:ADR-060:H-1")
|
|
40
|
+
/@Tag\s*\(\s*["']INV:([^"']+)["']/g,
|
|
41
|
+
// Python: @pytest.mark.invariant("ADR-060:H-1") or @invariant("ADR-060:H-1")
|
|
42
|
+
/@(?:pytest\.mark\.)?invariant\s*\(\s*["']([^"']+)["']/g,
|
|
43
|
+
// Comment forms across Go, Python, TS, Rust (须带显式 @invariant / INVARIANT: / Invariant: 标识):
|
|
44
|
+
// // Invariant: ADR-060:H-1
|
|
45
|
+
// # Invariant: ADR-060:H-1
|
|
46
|
+
// // [INVARIANT: ADR-060:H-1]
|
|
47
|
+
// # [INVARIANT: ADR-060:H-1]
|
|
48
|
+
// // @invariant ADR-060:H-1
|
|
49
|
+
/(?:\/\/|#)\s*(?:@invariant(?:\s+|:\s*)|\[INVARIANT:\s*|Invariant:\s*)([A-Za-z0-9_:-]+)/gi,
|
|
50
|
+
// Rust: #[doc = "invariant: ADR-060:H-1"]
|
|
51
|
+
/#\[doc\s*=\s*["'].*?invariant:\s*([A-Za-z0-9_:-]+).*?["']\]/gi,
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 正则匹配多语言 ContractOnly 声明
|
|
56
|
+
*/
|
|
57
|
+
const CONTRACT_ONLY_PATTERNS = [
|
|
58
|
+
// Kotlin: @ContractOnly(adr = "ADR-060", expire = "2026-12-01", reason = "...")
|
|
59
|
+
/@ContractOnly\s*\(([^)]*)\)/g,
|
|
60
|
+
// Python: @contract_only(adr="ADR-060", ...)
|
|
61
|
+
/@contract_only\s*\(([^)]*)\)/g,
|
|
62
|
+
// Comments: // [CONTRACT-ONLY: ADR-060, expire: 2026-12-01]
|
|
63
|
+
/(?:\/\/|#)\s*\[CONTRACT-ONLY:\s*([^\]]+)\]/gi,
|
|
64
|
+
// TS: /** @contractOnly ADR-060 ... */
|
|
65
|
+
/@contractOnly\s+([^\n*]+)/gi,
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 扫描单个文件的内容
|
|
70
|
+
*/
|
|
71
|
+
export function scanFileContent(content, relativePath) {
|
|
72
|
+
const isTest = isTestPath(relativePath);
|
|
73
|
+
const invariants = [];
|
|
74
|
+
const contracts = [];
|
|
75
|
+
const lines = content.split('\n');
|
|
76
|
+
|
|
77
|
+
// 1. 扫描 Invariant
|
|
78
|
+
for (let lineIdx = 0; lineIdx < lines.length; lineIdx++) {
|
|
79
|
+
const line = lines[lineIdx];
|
|
80
|
+
|
|
81
|
+
for (const pattern of INVARIANT_PATTERNS) {
|
|
82
|
+
pattern.lastIndex = 0;
|
|
83
|
+
let match;
|
|
84
|
+
while ((match = pattern.exec(line)) !== null) {
|
|
85
|
+
const rawId = match[1].trim();
|
|
86
|
+
// 严格检验 ID 格式 (e.g. ADR-060:H-1 or H-1 or Gate1)
|
|
87
|
+
if (/^[A-Za-z0-9_:-]+$/.test(rawId)) {
|
|
88
|
+
// 提取显式 symbol 或 target 参数(例如 symbol = "acquire_guard")
|
|
89
|
+
let targetSymbol = '';
|
|
90
|
+
const symMatch = line.match(/(?:symbol|target)\s*[:=]\s*["']?([A-Za-z0-9_]+)["']?/i);
|
|
91
|
+
if (symMatch) {
|
|
92
|
+
targetSymbol = symMatch[1];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// 提取当前行或邻近紧随行的声明符号名 (def func / fun func / class Cls / const sym =)
|
|
96
|
+
let declaredSymbol = '';
|
|
97
|
+
for (let offset = 0; offset <= 4 && lineIdx + offset < lines.length; offset++) {
|
|
98
|
+
const checkLine = lines[lineIdx + offset].trim();
|
|
99
|
+
if (offset > 0 && (checkLine.startsWith('@') || checkLine.startsWith('//') || checkLine.startsWith('#'))) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const declM = checkLine.match(/(?:fun|def|func|function|fn|class)\s+(?:[A-Za-z0-9_.]+\.)?([A-Za-z0-9_]+)\b|(?:val|var|const|let)\s+([A-Za-z0-9_]+)\s*[:=]/);
|
|
103
|
+
if (declM) {
|
|
104
|
+
declaredSymbol = declM[1] || declM[2];
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
invariants.push({
|
|
110
|
+
id: rawId,
|
|
111
|
+
file: relativePath,
|
|
112
|
+
line: lineIdx + 1,
|
|
113
|
+
isTest,
|
|
114
|
+
lineContent: line.trim(),
|
|
115
|
+
symbolName: declaredSymbol || targetSymbol || '',
|
|
116
|
+
targetSymbol: targetSymbol || '',
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// 2. 扫描 ContractOnly
|
|
123
|
+
for (const pattern of CONTRACT_ONLY_PATTERNS) {
|
|
124
|
+
pattern.lastIndex = 0;
|
|
125
|
+
let match;
|
|
126
|
+
while ((match = pattern.exec(line)) !== null) {
|
|
127
|
+
const payload = match[1].trim();
|
|
128
|
+
let adr = '';
|
|
129
|
+
let expire = '';
|
|
130
|
+
let reason = '';
|
|
131
|
+
|
|
132
|
+
const adrMatch = payload.match(/(?:adr\s*=\s*["']?|ADR-)([^"',\s)]+)/i);
|
|
133
|
+
if (adrMatch) {
|
|
134
|
+
adr = adrMatch[0].includes('ADR-') ? (adrMatch[1].startsWith('ADR-') ? adrMatch[1] : 'ADR-' + adrMatch[1]) : adrMatch[1];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const expireMatch = payload.match(/expire(?:After)?\s*[:=]\s*["']?(\d{4}-\d{2}-\d{2})["']?/i);
|
|
138
|
+
if (expireMatch) {
|
|
139
|
+
expire = expireMatch[1];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
contracts.push({
|
|
143
|
+
adr: adr || 'ADR-UNKNOWN',
|
|
144
|
+
expire,
|
|
145
|
+
reason,
|
|
146
|
+
file: relativePath,
|
|
147
|
+
line: lineIdx + 1,
|
|
148
|
+
isTest,
|
|
149
|
+
lineContent: line.trim(),
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return {
|
|
156
|
+
relativePath,
|
|
157
|
+
isTest,
|
|
158
|
+
invariants,
|
|
159
|
+
contracts,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* 递归扫描项目代码库
|
|
165
|
+
*/
|
|
166
|
+
export function scanRepository(repoRoot, options = {}) {
|
|
167
|
+
const ignoreDirs = new Set([
|
|
168
|
+
'.git',
|
|
169
|
+
'node_modules',
|
|
170
|
+
'dist',
|
|
171
|
+
'build',
|
|
172
|
+
'.worktrees',
|
|
173
|
+
'.workbuddy',
|
|
174
|
+
'.idea',
|
|
175
|
+
'.vscode',
|
|
176
|
+
'coverage',
|
|
177
|
+
'.codegraph',
|
|
178
|
+
'.venv',
|
|
179
|
+
'venv',
|
|
180
|
+
'env',
|
|
181
|
+
'.gradle',
|
|
182
|
+
'.tox',
|
|
183
|
+
]);
|
|
184
|
+
|
|
185
|
+
const targetExtensions = new Set([
|
|
186
|
+
'.kt',
|
|
187
|
+
'.java',
|
|
188
|
+
'.py',
|
|
189
|
+
'.go',
|
|
190
|
+
'.ts',
|
|
191
|
+
'.tsx',
|
|
192
|
+
'.js',
|
|
193
|
+
'.jsx',
|
|
194
|
+
'.mjs',
|
|
195
|
+
'.cjs',
|
|
196
|
+
'.rs',
|
|
197
|
+
]);
|
|
198
|
+
|
|
199
|
+
const foundInvariants = [];
|
|
200
|
+
const foundContracts = [];
|
|
201
|
+
const scannedFiles = [];
|
|
202
|
+
|
|
203
|
+
function walk(currentDir) {
|
|
204
|
+
let entries;
|
|
205
|
+
try {
|
|
206
|
+
entries = fs.readdirSync(currentDir, { withFileTypes: true });
|
|
207
|
+
} catch {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
for (const entry of entries) {
|
|
212
|
+
if (entry.isDirectory()) {
|
|
213
|
+
if (!ignoreDirs.has(entry.name)) {
|
|
214
|
+
walk(path.join(currentDir, entry.name));
|
|
215
|
+
}
|
|
216
|
+
} else if (entry.isFile()) {
|
|
217
|
+
const ext = path.extname(entry.name).toLowerCase();
|
|
218
|
+
if (targetExtensions.has(ext)) {
|
|
219
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
220
|
+
const relPath = path.relative(repoRoot, fullPath);
|
|
221
|
+
try {
|
|
222
|
+
const content = fs.readFileSync(fullPath, 'utf8');
|
|
223
|
+
const fileResult = scanFileContent(content, relPath);
|
|
224
|
+
scannedFiles.push(relPath);
|
|
225
|
+
foundInvariants.push(...fileResult.invariants);
|
|
226
|
+
foundContracts.push(...fileResult.contracts);
|
|
227
|
+
} catch {
|
|
228
|
+
// ignore read error
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
walk(repoRoot);
|
|
236
|
+
|
|
237
|
+
return {
|
|
238
|
+
repoRoot,
|
|
239
|
+
scannedFiles,
|
|
240
|
+
scannedFilesCount: scannedFiles.length,
|
|
241
|
+
invariants: foundInvariants,
|
|
242
|
+
contracts: foundContracts,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* 检索符号调用点并执行防伪 / 空壳接线启发式分析
|
|
248
|
+
*
|
|
249
|
+
* @param {string} symbolName 待检查的生产函数/符号名(如 "shouldTriggerScheduledCheck")
|
|
250
|
+
* @param {string} repoRoot 仓库根目录
|
|
251
|
+
*/
|
|
252
|
+
export function analyzeSymbolWiring(symbolName, repoRoot) {
|
|
253
|
+
const scanRes = scanRepository(repoRoot);
|
|
254
|
+
const escapedSymbol = symbolName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
255
|
+
// 严格调用匹配正则: symbol(...)
|
|
256
|
+
const callRegex = new RegExp(`(?<=^|[^a-zA-Z0-9_])${escapedSymbol}\\s*\\(`, 'g');
|
|
257
|
+
// 严格声明行匹配正则: fun symbol / def symbol / val symbol = / let symbol =
|
|
258
|
+
const declRegex = new RegExp(`(?:fun|def|func|function|fn)\\s+(?:[A-Za-z0-9_.]+\\.)?${escapedSymbol}\\b|(?:val|var|const|let)\\s+${escapedSymbol}\\s*[:=]`);
|
|
259
|
+
|
|
260
|
+
const prodCallers = [];
|
|
261
|
+
const testCallers = [];
|
|
262
|
+
const warnings = [];
|
|
263
|
+
|
|
264
|
+
for (const relFile of scanRes.scannedFiles) {
|
|
265
|
+
const fullPath = path.join(repoRoot, relFile);
|
|
266
|
+
let content = '';
|
|
267
|
+
try {
|
|
268
|
+
content = fs.readFileSync(fullPath, 'utf8');
|
|
269
|
+
} catch {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const lines = content.split('\n');
|
|
274
|
+
const isTest = isTestPath(relFile);
|
|
275
|
+
|
|
276
|
+
for (let i = 0; i < lines.length; i++) {
|
|
277
|
+
const line = lines[i];
|
|
278
|
+
// 排除符号本身的声明行
|
|
279
|
+
if (declRegex.test(line)) {
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
callRegex.lastIndex = 0;
|
|
284
|
+
if (callRegex.test(line)) {
|
|
285
|
+
const callsite = {
|
|
286
|
+
file: relFile,
|
|
287
|
+
line: i + 1,
|
|
288
|
+
content: line.trim(),
|
|
289
|
+
isTest,
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
if (isTest) {
|
|
293
|
+
testCallers.push(callsite);
|
|
294
|
+
} else {
|
|
295
|
+
prodCallers.push(callsite);
|
|
296
|
+
|
|
297
|
+
// 启发式空壳接线探针(针对副作用函数):
|
|
298
|
+
// 若调用语句为独立行(纯单行无前置条件或赋值),输出 WARN 级提示,不硬报错
|
|
299
|
+
const trimmed = line.trim();
|
|
300
|
+
if (trimmed.startsWith(symbolName) || trimmed.startsWith('this.' + symbolName)) {
|
|
301
|
+
warnings.push({
|
|
302
|
+
level: 'WARN',
|
|
303
|
+
type: 'SUSPICIOUS_UNCHECKED_CALL',
|
|
304
|
+
message: `符号 ${symbolName} 在 ${relFile}:${i + 1} 作为独立语句调用,请确认是否具备业务前置互锁(如温控/Idle)判断。`,
|
|
305
|
+
callsite,
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// 判定接线状态(No-Cheat Rule:测试调用一律不计入生产可达性)
|
|
314
|
+
let wiringStatus = 'unwired';
|
|
315
|
+
if (prodCallers.length > 0) {
|
|
316
|
+
wiringStatus = 'wired';
|
|
317
|
+
} else if (testCallers.length > 0) {
|
|
318
|
+
wiringStatus = 'test_only';
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return {
|
|
322
|
+
symbolName,
|
|
323
|
+
wiringStatus,
|
|
324
|
+
prodCallers,
|
|
325
|
+
productionCallers: prodCallers,
|
|
326
|
+
testCallers,
|
|
327
|
+
productionCallerCount: prodCallers.length,
|
|
328
|
+
testCallerCount: testCallers.length,
|
|
329
|
+
isWiredInProduction: prodCallers.length > 0,
|
|
330
|
+
isTestOnly: prodCallers.length === 0 && testCallers.length > 0,
|
|
331
|
+
warnings,
|
|
332
|
+
};
|
|
333
|
+
}
|