clinkx 1.2.0 → 1.3.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/CHANGELOG.md +32 -0
- package/README.md +4 -2
- package/clinkx-workflows/dist/architecture-arena/admission.d.ts +16 -0
- package/clinkx-workflows/dist/architecture-arena/admission.js +107 -0
- package/clinkx-workflows/dist/architecture-arena/admission.js.map +1 -0
- package/clinkx-workflows/dist/architecture-arena/contract.d.ts +1368 -0
- package/clinkx-workflows/dist/architecture-arena/contract.js +254 -0
- package/clinkx-workflows/dist/architecture-arena/contract.js.map +1 -0
- package/clinkx-workflows/dist/architecture-arena/runtime.d.ts +53 -0
- package/clinkx-workflows/dist/architecture-arena/runtime.js +511 -0
- package/clinkx-workflows/dist/architecture-arena/runtime.js.map +1 -0
- package/clinkx-workflows/dist/architecture-comparison/admission.d.ts +17 -1
- package/clinkx-workflows/dist/architecture-comparison/admission.js +27 -4
- package/clinkx-workflows/dist/architecture-comparison/admission.js.map +1 -1
- package/clinkx-workflows/dist/architecture-comparison/contract.d.ts +59 -62
- package/clinkx-workflows/dist/architecture-comparison/contract.js +4 -21
- package/clinkx-workflows/dist/architecture-comparison/contract.js.map +1 -1
- package/clinkx-workflows/dist/architecture-comparison/runtime.d.ts +4 -3
- package/clinkx-workflows/dist/architecture-comparison/runtime.js +22 -67
- package/clinkx-workflows/dist/architecture-comparison/runtime.js.map +1 -1
- package/clinkx-workflows/dist/artifacts.d.ts +19 -4
- package/clinkx-workflows/dist/artifacts.js +16 -7
- package/clinkx-workflows/dist/artifacts.js.map +1 -1
- package/clinkx-workflows/dist/backend.d.ts +30 -0
- package/clinkx-workflows/dist/clink-client.d.ts +8 -2
- package/clinkx-workflows/dist/clink-client.js +4 -2
- package/clinkx-workflows/dist/clink-client.js.map +1 -1
- package/clinkx-workflows/dist/context-preflight.d.ts +6 -0
- package/clinkx-workflows/dist/context-preflight.js.map +1 -1
- package/clinkx-workflows/dist/council-execution-policy.d.ts +3 -1
- package/clinkx-workflows/dist/council-execution-policy.js +4 -0
- package/clinkx-workflows/dist/council-execution-policy.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/contracts.d.ts +586 -586
- package/clinkx-workflows/dist/dashboard/progress-report-contract.d.ts +28 -28
- package/clinkx-workflows/dist/dashboard/session-log-contract.d.ts +32 -32
- package/clinkx-workflows/dist/dashboard-ui/assets/index-DRId2DVA.js +119 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/style-CHAw57y5.css +1 -0
- package/clinkx-workflows/dist/dashboard-ui/index.html +2 -2
- package/clinkx-workflows/dist/delegate-signature.d.ts +4 -3
- package/clinkx-workflows/dist/delegate-signature.js +4 -3
- package/clinkx-workflows/dist/delegate-signature.js.map +1 -1
- package/clinkx-workflows/dist/durable-file.d.ts +69 -0
- package/clinkx-workflows/dist/durable-file.js +145 -0
- package/clinkx-workflows/dist/durable-file.js.map +1 -0
- package/clinkx-workflows/dist/engine.d.ts +42 -7
- package/clinkx-workflows/dist/engine.js +196 -24
- package/clinkx-workflows/dist/engine.js.map +1 -1
- package/clinkx-workflows/dist/ping-pong/admission.d.ts +127 -0
- package/clinkx-workflows/dist/ping-pong/admission.js +522 -0
- package/clinkx-workflows/dist/ping-pong/admission.js.map +1 -0
- package/clinkx-workflows/dist/ping-pong/contract.d.ts +2539 -0
- package/clinkx-workflows/dist/ping-pong/contract.js +819 -0
- package/clinkx-workflows/dist/ping-pong/contract.js.map +1 -0
- package/clinkx-workflows/dist/ping-pong/control.d.ts +67 -0
- package/clinkx-workflows/dist/ping-pong/control.js +12 -0
- package/clinkx-workflows/dist/ping-pong/control.js.map +1 -0
- package/clinkx-workflows/dist/ping-pong/runtime-handle.d.ts +24 -0
- package/clinkx-workflows/dist/ping-pong/runtime-handle.js +55 -0
- package/clinkx-workflows/dist/ping-pong/runtime-handle.js.map +1 -0
- package/clinkx-workflows/dist/ping-pong/runtime.d.ts +235 -0
- package/clinkx-workflows/dist/ping-pong/runtime.js +1183 -0
- package/clinkx-workflows/dist/ping-pong/runtime.js.map +1 -0
- package/clinkx-workflows/dist/ping-pong/settle.d.ts +57 -0
- package/clinkx-workflows/dist/ping-pong/settle.js +58 -0
- package/clinkx-workflows/dist/ping-pong/settle.js.map +1 -0
- package/clinkx-workflows/dist/ping-pong/sidecar.d.ts +65 -0
- package/clinkx-workflows/dist/ping-pong/sidecar.js +138 -0
- package/clinkx-workflows/dist/ping-pong/sidecar.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/publication.d.ts +2 -1
- package/clinkx-workflows/dist/plan-review/publication.js +5 -6
- package/clinkx-workflows/dist/plan-review/publication.js.map +1 -1
- package/clinkx-workflows/dist/plan-review/snapshot.d.ts +3 -2
- package/clinkx-workflows/dist/plan-review/snapshot.js +8 -8
- package/clinkx-workflows/dist/plan-review/snapshot.js.map +1 -1
- package/clinkx-workflows/dist/recipe-host.d.ts +315 -0
- package/clinkx-workflows/dist/recipe-host.js +183 -0
- package/clinkx-workflows/dist/recipe-host.js.map +1 -0
- package/clinkx-workflows/dist/recipe-seats.d.ts +96 -0
- package/clinkx-workflows/dist/recipe-seats.js +163 -0
- package/clinkx-workflows/dist/recipe-seats.js.map +1 -0
- package/clinkx-workflows/dist/recipe-shared/evidence.d.ts +67 -0
- package/clinkx-workflows/dist/recipe-shared/evidence.js +111 -0
- package/clinkx-workflows/dist/recipe-shared/evidence.js.map +1 -0
- package/clinkx-workflows/dist/reducers/index.d.ts +9 -1
- package/clinkx-workflows/dist/reducers/index.js +30 -0
- package/clinkx-workflows/dist/reducers/index.js.map +1 -1
- package/clinkx-workflows/dist/run-lock-reclaim.d.ts +44 -0
- package/clinkx-workflows/dist/run-lock-reclaim.js +86 -0
- package/clinkx-workflows/dist/run-lock-reclaim.js.map +1 -0
- package/clinkx-workflows/dist/state-schema.d.ts +11 -0
- package/clinkx-workflows/dist/state-schema.js +4 -1
- package/clinkx-workflows/dist/state-schema.js.map +1 -1
- package/clinkx-workflows/dist/state.d.ts +178 -3
- package/clinkx-workflows/dist/state.js +618 -83
- package/clinkx-workflows/dist/state.js.map +1 -1
- package/clinkx-workflows/dist/transport.d.ts +2 -1
- package/clinkx-workflows/dist/transport.js +5 -0
- package/clinkx-workflows/dist/transport.js.map +1 -1
- package/clinkx-workflows/dist/validators/architecture-arena.d.ts +6 -0
- package/clinkx-workflows/dist/validators/architecture-arena.js +16 -0
- package/clinkx-workflows/dist/validators/architecture-arena.js.map +1 -0
- package/clinkx-workflows/dist/validators/index.js +4 -0
- package/clinkx-workflows/dist/validators/index.js.map +1 -1
- package/clinkx-workflows/dist/validators/ping-pong.d.ts +6 -0
- package/clinkx-workflows/dist/validators/ping-pong.js +10 -0
- package/clinkx-workflows/dist/validators/ping-pong.js.map +1 -0
- package/clinkx-workflows/dist/workflow-tools.d.ts +51 -5
- package/clinkx-workflows/dist/workflow-tools.js +785 -34
- package/clinkx-workflows/dist/workflow-tools.js.map +1 -1
- package/clinkx-workflows/dist/workflow-verification-contract.d.ts +4 -4
- package/clinkx-workflows/templates/architecture-arena/candidate.txt +39 -0
- package/clinkx-workflows/templates/architecture-arena/judge.txt +34 -0
- package/clinkx-workflows/templates/ping-pong/implement.txt +14 -0
- package/clinkx-workflows/templates/ping-pong/remediate.txt +14 -0
- package/clinkx-workflows/templates/ping-pong/review.txt +27 -0
- package/clinkx-workflows/workflows/architecture-arena.yaml +127 -0
- package/clinkx-workflows/workflows/ping-pong.yaml +158 -0
- package/dist/context-builder/bundle.js +4 -3
- package/dist/context-builder/bundle.js.map +1 -1
- package/dist/context-builder/delegate-packet.d.ts +1 -0
- package/dist/context-builder/delegate-packet.js +66 -7
- package/dist/context-builder/delegate-packet.js.map +1 -1
- package/dist/context-builder/delegate-validation.d.ts +12 -3
- package/dist/context-builder/delegate-validation.js +23 -13
- package/dist/context-builder/delegate-validation.js.map +1 -1
- package/dist/context-builder/external-gaps.d.ts +14 -3
- package/dist/context-builder/external-gaps.js +124 -18
- package/dist/context-builder/external-gaps.js.map +1 -1
- package/dist/context-builder/handler.js +108 -191
- package/dist/context-builder/handler.js.map +1 -1
- package/dist/context-builder/review-coverage.js +27 -1
- package/dist/context-builder/review-coverage.js.map +1 -1
- package/dist/context-builder/secrets.js +1 -1
- package/dist/context-builder/secrets.js.map +1 -1
- package/dist/context-builder/versions.d.ts +10 -4
- package/dist/context-builder/versions.js +10 -4
- package/dist/context-builder/versions.js.map +1 -1
- package/dist/context-builder/workflow-runner.js +33 -24
- package/dist/context-builder/workflow-runner.js.map +1 -1
- package/dist/dashboard-cli.d.ts +2 -0
- package/dist/dashboard-cli.js +147 -57
- package/dist/dashboard-cli.js.map +1 -1
- package/dist/dashboard-companion/client.d.ts +10 -0
- package/dist/dashboard-companion/client.js +43 -1
- package/dist/dashboard-companion/client.js.map +1 -1
- package/dist/dashboard-companion/config.d.ts +19 -1
- package/dist/dashboard-companion/config.js +104 -3
- package/dist/dashboard-companion/config.js.map +1 -1
- package/dist/dashboard-companion/protocol.d.ts +16 -0
- package/dist/dashboard-companion/protocol.js +38 -1
- package/dist/dashboard-companion/protocol.js.map +1 -1
- package/dist/dashboard-companion/workstation-binding.d.ts +69 -0
- package/dist/dashboard-companion/workstation-binding.js +192 -0
- package/dist/dashboard-companion/workstation-binding.js.map +1 -0
- package/dist/dashboard-gateway/admin-cli.d.ts +10 -0
- package/dist/dashboard-gateway/admin-cli.js +266 -0
- package/dist/dashboard-gateway/admin-cli.js.map +1 -0
- package/dist/dashboard-gateway/config.d.ts +50 -0
- package/dist/dashboard-gateway/config.js +235 -1
- package/dist/dashboard-gateway/config.js.map +1 -1
- package/dist/dashboard-gateway/connection-registry.d.ts +100 -0
- package/dist/dashboard-gateway/connection-registry.js +228 -0
- package/dist/dashboard-gateway/connection-registry.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/account-auth.d.ts +78 -0
- package/dist/dashboard-gateway/control-plane/account-auth.js +198 -0
- package/dist/dashboard-gateway/control-plane/account-auth.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/billing.d.ts +264 -0
- package/dist/dashboard-gateway/control-plane/billing.js +787 -0
- package/dist/dashboard-gateway/control-plane/billing.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/contracts.d.ts +1293 -0
- package/dist/dashboard-gateway/control-plane/contracts.js +280 -0
- package/dist/dashboard-gateway/control-plane/contracts.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/cookies.d.ts +13 -0
- package/dist/dashboard-gateway/control-plane/cookies.js +46 -0
- package/dist/dashboard-gateway/control-plane/cookies.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/credentials.d.ts +63 -0
- package/dist/dashboard-gateway/control-plane/credentials.js +66 -0
- package/dist/dashboard-gateway/control-plane/credentials.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/entitlements.d.ts +118 -0
- package/dist/dashboard-gateway/control-plane/entitlements.js +329 -0
- package/dist/dashboard-gateway/control-plane/entitlements.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/errors.d.ts +17 -0
- package/dist/dashboard-gateway/control-plane/errors.js +23 -0
- package/dist/dashboard-gateway/control-plane/errors.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/hosts.d.ts +6 -0
- package/dist/dashboard-gateway/control-plane/hosts.js +16 -0
- package/dist/dashboard-gateway/control-plane/hosts.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/http.d.ts +34 -0
- package/dist/dashboard-gateway/control-plane/http.js +331 -0
- package/dist/dashboard-gateway/control-plane/http.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/schema.d.ts +9 -0
- package/dist/dashboard-gateway/control-plane/schema.js +247 -0
- package/dist/dashboard-gateway/control-plane/schema.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/secrets.d.ts +20 -0
- package/dist/dashboard-gateway/control-plane/secrets.js +39 -0
- package/dist/dashboard-gateway/control-plane/secrets.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/store.d.ts +579 -0
- package/dist/dashboard-gateway/control-plane/store.js +1115 -0
- package/dist/dashboard-gateway/control-plane/store.js.map +1 -0
- package/dist/dashboard-gateway/cookie-boundary.d.ts +60 -0
- package/dist/dashboard-gateway/cookie-boundary.js +205 -0
- package/dist/dashboard-gateway/cookie-boundary.js.map +1 -0
- package/dist/dashboard-gateway/index.js +271 -494
- package/dist/dashboard-gateway/index.js.map +1 -1
- package/dist/dashboard-gateway/main.js +7 -2
- package/dist/dashboard-gateway/main.js.map +1 -1
- package/dist/dashboard-gateway/routing.d.ts +43 -0
- package/dist/dashboard-gateway/routing.js +65 -0
- package/dist/dashboard-gateway/routing.js.map +1 -0
- package/dist/dashboard-gateway/tenant-gateway.d.ts +56 -0
- package/dist/dashboard-gateway/tenant-gateway.js +989 -0
- package/dist/dashboard-gateway/tenant-gateway.js.map +1 -0
- package/dist/dashboard-gateway/tenant-main.d.ts +41 -0
- package/dist/dashboard-gateway/tenant-main.js +303 -0
- package/dist/dashboard-gateway/tenant-main.js.map +1 -0
- package/dist/dashboard-gateway/tunnel-errors.d.ts +16 -0
- package/dist/dashboard-gateway/tunnel-errors.js +22 -0
- package/dist/dashboard-gateway/tunnel-errors.js.map +1 -0
- package/dist/dashboard-gateway/tunnel-http.d.ts +21 -0
- package/dist/dashboard-gateway/tunnel-http.js +175 -0
- package/dist/dashboard-gateway/tunnel-http.js.map +1 -0
- package/dist/handler.d.ts +6 -0
- package/dist/handler.js +17 -1
- package/dist/handler.js.map +1 -1
- package/dist/local-clink-backend.d.ts +2 -1
- package/dist/local-clink-backend.js +28 -4
- package/dist/local-clink-backend.js.map +1 -1
- package/dist/parsers/extract.d.ts +19 -1
- package/dist/parsers/extract.js +68 -3
- package/dist/parsers/extract.js.map +1 -1
- package/dist/pipeline.d.ts +17 -1
- package/dist/pipeline.js +34 -6
- package/dist/pipeline.js.map +1 -1
- package/dist/process-group.d.ts +65 -0
- package/dist/process-group.js +153 -0
- package/dist/process-group.js.map +1 -0
- package/dist/progress-report/schema.d.ts +23 -23
- package/dist/project-verification/files.js +1 -1
- package/dist/project-verification/files.js.map +1 -1
- package/dist/project-verification/process.js +23 -44
- package/dist/project-verification/process.js.map +1 -1
- package/dist/project-verification/service.js +9 -1
- package/dist/project-verification/service.js.map +1 -1
- package/dist/prompt.d.ts +7 -0
- package/dist/prompt.js +18 -1
- package/dist/prompt.js.map +1 -1
- package/dist/recipe-host/git-trust.d.ts +43 -0
- package/dist/recipe-host/git-trust.js +360 -0
- package/dist/recipe-host/git-trust.js.map +1 -0
- package/dist/recipe-host/git.d.ts +42 -0
- package/dist/recipe-host/git.js +207 -0
- package/dist/recipe-host/git.js.map +1 -0
- package/dist/recipe-host/native-recipe-host.d.ts +127 -0
- package/dist/recipe-host/native-recipe-host.js +880 -0
- package/dist/recipe-host/native-recipe-host.js.map +1 -0
- package/dist/recipe-host/seat-cwd.d.ts +16 -0
- package/dist/recipe-host/seat-cwd.js +170 -0
- package/dist/recipe-host/seat-cwd.js.map +1 -0
- package/dist/runner.d.ts +43 -1
- package/dist/runner.js +234 -35
- package/dist/runner.js.map +1 -1
- package/dist/server.js +9 -1
- package/dist/server.js.map +1 -1
- package/docs/configuration.md +24 -3
- package/docs/engineering-recipes.md +291 -0
- package/docs/security.md +84 -0
- package/docs/verification/project-checks.md +24 -2
- package/package.json +5 -1
- package/clinkx-workflows/dist/dashboard-ui/assets/index-BdpmbPps.js +0 -115
- package/clinkx-workflows/dist/dashboard-ui/assets/style-Im5i1iAs.css +0 -1
|
@@ -10,13 +10,13 @@ import { invocationAuditV2PersistenceEnabled } from "../../clinkx-workflows/dist
|
|
|
10
10
|
import { assertContextBuilderAnchorSufficiency } from "./anchors.js";
|
|
11
11
|
import { writeContextBuilderFinalArtifacts, } from "./bundle.js";
|
|
12
12
|
import { CONTEXT_BUILDER_INTERNAL_CAP_DEFAULTS, getSharedContextBuilderSemaphore, resolveContextBuilderRunsDir, } from "./config.js";
|
|
13
|
-
import { buildContextBuilderCuratorPacket, buildContextBuilderFinalizerPacket, CONTEXT_BUILDER_DELEGATE_PACKET_CAP_PROFILE_DEFAULTS, contextBuilderCandidateId, countDelegatePacketObligationTruncation, } from "./delegate-packet.js";
|
|
13
|
+
import { buildContextBuilderCuratorPacket, buildContextBuilderFinalizerPacket, CONTEXT_BUILDER_DELEGATE_PACKET_CAP_PROFILE_DEFAULTS, CONTEXT_BUILDER_REVIEW_EVIDENCE_PRUNED_OMISSION_REASON, contextBuilderCandidateId, countDelegatePacketObligationTruncation, } from "./delegate-packet.js";
|
|
14
14
|
import { reconstructContextBuilderDelegateSelection, reconstructContextBuilderDelegateSelectionWithReport, } from "./delegate-reconstruction.js";
|
|
15
15
|
import { assertNoDisabledFinalizerInvocationOverrides, resolveContextBuilderFinalizerEffectiveEnabled, } from "./delegate-finalizer-effective.js";
|
|
16
16
|
import { runContextBuilderDelegateCall, } from "./delegate.js";
|
|
17
17
|
import { recordContextInvocationAudit } from "./invocation-sidecar.js";
|
|
18
18
|
import { classifyFinalizerExternalGaps, } from "./external-gaps.js";
|
|
19
|
-
import { ContextBuilderFinalizerRejectionError, MAX_FINALIZER_EXTERNAL_GAPS, validateContextBuilderCuratorOutput,
|
|
19
|
+
import { ContextBuilderFinalizerRejectionError, MAX_FINALIZER_EXTERNAL_GAPS, validateContextBuilderCuratorOutput, findContextBuilderDelegateCoverageGaps, validateContextBuilderFinalizerOutput, } from "./delegate-validation.js";
|
|
20
20
|
import { discoverContextBuilderCandidates, mergeLineRanges, secretRedactionWarning, } from "./discovery.js";
|
|
21
21
|
import { createScanProgressPublisher } from "./discovery-progress.js";
|
|
22
22
|
import { withContextBuilderDiscoveryWatchdog } from "./discovery-watchdog.js";
|
|
@@ -40,7 +40,7 @@ import { admitJournalContextGeneration } from "./session-log-identity.js";
|
|
|
40
40
|
import { estimateContextBuilderTokensFromUtf8Bytes } from "./token-estimate.js";
|
|
41
41
|
let defaultAdapterRegistry;
|
|
42
42
|
const artifactOnlyAllowedRoots = new Set();
|
|
43
|
-
const CONTEXT_BUILDER_DELEGATE_PROMPT_VERSION = "cb-delegate-
|
|
43
|
+
const CONTEXT_BUILDER_DELEGATE_PROMPT_VERSION = "cb-delegate-v7-advisory-coverage";
|
|
44
44
|
const MAX_DELEGATE_MINIMUM_OUTPUT_SELECTIONS = 24;
|
|
45
45
|
export async function handleContextBuilder(args, options = {}) {
|
|
46
46
|
const input = parseContextBuilderInput(args);
|
|
@@ -545,17 +545,44 @@ function evaluateSelectionCoverage(input) {
|
|
|
545
545
|
selectedRanges: input.selected,
|
|
546
546
|
});
|
|
547
547
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
548
|
+
// D7: review coverage gaps are non-fatal. One aggregated warning per stage, so
|
|
549
|
+
// a wide no-focus search cannot flood the receipt; terminal review_deep_v1
|
|
550
|
+
// coverage reports the consequence as `degraded`.
|
|
551
|
+
function delegateCoverageSelectionWarnings(selected, candidates, coveragePolicy) {
|
|
552
|
+
const gaps = findContextBuilderDelegateCoverageGaps(selected.map((file) => ({
|
|
553
|
+
candidate_id: contextBuilderCandidateId(file.root_index, file.path),
|
|
554
|
+
ranges: file.ranges,
|
|
555
|
+
})), candidates, coveragePolicy);
|
|
556
|
+
if (gaps.length === 0) {
|
|
557
|
+
return [];
|
|
555
558
|
}
|
|
556
|
-
|
|
557
|
-
|
|
559
|
+
const shown = gaps.slice(0, REVIEW_EVIDENCE_WARNING_MAX_ENTRIES);
|
|
560
|
+
const dropped = gaps.length - shown.length;
|
|
561
|
+
return [
|
|
562
|
+
delegateWarning(DELEGATE_REVIEW_COVERAGE_GAP_WARNING_CODE, `delegate selection leaves ${gaps.length} review coverage gap(s); review_deep_v1 coverage is degraded: ${shown.join("; ")}${dropped > 0 ? ` (+${dropped} more)` : ""}`),
|
|
563
|
+
];
|
|
564
|
+
}
|
|
565
|
+
// Warnings are bounded to MAX_DIAGNOSTIC_TEXT_LENGTH on output; a few entries
|
|
566
|
+
// plus the total count keep the message useful within that bound.
|
|
567
|
+
const REVIEW_EVIDENCE_WARNING_MAX_ENTRIES = 3;
|
|
568
|
+
const DELEGATE_REVIEW_COVERAGE_GAP_WARNING_CODE = "delegate_review_coverage_gap";
|
|
569
|
+
const DELEGATE_PACKET_REVIEW_EVIDENCE_PRUNED_WARNING_CODE = "delegate_packet_review_evidence_pruned";
|
|
570
|
+
const DELEGATE_EXTERNAL_GAP_UNRESOLVED_WARNING_CODE = "delegate_external_gap_unresolved";
|
|
571
|
+
// The packet aggregates pruned protected review evidence into one omission;
|
|
572
|
+
// surface it as a non-fatal warning (D7) instead of a delegate failure.
|
|
573
|
+
function packetReviewEvidencePrunedWarning(packet) {
|
|
574
|
+
const pruned = packet.omissions.find((omission) => omission.reason === CONTEXT_BUILDER_REVIEW_EVIDENCE_PRUNED_OMISSION_REASON);
|
|
575
|
+
if (pruned == null) {
|
|
576
|
+
return undefined;
|
|
558
577
|
}
|
|
578
|
+
const paths = pruned.paths ?? [];
|
|
579
|
+
const total = paths.length + (pruned.omitted_path_count ?? 0);
|
|
580
|
+
const shown = boundContextBuilderPathList(paths, REVIEW_EVIDENCE_WARNING_MAX_ENTRIES);
|
|
581
|
+
const dropped = total - shown.length;
|
|
582
|
+
return {
|
|
583
|
+
code: DELEGATE_PACKET_REVIEW_EVIDENCE_PRUNED_WARNING_CODE,
|
|
584
|
+
message: `delegate packet could not carry ${total} review target or regression-link path(s); review_deep_v1 coverage may be degraded: ${shown.join(", ")}${dropped > 0 ? ` (+${dropped} more)` : ""}`,
|
|
585
|
+
};
|
|
559
586
|
}
|
|
560
587
|
async function rejectArtifactOnlySourceRoots(inputRoots, input) {
|
|
561
588
|
if (artifactOnlyAllowedRoots.size === 0) {
|
|
@@ -876,6 +903,7 @@ async function resolveDelegateSelection(input) {
|
|
|
876
903
|
delegatePacketSize = curatorPacket.metrics.packet_estimated_tokens;
|
|
877
904
|
delegatePacketCompaction = curatorPacket.metrics.compaction;
|
|
878
905
|
recordPacketEvidenceWarning(curatorPacket.evidence_warning);
|
|
906
|
+
recordPacketEvidenceWarning(packetReviewEvidencePrunedWarning(curatorPacket));
|
|
879
907
|
recordPacketEvidenceWarning(packetObligationTruncationWarning(input.discovery.review_obligations, curatorPacket.coverage_policy));
|
|
880
908
|
const curatorPacketRequestedOmissions = curatorPacket.omissions.filter(isRequestedEvidenceOmission);
|
|
881
909
|
if (curatorPacketRequestedOmissions.length > 0) {
|
|
@@ -968,7 +996,6 @@ async function resolveDelegateSelection(input) {
|
|
|
968
996
|
candidates: curatorPacket.candidates,
|
|
969
997
|
budget: input.input.budget,
|
|
970
998
|
allowSecrets: input.input.allow_secrets,
|
|
971
|
-
coveragePolicy: curatorPacket.coverage_policy,
|
|
972
999
|
});
|
|
973
1000
|
curatorProposal = augmentCuratorProposalWithDeterministicBaseline(validatedCuratorProposal, curatorPacket, input.input.budget.max_files);
|
|
974
1001
|
curatorSelection = reconstructContextBuilderDelegateSelection({
|
|
@@ -1051,23 +1078,12 @@ async function resolveDelegateSelection(input) {
|
|
|
1051
1078
|
const omissionCount = input.baselineOmissions.length +
|
|
1052
1079
|
input.discovery.omissions.length +
|
|
1053
1080
|
repairedSelection.selection.omissions.length;
|
|
1054
|
-
|
|
1081
|
+
warnings.push(...delegateCoverageSelectionWarnings(restoreDroppedDegenerateReviewTargetsForValidation({
|
|
1055
1082
|
preRepairSelected: curatorSelection.selected,
|
|
1056
1083
|
postRepairSelected: repairedSelection.selection.selected,
|
|
1057
1084
|
candidates: curatorPacket.candidates,
|
|
1058
1085
|
coveragePolicy: curatorPacket.coverage_policy,
|
|
1059
|
-
}), curatorPacket.candidates, curatorPacket.coverage_policy);
|
|
1060
|
-
if (delegateEvidenceCoverageFailure != null) {
|
|
1061
|
-
return handleDelegateRuntimeFailure({
|
|
1062
|
-
delegate,
|
|
1063
|
-
discoveryMetrics: input.discovery.metrics,
|
|
1064
|
-
reason: `post-repair evidence coverage failed: ${delegateEvidenceCoverageFailure}`,
|
|
1065
|
-
deterministicSelection: input.deterministicSelection,
|
|
1066
|
-
omissionCount,
|
|
1067
|
-
candidateFallbackCount,
|
|
1068
|
-
observability: currentDelegateObservability(),
|
|
1069
|
-
});
|
|
1070
|
-
}
|
|
1086
|
+
}), curatorPacket.candidates, curatorPacket.coverage_policy));
|
|
1071
1087
|
// Re-verify required-focus presence against the actual returned selection.
|
|
1072
1088
|
// The curator-only branch does not fold required-focus ranges, so it checks
|
|
1073
1089
|
// whole-file presence here; range coverage is re-verified only in the
|
|
@@ -1122,6 +1138,7 @@ async function resolveDelegateSelection(input) {
|
|
|
1122
1138
|
delegatePacketSize = finalizerPacket.metrics.packet_estimated_tokens;
|
|
1123
1139
|
delegatePacketCompaction = finalizerPacket.metrics.compaction;
|
|
1124
1140
|
recordPacketEvidenceWarning(finalizerPacket.evidence_warning);
|
|
1141
|
+
recordPacketEvidenceWarning(packetReviewEvidencePrunedWarning(finalizerPacket));
|
|
1125
1142
|
recordPacketEvidenceWarning(packetObligationTruncationWarning(input.discovery.review_obligations, finalizerPacket.coverage_policy));
|
|
1126
1143
|
const finalizerPacketRequestedOmissions = finalizerPacket.omissions.filter(isRequestedEvidenceOmission);
|
|
1127
1144
|
if (finalizerPacketRequestedOmissions.length > 0) {
|
|
@@ -1190,7 +1207,6 @@ async function resolveDelegateSelection(input) {
|
|
|
1190
1207
|
budget: input.input.budget,
|
|
1191
1208
|
minScore: delegate.finalizer.min_score,
|
|
1192
1209
|
allowSecrets: input.input.allow_secrets,
|
|
1193
|
-
coveragePolicy: finalizerPacket.coverage_policy,
|
|
1194
1210
|
});
|
|
1195
1211
|
const externalGaps = classifyFinalizerExternalGaps({
|
|
1196
1212
|
gaps: finalizerProposal.external_gaps,
|
|
@@ -1205,14 +1221,21 @@ async function resolveDelegateSelection(input) {
|
|
|
1205
1221
|
: { excludedRealRoots: input.excludedRealRoots }),
|
|
1206
1222
|
});
|
|
1207
1223
|
// A rejected gap means the finalizer mis-described the packet (it named
|
|
1208
|
-
// in-packet or focused evidence, or a path that is not local
|
|
1209
|
-
// that is invalid output under either gap policy.
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1224
|
+
// in-packet or focused evidence, or a path that is not provably local);
|
|
1225
|
+
// that is invalid output under either gap policy. The one exception (D7):
|
|
1226
|
+
// under degrade, a confirmed in-root ENOENT is plausible missing evidence
|
|
1227
|
+
// (e.g. a file the change should have added), so it warns instead.
|
|
1228
|
+
const degradeGaps = delegate.external_gap_policy === "degrade";
|
|
1229
|
+
const unresolvedExternalGaps = degradeGaps
|
|
1230
|
+
? externalGaps.rejected.filter(isUnresolvedExternalGap)
|
|
1231
|
+
: [];
|
|
1232
|
+
const fatalRejectedGaps = externalGaps.rejected.filter((gap) => !unresolvedExternalGaps.includes(gap));
|
|
1233
|
+
const externalGapFailure = fatalRejectedGaps.length > 0
|
|
1234
|
+
? formatExternalGapRejectionFailure(fatalRejectedGaps, { degrade: degradeGaps })
|
|
1235
|
+
: externalGaps.external.length > 0 && !degradeGaps
|
|
1214
1236
|
? formatExternalGapPolicyFailure(externalGaps.external)
|
|
1215
1237
|
: null;
|
|
1238
|
+
const degradedByGaps = externalGaps.external.length > 0 || unresolvedExternalGaps.length > 0;
|
|
1216
1239
|
if (externalGapFailure != null) {
|
|
1217
1240
|
return handleDelegateRuntimeFailure({
|
|
1218
1241
|
delegate,
|
|
@@ -1310,20 +1333,7 @@ async function resolveDelegateSelection(input) {
|
|
|
1310
1333
|
budget: input.input.budget,
|
|
1311
1334
|
expandSelectedFiles: false,
|
|
1312
1335
|
});
|
|
1313
|
-
const
|
|
1314
|
-
if (delegateEvidenceCoverageFailure != null) {
|
|
1315
|
-
return handleDelegateRuntimeFailure({
|
|
1316
|
-
delegate,
|
|
1317
|
-
discoveryMetrics: input.discovery.metrics,
|
|
1318
|
-
reason: `post-repair evidence coverage failed: ${delegateEvidenceCoverageFailure}`,
|
|
1319
|
-
deterministicSelection: input.deterministicSelection,
|
|
1320
|
-
omissionCount: input.baselineOmissions.length +
|
|
1321
|
-
input.discovery.omissions.length +
|
|
1322
|
-
repairedSelection.selection.omissions.length,
|
|
1323
|
-
candidateFallbackCount,
|
|
1324
|
-
observability: currentDelegateObservability(),
|
|
1325
|
-
});
|
|
1326
|
-
}
|
|
1336
|
+
const reviewCoverageWarnings = delegateCoverageSelectionWarnings(repairedSelection.selection.selected, finalizerPacket.candidates, finalizerPacket.coverage_policy);
|
|
1327
1337
|
// D1 backstop: required-first reconstruction plus the completeness gate
|
|
1328
1338
|
// above should make this unreachable. It fails closed if a server-side
|
|
1329
1339
|
// change ever lets a non-degenerate required-focus file vanish while
|
|
@@ -1390,7 +1400,9 @@ async function resolveDelegateSelection(input) {
|
|
|
1390
1400
|
}));
|
|
1391
1401
|
warnings.push(...packetEvidenceWarnings);
|
|
1392
1402
|
appendDelegateRepairWarnings(warnings, repairedSelection);
|
|
1403
|
+
warnings.push(...reviewCoverageWarnings);
|
|
1393
1404
|
warnings.push(...externalGapWarnings(externalGaps.external));
|
|
1405
|
+
warnings.push(...unresolvedExternalGapWarnings(unresolvedExternalGaps));
|
|
1394
1406
|
const openQuestions = curatorProposal.open_questions.map((question) => sanitizeDiagnosticText(question));
|
|
1395
1407
|
const omissionCount = input.baselineOmissions.length +
|
|
1396
1408
|
input.discovery.omissions.length +
|
|
@@ -1407,8 +1419,8 @@ async function resolveDelegateSelection(input) {
|
|
|
1407
1419
|
enabled: true,
|
|
1408
1420
|
// partial WITHOUT fallback is the degrade signature: the curated
|
|
1409
1421
|
// selection is used as-is, but conclusions resting on the reported
|
|
1410
|
-
// external gaps are conditional.
|
|
1411
|
-
status:
|
|
1422
|
+
// external (or unresolved) gaps are conditional.
|
|
1423
|
+
status: degradedByGaps ? "partial" : "succeeded",
|
|
1412
1424
|
failure_policy: delegate.failure_policy,
|
|
1413
1425
|
fallback_used: false,
|
|
1414
1426
|
curator: delegateProviderReceiptMetadata(delegate.curator),
|
|
@@ -2274,18 +2286,16 @@ function totalSelectedRangeLines(ranges) {
|
|
|
2274
2286
|
return ranges.reduce((total, range) => total + Math.max(0, range.end_line - range.start_line + 1), 0);
|
|
2275
2287
|
}
|
|
2276
2288
|
/**
|
|
2277
|
-
* Renders the
|
|
2289
|
+
* Renders the review coverage obligations as explicit prompt rules.
|
|
2278
2290
|
*
|
|
2279
|
-
*
|
|
2280
|
-
*
|
|
2281
|
-
*
|
|
2282
|
-
*
|
|
2291
|
+
* D7: obligations are advisory. Only caller focus is required evidence; a
|
|
2292
|
+
* selection that leaves a target uncovered is accepted, warned about, and
|
|
2293
|
+
* reported as degraded review coverage. The rules still ask for coverage
|
|
2294
|
+
* because degraded coverage is the worse bundle.
|
|
2283
2295
|
*
|
|
2284
|
-
* Branch selection here tracks
|
|
2285
|
-
* obligation branch on `obligations != null`, NOT on a non-empty
|
|
2286
|
-
*
|
|
2287
|
-
* evidence-class contract for a packet the validator rejects outright, i.e.
|
|
2288
|
-
* instruct the delegate to do something that provably cannot pass.
|
|
2296
|
+
* Branch selection here tracks {@link findContextBuilderDelegateCoverageGaps}:
|
|
2297
|
+
* it enters the obligation branch on `obligations != null`, NOT on a non-empty
|
|
2298
|
+
* target list, so the rendered contract always matches what the server checks.
|
|
2289
2299
|
*/
|
|
2290
2300
|
function packetCoverageObligationRules(packet) {
|
|
2291
2301
|
if (packet == null || typeof packet !== "object") {
|
|
@@ -2307,19 +2317,17 @@ function packetCoverageObligationRules(packet) {
|
|
|
2307
2317
|
if (obligations != null && typeof obligations === "object") {
|
|
2308
2318
|
const targets = obligations["targets"];
|
|
2309
2319
|
if (!Array.isArray(targets) || targets.length === 0) {
|
|
2310
|
-
//
|
|
2311
|
-
// so
|
|
2312
|
-
//
|
|
2313
|
-
// a packet it will always reject is a separate defect; do not paper over
|
|
2314
|
-
// it by rendering the evidence-class rules the validator will not apply.)
|
|
2320
|
+
// A present-but-empty target list can never report satisfied coverage,
|
|
2321
|
+
// so there is nothing a delegate could act on. Stay silent rather than
|
|
2322
|
+
// render the evidence-class rules the server will not apply here.
|
|
2315
2323
|
return [];
|
|
2316
2324
|
}
|
|
2317
2325
|
return [
|
|
2318
|
-
"
|
|
2319
|
-
"- packet.coverage_policy.obligations.targets
|
|
2320
|
-
"- For
|
|
2321
|
-
"- For
|
|
2322
|
-
"-
|
|
2326
|
+
"Review coverage obligations (strongly preferred; the server does not reject output for them):",
|
|
2327
|
+
"- packet.coverage_policy.obligations.targets lists the review targets this run should cover. Output that leaves a target uncovered is accepted, but the run then reports degraded review coverage.",
|
|
2328
|
+
"- For every target: include that target's candidate_id with at least one range that overlaps one of that target's ranges.",
|
|
2329
|
+
"- For every target whose regression_links is non-empty: also include at least ONE of those links' candidate_id with an overlapping range. One linked candidate per target is sufficient; you do not need all of them.",
|
|
2330
|
+
"- Keep these candidates even when the task reads narrower than the obligation set; add them alongside your task-driven picks.",
|
|
2323
2331
|
];
|
|
2324
2332
|
}
|
|
2325
2333
|
const classes = requiredClasses.filter((entry) => typeof entry === "string");
|
|
@@ -2327,9 +2335,9 @@ function packetCoverageObligationRules(packet) {
|
|
|
2327
2335
|
return [];
|
|
2328
2336
|
}
|
|
2329
2337
|
return [
|
|
2330
|
-
"
|
|
2331
|
-
`- packet.coverage_policy.required_when_available lists
|
|
2332
|
-
"- For every listed class that ANY packet candidate carries in its evidence_classes,
|
|
2338
|
+
"Review coverage obligations (strongly preferred; the server does not reject output for them):",
|
|
2339
|
+
`- packet.coverage_policy.required_when_available lists the review evidence classes: ${classes.join(", ")}.`,
|
|
2340
|
+
"- For every listed class that ANY packet candidate carries in its evidence_classes, include at least one candidate carrying that class; otherwise the run reports degraded review coverage.",
|
|
2333
2341
|
];
|
|
2334
2342
|
}
|
|
2335
2343
|
/**
|
|
@@ -2454,7 +2462,9 @@ function finalizerExternalGapRules(policy) {
|
|
|
2454
2462
|
return [
|
|
2455
2463
|
"External gaps:",
|
|
2456
2464
|
`- Evidence the task needs that is ABSENT from packet.candidates goes in external_gaps as [{"path":"<root-relative path>","reason":"<why the task needs it>"}] (at most ${MAX_FINALIZER_EXTERNAL_GAPS} entries). Never lower score for it.`,
|
|
2457
|
-
|
|
2465
|
+
policy === "degrade"
|
|
2466
|
+
? "- Never list a path that is in packet.candidates or under a focus path in external_gaps; the server verifies every entry and rejects the whole answer if one is wrong. A listed path that does not exist under the source roots is kept only as an unresolved warning."
|
|
2467
|
+
: "- Never list a path that is in packet.candidates or under a focus path in external_gaps; the server verifies every entry and rejects the whole answer if one is wrong.",
|
|
2458
2468
|
"- Never list a directory that contains a packet.candidates path or a focus path; name the specific missing file instead.",
|
|
2459
2469
|
"- If evidence present in packet.candidates is insufficient, that is still approved:false with concrete omissions, not an external gap.",
|
|
2460
2470
|
policy === "degrade"
|
|
@@ -2540,115 +2550,6 @@ export function renderDelegatePrompt(stage, packet, options) {
|
|
|
2540
2550
|
"Return the JSON object now. If candidates exist, selected must be non-empty.",
|
|
2541
2551
|
].join("\n");
|
|
2542
2552
|
}
|
|
2543
|
-
/**
|
|
2544
|
-
* True when `selections` would clear the packet's coverage obligations.
|
|
2545
|
-
*
|
|
2546
|
-
* Mirrors {@link validateContextBuilderDelegateCoverageSelection}: every target
|
|
2547
|
-
* needs an overlapping selected range, and a target with regression links needs
|
|
2548
|
-
* an overlapping range from at least ONE of them (the link check is disjunctive).
|
|
2549
|
-
*/
|
|
2550
|
-
function selectionsSatisfyPacketObligations(selections, packet) {
|
|
2551
|
-
if (packet == null || typeof packet !== "object") {
|
|
2552
|
-
return true;
|
|
2553
|
-
}
|
|
2554
|
-
const policy = packet["coverage_policy"];
|
|
2555
|
-
if (policy == null || typeof policy !== "object") {
|
|
2556
|
-
return true;
|
|
2557
|
-
}
|
|
2558
|
-
const policyRecord = policy;
|
|
2559
|
-
if (policyRecord["policy_id"] !== "review_deep_v1") {
|
|
2560
|
-
return true;
|
|
2561
|
-
}
|
|
2562
|
-
const requiredClasses = policyRecord["required_when_available"];
|
|
2563
|
-
if (!Array.isArray(requiredClasses) || requiredClasses.length === 0) {
|
|
2564
|
-
return true;
|
|
2565
|
-
}
|
|
2566
|
-
const obligations = policyRecord["obligations"];
|
|
2567
|
-
if (obligations == null || typeof obligations !== "object") {
|
|
2568
|
-
// The validator does NOT concede this branch: it falls through to the
|
|
2569
|
-
// evidence-class check and still rejects a selection that omits an
|
|
2570
|
-
// available required class. Returning true here would advertise an example
|
|
2571
|
-
// the validator rejects. Unreachable through the current packet builder
|
|
2572
|
-
// (normalizeCoveragePolicy attaches obligations for every review_deep_v1
|
|
2573
|
-
// policy), but the two must not disagree — that divergence is the bug
|
|
2574
|
-
// generator this whole change exists to close.
|
|
2575
|
-
const candidates = packet["candidates"];
|
|
2576
|
-
if (!Array.isArray(candidates)) {
|
|
2577
|
-
return true;
|
|
2578
|
-
}
|
|
2579
|
-
const selectedIds = new Set(selections.map((selection) => selection.candidate_id));
|
|
2580
|
-
const evidenceClassesOf = (candidate) => {
|
|
2581
|
-
if (candidate == null || typeof candidate !== "object") {
|
|
2582
|
-
return [];
|
|
2583
|
-
}
|
|
2584
|
-
const classes = candidate["evidence_classes"];
|
|
2585
|
-
return Array.isArray(classes) ? classes : [];
|
|
2586
|
-
};
|
|
2587
|
-
return requiredClasses.every((evidenceClass) => {
|
|
2588
|
-
const available = candidates.some((candidate) => evidenceClassesOf(candidate).includes(evidenceClass));
|
|
2589
|
-
if (!available) {
|
|
2590
|
-
return true;
|
|
2591
|
-
}
|
|
2592
|
-
return candidates.some((candidate) => {
|
|
2593
|
-
const id = candidate != null && typeof candidate === "object"
|
|
2594
|
-
? candidate["id"]
|
|
2595
|
-
: undefined;
|
|
2596
|
-
return (typeof id === "string" &&
|
|
2597
|
-
selectedIds.has(id) &&
|
|
2598
|
-
evidenceClassesOf(candidate).includes(evidenceClass));
|
|
2599
|
-
});
|
|
2600
|
-
});
|
|
2601
|
-
}
|
|
2602
|
-
const targets = obligations["targets"];
|
|
2603
|
-
if (!Array.isArray(targets)) {
|
|
2604
|
-
return true;
|
|
2605
|
-
}
|
|
2606
|
-
if (targets.length === 0) {
|
|
2607
|
-
// The validator rejects a present-but-empty target list unconditionally, so
|
|
2608
|
-
// no example can be valid.
|
|
2609
|
-
return false;
|
|
2610
|
-
}
|
|
2611
|
-
const selectedById = new Map(selections.map((selection) => [selection.candidate_id, selection.ranges]));
|
|
2612
|
-
const covers = (value) => {
|
|
2613
|
-
if (value == null || typeof value !== "object") {
|
|
2614
|
-
return false;
|
|
2615
|
-
}
|
|
2616
|
-
const record = value;
|
|
2617
|
-
const candidateId = record["candidate_id"];
|
|
2618
|
-
if (typeof candidateId !== "string") {
|
|
2619
|
-
return false;
|
|
2620
|
-
}
|
|
2621
|
-
const selectedRanges = selectedById.get(candidateId);
|
|
2622
|
-
if (selectedRanges == null || selectedRanges.length === 0) {
|
|
2623
|
-
return false;
|
|
2624
|
-
}
|
|
2625
|
-
const obligationRanges = record["ranges"];
|
|
2626
|
-
if (!Array.isArray(obligationRanges) || obligationRanges.length === 0) {
|
|
2627
|
-
return false;
|
|
2628
|
-
}
|
|
2629
|
-
return obligationRanges.some((range) => {
|
|
2630
|
-
if (range == null || typeof range !== "object") {
|
|
2631
|
-
return false;
|
|
2632
|
-
}
|
|
2633
|
-
const start = range["start_line"];
|
|
2634
|
-
const end = range["end_line"];
|
|
2635
|
-
if (typeof start !== "number" || typeof end !== "number") {
|
|
2636
|
-
return false;
|
|
2637
|
-
}
|
|
2638
|
-
return selectedRanges.some((selectedRange) => selectedRange.start_line <= end && start <= selectedRange.end_line);
|
|
2639
|
-
});
|
|
2640
|
-
};
|
|
2641
|
-
return targets.every((target) => {
|
|
2642
|
-
if (!covers(target)) {
|
|
2643
|
-
return false;
|
|
2644
|
-
}
|
|
2645
|
-
const links = target["regression_links"];
|
|
2646
|
-
if (!Array.isArray(links) || links.length === 0) {
|
|
2647
|
-
return true;
|
|
2648
|
-
}
|
|
2649
|
-
return links.some((link) => covers(link));
|
|
2650
|
-
});
|
|
2651
|
-
}
|
|
2652
2553
|
/** The packet's `budget.max_files`, when it carries a usable one. */
|
|
2653
2554
|
function packetBudgetMaxFiles(packet) {
|
|
2654
2555
|
if (packet == null || typeof packet !== "object") {
|
|
@@ -2681,12 +2582,9 @@ function buildMinimumDelegateOutput(stage, packet, minScore) {
|
|
|
2681
2582
|
if (minimumSelections.length === 0) {
|
|
2682
2583
|
return null;
|
|
2683
2584
|
}
|
|
2684
|
-
//
|
|
2685
|
-
//
|
|
2686
|
-
//
|
|
2687
|
-
if (!selectionsSatisfyPacketObligations(minimumSelections, packet)) {
|
|
2688
|
-
return null;
|
|
2689
|
-
}
|
|
2585
|
+
// Review coverage obligations are advisory (D7), so an example that leaves a
|
|
2586
|
+
// target uncovered is still valid output; it degrades coverage rather than
|
|
2587
|
+
// failing. Offering it beats an unsure delegate emitting an empty selection.
|
|
2690
2588
|
const selected = minimumSelections.map((selection) => ({
|
|
2691
2589
|
candidate_id: selection.candidate_id,
|
|
2692
2590
|
ranges: selection.ranges.map((range) => ({
|
|
@@ -2882,6 +2780,8 @@ function finalizerScoreDiagnostic(json, minScore) {
|
|
|
2882
2780
|
: `; min_score=${minScore}`;
|
|
2883
2781
|
}
|
|
2884
2782
|
const FINALIZER_REJECTION_LEVERS = 'levers: add missing path(s) to focus_paths (workflow: cb_focus_paths); exclude vendor/generated dirs via exclude_globs (workflow: cb_exclude_globs); or set external_gap_policy:"degrade" (workflow: cb_delegate.external_gap_policy)';
|
|
2783
|
+
// Same levers minus the one already in effect.
|
|
2784
|
+
const FINALIZER_REJECTION_LEVERS_UNDER_DEGRADE = "levers: add missing path(s) to focus_paths (workflow: cb_focus_paths) or exclude vendor/generated dirs via exclude_globs (workflow: cb_exclude_globs)";
|
|
2885
2785
|
// Verdict-first text for a finalizer veto: what the finalizer said (approval,
|
|
2886
2786
|
// its own omission list) leads, because that is what the caller acts on; the
|
|
2887
2787
|
// score and packet diagnostics trail. Each omission is provider text, so it is
|
|
@@ -2919,12 +2819,23 @@ function formatExternalGapEntries(entries) {
|
|
|
2919
2819
|
const dropped = entries.length - shown.length;
|
|
2920
2820
|
return `${entries.length}: ${shown.join("; ")}${dropped > 0 ? ` (+${dropped} more external gaps)` : ""}`;
|
|
2921
2821
|
}
|
|
2922
|
-
function formatExternalGapRejectionFailure(rejected) {
|
|
2822
|
+
function formatExternalGapRejectionFailure(rejected, options) {
|
|
2923
2823
|
return [
|
|
2924
|
-
`finalizer_validation: external_gaps rejected=${formatExternalGapEntries(rejected.map((gap) => ({
|
|
2925
|
-
|
|
2824
|
+
`finalizer_validation: external_gaps rejected=${formatExternalGapEntries(rejected.map((gap) => ({
|
|
2825
|
+
path: gap.path,
|
|
2826
|
+
detail: gap.existence == null ? gap.why : `${gap.why}: ${gap.existence}`,
|
|
2827
|
+
})))}`,
|
|
2828
|
+
options.degrade ? FINALIZER_REJECTION_LEVERS_UNDER_DEGRADE : FINALIZER_REJECTION_LEVERS,
|
|
2926
2829
|
].join("; ");
|
|
2927
2830
|
}
|
|
2831
|
+
function isUnresolvedExternalGap(gap) {
|
|
2832
|
+
return gap.why === "nonexistent_or_outside_roots" && gap.existence === "enoent";
|
|
2833
|
+
}
|
|
2834
|
+
// Not rendered under "Known missing evidence": the path was never local, so the
|
|
2835
|
+
// bundle cannot vouch for it beyond this flag. The reason is provider prose.
|
|
2836
|
+
function unresolvedExternalGapWarnings(unresolved) {
|
|
2837
|
+
return unresolved.map((gap) => delegateWarning(DELEGATE_EXTERNAL_GAP_UNRESOLVED_WARNING_CODE, `finalizer named evidence that does not exist under the source roots: ${gap.path}; conclusions depending on it are conditional`));
|
|
2838
|
+
}
|
|
2928
2839
|
function formatExternalGapPolicyFailure(external) {
|
|
2929
2840
|
return [
|
|
2930
2841
|
`finalizer_validation: external_gap_policy=fail; external_gaps=${formatExternalGapEntries(external.map((gap) => ({ path: gap.path, detail: gap.provenance })))}`,
|
|
@@ -3053,8 +2964,14 @@ function reconcileContextBuilderWarnings(input) {
|
|
|
3053
2964
|
// never be stale against the selection; their reason text is provider
|
|
3054
2965
|
// prose and may happen to use omission vocabulary. The corrective-retry
|
|
3055
2966
|
// notice names no evidence at all, so it is never stale either.
|
|
2967
|
+
// Unresolved gaps name paths that never existed locally; review coverage
|
|
2968
|
+
// and packet-pruned review evidence are computed against the final
|
|
2969
|
+
// packet/selection, so none of them can be stale either.
|
|
3056
2970
|
if (warning.code === "delegate_external_gaps" ||
|
|
3057
2971
|
warning.code === "delegate_external_gap" ||
|
|
2972
|
+
warning.code === DELEGATE_EXTERNAL_GAP_UNRESOLVED_WARNING_CODE ||
|
|
2973
|
+
warning.code === DELEGATE_REVIEW_COVERAGE_GAP_WARNING_CODE ||
|
|
2974
|
+
warning.code === DELEGATE_PACKET_REVIEW_EVIDENCE_PRUNED_WARNING_CODE ||
|
|
3058
2975
|
warning.code === DELEGATE_JSON_CORRECTIVE_RETRY_WARNING_CODE) {
|
|
3059
2976
|
return true;
|
|
3060
2977
|
}
|