@holmes-lab/holmes-kit 0.39.0 → 0.40.1
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 +578 -6
- package/README.md +120 -41
- package/dist/.build-id +1 -1
- package/dist/holmes/admission/core/admission-policy.d.ts +37 -0
- package/dist/holmes/admission/core/admission-policy.js +147 -0
- package/dist/holmes/admission/core/bounded-reader.d.ts +56 -0
- package/dist/holmes/admission/core/bounded-reader.js +135 -0
- package/dist/holmes/admission/core/change-classifier.d.ts +34 -0
- package/dist/holmes/admission/core/change-classifier.js +278 -0
- package/dist/holmes/admission/core/config-loader.d.ts +30 -0
- package/dist/holmes/admission/core/config-loader.js +145 -0
- package/dist/holmes/admission/core/event-judgement.d.ts +37 -0
- package/dist/holmes/admission/core/event-judgement.js +251 -0
- package/dist/holmes/admission/core/path-rules.d.ts +35 -0
- package/dist/holmes/admission/core/path-rules.js +88 -0
- package/dist/holmes/admission/core/pin.d.ts +7 -0
- package/dist/holmes/admission/core/pin.js +29 -0
- package/dist/holmes/admission/core/ports.d.ts +48 -0
- package/dist/holmes/admission/core/ports.js +11 -0
- package/dist/holmes/admission/core/range-resolver.d.ts +32 -0
- package/dist/holmes/admission/core/range-resolver.js +51 -0
- package/dist/holmes/admission/core/self-containment.d.ts +1 -0
- package/dist/holmes/admission/core/self-containment.js +125 -0
- package/dist/holmes/admission/core/signature-source.d.ts +9 -0
- package/dist/holmes/admission/core/signature-source.js +4 -0
- package/dist/holmes/admission/core/transition-planner.d.ts +15 -0
- package/dist/holmes/admission/core/transition-planner.js +14 -0
- package/dist/holmes/admission/core/verdict.d.ts +38 -0
- package/dist/holmes/admission/core/verdict.js +17 -0
- package/dist/holmes/admission/core/wiring.d.ts +44 -0
- package/dist/holmes/admission/core/wiring.js +618 -0
- package/dist/holmes/admission/forge/git-object-port.d.ts +4 -0
- package/dist/holmes/admission/forge/git-object-port.js +132 -0
- package/dist/holmes/assoc/assoc-arm.d.ts +1 -1
- package/dist/holmes/assoc/assoc-arm.js +1 -1
- package/dist/holmes/cli/agents.d.ts +8 -0
- package/dist/holmes/cli/agents.js +9 -5
- package/dist/holmes/cli/approve-cli.d.ts +2 -0
- package/dist/holmes/cli/approve-cli.js +392 -0
- package/dist/holmes/cli/approve-ref.d.ts +13 -7
- package/dist/holmes/cli/approve-ref.js +30 -10
- package/dist/holmes/cli/approve-status.d.ts +26 -2
- package/dist/holmes/cli/approve-status.js +98 -18
- package/dist/holmes/cli/approve-watch.d.ts +5 -0
- package/dist/holmes/cli/approve-watch.js +10 -5
- package/dist/holmes/cli/approve.d.ts +49 -13
- package/dist/holmes/cli/approve.js +249 -67
- package/dist/holmes/cli/attest.js +2 -1
- package/dist/holmes/cli/autonomy.d.ts +4 -1
- package/dist/holmes/cli/autonomy.js +17 -10
- package/dist/holmes/cli/codex-oracle.d.ts +11 -0
- package/dist/holmes/cli/codex-oracle.js +5 -1
- package/dist/holmes/cli/codex-toml.d.ts +10 -0
- package/dist/holmes/cli/codex-toml.js +36 -2
- package/dist/holmes/cli/doctor-boundary.d.ts +76 -0
- package/dist/holmes/cli/doctor-boundary.js +308 -0
- package/dist/holmes/cli/doctor-locks.d.ts +15 -0
- package/dist/holmes/cli/doctor-locks.js +119 -0
- package/dist/holmes/cli/doctor.d.ts +2 -0
- package/dist/holmes/cli/doctor.js +34 -5
- package/dist/holmes/cli/flags.d.ts +23 -0
- package/dist/holmes/cli/flags.js +89 -0
- package/dist/holmes/cli/index.d.ts +5 -1
- package/dist/holmes/cli/index.js +226 -442
- package/dist/holmes/cli/init.js +33 -0
- package/dist/holmes/cli/interactive-prompt.d.ts +39 -2
- package/dist/holmes/cli/interactive-prompt.js +98 -16
- package/dist/holmes/cli/lock-recover.d.ts +5 -0
- package/dist/holmes/cli/lock-recover.js +126 -0
- package/dist/holmes/cli/mcp-processes.js +1 -1
- package/dist/holmes/cli/release-docs.js +1 -1
- package/dist/holmes/cli/run-exec.d.ts +141 -0
- package/dist/holmes/cli/run-exec.js +1435 -0
- package/dist/holmes/cli/run-provision.d.ts +3 -1
- package/dist/holmes/cli/run-provision.js +255 -44
- package/dist/holmes/cli/run-wiring.d.ts +69 -0
- package/dist/holmes/cli/run-wiring.js +270 -0
- package/dist/holmes/cli/run.d.ts +21 -0
- package/dist/holmes/cli/run.js +341 -92
- package/dist/holmes/cli/runtime-binding-approval.js +32 -19
- package/dist/holmes/cli/screen-safe.d.ts +3 -92
- package/dist/holmes/cli/screen-safe.js +18 -756
- package/dist/holmes/config/config.d.ts +19 -0
- package/dist/holmes/config/config.js +18 -3
- package/dist/holmes/cpg/foundation/language-matrix.js +2 -2
- package/dist/holmes/cpg/import-resolver.js +1 -1
- package/dist/holmes/governance/approval-decisions.d.ts +47 -0
- package/dist/holmes/governance/approval-decisions.js +29 -0
- package/dist/holmes/governance/approval-grants.d.ts +220 -1
- package/dist/holmes/governance/approval-grants.js +612 -33
- package/dist/holmes/governance/approval-queue.d.ts +26 -0
- package/dist/holmes/governance/approval-queue.js +109 -11
- package/dist/holmes/governance/approval-spend.d.ts +95 -0
- package/dist/holmes/governance/approval-spend.js +191 -0
- package/dist/holmes/governance/autonomous-shell.d.ts +61 -0
- package/dist/holmes/governance/autonomous-shell.js +332 -0
- package/dist/holmes/governance/autonomy.d.ts +12 -0
- package/dist/holmes/governance/autonomy.js +51 -15
- package/dist/holmes/governance/constitution.d.ts +5 -0
- package/dist/holmes/governance/constitution.js +32 -12
- package/dist/holmes/governance/full-autonomy.d.ts +10 -0
- package/dist/holmes/governance/full-autonomy.js +103 -7
- package/dist/holmes/governance/harness-catalog.d.ts +103 -0
- package/dist/holmes/governance/harness-catalog.js +348 -0
- package/dist/holmes/governance/human-channel.d.ts +38 -0
- package/dist/holmes/governance/human-channel.js +49 -0
- package/dist/holmes/governance/install-manifest.d.ts +22 -0
- package/dist/holmes/governance/install-manifest.js +160 -0
- package/dist/holmes/governance/ledger-rechain.js +2 -0
- package/dist/holmes/governance/ledger-store.conformance.d.ts +7 -1
- package/dist/holmes/governance/ledger-store.conformance.js +66 -0
- package/dist/holmes/governance/ledger-store.d.ts +88 -11
- package/dist/holmes/governance/ledger-store.js +186 -8
- package/dist/holmes/governance/provenance-chain.d.ts +16 -4
- package/dist/holmes/governance/provenance-chain.js +19 -4
- package/dist/holmes/governance/provenance-ledger.d.ts +6 -3
- package/dist/holmes/governance/provenance-ledger.js +53 -18
- package/dist/holmes/governance/push-gate-runner.d.ts +2 -0
- package/dist/holmes/governance/push-gate-runner.js +50 -9
- package/dist/holmes/governance/push-gate.d.ts +13 -2
- package/dist/holmes/governance/push-gate.js +106 -14
- package/dist/holmes/governance/recorded-pairs.d.ts +96 -0
- package/dist/holmes/governance/recorded-pairs.js +522 -0
- package/dist/holmes/governance/replica-id.d.ts +1 -1
- package/dist/holmes/governance/replica-id.js +1 -1
- package/dist/holmes/governance/spec-seam.d.ts +59 -0
- package/dist/holmes/governance/spec-seam.js +587 -0
- package/dist/holmes/governance/spend-kinds.d.ts +16 -0
- package/dist/holmes/governance/spend-kinds.js +18 -0
- package/dist/holmes/guardrail/advisory-line.d.ts +102 -0
- package/dist/holmes/guardrail/advisory-line.js +718 -0
- package/dist/holmes/guardrail/decision-ledger.d.ts +2 -1
- package/dist/holmes/guardrail/decision-ledger.js +2 -1
- package/dist/holmes/guardrail/impact-gate.d.ts +7 -0
- package/dist/holmes/guardrail/impact-gate.js +33 -6
- package/dist/holmes/guardrail/line-continuation.d.ts +8 -0
- package/dist/holmes/guardrail/line-continuation.js +39 -0
- package/dist/holmes/guardrail/operator-person.d.ts +28 -4
- package/dist/holmes/guardrail/operator-person.js +57 -11
- package/dist/holmes/guardrail/refusal-codes.d.ts +8 -3
- package/dist/holmes/guardrail/refusal-codes.js +64 -10
- package/dist/holmes/guardrail/risk-classifier.d.ts +15 -9
- package/dist/holmes/guardrail/risk-classifier.js +228 -16
- package/dist/holmes/guardrail/risk-gate.d.ts +2 -8
- package/dist/holmes/guardrail/risk-gate.js +7 -34
- package/dist/holmes/guardrail/risk-types.d.ts +10 -0
- package/dist/holmes/guardrail/run-plan-scope.js +3 -1
- package/dist/holmes/guardrail/run-refusals.js +24 -8
- package/dist/holmes/guardrail/run-stages.d.ts +5 -0
- package/dist/holmes/guardrail/run-stages.js +25 -5
- package/dist/holmes/guardrail/scope-judgment.js +1 -1
- package/dist/holmes/guardrail/shell-words.js +24 -3
- package/dist/holmes/guardrail/unresolved-write.d.ts +40 -0
- package/dist/holmes/guardrail/unresolved-write.js +556 -0
- package/dist/holmes/guardrail/write-target.d.ts +3 -0
- package/dist/holmes/guardrail/write-target.js +26 -5
- package/dist/holmes/hooks/pre-tool-use.d.ts +116 -1
- package/dist/holmes/hooks/pre-tool-use.js +1176 -170
- package/dist/holmes/hooks/rtm-refresh-child.d.ts +1 -1
- package/dist/holmes/hooks/rtm-refresh-child.js +1 -1
- package/dist/holmes/hooks/session-start.js +17 -1
- package/dist/holmes/hooks/stop.d.ts +23 -0
- package/dist/holmes/hooks/stop.js +86 -33
- package/dist/holmes/mcp/approval-adapters.js +3 -1
- package/dist/holmes/mcp/approval-commit.js +3 -2
- package/dist/holmes/mcp/approval-policy.d.ts +2 -1
- package/dist/holmes/mcp/approval-policy.js +3 -1
- package/dist/holmes/mcp/handlers/adoption.d.ts +1 -1
- package/dist/holmes/mcp/handlers/approval-ask.d.ts +3 -0
- package/dist/holmes/mcp/handlers/approval-ask.js +18 -7
- package/dist/holmes/mcp/handlers/entity-integration.d.ts +3 -3
- package/dist/holmes/mcp/handlers/entity-integration.js +29 -11
- package/dist/holmes/mcp/handlers/entity-renumber.d.ts +4 -4
- package/dist/holmes/mcp/handlers/entity-renumber.js +29 -11
- package/dist/holmes/mcp/handlers/entity-store.d.ts +2 -2
- package/dist/holmes/mcp/handlers/entity-store.js +133 -59
- package/dist/holmes/mcp/handlers/maintenance-analysis.d.ts +13 -0
- package/dist/holmes/mcp/handlers/maintenance-analysis.js +59 -2
- package/dist/holmes/mcp/handlers/operator-inspection.d.ts +9 -5
- package/dist/holmes/mcp/handlers/operator-inspection.js +79 -16
- package/dist/holmes/mcp/handlers/phase-queries.d.ts +1 -1
- package/dist/holmes/mcp/handlers/requirement-triage.d.ts +4 -4
- package/dist/holmes/mcp/handlers/review-evidence.d.ts +2 -2
- package/dist/holmes/mcp/handlers/review-evidence.js +35 -11
- package/dist/holmes/mcp/handlers/review-queries.d.ts +5 -0
- package/dist/holmes/mcp/handlers/review-queries.js +8 -1
- package/dist/holmes/mcp/handlers/review-verdict.d.ts +3 -0
- package/dist/holmes/mcp/handlers/review-verdict.js +10 -3
- package/dist/holmes/mcp/handlers/risk-assessment.d.ts +7 -2
- package/dist/holmes/mcp/handlers/risk-assessment.js +34 -12
- package/dist/holmes/mcp/handlers/runtime-binding-tool.d.ts +2 -2
- package/dist/holmes/mcp/handlers/slice-orchestration.d.ts +6 -1
- package/dist/holmes/mcp/handlers/slice-orchestration.js +14 -1
- package/dist/holmes/mcp/handlers/spec-approval.d.ts +15 -3
- package/dist/holmes/mcp/handlers/spec-approval.js +32 -5
- package/dist/holmes/mcp/handlers/spec-authoring.d.ts +2 -2
- package/dist/holmes/mcp/handlers/spec-authoring.js +19 -2
- package/dist/holmes/mcp/handlers/spec-lifecycle.d.ts +11 -38
- package/dist/holmes/mcp/handlers/spec-lifecycle.js +441 -94
- package/dist/holmes/mcp/handlers/spec-queries.d.ts +2 -2
- package/dist/holmes/mcp/handlers/taint-screening.d.ts +1 -1
- package/dist/holmes/mcp/handlers/taint-screening.js +2 -2
- package/dist/holmes/mcp/handlers/test-execution.d.ts +471 -4
- package/dist/holmes/mcp/handlers/test-execution.js +199 -21
- package/dist/holmes/mcp/handlers/workspace-queries.d.ts +2 -2
- package/dist/holmes/mcp/handlers.d.ts +557 -82
- package/dist/holmes/mcp/handlers.js +74 -23
- package/dist/holmes/mcp/harness-attestation.d.ts +78 -5
- package/dist/holmes/mcp/harness-attestation.js +325 -53
- package/dist/holmes/mcp/maintenance-analyze.d.ts +6 -1
- package/dist/holmes/mcp/maintenance-analyze.js +13 -11
- package/dist/holmes/mcp/maintenance-evidence.d.ts +9 -0
- package/dist/holmes/mcp/maintenance-evidence.js +35 -3
- package/dist/holmes/mcp/requirement-triage-evidence.js +22 -13
- package/dist/holmes/mcp/server-staleness.js +1 -1
- package/dist/holmes/mcp/server.js +9 -8
- package/dist/holmes/mcp/spec-id-guard.js +1 -1
- package/dist/holmes/mcp/tool-schemas.d.ts +13 -0
- package/dist/holmes/mcp/tool-schemas.js +42 -9
- package/dist/holmes/project/act-root.d.ts +19 -0
- package/dist/holmes/project/act-root.js +100 -0
- package/dist/holmes/project/baseline.d.ts +15 -2
- package/dist/holmes/project/baseline.js +14 -8
- package/dist/holmes/project/bounded-group.d.ts +47 -0
- package/dist/holmes/project/bounded-group.js +140 -0
- package/dist/holmes/project/bounded-io.d.ts +51 -2
- package/dist/holmes/project/bounded-io.js +140 -6
- package/dist/holmes/project/change-source.d.ts +4 -0
- package/dist/holmes/project/change-source.js +14 -6
- package/dist/holmes/project/instance-id.d.ts +10 -0
- package/dist/holmes/project/instance-id.js +233 -0
- package/dist/holmes/project/machine-identity.d.ts +25 -0
- package/dist/holmes/project/machine-identity.js +133 -0
- package/dist/holmes/project/owned-lock.d.ts +84 -0
- package/dist/holmes/project/owned-lock.js +263 -0
- package/dist/holmes/project/plain-lock-fs.d.ts +2 -0
- package/dist/holmes/project/plain-lock-fs.js +126 -0
- package/dist/holmes/project/request-lock.d.ts +85 -0
- package/dist/holmes/project/request-lock.js +459 -0
- package/dist/holmes/project/root.d.ts +12 -4
- package/dist/holmes/project/root.js +29 -8
- package/dist/holmes/project/run-records.d.ts +19 -0
- package/dist/holmes/project/run-records.js +94 -12
- package/dist/holmes/project/screen-text.d.ts +94 -0
- package/dist/holmes/project/screen-text.js +763 -0
- package/dist/holmes/project/spend-lock.d.ts +82 -0
- package/dist/holmes/project/spend-lock.js +413 -0
- package/dist/holmes/refresh/freshness-coordinator.d.ts +1 -1
- package/dist/holmes/refresh/freshness-coordinator.js +1 -1
- package/dist/holmes/review/condition-hunk-replay.js +4 -2
- package/dist/holmes/review/confidence-calibration.d.ts +1 -1
- package/dist/holmes/review/confidence-calibration.js +1 -1
- package/dist/holmes/review/content-verify.js +1 -1
- package/dist/holmes/review/evidence-mode.d.ts +21 -0
- package/dist/holmes/review/evidence-mode.js +33 -0
- package/dist/holmes/review/head-worktree.d.ts +55 -0
- package/dist/holmes/review/head-worktree.js +329 -0
- package/dist/holmes/review/hop-ablation.d.ts +4 -4
- package/dist/holmes/review/hop-ablation.js +5 -5
- package/dist/holmes/review/mrp.js +13 -3
- package/dist/holmes/review/point-in-time-replay.js +12 -3
- package/dist/holmes/review/rank-diagnosis.d.ts +2 -2
- package/dist/holmes/review/rank-diagnosis.js +1 -1
- package/dist/holmes/review/replay-corpus.d.ts +10 -4
- package/dist/holmes/review/replay-corpus.js +25 -9
- package/dist/holmes/review/requirement-triage.js +2 -2
- package/dist/holmes/review/run-provenance.d.ts +45 -0
- package/dist/holmes/review/run-provenance.js +314 -0
- package/dist/holmes/review/semantic-arm.d.ts +3 -3
- package/dist/holmes/review/semantic-arm.js +3 -3
- package/dist/holmes/review/test-evidence.d.ts +174 -0
- package/dist/holmes/review/test-evidence.js +330 -2
- package/dist/holmes/review/test-outcomes.js +3 -1
- package/dist/holmes/review/test-reports.d.ts +94 -0
- package/dist/holmes/review/test-reports.js +382 -0
- package/dist/holmes/review/test-runner.d.ts +180 -58
- package/dist/holmes/review/test-runner.js +560 -324
- package/dist/holmes/review/test-selection-breadth.js +2 -2
- package/dist/holmes/review/test-units.d.ts +159 -0
- package/dist/holmes/review/test-units.js +814 -0
- package/dist/holmes/review/verdicts.d.ts +105 -8
- package/dist/holmes/review/verdicts.js +640 -36
- package/dist/holmes/rtm/anchor-census.d.ts +9 -0
- package/dist/holmes/rtm/anchor-census.js +151 -0
- package/dist/holmes/rtm/anchor-ids.d.ts +25 -1
- package/dist/holmes/rtm/anchor-ids.js +45 -2
- package/dist/holmes/rtm/comment-ranges.d.ts +2 -0
- package/dist/holmes/rtm/comment-ranges.js +104 -0
- package/dist/holmes/rtm/counted-tests.d.ts +1 -0
- package/dist/holmes/rtm/counted-tests.js +63 -0
- package/dist/holmes/rtm/impact-advisory.d.ts +1 -1
- package/dist/holmes/rtm/known-defects.js +1 -1
- package/dist/holmes/rtm/localize.js +1 -1
- package/dist/holmes/rtm/taint-benchmark.d.ts +1 -1
- package/dist/holmes/rtm/taint-vocabulary.d.ts +1 -1
- package/dist/holmes/rtm/test-scope.d.ts +31 -0
- package/dist/holmes/rtm/test-scope.js +166 -5
- package/dist/holmes/rtm/trace-gaps.js +1 -1
- package/dist/holmes/runtime/dispatch.d.ts +10 -0
- package/dist/holmes/runtime/dispatch.js +12 -1
- package/dist/holmes/semantic/cloud-usage.d.ts +1 -1
- package/dist/holmes/semantic/cloud-usage.js +1 -1
- package/dist/holmes/semantic/unreadable-paths.d.ts +1 -1
- package/dist/holmes/semantic/unreadable-paths.js +1 -1
- package/dist/holmes/spec/approval-blockers.js +1 -1
- package/dist/holmes/spec/entity-store.d.ts +6 -1
- package/dist/holmes/spec/entity-store.js +16 -2
- package/dist/holmes/spec/entity-transaction.d.ts +7 -2
- package/dist/holmes/spec/entity-transaction.js +87 -170
- package/dist/holmes/spec/spec-store.d.ts +12 -6
- package/dist/holmes/spec/spec-store.js +4 -2
- package/dist/holmes/spec/spec-types.js +1 -1
- package/dist/holmes/spec/succession-guard.d.ts +56 -0
- package/dist/holmes/spec/succession-guard.js +187 -0
- package/dist/holmes/spec/succession.d.ts +70 -0
- package/dist/holmes/spec/succession.js +171 -0
- package/dist/holmes/spec/transition-policy.d.ts +2 -2
- package/docs/install-guide.md +9 -3
- package/docs/language-support.md +78 -0
- package/package.json +4 -3
- package/playbooks/author-slice/PLAYBOOK.md +1 -1
- package/playbooks/promote-slice/PLAYBOOK.md +5 -1
- package/playbooks/publish/PLAYBOOK.md +47 -34
- package/dist/holmes/review/manual-baseline.d.ts +0 -209
- package/dist/holmes/review/manual-baseline.js +0 -2847
|
@@ -33,18 +33,21 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.GEMINI_CLI_MEASUREMENT = exports.GEMINI_CLI_CORPUS = exports.
|
|
36
|
+
exports.GEMINI_CLI_MEASUREMENT = exports.GEMINI_CLI_CORPUS = exports.CONSUMER_CORPUS = exports.HOLMES_CORPUS = void 0;
|
|
37
37
|
exports.changedParentLines = changedParentLines;
|
|
38
|
+
exports.absentCorpusNotice = absentCorpusNotice;
|
|
38
39
|
exports.casesFor = casesFor;
|
|
39
40
|
exports.thinSpecs = thinSpecs;
|
|
40
41
|
exports.casesAvoidingRecent = casesAvoidingRecent;
|
|
41
|
-
// @implements A-SPEC-345, A-SPEC-734
|
|
42
|
+
// @implements A-SPEC-345, A-SPEC-734, A-SPEC-794.56, A-SPEC-794.57, A-SPEC-794.58
|
|
42
43
|
// @implements A-SPEC-387
|
|
44
|
+
const fs = __importStar(require("node:fs"));
|
|
43
45
|
const os = __importStar(require("node:os"));
|
|
44
46
|
const path = __importStar(require("node:path"));
|
|
45
47
|
const node_child_process_1 = require("node:child_process");
|
|
46
48
|
const maintenance_analyze_1 = require("../mcp/maintenance-analyze");
|
|
47
49
|
const bounded_io_1 = require("../project/bounded-io");
|
|
50
|
+
const root_1 = require("../project/root");
|
|
48
51
|
const TS_FAMILY = (f) => f.endsWith('.ts') && !f.endsWith('.d.ts');
|
|
49
52
|
// @implements A-SPEC-573.3
|
|
50
53
|
/**
|
|
@@ -60,7 +63,8 @@ const TS_FAMILY = (f) => f.endsWith('.ts') && !f.endsWith('.d.ts');
|
|
|
60
63
|
function changedParentLines(root, commit, file) {
|
|
61
64
|
let raw;
|
|
62
65
|
try {
|
|
63
|
-
|
|
66
|
+
// @implements A-SPEC-792.39 — the shared inert git environment, no external diff or textconv.
|
|
67
|
+
raw = (0, node_child_process_1.execFileSync)('git', ['-C', root, 'show', '--no-ext-diff', '--no-textconv', '--unified=0', '--format=', commit, '--', file], { timeout: bounded_io_1.GIT_LONG_TIMEOUT_MS, encoding: 'utf8', maxBuffer: 16 * 1024 * 1024, env: (0, bounded_io_1.gitEnv)((0, root_1.cleanSubprocessEnv)()) });
|
|
64
68
|
}
|
|
65
69
|
catch {
|
|
66
70
|
return [];
|
|
@@ -94,11 +98,14 @@ exports.HOLMES_CORPUS = {
|
|
|
94
98
|
* truth files, and its own `.ax/specs`. Tests live in `tests/` rather than beside the source, which
|
|
95
99
|
* is precisely the assumption that had to stop being hard-coded.
|
|
96
100
|
*
|
|
97
|
-
* Absent
|
|
98
|
-
* someone else's checkout is a benchmark nobody else can run.
|
|
101
|
+
* Absent unless HOLMES_CONSUMER_CORPUS names a checkout of it, and callers skip rather than fail — a benchmark that
|
|
102
|
+
* requires someone else's checkout is a benchmark nobody else can run. A-SPEC-794.57: a caller that skips says so
|
|
103
|
+
* (`absentCorpusNotice`), so a green run does not hide that nothing was measured.
|
|
99
104
|
*/
|
|
100
|
-
exports.
|
|
101
|
-
|
|
105
|
+
exports.CONSUMER_CORPUS = {
|
|
106
|
+
// A-SPEC-794.56 — the package names no consumer: the checkout is named by HOLMES_CONSUMER_CORPUS, and without it the
|
|
107
|
+
// root is a path that does not exist, so callers skip as they do when the corpus is absent
|
|
108
|
+
root: process.env.HOLMES_CONSUMER_CORPUS || path.join(os.tmpdir(), 'holmes-consumer-corpus-unset'),
|
|
102
109
|
// @implements A-SPEC-443 — the last commit before 2026-08-30, the day five landed and moved a
|
|
103
110
|
// six-decimal assertion with no product change.
|
|
104
111
|
pin: '7b58e40ba3723b9d85390fdadf1d407cdf7bb9ec',
|
|
@@ -107,6 +114,14 @@ exports.JARVIS_CORPUS = {
|
|
|
107
114
|
isTest: (f) => f.startsWith('tests/') || f.includes('.test.') || f.includes('.spec.'),
|
|
108
115
|
isSource: (f) => (f.endsWith('.ts') || f.endsWith('.py') || f.endsWith('.js')) && !f.endsWith('.d.ts'),
|
|
109
116
|
};
|
|
117
|
+
/**
|
|
118
|
+
* @implements A-SPEC-794.57 — the line a caller prints when it skips because `corpus` is not checked out, or null when it
|
|
119
|
+
* is. The variable that names it is said, so the run says how to measure it.
|
|
120
|
+
*/
|
|
121
|
+
function absentCorpusNotice(corpus, label, variable) {
|
|
122
|
+
return fs.existsSync(path.join(corpus.root, '.git')) ? null
|
|
123
|
+
: `[${label}-corpus] ${variable} is unset or names no checkout (${corpus.root}): not checked`;
|
|
124
|
+
}
|
|
110
125
|
// @implements A-SPEC-426
|
|
111
126
|
/**
|
|
112
127
|
* A third party's repository, with no spec store at all.
|
|
@@ -120,7 +135,8 @@ exports.JARVIS_CORPUS = {
|
|
|
120
135
|
* Whatever the remaining layers are worth, they are worth something on their own.
|
|
121
136
|
*/
|
|
122
137
|
exports.GEMINI_CLI_CORPUS = {
|
|
123
|
-
|
|
138
|
+
// A-SPEC-794.57 — named by HOLMES_GEMINI_CLI_CORPUS, as the consumer corpus is; without it, a path that does not exist
|
|
139
|
+
root: process.env.HOLMES_GEMINI_CLI_CORPUS || path.join(os.tmpdir(), 'holmes-reference-gemini-cli-unset'),
|
|
124
140
|
sourcePathspec: ['packages'],
|
|
125
141
|
specPathspec: '.ax/specs',
|
|
126
142
|
isTest: (f) => f.includes('.test.') || f.includes('.spec.'),
|
|
@@ -196,7 +212,7 @@ function casesFor(corpus, limit, offset = 0) {
|
|
|
196
212
|
* A deterministic sub-sample of a spec store, for holding a repository fixed while varying only how
|
|
197
213
|
* many specs it has.
|
|
198
214
|
*
|
|
199
|
-
* The advantage over a no-graph baseline is 2.5x on this repository (585 specs) and a wash on
|
|
215
|
+
* The advantage over a no-graph baseline is 2.5x on this repository (585 specs) and a wash on the consumer corpus
|
|
200
216
|
* (54). Reading that as a DENSITY effect is, so far, a correlation: the two corpora differ in
|
|
201
217
|
* language, size, subject and commit style as well. Thinning one corpus is the controlled version of
|
|
202
218
|
* the same question — everything else stays exactly where it is.
|
|
@@ -4,7 +4,7 @@ exports.canonicalRequirementDocument = void 0;
|
|
|
4
4
|
exports.requestIdentifiers = requestIdentifiers;
|
|
5
5
|
exports.triageRequirements = triageRequirements;
|
|
6
6
|
exports.requirementSemanticCoverage = requirementSemanticCoverage;
|
|
7
|
-
// @implements A-SPEC-713.1, A-SPEC-713.2, A-SPEC-713.3, A-SPEC-713.4, A-SPEC-742, A-SPEC-713, A-SPEC-757
|
|
7
|
+
// @implements A-SPEC-713.1, A-SPEC-713.2, A-SPEC-713.3, A-SPEC-713.4, A-SPEC-742, A-SPEC-713, A-SPEC-757, A-SPEC-794.56
|
|
8
8
|
/** Pure, conservative lifecycle triage over governed requirement documents. */
|
|
9
9
|
const semantic_retrieval_1 = require("./semantic-retrieval");
|
|
10
10
|
const localize_1 = require("../rtm/localize");
|
|
@@ -200,7 +200,7 @@ function triageCore(input) {
|
|
|
200
200
|
const contentTerms = promptTerms.filter((term) => textLower.includes(term));
|
|
201
201
|
const operational = input.evidence?.[row.reqId] ?? {};
|
|
202
202
|
// @implements A-SPEC-713.4 — judged by the documents, not their count: `length === 4` left 62 of 672 fully
|
|
203
|
-
// approved lineages here (8 of 671 in
|
|
203
|
+
// approved lineages here (8 of 671 in the consumer corpus) unapproved because they carry sub-slices or retired documents,
|
|
204
204
|
// and counted REQ, H-SPEC and two A-SPECs without any T-SPEC as approved.
|
|
205
205
|
const live = row.docs.filter((d) => d.status !== 'outdated');
|
|
206
206
|
const kinds = new Set(live.map((d) => d.type));
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare const PLUGIN = "holmes_provenance";
|
|
2
|
+
/** Runs one child within the run's budget and process group (the runner's runBounded); throws on a non-zero exit. */
|
|
3
|
+
export type BoundedExec = (cmd: string, args: string[], opts: {
|
|
4
|
+
cwd: string;
|
|
5
|
+
env: NodeJS.ProcessEnv;
|
|
6
|
+
}) => string;
|
|
7
|
+
export declare const PYTHON_NAMES = 20000;
|
|
8
|
+
/**
|
|
9
|
+
* A-SPEC-128.17 N2: every dotted module name of HEAD's python files — each identifier suffix of each path, and each
|
|
10
|
+
* package on the way (namespace packages included), so no layout (src/, python/, packages/x/src/) is missed. `over` when
|
|
11
|
+
* the names pass the cap (testRun.pythonNames).
|
|
12
|
+
*/
|
|
13
|
+
export declare function pythonNames(runRoot: string, cap?: number): {
|
|
14
|
+
names: string[];
|
|
15
|
+
over: boolean;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* E3: where the interpreter resolves HEAD's names, asked in HEAD's worktree with the unit's environment; a reason or null.
|
|
19
|
+
* `-P` (python 3.11+) keeps the current directory off sys.path from the first import, so HEAD's own json.py or
|
|
20
|
+
* sysconfig.py never runs in the question; an older python fails it, and that is environment. The answer is written to
|
|
21
|
+
* a file, so nothing a .pth or an exit handler prints can be read as it (review A of 128.16, L1 and L2).
|
|
22
|
+
*/
|
|
23
|
+
export declare function pythonEnvironmentResolves(python: string, cwd: string, names: string[], workTree: string, headTree: string, env: NodeJS.ProcessEnv, exec?: BoundedExec): string | null;
|
|
24
|
+
/** O1: the first loaded file inside the work tree, outside HEAD's worktree and every library directory, as a reason; or null. */
|
|
25
|
+
export declare function loadedFromWorkTree(recordFile: string, workTree: string, headTree: string): string | null;
|
|
26
|
+
/**
|
|
27
|
+
* The provenance of one full pytest unit in HEAD's worktree: P1's pinned configuration and confcutdir, E3's environment
|
|
28
|
+
* answer (`refused` when the environment resolves HEAD's names to the work tree), and O1's plugin with its judgement.
|
|
29
|
+
*/
|
|
30
|
+
export declare function pytestRunProvenance(tmpDir: string, run: {
|
|
31
|
+
root: string;
|
|
32
|
+
sourceRoot: string;
|
|
33
|
+
}, unitCwd: string, python: string, env: NodeJS.ProcessEnv, exec?: BoundedExec): {
|
|
34
|
+
refused: string | null;
|
|
35
|
+
args: string[];
|
|
36
|
+
confcutdir: string;
|
|
37
|
+
env: (base: NodeJS.ProcessEnv) => NodeJS.ProcessEnv;
|
|
38
|
+
judge: (passed: boolean) => string | null;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* E4: HEAD's package names (every package.json of the worktree outside node_modules), each resolved as node resolves a
|
|
42
|
+
* bare name — `node_modules/<name>` up the ancestors of every package directory, then each NODE_PATH entry. One that
|
|
43
|
+
* lands inside the work tree, outside HEAD's worktree and every node_modules, is a reason; otherwise null.
|
|
44
|
+
*/
|
|
45
|
+
export declare function nodeNamesResolveToWorkTree(headTree: string, workTree: string, env: NodeJS.ProcessEnv): string | null;
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.PYTHON_NAMES = exports.PLUGIN = void 0;
|
|
37
|
+
exports.pythonNames = pythonNames;
|
|
38
|
+
exports.pythonEnvironmentResolves = pythonEnvironmentResolves;
|
|
39
|
+
exports.loadedFromWorkTree = loadedFromWorkTree;
|
|
40
|
+
exports.pytestRunProvenance = pytestRunProvenance;
|
|
41
|
+
exports.nodeNamesResolveToWorkTree = nodeNamesResolveToWorkTree;
|
|
42
|
+
// @implements A-SPEC-128.14, A-SPEC-128.15, A-SPEC-128.16, A-SPEC-128.17
|
|
43
|
+
/**
|
|
44
|
+
* HEAD's run must import HEAD's code. A full pytest unit in HEAD's worktree runs the work tree's interpreter (a `.venv`
|
|
45
|
+
* is not in HEAD), and an editable install, a `.pth` finder or a path entry there can load the work tree's source — so
|
|
46
|
+
* a red commit went green on code that was never committed (reviewer B, 128.13 to 128.15).
|
|
47
|
+
*
|
|
48
|
+
* Two witnesses, both judged against the same exemption — the interpreter's own library directories:
|
|
49
|
+
* - A-SPEC-128.16 E3 asks the ENVIRONMENT, before and apart from the tests: the interpreter, started in HEAD's
|
|
50
|
+
* worktree with the unit's environment, says where each of HEAD's top-level names resolves. A subprocess, an xdist
|
|
51
|
+
* worker or a test that restores sys.modules uses the same environment, so one question covers them all.
|
|
52
|
+
* - A-SPEC-128.15 O1 records the OUTCOME: a plugin writes the file of every module the run loaded.
|
|
53
|
+
* Node is asked the same question (E4): where HEAD's package names resolve from each package directory.
|
|
54
|
+
*/
|
|
55
|
+
const fs = __importStar(require("node:fs"));
|
|
56
|
+
const os = __importStar(require("node:os"));
|
|
57
|
+
const path = __importStar(require("node:path"));
|
|
58
|
+
const node_child_process_1 = require("node:child_process");
|
|
59
|
+
const test_units_1 = require("./test-units");
|
|
60
|
+
const config_1 = require("../config/config");
|
|
61
|
+
const root_1 = require("../project/root");
|
|
62
|
+
const bounded_io_1 = require("../project/bounded-io");
|
|
63
|
+
exports.PLUGIN = 'holmes_provenance';
|
|
64
|
+
const LIBS = 'import sysconfig\ndef _libs():\n p = sysconfig.get_paths()\n return [p[k] for k in ("stdlib", "platstdlib", "purelib", "platlib") if p.get(k)]\n';
|
|
65
|
+
const SOURCE = [
|
|
66
|
+
'import json, os, sys', LIBS,
|
|
67
|
+
'def pytest_sessionfinish(session, exitstatus):',
|
|
68
|
+
' out = os.environ.get("HOLMES_PROVENANCE_OUT")',
|
|
69
|
+
' if not out:',
|
|
70
|
+
' return',
|
|
71
|
+
' files = [f for f in (getattr(m, "__file__", None) for m in list(sys.modules.values())) if isinstance(f, str)]',
|
|
72
|
+
' with open(out, "w") as fh:',
|
|
73
|
+
' json.dump({"prefixes": _libs(), "files": files}, fh)',
|
|
74
|
+
'',
|
|
75
|
+
].join('\n');
|
|
76
|
+
const PROBE = [
|
|
77
|
+
'import importlib.util, json, os, sys', LIBS,
|
|
78
|
+
'here = {os.getcwd(), os.path.realpath(os.getcwd())}',
|
|
79
|
+
'sys.path = [p for p in sys.path if p not in ("", ".") and os.path.realpath(p) not in here]',
|
|
80
|
+
'channels = list(sys.path)',
|
|
81
|
+
'# HEAD itself is only the last resort, so a parent package resolves and the environment\'s own paths still come first',
|
|
82
|
+
'sys.path.append(os.getcwd())',
|
|
83
|
+
'found = {}',
|
|
84
|
+
'with open(os.environ["HOLMES_PROBE_NAMES_FILE"]) as fh:',
|
|
85
|
+
' names = json.load(fh)',
|
|
86
|
+
'for n in names:',
|
|
87
|
+
' try:',
|
|
88
|
+
' s = importlib.util.find_spec(n)',
|
|
89
|
+
' except Exception:',
|
|
90
|
+
' continue',
|
|
91
|
+
' if s is None:',
|
|
92
|
+
' continue',
|
|
93
|
+
' locs = [s.origin] if s.origin and s.origin not in ("built-in", "frozen") else []',
|
|
94
|
+
' locs += [str(x) for x in (s.submodule_search_locations or [])]',
|
|
95
|
+
' if locs:',
|
|
96
|
+
' found[n] = locs',
|
|
97
|
+
'with open(os.environ["HOLMES_PROBE_OUT"], "w") as fh:',
|
|
98
|
+
' json.dump({"libs": _libs(), "found": found, "paths": channels}, fh)',
|
|
99
|
+
].join('\n');
|
|
100
|
+
const real = (p) => { try {
|
|
101
|
+
return fs.realpathSync(p);
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
return path.resolve(p);
|
|
105
|
+
} };
|
|
106
|
+
const inside = (child, parent) => { const rel = path.relative(parent, child); return rel === '' || (!rel.startsWith('..') && !path.isAbsolute(rel)); };
|
|
107
|
+
const IDENT = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
108
|
+
/** A location of the work tree's code: inside it, outside HEAD's worktree, outside every library directory. */
|
|
109
|
+
const workTreeCode = (loc, tree, head, libs) => { const r = real(loc); return inside(r, tree) && !inside(r, head) && !libs.some((l) => inside(r, l)); };
|
|
110
|
+
const rel = (tree, loc) => path.relative(tree, real(loc)).split(path.sep).join('/');
|
|
111
|
+
exports.PYTHON_NAMES = 20_000;
|
|
112
|
+
/** HEAD's tracked python files, as git lists them in the worktree; a bounded walk when git cannot answer. */
|
|
113
|
+
function pythonFiles(runRoot) {
|
|
114
|
+
try {
|
|
115
|
+
return (0, node_child_process_1.execFileSync)('git', ['-C', runRoot, 'ls-files', '-z', '--', '*.py'], { encoding: 'utf8', timeout: bounded_io_1.GIT_TIMEOUT_MS * 4, maxBuffer: 256 * 1024 * 1024, env: (0, root_1.cleanSubprocessEnv)(), stdio: ['ignore', 'pipe', 'ignore'] })
|
|
116
|
+
.split('\0').filter((f) => f !== '');
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
const out = [];
|
|
120
|
+
const walk = (d, relDir) => {
|
|
121
|
+
let kids = [];
|
|
122
|
+
try {
|
|
123
|
+
kids = fs.readdirSync(d, { withFileTypes: true });
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (kids.some((k) => k.name === 'pyvenv.cfg'))
|
|
129
|
+
return;
|
|
130
|
+
for (const k of kids) {
|
|
131
|
+
if (k.name.startsWith('.') || k.name === 'node_modules')
|
|
132
|
+
continue;
|
|
133
|
+
const r = relDir === '' ? k.name : `${relDir}/${k.name}`;
|
|
134
|
+
if (k.isDirectory())
|
|
135
|
+
walk(path.join(d, k.name), r);
|
|
136
|
+
else if (k.name.endsWith('.py'))
|
|
137
|
+
out.push(r);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
walk(runRoot, '');
|
|
141
|
+
return out;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* A-SPEC-128.17 N2: every dotted module name of HEAD's python files — each identifier suffix of each path, and each
|
|
146
|
+
* package on the way (namespace packages included), so no layout (src/, python/, packages/x/src/) is missed. `over` when
|
|
147
|
+
* the names pass the cap (testRun.pythonNames).
|
|
148
|
+
*/
|
|
149
|
+
function pythonNames(runRoot, cap = exports.PYTHON_NAMES) {
|
|
150
|
+
const names = new Set();
|
|
151
|
+
for (const file of pythonFiles(runRoot)) {
|
|
152
|
+
const segs = file.split('/');
|
|
153
|
+
const stem = segs[segs.length - 1].slice(0, -3);
|
|
154
|
+
const mod = stem === '__init__' ? segs.slice(0, -1) : [...segs.slice(0, -1), stem];
|
|
155
|
+
for (let end = 1; end <= mod.length; end++) {
|
|
156
|
+
for (let start = end - 1; start >= 0; start--) {
|
|
157
|
+
if (!IDENT.test(mod[start]))
|
|
158
|
+
break;
|
|
159
|
+
names.add(mod.slice(start, end).join('.'));
|
|
160
|
+
if (names.size > cap)
|
|
161
|
+
return { names: [...names], over: true };
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return { names: [...names], over: false };
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* E3: where the interpreter resolves HEAD's names, asked in HEAD's worktree with the unit's environment; a reason or null.
|
|
169
|
+
* `-P` (python 3.11+) keeps the current directory off sys.path from the first import, so HEAD's own json.py or
|
|
170
|
+
* sysconfig.py never runs in the question; an older python fails it, and that is environment. The answer is written to
|
|
171
|
+
* a file, so nothing a .pth or an exit handler prints can be read as it (review A of 128.16, L1 and L2).
|
|
172
|
+
*/
|
|
173
|
+
function pythonEnvironmentResolves(python, cwd, names, workTree, headTree, env, exec = (c, a, o) => (0, node_child_process_1.execFileSync)(c, a, { ...o, encoding: 'utf8', timeout: 60_000, stdio: ['ignore', 'pipe', 'pipe'] })) {
|
|
174
|
+
let answer;
|
|
175
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'holmes-probe-'));
|
|
176
|
+
const out = path.join(dir, 'answer.json');
|
|
177
|
+
const namesFile = path.join(dir, 'names.json');
|
|
178
|
+
try {
|
|
179
|
+
fs.writeFileSync(namesFile, JSON.stringify(names));
|
|
180
|
+
exec(python, ['-P', '-c', PROBE], { cwd, env: { ...env, HOLMES_PROBE_NAMES_FILE: namesFile, HOLMES_PROBE_OUT: out } });
|
|
181
|
+
answer = JSON.parse(fs.readFileSync(out, 'utf8'));
|
|
182
|
+
}
|
|
183
|
+
catch (e) {
|
|
184
|
+
return `the interpreter (${python}) could not say where HEAD's names resolve (python 3.11 or later is needed): ${String(e.message ?? e).split('\n')[0].slice(0, 160)}`;
|
|
185
|
+
}
|
|
186
|
+
finally {
|
|
187
|
+
try {
|
|
188
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
189
|
+
}
|
|
190
|
+
catch { /* best effort */ }
|
|
191
|
+
}
|
|
192
|
+
const tree = real(workTree), head = real(headTree);
|
|
193
|
+
const libs = (Array.isArray(answer.libs) ? answer.libs : []).filter((l) => typeof l === 'string' && l !== '').map(real);
|
|
194
|
+
// A-SPEC-128.17 C1: an import-path entry into the work tree is a channel, whatever names resolve through it
|
|
195
|
+
const channel = (Array.isArray(answer.paths) ? answer.paths : []).find((p) => typeof p === 'string' && p !== '' && workTreeCode(p, tree, head, libs));
|
|
196
|
+
if (channel !== undefined) {
|
|
197
|
+
return `the interpreter's import path holds the work tree (${rel(tree, channel)}) — PYTHONPATH, a .pth line or site configuration would let any process of the run load uncommitted code; remove it from the environment`;
|
|
198
|
+
}
|
|
199
|
+
const found = (answer.found && typeof answer.found === 'object' ? answer.found : {});
|
|
200
|
+
for (const [name, locs] of Object.entries(found)) {
|
|
201
|
+
const hit = (Array.isArray(locs) ? locs : []).find((l) => typeof l === 'string' && workTreeCode(l, tree, head, libs));
|
|
202
|
+
if (hit !== undefined) {
|
|
203
|
+
return `the environment resolves HEAD's ${name} to the work tree (${rel(tree, hit)}) — an editable install, a .pth finder or a path entry; every process of the run (subprocesses, workers) would load uncommitted code; use a non-editable environment`;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
/** O1: the first loaded file inside the work tree, outside HEAD's worktree and every library directory, as a reason; or null. */
|
|
209
|
+
function loadedFromWorkTree(recordFile, workTree, headTree) {
|
|
210
|
+
let rec;
|
|
211
|
+
try {
|
|
212
|
+
rec = JSON.parse(fs.readFileSync(recordFile, 'utf8'));
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
return 'the run left no record of the modules it loaded (holmes_provenance) — HEAD\'s provenance cannot be judged';
|
|
216
|
+
}
|
|
217
|
+
const tree = real(workTree), head = real(headTree);
|
|
218
|
+
const libs = (Array.isArray(rec.prefixes) ? rec.prefixes : []).filter((p) => typeof p === 'string' && p !== '').map(real);
|
|
219
|
+
const files = (Array.isArray(rec.files) ? rec.files : []).filter((f) => typeof f === 'string' && f !== '');
|
|
220
|
+
const hit = files.find((f) => workTreeCode(f, tree, head, libs));
|
|
221
|
+
return hit === undefined ? null
|
|
222
|
+
: `the run loaded a module from the work tree (${rel(tree, hit)}) — an editable install, a .pth finder or a path entry put uncommitted code into HEAD's run; use a non-editable environment`;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* The provenance of one full pytest unit in HEAD's worktree: P1's pinned configuration and confcutdir, E3's environment
|
|
226
|
+
* answer (`refused` when the environment resolves HEAD's names to the work tree), and O1's plugin with its judgement.
|
|
227
|
+
*/
|
|
228
|
+
function pytestRunProvenance(tmpDir, run, unitCwd, python, env, exec) {
|
|
229
|
+
const unitDir = path.relative(run.root, unitCwd).split(path.sep).filter(Boolean).join('/');
|
|
230
|
+
let cap = exports.PYTHON_NAMES;
|
|
231
|
+
try {
|
|
232
|
+
cap = (0, config_1.loadConfig)(run.root).testRun.pythonNames ?? exports.PYTHON_NAMES;
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
cap = exports.PYTHON_NAMES;
|
|
236
|
+
}
|
|
237
|
+
const named = pythonNames(run.root, cap);
|
|
238
|
+
const inifile = (0, test_units_1.pytestInifile)(run.root, unitDir);
|
|
239
|
+
const ini = inifile ?? path.join(tmpDir, 'pytest.ini');
|
|
240
|
+
if (inifile === null)
|
|
241
|
+
fs.writeFileSync(ini, '[pytest]\n');
|
|
242
|
+
const out = path.join(tmpDir, 'provenance.json');
|
|
243
|
+
fs.writeFileSync(path.join(tmpDir, `${exports.PLUGIN}.py`), SOURCE);
|
|
244
|
+
return {
|
|
245
|
+
refused: named.over
|
|
246
|
+
? `HEAD has more python module names than ${cap} — raise ax.config.json testRun.pythonNames to let the run prove where each resolves`
|
|
247
|
+
: pythonEnvironmentResolves(python, unitCwd, named.names, run.sourceRoot, run.root, env, exec),
|
|
248
|
+
args: ['-c', ini, '-p', exports.PLUGIN],
|
|
249
|
+
confcutdir: inifile ? real(path.dirname(inifile)) : real(unitCwd),
|
|
250
|
+
env: (base) => ({ ...base, PYTHONPATH: [tmpDir, base.PYTHONPATH].filter((p) => typeof p === 'string' && p !== '').join(path.delimiter), HOLMES_PROVENANCE_OUT: out }),
|
|
251
|
+
// A missing record matters only for a green run: a red that stopped before the session (a conftest that cannot import)
|
|
252
|
+
// is already red, and is the tests', not the environment's
|
|
253
|
+
judge: (passed) => (passed || fs.existsSync(out) ? loadedFromWorkTree(out, run.sourceRoot, run.root) : null),
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* E4: HEAD's package names (every package.json of the worktree outside node_modules), each resolved as node resolves a
|
|
258
|
+
* bare name — `node_modules/<name>` up the ancestors of every package directory, then each NODE_PATH entry. One that
|
|
259
|
+
* lands inside the work tree, outside HEAD's worktree and every node_modules, is a reason; otherwise null.
|
|
260
|
+
*/
|
|
261
|
+
function nodeNamesResolveToWorkTree(headTree, workTree, env) {
|
|
262
|
+
const dirs = [];
|
|
263
|
+
const names = new Set();
|
|
264
|
+
const walk = (d, depth) => {
|
|
265
|
+
if (depth > 6 || dirs.length >= 200)
|
|
266
|
+
return;
|
|
267
|
+
let kids = [];
|
|
268
|
+
try {
|
|
269
|
+
kids = fs.readdirSync(d, { withFileTypes: true });
|
|
270
|
+
}
|
|
271
|
+
catch {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (kids.some((k) => k.isFile() && k.name === 'package.json')) {
|
|
275
|
+
dirs.push(d);
|
|
276
|
+
try {
|
|
277
|
+
const n = JSON.parse(fs.readFileSync(path.join(d, 'package.json'), 'utf8')).name;
|
|
278
|
+
if (typeof n === 'string' && n !== '')
|
|
279
|
+
names.add(n);
|
|
280
|
+
}
|
|
281
|
+
catch { /* unnamed */ }
|
|
282
|
+
}
|
|
283
|
+
for (const k of kids)
|
|
284
|
+
if (k.isDirectory() && k.name !== 'node_modules' && !k.name.startsWith('.'))
|
|
285
|
+
walk(path.join(d, k.name), depth + 1);
|
|
286
|
+
};
|
|
287
|
+
walk(headTree, 0);
|
|
288
|
+
const tree = real(workTree), head = real(headTree);
|
|
289
|
+
const extra = (env.NODE_PATH ?? '').split(path.delimiter).filter((p) => p !== '');
|
|
290
|
+
// A-SPEC-128.17 C1: a NODE_PATH entry into the work tree is a channel, whatever HEAD's package names are
|
|
291
|
+
const channel = extra.find((p) => { const to = real(p); return inside(to, tree) && !inside(to, head) && !path.relative(tree, to).split(path.sep).includes('node_modules'); });
|
|
292
|
+
if (channel !== undefined)
|
|
293
|
+
return `NODE_PATH holds the work tree (${rel(tree, channel)}) — any require of the run could load uncommitted code through it; remove it from the environment`;
|
|
294
|
+
for (const name of names) {
|
|
295
|
+
for (const d of dirs) {
|
|
296
|
+
const candidates = [];
|
|
297
|
+
for (let a = d;; a = path.dirname(a)) {
|
|
298
|
+
candidates.push(path.join(a, 'node_modules', name));
|
|
299
|
+
if (path.dirname(a) === a)
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
for (const p of extra)
|
|
303
|
+
candidates.push(path.join(p, name));
|
|
304
|
+
const at = candidates.find((c) => fs.existsSync(path.join(c, 'package.json')));
|
|
305
|
+
if (at === undefined)
|
|
306
|
+
continue;
|
|
307
|
+
const to = real(at);
|
|
308
|
+
if (inside(to, tree) && !inside(to, head) && !path.relative(tree, to).split(path.sep).includes('node_modules')) {
|
|
309
|
+
return `HEAD's package ${name} resolves to the work tree (${rel(tree, to)}) — a workspace link or NODE_PATH would load uncommitted code; 0.40.x does not evidence it`;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
@@ -130,7 +130,7 @@ export declare function anchorCoverage(scanned: readonly ScannedFile[], specs?:
|
|
|
130
130
|
* Measured on one repository with only the spec count varied (A-SPEC-364): 585 specs gave Top-10
|
|
131
131
|
* recall 0.770, but 146 gave 0.253 and 59 gave 0.264 — BELOW the 0.305 of no spec layer at all. A
|
|
132
132
|
* partly populated spec store is worse than an empty one, and every project that adopts Holmes
|
|
133
|
-
* passes through that valley on its way to the peak.
|
|
133
|
+
* passes through that valley on its way to the peak. The consumer corpus, at 54 specs, is sitting in it.
|
|
134
134
|
*
|
|
135
135
|
* Scaling by coverage makes the layer fade in rather than switch on: at zero coverage the ranking is
|
|
136
136
|
* exactly the lexical arm (the floor a project starts from), and at full coverage the bonus is
|
|
@@ -160,7 +160,7 @@ export declare function rankCitationConditioned(issueText: string, scanned: read
|
|
|
160
160
|
*
|
|
161
161
|
* Conditioning on whether the request cited a spec repaired this repository and cost the second
|
|
162
162
|
* corpus its lead, because that corpus cites nothing and would always take the strict path. Both
|
|
163
|
-
* measurements point at the same underlying quantity: HOW MANY specs the request matched.
|
|
163
|
+
* measurements point at the same underlying quantity: HOW MANY specs the request matched. The consumer corpus
|
|
164
164
|
* matches 0.87 per case, this repository 26.6 (A-SPEC-367).
|
|
165
165
|
*
|
|
166
166
|
* One matching spec is a claim about where the request belongs. Twenty-six matching specs is a fact
|
|
@@ -222,7 +222,7 @@ export declare function ablate(issueText: string, scanned: readonly ScannedFile[
|
|
|
222
222
|
* Limit how many files each matched spec may lift.
|
|
223
223
|
*
|
|
224
224
|
* The ablation isolated the cost: turning the spec bonus off restores the baseline exactly, so that
|
|
225
|
-
* layer buys Top-1 (0.244 → 0.267 here, 0.400 → 0.433 on
|
|
225
|
+
* layer buys Top-1 (0.244 → 0.267 here, 0.400 → 0.433 on the consumer corpus) and sells precision (0.156 → 0.104).
|
|
226
226
|
*
|
|
227
227
|
* Three earlier attempts all changed WHICH specs are admitted — breadth damping, coverage scaling,
|
|
228
228
|
* a cap on matched specs — and all three were rejected. This changes something else: once a spec is
|
|
@@ -403,7 +403,7 @@ function anchorCoverage(scanned, specs = []) {
|
|
|
403
403
|
* Measured on one repository with only the spec count varied (A-SPEC-364): 585 specs gave Top-10
|
|
404
404
|
* recall 0.770, but 146 gave 0.253 and 59 gave 0.264 — BELOW the 0.305 of no spec layer at all. A
|
|
405
405
|
* partly populated spec store is worse than an empty one, and every project that adopts Holmes
|
|
406
|
-
* passes through that valley on its way to the peak.
|
|
406
|
+
* passes through that valley on its way to the peak. The consumer corpus, at 54 specs, is sitting in it.
|
|
407
407
|
*
|
|
408
408
|
* Scaling by coverage makes the layer fade in rather than switch on: at zero coverage the ranking is
|
|
409
409
|
* exactly the lexical arm (the floor a project starts from), and at full coverage the bonus is
|
|
@@ -460,7 +460,7 @@ function rankCitationConditioned(issueText, scanned, specs, topN, weight, citedT
|
|
|
460
460
|
*
|
|
461
461
|
* Conditioning on whether the request cited a spec repaired this repository and cost the second
|
|
462
462
|
* corpus its lead, because that corpus cites nothing and would always take the strict path. Both
|
|
463
|
-
* measurements point at the same underlying quantity: HOW MANY specs the request matched.
|
|
463
|
+
* measurements point at the same underlying quantity: HOW MANY specs the request matched. The consumer corpus
|
|
464
464
|
* matches 0.87 per case, this repository 26.6 (A-SPEC-367).
|
|
465
465
|
*
|
|
466
466
|
* One matching spec is a claim about where the request belongs. Twenty-six matching specs is a fact
|
|
@@ -617,7 +617,7 @@ function ablate(issueText, scanned, specs, topN, opts) {
|
|
|
617
617
|
* Limit how many files each matched spec may lift.
|
|
618
618
|
*
|
|
619
619
|
* The ablation isolated the cost: turning the spec bonus off restores the baseline exactly, so that
|
|
620
|
-
* layer buys Top-1 (0.244 → 0.267 here, 0.400 → 0.433 on
|
|
620
|
+
* layer buys Top-1 (0.244 → 0.267 here, 0.400 → 0.433 on the consumer corpus) and sells precision (0.156 → 0.104).
|
|
621
621
|
*
|
|
622
622
|
* Three earlier attempts all changed WHICH specs are admitted — breadth damping, coverage scaling,
|
|
623
623
|
* a cap on matched specs — and all three were rejected. This changes something else: once a spec is
|