@velum-labs/routekit-eval-setup 1.3.2 → 1.5.0
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/dist/adapters/authoring-responses-request.d.ts +5 -0
- package/dist/adapters/authoring-responses-request.js +38 -0
- package/dist/adapters/evaluation-evidence-freshness.d.ts +7 -0
- package/dist/adapters/evaluation-evidence-freshness.js +76 -0
- package/dist/adapters/git-task-history.d.ts +67 -0
- package/dist/adapters/git-task-history.js +171 -0
- package/dist/adapters/integrated-repository-history.d.ts +21 -0
- package/dist/adapters/integrated-repository-history.js +175 -0
- package/dist/adapters/repository-command-diagnostic.d.ts +8 -0
- package/dist/adapters/repository-command-diagnostic.js +46 -0
- package/dist/adapters/repository-command-evidence.d.ts +13 -0
- package/dist/adapters/repository-command-evidence.js +102 -0
- package/dist/adapters/repository-command-runner.d.ts +238 -0
- package/dist/adapters/repository-command-runner.js +1483 -0
- package/dist/adapters/repository-import-context.d.ts +47 -0
- package/dist/adapters/repository-import-context.js +469 -0
- package/dist/adapters/repository-node-test-reporter.d.ts +3 -0
- package/dist/adapters/repository-node-test-reporter.js +27 -0
- package/dist/adapters/repository-review-evidence.d.ts +39 -0
- package/dist/adapters/repository-review-evidence.js +632 -0
- package/dist/adapters/repository-seed-selection.d.ts +7 -0
- package/dist/adapters/repository-seed-selection.js +79 -0
- package/dist/adapters/repository-solution-edits.d.ts +49 -0
- package/dist/adapters/repository-solution-edits.js +136 -0
- package/dist/adapters/repository-vitest-phase-adapter.d.ts +8 -0
- package/dist/adapters/repository-vitest-phase-adapter.js +310 -0
- package/dist/adapters/repository-vitest-reporter.d.ts +24 -0
- package/dist/adapters/repository-vitest-reporter.js +314 -0
- package/dist/adapters/strict-authoring-schema.d.ts +5 -0
- package/dist/adapters/strict-authoring-schema.js +158 -0
- package/dist/adapters/test-discovery.d.ts +30 -0
- package/dist/adapters/test-discovery.js +124 -0
- package/dist/adapters/typescript-repository-index.d.ts +51 -0
- package/dist/adapters/typescript-repository-index.js +226 -0
- package/dist/agentic-capabilities-protocol.d.ts +1373 -0
- package/dist/agentic-capabilities-protocol.js +786 -0
- package/dist/case-checkpoint-store.d.ts +29 -0
- package/dist/case-checkpoint-store.js +133 -0
- package/dist/case-pipeline-protocol-v2.d.ts +184 -0
- package/dist/case-pipeline-protocol-v2.js +193 -0
- package/dist/case-pipeline-protocol.d.ts +2626 -0
- package/dist/case-pipeline-protocol.js +371 -0
- package/dist/effect-api.d.ts +74 -10
- package/dist/effect-api.js +56 -6
- package/dist/errors.d.ts +31 -0
- package/dist/errors.js +10 -0
- package/dist/eval-capability-execution-envelope.d.ts +64 -0
- package/dist/eval-capability-execution-envelope.js +98 -0
- package/dist/eval-capability-policy.d.ts +90 -0
- package/dist/eval-capability-policy.js +107 -0
- package/dist/eval-event-log.d.ts +140 -0
- package/dist/eval-event-log.js +220 -0
- package/dist/evaluation-authoring-policy.d.ts +18 -0
- package/dist/evaluation-authoring-policy.js +19 -0
- package/dist/evaluation-authoring-validation.d.ts +22 -0
- package/dist/evaluation-authoring-validation.js +72 -0
- package/dist/evaluation-evidence.d.ts +20 -0
- package/dist/evaluation-evidence.js +319 -0
- package/dist/evaluation-grader-calibration-protocol.d.ts +108 -0
- package/dist/evaluation-grader-calibration-protocol.js +80 -0
- package/dist/evaluation-grader-calibration.d.ts +18 -0
- package/dist/evaluation-grader-calibration.js +334 -0
- package/dist/evaluation-grading-policy.d.ts +24 -0
- package/dist/evaluation-grading-policy.js +54 -0
- package/dist/evaluation-proposal-policy.d.ts +4 -0
- package/dist/evaluation-proposal-policy.js +91 -0
- package/dist/evaluation-source-retrieval.d.ts +68 -0
- package/dist/evaluation-source-retrieval.js +513 -0
- package/dist/evaluation-structure-policy.d.ts +29 -0
- package/dist/evaluation-structure-policy.js +138 -0
- package/dist/index.d.ts +124 -17
- package/dist/index.js +69 -11
- package/dist/inspection.js +2 -3
- package/dist/project-artifacts.d.ts +7 -2
- package/dist/project-artifacts.js +49 -136
- package/dist/project-authoring.d.ts +66 -5
- package/dist/project-authoring.js +783 -109
- package/dist/project-contracts.d.ts +419 -84
- package/dist/project-contracts.js +160 -52
- package/dist/project-store.js +2 -1
- package/dist/project-workflow.d.ts +5 -4
- package/dist/project-workflow.js +154 -35
- package/dist/repository-adversary-protocol.d.ts +64 -0
- package/dist/repository-adversary-protocol.js +105 -0
- package/dist/repository-behavior-protocol.d.ts +188 -0
- package/dist/repository-behavior-protocol.js +202 -0
- package/dist/repository-benchmark-protocol.d.ts +487 -0
- package/dist/repository-benchmark-protocol.js +96 -0
- package/dist/repository-execution-protocol.d.ts +150 -0
- package/dist/repository-execution-protocol.js +38 -0
- package/dist/repository-fixture-instructions.d.ts +3 -0
- package/dist/repository-fixture-instructions.js +91 -0
- package/dist/repository-fixture-protocol.d.ts +79 -0
- package/dist/repository-fixture-protocol.js +79 -0
- package/dist/repository-foundry-plan-protocol.d.ts +118 -0
- package/dist/repository-foundry-plan-protocol.js +296 -0
- package/dist/repository-foundry-progress-protocol.d.ts +52 -0
- package/dist/repository-foundry-progress-protocol.js +52 -0
- package/dist/repository-improvement-protocol.d.ts +100 -0
- package/dist/repository-improvement-protocol.js +106 -0
- package/dist/repository-language-model-protocol.d.ts +43 -0
- package/dist/repository-language-model-protocol.js +146 -0
- package/dist/repository-oracle-coverage-protocol.d.ts +18 -0
- package/dist/repository-oracle-coverage-protocol.js +39 -0
- package/dist/repository-oracle-execution-binding.d.ts +27 -0
- package/dist/repository-oracle-execution-binding.js +59 -0
- package/dist/repository-oracle-protocol.d.ts +230 -0
- package/dist/repository-oracle-protocol.js +156 -0
- package/dist/repository-oracle-scope-policy.d.ts +22 -0
- package/dist/repository-oracle-scope-policy.js +92 -0
- package/dist/repository-quality-policy.d.ts +15 -0
- package/dist/repository-quality-policy.js +357 -0
- package/dist/repository-routing-benchmark-protocol.d.ts +176 -0
- package/dist/repository-routing-benchmark-protocol.js +103 -0
- package/dist/repository-routing-model-protocol.d.ts +36 -0
- package/dist/repository-routing-model-protocol.js +89 -0
- package/dist/repository-routing-plan-protocol.d.ts +112 -0
- package/dist/repository-routing-plan-protocol.js +58 -0
- package/dist/repository-routing-quality-policy.d.ts +9 -0
- package/dist/repository-routing-quality-policy.js +191 -0
- package/dist/repository-seed-qualification-progress-protocol.d.ts +205 -0
- package/dist/repository-seed-qualification-progress-protocol.js +28 -0
- package/dist/repository-semantic-calibration-protocol.d.ts +768 -0
- package/dist/repository-semantic-calibration-protocol.js +276 -0
- package/dist/repository-semantic-calibration.d.ts +163 -0
- package/dist/repository-semantic-calibration.js +581 -0
- package/dist/repository-specification-contract-facts-protocol.d.ts +224 -0
- package/dist/repository-specification-contract-facts-protocol.js +276 -0
- package/dist/repository-specification-critique-protocol.d.ts +189 -0
- package/dist/repository-specification-critique-protocol.js +103 -0
- package/dist/repository-task-family-protocol.d.ts +24 -0
- package/dist/repository-task-family-protocol.js +37 -0
- package/dist/repository-task-seed-protocol.d.ts +384 -0
- package/dist/repository-task-seed-protocol.js +236 -0
- package/dist/repository-trajectory-protocol.d.ts +20 -0
- package/dist/repository-trajectory-protocol.js +42 -0
- package/dist/service.js +1 -1
- package/dist/services/adversary/service.d.ts +64 -0
- package/dist/services/adversary/service.js +330 -0
- package/dist/services/benchmark-compiler/service.d.ts +450 -0
- package/dist/services/benchmark-compiler/service.js +9 -0
- package/dist/services/budgeted-model/service.d.ts +118 -0
- package/dist/services/budgeted-model/service.js +460 -0
- package/dist/services/case-authoring/service.d.ts +163 -0
- package/dist/services/case-authoring/service.js +1456 -0
- package/dist/services/case-finalization/service.d.ts +283 -0
- package/dist/services/case-finalization/service.js +370 -0
- package/dist/services/case-generation/service.d.ts +619 -0
- package/dist/services/case-generation/service.js +2628 -0
- package/dist/services/case-pipeline/service.d.ts +31 -0
- package/dist/services/case-pipeline/service.js +485 -0
- package/dist/services/case-pipeline-v2/service.d.ts +70 -0
- package/dist/services/case-pipeline-v2/service.js +477 -0
- package/dist/services/command-observability/service.d.ts +13 -0
- package/dist/services/command-observability/service.js +3 -0
- package/dist/services/dimension-labeling/service.d.ts +77 -0
- package/dist/services/dimension-labeling/service.js +188 -0
- package/dist/services/eval-candidate/service.d.ts +208 -0
- package/dist/services/eval-candidate/service.js +64 -0
- package/dist/services/eval-capabilities/service.d.ts +183 -0
- package/dist/services/eval-capabilities/service.js +1433 -0
- package/dist/services/eval-environment/service.d.ts +173 -0
- package/dist/services/eval-environment/service.js +127 -0
- package/dist/services/evidence-reconstruction/service.d.ts +36 -0
- package/dist/services/evidence-reconstruction/service.js +145 -0
- package/dist/services/fixture-builder/service.d.ts +62 -0
- package/dist/services/fixture-builder/service.js +36 -0
- package/dist/services/fixture-validation/service.d.ts +75 -0
- package/dist/services/fixture-validation/service.js +295 -0
- package/dist/services/foundry/service.d.ts +831 -0
- package/dist/services/foundry/service.js +442 -0
- package/dist/services/foundry-progress/service.d.ts +62 -0
- package/dist/services/foundry-progress/service.js +149 -0
- package/dist/services/foundry-v2/service.d.ts +54 -0
- package/dist/services/foundry-v2/service.js +28 -0
- package/dist/services/grounded-authoring/service.d.ts +126 -0
- package/dist/services/grounded-authoring/service.js +822 -0
- package/dist/services/historical-case/service.d.ts +722 -0
- package/dist/services/historical-case/service.js +177 -0
- package/dist/services/improvement-loop/service.d.ts +59 -0
- package/dist/services/improvement-loop/service.js +176 -0
- package/dist/services/language-model/service.d.ts +52 -0
- package/dist/services/language-model/service.js +194 -0
- package/dist/services/oracle-builder/service.d.ts +146 -0
- package/dist/services/oracle-builder/service.js +513 -0
- package/dist/services/oracle-coverage/service.d.ts +28 -0
- package/dist/services/oracle-coverage/service.js +50 -0
- package/dist/services/oracle-coverage-witness/service.d.ts +130 -0
- package/dist/services/oracle-coverage-witness/service.js +538 -0
- package/dist/services/pipeline-challenge/service.d.ts +551 -0
- package/dist/services/pipeline-challenge/service.js +427 -0
- package/dist/services/pipeline-controls/service.d.ts +130 -0
- package/dist/services/pipeline-controls/service.js +483 -0
- package/dist/services/pipeline-oracle/service.d.ts +8 -0
- package/dist/services/pipeline-oracle/service.js +256 -0
- package/dist/services/pipeline-seed/service.d.ts +298 -0
- package/dist/services/pipeline-seed/service.js +428 -0
- package/dist/services/pipeline-spec/service.d.ts +103 -0
- package/dist/services/pipeline-spec/service.js +619 -0
- package/dist/services/pipeline-tournament/service.d.ts +258 -0
- package/dist/services/pipeline-tournament/service.js +476 -0
- package/dist/services/quality-gate/service.d.ts +233 -0
- package/dist/services/quality-gate/service.js +136 -0
- package/dist/services/repository-bundle/service.d.ts +33 -0
- package/dist/services/repository-bundle/service.js +114 -0
- package/dist/services/repository-model/service.d.ts +105 -0
- package/dist/services/repository-model/service.js +250 -0
- package/dist/services/repository-public-artifact/service.d.ts +133 -0
- package/dist/services/repository-public-artifact/service.js +330 -0
- package/dist/services/routing-benchmark/service.d.ts +362 -0
- package/dist/services/routing-benchmark/service.js +96 -0
- package/dist/services/specification-critic/service.d.ts +92 -0
- package/dist/services/specification-critic/service.js +172 -0
- package/dist/services/task-family/service.d.ts +40 -0
- package/dist/services/task-family/service.js +55 -0
- package/dist/services/task-seed/service.d.ts +906 -0
- package/dist/services/task-seed/service.js +1406 -0
- package/dist/services/task-specification/service.d.ts +27 -0
- package/dist/services/task-specification/service.js +40 -0
- package/dist/services/trajectory-policy/service.d.ts +110 -0
- package/dist/services/trajectory-policy/service.js +216 -0
- package/dist/test/agentic-capabilities-protocol.test.d.ts +1 -0
- package/dist/test/agentic-capabilities-protocol.test.js +570 -0
- package/dist/test/agentic-capabilities.test.d.ts +1 -0
- package/dist/test/agentic-capabilities.test.js +1461 -0
- package/dist/test/agentic-environment.test.d.ts +1 -0
- package/dist/test/agentic-environment.test.js +213 -0
- package/dist/test/case-pipeline-foundation.test.d.ts +1 -0
- package/dist/test/case-pipeline-foundation.test.js +535 -0
- package/dist/test/case-pipeline-protocol-v2.test.d.ts +1 -0
- package/dist/test/case-pipeline-protocol-v2.test.js +124 -0
- package/dist/test/case-pipeline-v2.test.d.ts +1 -0
- package/dist/test/case-pipeline-v2.test.js +286 -0
- package/dist/test/case-pipeline.test.d.ts +1 -0
- package/dist/test/case-pipeline.test.js +851 -0
- package/dist/test/eval-capability-policy.test.d.ts +1 -0
- package/dist/test/eval-capability-policy.test.js +50 -0
- package/dist/test/eval-event-log.test.d.ts +1 -0
- package/dist/test/eval-event-log.test.js +125 -0
- package/dist/test/evaluation-evidence-freshness.test.d.ts +1 -0
- package/dist/test/evaluation-evidence-freshness.test.js +44 -0
- package/dist/test/evaluation-evidence.test.d.ts +1 -0
- package/dist/test/evaluation-evidence.test.js +230 -0
- package/dist/test/evaluation-grader-calibration.test.d.ts +1 -0
- package/dist/test/evaluation-grader-calibration.test.js +373 -0
- package/dist/test/evaluation-proposal-digest.test.d.ts +1 -0
- package/dist/test/evaluation-proposal-digest.test.js +187 -0
- package/dist/test/evaluation-source-retrieval.test.d.ts +1 -0
- package/dist/test/evaluation-source-retrieval.test.js +237 -0
- package/dist/test/evaluation-structure-policy.test.d.ts +1 -0
- package/dist/test/evaluation-structure-policy.test.js +196 -0
- package/dist/test/fixtures/repository-resource-panel.d.ts +39 -0
- package/dist/test/fixtures/repository-resource-panel.js +111 -0
- package/dist/test/fixtures/vitest-boundary-panel.d.ts +84 -0
- package/dist/test/fixtures/vitest-boundary-panel.js +120 -0
- package/dist/test/fixtures/vitest-phase-panel.d.ts +135 -0
- package/dist/test/fixtures/vitest-phase-panel.js +213 -0
- package/dist/test/fixtures/vitest-reporter-results.d.ts +76 -0
- package/dist/test/fixtures/vitest-reporter-results.js +94 -0
- package/dist/test/grounded-authoring.test.d.ts +1 -0
- package/dist/test/grounded-authoring.test.js +565 -0
- package/dist/test/integrated-repository-history.test.d.ts +1 -0
- package/dist/test/integrated-repository-history.test.js +227 -0
- package/dist/test/project-authoring.test.js +593 -43
- package/dist/test/project-workflow.test.js +419 -40
- package/dist/test/repository-authoring-artifacts.test.d.ts +1 -0
- package/dist/test/repository-authoring-artifacts.test.js +185 -0
- package/dist/test/repository-bundle.test.d.ts +1 -0
- package/dist/test/repository-bundle.test.js +52 -0
- package/dist/test/repository-case-generation.test.d.ts +1 -0
- package/dist/test/repository-case-generation.test.js +3465 -0
- package/dist/test/repository-command-diagnostic.test.d.ts +1 -0
- package/dist/test/repository-command-diagnostic.test.js +55 -0
- package/dist/test/repository-command-signals.test.d.ts +1 -0
- package/dist/test/repository-command-signals.test.js +124 -0
- package/dist/test/repository-fixture-scope-coverage.test.d.ts +1 -0
- package/dist/test/repository-fixture-scope-coverage.test.js +127 -0
- package/dist/test/repository-fixture-validation.test.d.ts +1 -0
- package/dist/test/repository-fixture-validation.test.js +362 -0
- package/dist/test/repository-foundry-progress.test.d.ts +1 -0
- package/dist/test/repository-foundry-progress.test.js +110 -0
- package/dist/test/repository-foundry-quality.test.d.ts +1 -0
- package/dist/test/repository-foundry-quality.test.js +1138 -0
- package/dist/test/repository-import-context.test.d.ts +1 -0
- package/dist/test/repository-import-context.test.js +354 -0
- package/dist/test/repository-model-authoring.test.d.ts +1 -0
- package/dist/test/repository-model-authoring.test.js +544 -0
- package/dist/test/repository-model.test.d.ts +1 -0
- package/dist/test/repository-model.test.js +2195 -0
- package/dist/test/repository-node-test-reporter.test.d.ts +1 -0
- package/dist/test/repository-node-test-reporter.test.js +104 -0
- package/dist/test/repository-oracle-concurrency.test.d.ts +1 -0
- package/dist/test/repository-oracle-concurrency.test.js +542 -0
- package/dist/test/repository-oracle-coverage-witness.test.d.ts +1 -0
- package/dist/test/repository-oracle-coverage-witness.test.js +511 -0
- package/dist/test/repository-oracle-coverage.test.d.ts +1 -0
- package/dist/test/repository-oracle-coverage.test.js +168 -0
- package/dist/test/repository-oracle-evidence.test.d.ts +1 -0
- package/dist/test/repository-oracle-evidence.test.js +185 -0
- package/dist/test/repository-oracle-plan.test.d.ts +1 -0
- package/dist/test/repository-oracle-plan.test.js +176 -0
- package/dist/test/repository-overlay-isolation.test.d.ts +1 -0
- package/dist/test/repository-overlay-isolation.test.js +85 -0
- package/dist/test/repository-preparation-cache.test.d.ts +1 -0
- package/dist/test/repository-preparation-cache.test.js +414 -0
- package/dist/test/repository-public-artifact.test.d.ts +1 -0
- package/dist/test/repository-public-artifact.test.js +273 -0
- package/dist/test/repository-qualification-diagnostics.test.d.ts +1 -0
- package/dist/test/repository-qualification-diagnostics.test.js +524 -0
- package/dist/test/repository-reference-authoring.test.d.ts +1 -0
- package/dist/test/repository-reference-authoring.test.js +1633 -0
- package/dist/test/repository-review-evidence-v2.test.d.ts +1 -0
- package/dist/test/repository-review-evidence-v2.test.js +183 -0
- package/dist/test/repository-review-evidence.test.d.ts +1 -0
- package/dist/test/repository-review-evidence.test.js +124 -0
- package/dist/test/repository-seed-exclusions.test.d.ts +1 -0
- package/dist/test/repository-seed-exclusions.test.js +96 -0
- package/dist/test/repository-seed-selection.test.d.ts +1 -0
- package/dist/test/repository-seed-selection.test.js +504 -0
- package/dist/test/repository-semantic-calibration.test.d.ts +1 -0
- package/dist/test/repository-semantic-calibration.test.js +688 -0
- package/dist/test/repository-solution-edits.test.d.ts +1 -0
- package/dist/test/repository-solution-edits.test.js +377 -0
- package/dist/test/repository-specification-budget.test.d.ts +1 -0
- package/dist/test/repository-specification-budget.test.js +171 -0
- package/dist/test/repository-specification-contract-checkpoint.test.d.ts +1 -0
- package/dist/test/repository-specification-contract-checkpoint.test.js +228 -0
- package/dist/test/repository-specification-contract-facts.test.d.ts +1 -0
- package/dist/test/repository-specification-contract-facts.test.js +177 -0
- package/dist/test/repository-trajectory-authoring.test.d.ts +1 -0
- package/dist/test/repository-trajectory-authoring.test.js +176 -0
- package/dist/test/repository-valid-control-plan.test.d.ts +1 -0
- package/dist/test/repository-valid-control-plan.test.js +45 -0
- package/dist/test/repository-vitest-phase.test.d.ts +1 -0
- package/dist/test/repository-vitest-phase.test.js +848 -0
- package/dist/test/repository-vitest-reporter.test.d.ts +1 -0
- package/dist/test/repository-vitest-reporter.test.js +158 -0
- package/dist/test/repository-workspace-build.test.d.ts +1 -0
- package/dist/test/repository-workspace-build.test.js +160 -0
- package/dist/test/strict-authoring-schema.test.d.ts +1 -0
- package/dist/test/strict-authoring-schema.test.js +169 -0
- package/package.json +48 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { test } from "node:test";
|
|
3
|
+
import { evalCapabilityScientificAttemptCostV1 } from "../eval-capability-policy.js";
|
|
4
|
+
const previous = {
|
|
5
|
+
version: 1,
|
|
6
|
+
acceptedEvidenceDigest: "a".repeat(64),
|
|
7
|
+
completedGateDigest: "b".repeat(64),
|
|
8
|
+
environmentDigest: "c".repeat(64),
|
|
9
|
+
continuationProgressDigest: "d".repeat(64)
|
|
10
|
+
};
|
|
11
|
+
const continuation = {
|
|
12
|
+
inputRevision: "candidate",
|
|
13
|
+
outputRevision: "candidate",
|
|
14
|
+
previousFingerprint: previous,
|
|
15
|
+
resultingFingerprint: { ...previous, continuationProgressDigest: "e".repeat(64) },
|
|
16
|
+
gatesCompleted: [],
|
|
17
|
+
gatesInvalidated: [],
|
|
18
|
+
sameFingerprintCount: 0
|
|
19
|
+
};
|
|
20
|
+
test("productive continuation consumes execution budgets but not another scientific attempt", () => {
|
|
21
|
+
assert.equal(evalCapabilityScientificAttemptCostV1(continuation), 0);
|
|
22
|
+
assert.equal(evalCapabilityScientificAttemptCostV1({
|
|
23
|
+
...continuation,
|
|
24
|
+
previousFingerprint: { ...previous, continuationProgressDigest: null }
|
|
25
|
+
}), 0, "the first durable partial work is also a continuation");
|
|
26
|
+
assert.equal(evalCapabilityScientificAttemptCostV1({
|
|
27
|
+
...continuation,
|
|
28
|
+
resultingFingerprint: {
|
|
29
|
+
...continuation.resultingFingerprint,
|
|
30
|
+
acceptedEvidenceDigest: "f".repeat(64)
|
|
31
|
+
}
|
|
32
|
+
}), 0, "an explicitly checkpointed slice may advance partial scientific evidence");
|
|
33
|
+
});
|
|
34
|
+
test("scientific decisions, resets, legacy and unchanged work still consume phase attempts", () => {
|
|
35
|
+
const changes = [
|
|
36
|
+
{ previousFingerprint: null },
|
|
37
|
+
{ inputRevision: null },
|
|
38
|
+
{ outputRevision: "other-candidate" },
|
|
39
|
+
{ sameFingerprintCount: 1 },
|
|
40
|
+
{ gatesCompleted: ["oracle_authored"] },
|
|
41
|
+
{ gatesInvalidated: ["oracle_authored"] },
|
|
42
|
+
{ resultingFingerprint: previous },
|
|
43
|
+
{ resultingFingerprint: { ...previous, continuationProgressDigest: null } },
|
|
44
|
+
{ resultingFingerprint: { ...continuation.resultingFingerprint, completedGateDigest: "f".repeat(64) } },
|
|
45
|
+
{ resultingFingerprint: { ...continuation.resultingFingerprint, environmentDigest: "f".repeat(64) } }
|
|
46
|
+
];
|
|
47
|
+
for (const change of changes) {
|
|
48
|
+
assert.equal(evalCapabilityScientificAttemptCostV1({ ...continuation, ...change }), 1);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { test } from "node:test";
|
|
3
|
+
import { Schema } from "effect";
|
|
4
|
+
import { EvalNamedEventLog, assertEvalRunCanFail, assertEvalRunCanComplete, presentEvalEventLog, resumeEvalCaseCursors } from "../eval-event-log.js";
|
|
5
|
+
const at = "2026-08-26T00:00:00.000Z";
|
|
6
|
+
const call = (name, caseId, sequence, dimensionId = "dimension") => ({
|
|
7
|
+
name,
|
|
8
|
+
at,
|
|
9
|
+
runId: "run",
|
|
10
|
+
dimensionId,
|
|
11
|
+
caseId,
|
|
12
|
+
sequence
|
|
13
|
+
});
|
|
14
|
+
test("N=4 candidate-only activity stays per-case and fails before completion", () => {
|
|
15
|
+
const events = [
|
|
16
|
+
{ name: "plan", at, runId: "run", plannedCalls: 80 },
|
|
17
|
+
...Array.from({ length: 40 }, (_, index) => call("candidate#", `case-${String((index % 4) + 1)}`, Math.floor(index / 4) + 1))
|
|
18
|
+
];
|
|
19
|
+
const presentation = presentEvalEventLog(events);
|
|
20
|
+
assert.equal(presentation.failed, true);
|
|
21
|
+
assert.equal(presentation.lines.length, 4);
|
|
22
|
+
assert.ok(presentation.lines.every((line) => /fail candidate#1 missing judge#1/u.test(line)));
|
|
23
|
+
assert.doesNotMatch(presentation.lines.join("\n"), /40\/80|candidate#40/u);
|
|
24
|
+
assert.throws(() => assertEvalRunCanComplete(events), /cannot complete after candidate#1/u);
|
|
25
|
+
});
|
|
26
|
+
test("resume cursor stops at the first unmatched candidate and does not resume past the hole", () => {
|
|
27
|
+
const events = [
|
|
28
|
+
{ name: "plan", at, runId: "run", plannedCalls: 8 },
|
|
29
|
+
call("candidate#", "case-a", 1),
|
|
30
|
+
call("judge#", "case-a", 1),
|
|
31
|
+
call("candidate#", "case-a", 2),
|
|
32
|
+
call("candidate#", "case-a", 3),
|
|
33
|
+
call("judge#", "case-a", 3)
|
|
34
|
+
];
|
|
35
|
+
assert.deepEqual(resumeEvalCaseCursors(events), [
|
|
36
|
+
{
|
|
37
|
+
dimensionId: "dimension",
|
|
38
|
+
caseId: "case-a",
|
|
39
|
+
completePairs: 1,
|
|
40
|
+
lastEvent: call("candidate#", "case-a", 2),
|
|
41
|
+
hole: call("candidate#", "case-a", 2)
|
|
42
|
+
}
|
|
43
|
+
]);
|
|
44
|
+
});
|
|
45
|
+
test("zero planned calls is a failed pulse, not progress", () => {
|
|
46
|
+
const events = [{ name: "plan", at, runId: "run", plannedCalls: 0 }];
|
|
47
|
+
assert.deepEqual(presentEvalEventLog(events), {
|
|
48
|
+
failed: true,
|
|
49
|
+
lines: ["run fail no planned calls"]
|
|
50
|
+
});
|
|
51
|
+
assert.throws(() => assertEvalRunCanComplete(events), /at least one call/u);
|
|
52
|
+
});
|
|
53
|
+
test("CI JSON round-trips the exact same named event log", () => {
|
|
54
|
+
const events = [
|
|
55
|
+
{ name: "basis", at, operationId: "author-basis" },
|
|
56
|
+
{ name: "dimensions", at, operationId: "author-dimensions" },
|
|
57
|
+
{ name: "activation", at, operationId: "author-activation" },
|
|
58
|
+
{ name: "plan", at, runId: "run", plannedCalls: 2 },
|
|
59
|
+
call("candidate#", "case-a", 1),
|
|
60
|
+
call("judge#", "case-a", 1)
|
|
61
|
+
];
|
|
62
|
+
const decoded = Schema.decodeUnknownSync(EvalNamedEventLog)(JSON.parse(JSON.stringify(events)));
|
|
63
|
+
assert.deepEqual(decoded, events);
|
|
64
|
+
assert.doesNotThrow(() => assertEvalRunCanComplete(decoded));
|
|
65
|
+
assert.deepEqual([...new Set(decoded.map((event) => event.name))], ["basis", "dimensions", "activation", "plan", "candidate#", "judge#"]);
|
|
66
|
+
});
|
|
67
|
+
test("authoring heartbeat is the last named artifact event", () => {
|
|
68
|
+
const events = [
|
|
69
|
+
{ name: "basis", at, operationId: "author-basis" },
|
|
70
|
+
{ name: "dimensions", at, operationId: "author-dimensions" }
|
|
71
|
+
];
|
|
72
|
+
assert.deepEqual(presentEvalEventLog(events, { failHoles: false }), {
|
|
73
|
+
failed: false,
|
|
74
|
+
lines: ["authoring dimensions"]
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
test("live presentation keeps a candidate hole in flight and failure presentation names it", () => {
|
|
78
|
+
const events = [
|
|
79
|
+
{ name: "plan", at, runId: "run", plannedCalls: 2 },
|
|
80
|
+
call("candidate#", "case-a", 1)
|
|
81
|
+
];
|
|
82
|
+
const live = presentEvalEventLog(events, { failHoles: false });
|
|
83
|
+
assert.deepEqual(live, {
|
|
84
|
+
failed: false,
|
|
85
|
+
lines: ["dimension/case-a candidate#1"]
|
|
86
|
+
});
|
|
87
|
+
assert.doesNotMatch(live.lines.join("\n"), /missing judge#/u);
|
|
88
|
+
assert.deepEqual(presentEvalEventLog(events, { failHoles: true }), {
|
|
89
|
+
failed: true,
|
|
90
|
+
lines: ["dimension/case-a fail candidate#1 missing judge#1"]
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
test("a terminal failure-detail makes plan-only pre-execution failure durable and bounded", () => {
|
|
94
|
+
const events = Schema.decodeUnknownSync(EvalNamedEventLog)([
|
|
95
|
+
{ name: "plan", at, runId: "run", plannedCalls: 275 },
|
|
96
|
+
{
|
|
97
|
+
name: "failure-detail",
|
|
98
|
+
at,
|
|
99
|
+
runId: "run",
|
|
100
|
+
phase: "target",
|
|
101
|
+
reason: "evalSession.open rejected while the data gateway was unavailable",
|
|
102
|
+
retryable: true,
|
|
103
|
+
accounting: {
|
|
104
|
+
expectedCalls: 275,
|
|
105
|
+
observedCalls: 0,
|
|
106
|
+
knownInputTokens: 0,
|
|
107
|
+
knownOutputTokens: 0,
|
|
108
|
+
unknownTokenMeasurements: 0,
|
|
109
|
+
knownPricedSubtotalUsd: 0,
|
|
110
|
+
unpricedCalls: 0,
|
|
111
|
+
subscriptionUnitCalls: 0
|
|
112
|
+
},
|
|
113
|
+
cleanup: { sessionOpened: false, sessionClosed: false }
|
|
114
|
+
}
|
|
115
|
+
]);
|
|
116
|
+
assert.doesNotThrow(() => assertEvalRunCanFail(events));
|
|
117
|
+
assert.throws(() => assertEvalRunCanComplete(events), /terminal failure/u);
|
|
118
|
+
assert.deepEqual(presentEvalEventLog(events), {
|
|
119
|
+
failed: true,
|
|
120
|
+
lines: ["run fail target: evalSession.open rejected while the data gateway was unavailable"]
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
test("failed eval runs cannot terminate with only a non-terminal plan event", () => {
|
|
124
|
+
assert.throws(() => assertEvalRunCanFail([{ name: "plan", at, runId: "run", plannedCalls: 275 }]), /terminal failure-detail/u);
|
|
125
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import test from "node:test";
|
|
6
|
+
import { layer as NodeServicesLayer } from "@effect/platform-node/NodeServices";
|
|
7
|
+
import { Effect } from "effect";
|
|
8
|
+
import { assertCurrentEvaluationEvidence } from "../adapters/evaluation-evidence-freshness.js";
|
|
9
|
+
import { compileEvaluationEvidence, selectEvaluationEvidenceBlocks } from "../evaluation-evidence.js";
|
|
10
|
+
import { EVAL_AUTHORING_EVIDENCE_BLOCK_BYTES } from "../evaluation-authoring-policy.js";
|
|
11
|
+
test("freshness revalidates sparse compiler blocks against the complete source", async () => {
|
|
12
|
+
const root = await mkdtemp(path.join(os.tmpdir(), "routekit-evidence-freshness-"));
|
|
13
|
+
try {
|
|
14
|
+
const relative = "provider.ts";
|
|
15
|
+
const content = [
|
|
16
|
+
"export const alpha = true;\n",
|
|
17
|
+
"\n",
|
|
18
|
+
"export const executeProvider = true;\n",
|
|
19
|
+
"\n",
|
|
20
|
+
"export const omega = true;\n"
|
|
21
|
+
].join("");
|
|
22
|
+
await writeFile(path.join(root, relative), content);
|
|
23
|
+
const compiled = compileEvaluationEvidence({
|
|
24
|
+
sources: [{ path: relative, content }],
|
|
25
|
+
maximumBlockBytes: EVAL_AUTHORING_EVIDENCE_BLOCK_BYTES
|
|
26
|
+
});
|
|
27
|
+
const sparse = selectEvaluationEvidenceBlocks({
|
|
28
|
+
sources: compiled,
|
|
29
|
+
evidenceIds: [compiled[0].blocks[0].id]
|
|
30
|
+
});
|
|
31
|
+
await Effect.runPromise(assertCurrentEvaluationEvidence({
|
|
32
|
+
repositoryRoot: root,
|
|
33
|
+
evidenceSources: sparse
|
|
34
|
+
}).pipe(Effect.provide(NodeServicesLayer)));
|
|
35
|
+
await writeFile(path.join(root, relative), content.replace("executeProvider", "executeChangedProvider"));
|
|
36
|
+
await assert.rejects(Effect.runPromise(assertCurrentEvaluationEvidence({
|
|
37
|
+
repositoryRoot: root,
|
|
38
|
+
evidenceSources: sparse
|
|
39
|
+
}).pipe(Effect.provide(NodeServicesLayer))), /source changed after authoring/u);
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
await rm(root, { recursive: true, force: true });
|
|
43
|
+
}
|
|
44
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { assertEvaluationEvidenceSources, compileEvaluationEvidence, mergeEvaluationEvidenceSources, renderEvaluationEvidenceContext, resolveEvaluationEvidence, selectEvaluationEvidenceBlocks } from "../evaluation-evidence.js";
|
|
4
|
+
test("evidence compilation is deterministic and independent of source input order", () => {
|
|
5
|
+
const sources = [
|
|
6
|
+
{ path: "src/b.ts", content: "bravo\n" },
|
|
7
|
+
{ path: "src/a.ts", content: "alpha\n" }
|
|
8
|
+
];
|
|
9
|
+
assert.deepEqual(compileEvaluationEvidence({ sources, maximumBlockBytes: 2_048 }), compileEvaluationEvidence({
|
|
10
|
+
sources: [...sources].reverse(),
|
|
11
|
+
maximumBlockBytes: 2_048
|
|
12
|
+
}));
|
|
13
|
+
assert.deepEqual(compileEvaluationEvidence({ sources, maximumBlockBytes: 2_048 }).map((source) => source.path), ["src/a.ts", "src/b.ts"]);
|
|
14
|
+
});
|
|
15
|
+
test("sparse evidence selection preserves whole-source identity and compiler locations", () => {
|
|
16
|
+
const compiled = compileEvaluationEvidence({
|
|
17
|
+
sources: [
|
|
18
|
+
{
|
|
19
|
+
path: "src/provider.ts",
|
|
20
|
+
content: [
|
|
21
|
+
"export const alpha = true;\n",
|
|
22
|
+
"\n",
|
|
23
|
+
"export const executeProvider = true;\n",
|
|
24
|
+
"\n",
|
|
25
|
+
"export const omega = true;\n"
|
|
26
|
+
].join("")
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
maximumBlockBytes: 45
|
|
30
|
+
});
|
|
31
|
+
const source = compiled[0];
|
|
32
|
+
assert.ok(source.blocks.length > 1);
|
|
33
|
+
const selectedBlock = source.blocks[1];
|
|
34
|
+
const selected = selectEvaluationEvidenceBlocks({
|
|
35
|
+
sources: compiled,
|
|
36
|
+
evidenceIds: [selectedBlock.id]
|
|
37
|
+
});
|
|
38
|
+
assert.equal(selected[0].sourceDigest, source.sourceDigest);
|
|
39
|
+
assert.equal(selected[0].sourceBytes, source.sourceBytes);
|
|
40
|
+
assert.equal(selected[0].sourceBlockCount, source.sourceBlockCount);
|
|
41
|
+
assert.deepEqual(selected[0].blocks, [selectedBlock]);
|
|
42
|
+
assertEvaluationEvidenceSources(selected);
|
|
43
|
+
});
|
|
44
|
+
test("sparse evidence merging unions compatible blocks and rejects source drift", () => {
|
|
45
|
+
const compiled = compileEvaluationEvidence({
|
|
46
|
+
sources: [
|
|
47
|
+
{
|
|
48
|
+
path: "src/provider.ts",
|
|
49
|
+
content: "alpha\n\nprovider backend\n\nresponse decoder\n"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
maximumBlockBytes: 18
|
|
53
|
+
});
|
|
54
|
+
const first = selectEvaluationEvidenceBlocks({
|
|
55
|
+
sources: compiled,
|
|
56
|
+
evidenceIds: [compiled[0].blocks[0].id]
|
|
57
|
+
});
|
|
58
|
+
const last = selectEvaluationEvidenceBlocks({
|
|
59
|
+
sources: compiled,
|
|
60
|
+
evidenceIds: [compiled[0].blocks.at(-1).id]
|
|
61
|
+
});
|
|
62
|
+
const merged = mergeEvaluationEvidenceSources([first, last]);
|
|
63
|
+
assert.deepEqual(merged[0].blocks.map((block) => block.id), [compiled[0].blocks[0].id, compiled[0].blocks.at(-1).id]);
|
|
64
|
+
assert.throws(() => mergeEvaluationEvidenceSources([
|
|
65
|
+
first,
|
|
66
|
+
[
|
|
67
|
+
{
|
|
68
|
+
...last[0],
|
|
69
|
+
sourceDigest: "0".repeat(64)
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
]), /identity does not match|changed between authoring packets/u);
|
|
73
|
+
});
|
|
74
|
+
test("evidence identity is bound to canonical path and exact UTF-8 content", () => {
|
|
75
|
+
const original = compileEvaluationEvidence({
|
|
76
|
+
sources: [{ path: "src/example.ts", content: "const label = \"café 🚀\";\n" }],
|
|
77
|
+
maximumBlockBytes: 2_048
|
|
78
|
+
})[0];
|
|
79
|
+
const changedContent = compileEvaluationEvidence({
|
|
80
|
+
sources: [{ path: "src/example.ts", content: "const label = \"cafe 🚀\";\n" }],
|
|
81
|
+
maximumBlockBytes: 2_048
|
|
82
|
+
})[0];
|
|
83
|
+
const changedPath = compileEvaluationEvidence({
|
|
84
|
+
sources: [{ path: "src/renamed.ts", content: "const label = \"café 🚀\";\n" }],
|
|
85
|
+
maximumBlockBytes: 2_048
|
|
86
|
+
})[0];
|
|
87
|
+
assert.notEqual(original.sourceDigest, changedContent.sourceDigest);
|
|
88
|
+
assert.notEqual(original.blocks[0].id, changedContent.blocks[0].id);
|
|
89
|
+
assert.notEqual(original.blocks[0].id, changedPath.blocks[0].id);
|
|
90
|
+
assert.equal(original.blocks[0].text, "const label = \"café 🚀\";\n");
|
|
91
|
+
});
|
|
92
|
+
test("repeated exact text in one source receives distinct compiler-owned identities", () => {
|
|
93
|
+
const compiled = compileEvaluationEvidence({
|
|
94
|
+
sources: [{ path: "src/repeated.txt", content: "same\nsame\n" }],
|
|
95
|
+
maximumBlockBytes: 5
|
|
96
|
+
})[0];
|
|
97
|
+
assert.equal(compiled.blocks.length, 2);
|
|
98
|
+
assert.equal(compiled.blocks[0].text, compiled.blocks[1].text);
|
|
99
|
+
assert.notEqual(compiled.blocks[0].id, compiled.blocks[1].id);
|
|
100
|
+
assert.deepEqual(resolveEvaluationEvidence({
|
|
101
|
+
sources: [compiled],
|
|
102
|
+
evidenceIds: compiled.blocks.map((block) => block.id),
|
|
103
|
+
maximumContextBytes: 10
|
|
104
|
+
}).map((block) => block.text), ["same\n", "same\n"]);
|
|
105
|
+
});
|
|
106
|
+
test("evidence blocks prefer blank-line boundaries and obey a hard UTF-8 byte bound", () => {
|
|
107
|
+
const compiled = compileEvaluationEvidence({
|
|
108
|
+
sources: [
|
|
109
|
+
{
|
|
110
|
+
path: "src/example.ts",
|
|
111
|
+
content: "first line\n\nsecond line\nthird line\n"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
maximumBlockBytes: 24
|
|
115
|
+
})[0];
|
|
116
|
+
assert.equal(compiled.blocks.length, 2);
|
|
117
|
+
assert.equal(compiled.blocks[0].text, "first line\n\n");
|
|
118
|
+
assert.equal(compiled.blocks[0].startLine, 1);
|
|
119
|
+
assert.equal(compiled.blocks[0].endLine, 2);
|
|
120
|
+
assert.equal(compiled.blocks[1].text, "second line\nthird line\n");
|
|
121
|
+
assert.ok(compiled.blocks.every((block) => Buffer.byteLength(block.text, "utf8") <= 24));
|
|
122
|
+
});
|
|
123
|
+
test("an oversized line is split without corrupting Unicode or inventing line ranges", () => {
|
|
124
|
+
const text = "🚀".repeat(9);
|
|
125
|
+
const compiled = compileEvaluationEvidence({
|
|
126
|
+
sources: [{ path: "data/emoji.txt", content: text }],
|
|
127
|
+
maximumBlockBytes: 12
|
|
128
|
+
})[0];
|
|
129
|
+
assert.equal(compiled.blocks.map((block) => block.text).join(""), text);
|
|
130
|
+
assert.deepEqual(compiled.blocks.map((block) => [block.startLine, block.endLine]), [
|
|
131
|
+
[1, 1],
|
|
132
|
+
[1, 1],
|
|
133
|
+
[1, 1]
|
|
134
|
+
]);
|
|
135
|
+
assert.ok(compiled.blocks.every((block) => Buffer.byteLength(block.text, "utf8") <= 12));
|
|
136
|
+
});
|
|
137
|
+
test("evidence resolution rejects unknown, duplicate, and oversized selections", () => {
|
|
138
|
+
const compiled = compileEvaluationEvidence({
|
|
139
|
+
sources: [{ path: "src/example.ts", content: "one\n\ntwo\n" }],
|
|
140
|
+
maximumBlockBytes: 6
|
|
141
|
+
});
|
|
142
|
+
const ids = compiled[0].blocks.map((block) => block.id);
|
|
143
|
+
assert.equal(ids.length, 2);
|
|
144
|
+
assert.throws(() => resolveEvaluationEvidence({
|
|
145
|
+
sources: compiled,
|
|
146
|
+
evidenceIds: ["ev_missing"],
|
|
147
|
+
maximumContextBytes: 12
|
|
148
|
+
}), /unknown evidence id/u);
|
|
149
|
+
assert.throws(() => resolveEvaluationEvidence({
|
|
150
|
+
sources: compiled,
|
|
151
|
+
evidenceIds: [ids[0], ids[0]],
|
|
152
|
+
maximumContextBytes: 12
|
|
153
|
+
}), /duplicate evidence id/u);
|
|
154
|
+
assert.throws(() => resolveEvaluationEvidence({
|
|
155
|
+
sources: compiled,
|
|
156
|
+
evidenceIds: ids,
|
|
157
|
+
maximumContextBytes: 4
|
|
158
|
+
}), /exceeds the 4 byte context bound/u);
|
|
159
|
+
});
|
|
160
|
+
test("evidence resolution rejects tampered content, identity, and line metadata", () => {
|
|
161
|
+
const compiled = compileEvaluationEvidence({
|
|
162
|
+
sources: [{ path: "src/example.ts", content: "one\ntwo\n" }],
|
|
163
|
+
maximumBlockBytes: 4
|
|
164
|
+
});
|
|
165
|
+
const source = compiled[0];
|
|
166
|
+
const first = source.blocks[0];
|
|
167
|
+
for (const tampered of [
|
|
168
|
+
[{ ...source, blocks: [{ ...first, text: "ONE\n" }, ...source.blocks.slice(1)] }],
|
|
169
|
+
[{ ...source, blocks: [{ ...first, id: "ev_tampered" }, ...source.blocks.slice(1)] }],
|
|
170
|
+
[{ ...source, blocks: [{ ...first, startLine: 2 }, ...source.blocks.slice(1)] }]
|
|
171
|
+
]) {
|
|
172
|
+
assert.throws(() => assertEvaluationEvidenceSources(tampered), /compiled evidence/u);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
test("evidence packet merging deduplicates identical sources and rejects drift", () => {
|
|
176
|
+
const first = compileEvaluationEvidence({
|
|
177
|
+
sources: [{ path: "src/example.ts", content: "one\n" }],
|
|
178
|
+
maximumBlockBytes: 8
|
|
179
|
+
});
|
|
180
|
+
const same = compileEvaluationEvidence({
|
|
181
|
+
sources: [{ path: "src/example.ts", content: "one\n" }],
|
|
182
|
+
maximumBlockBytes: 8
|
|
183
|
+
});
|
|
184
|
+
const changed = compileEvaluationEvidence({
|
|
185
|
+
sources: [{ path: "src/example.ts", content: "two\n" }],
|
|
186
|
+
maximumBlockBytes: 8
|
|
187
|
+
});
|
|
188
|
+
assert.deepEqual(mergeEvaluationEvidenceSources([first, same]), first);
|
|
189
|
+
assert.throws(() => mergeEvaluationEvidenceSources([first, changed]), /changed between authoring packets/u);
|
|
190
|
+
});
|
|
191
|
+
test("candidate context is mechanically rendered from selected evidence IDs", () => {
|
|
192
|
+
const compiled = compileEvaluationEvidence({
|
|
193
|
+
sources: [{ path: "src/example.ts", content: "one\n\ntwo\n" }],
|
|
194
|
+
maximumBlockBytes: 6
|
|
195
|
+
});
|
|
196
|
+
const selected = resolveEvaluationEvidence({
|
|
197
|
+
sources: compiled,
|
|
198
|
+
evidenceIds: compiled[0].blocks.map((block) => block.id),
|
|
199
|
+
maximumContextBytes: 12
|
|
200
|
+
});
|
|
201
|
+
assert.equal(renderEvaluationEvidenceContext(selected), selected
|
|
202
|
+
.map((block) => `Evidence ${block.id} — ${block.path} (lines ${String(block.startLine)}-${String(block.endLine)})\n-----\n${block.text}\n-----`)
|
|
203
|
+
.join("\n\n"));
|
|
204
|
+
});
|
|
205
|
+
test("evidence compilation rejects duplicate and non-canonical source paths", () => {
|
|
206
|
+
assert.throws(() => compileEvaluationEvidence({
|
|
207
|
+
sources: [
|
|
208
|
+
{ path: "src/example.ts", content: "one" },
|
|
209
|
+
{ path: "src/example.ts", content: "two" }
|
|
210
|
+
],
|
|
211
|
+
maximumBlockBytes: 2_048
|
|
212
|
+
}), /duplicate evidence source path/u);
|
|
213
|
+
for (const path of [
|
|
214
|
+
"/absolute.ts",
|
|
215
|
+
"../escape.ts",
|
|
216
|
+
"./relative.ts",
|
|
217
|
+
"src//file.ts",
|
|
218
|
+
"src/./file.ts",
|
|
219
|
+
"src\\file.ts"
|
|
220
|
+
]) {
|
|
221
|
+
assert.throws(() => compileEvaluationEvidence({
|
|
222
|
+
sources: [{ path, content: "one" }],
|
|
223
|
+
maximumBlockBytes: 2_048
|
|
224
|
+
}), /not canonical/u);
|
|
225
|
+
}
|
|
226
|
+
assert.throws(() => compileEvaluationEvidence({
|
|
227
|
+
sources: [{ path: "src/empty.ts", content: "" }],
|
|
228
|
+
maximumBlockBytes: 2_048
|
|
229
|
+
}), /evidence source is empty/u);
|
|
230
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|