@telora/daemon 0.22.85 → 0.22.87
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/build-info.json +4 -3
- package/dist/ci/ci-escalation.d.ts +17 -1
- package/dist/ci/ci-escalation.d.ts.map +1 -1
- package/dist/ci/ci-escalation.js +51 -3
- package/dist/ci/ci-escalation.js.map +1 -1
- package/dist/ci/ci-red-attribution.d.ts +85 -0
- package/dist/ci/ci-red-attribution.d.ts.map +1 -0
- package/dist/ci/ci-red-attribution.js +108 -0
- package/dist/ci/ci-red-attribution.js.map +1 -0
- package/dist/ci/ci-sensor-loop.d.ts +84 -80
- package/dist/ci/ci-sensor-loop.d.ts.map +1 -1
- package/dist/ci/ci-sensor-loop.js +132 -129
- package/dist/ci/ci-sensor-loop.js.map +1 -1
- package/dist/completion/coverage-stabilized.d.ts.map +1 -1
- package/dist/completion/coverage-stabilized.js +1 -1
- package/dist/completion/coverage-stabilized.js.map +1 -1
- package/dist/completion/escalations.d.ts +40 -5
- package/dist/completion/escalations.d.ts.map +1 -1
- package/dist/completion/escalations.js +19 -11
- package/dist/completion/escalations.js.map +1 -1
- package/dist/completion/event-escalations.d.ts +12 -1
- package/dist/completion/event-escalations.d.ts.map +1 -1
- package/dist/completion/event-escalations.js +73 -37
- package/dist/completion/event-escalations.js.map +1 -1
- package/dist/completion/event.d.ts +4 -1
- package/dist/completion/event.d.ts.map +1 -1
- package/dist/completion/event.js +1 -1
- package/dist/completion/event.js.map +1 -1
- package/dist/completion/human-only-act.d.ts +1 -1
- package/dist/completion/human-only-act.js +1 -1
- package/dist/completion/machine-remediable-demotion.d.ts +28 -1
- package/dist/completion/machine-remediable-demotion.d.ts.map +1 -1
- package/dist/completion/machine-remediable-demotion.js +9 -6
- package/dist/completion/machine-remediable-demotion.js.map +1 -1
- package/dist/completion/read-only-pristine.d.ts.map +1 -1
- package/dist/completion/read-only-pristine.js +4 -0
- package/dist/completion/read-only-pristine.js.map +1 -1
- package/dist/completion/review-exit-deps.js +1 -1
- package/dist/completion/review-exit-deps.js.map +1 -1
- package/dist/completion/review-exit-escalations.d.ts +10 -0
- package/dist/completion/review-exit-escalations.d.ts.map +1 -1
- package/dist/completion/review-exit-escalations.js +38 -3
- package/dist/completion/review-exit-escalations.js.map +1 -1
- package/dist/completion/review-exit-phase.d.ts.map +1 -1
- package/dist/completion/review-exit-phase.js +8 -7
- package/dist/completion/review-exit-phase.js.map +1 -1
- package/dist/completion/review-exit-shortfall.d.ts +5 -1
- package/dist/completion/review-exit-shortfall.d.ts.map +1 -1
- package/dist/completion/review-exit-shortfall.js +8 -3
- package/dist/completion/review-exit-shortfall.js.map +1 -1
- package/dist/completion/status-advance-phase.d.ts +2 -0
- package/dist/completion/status-advance-phase.d.ts.map +1 -1
- package/dist/completion/status-advance-phase.js +2 -1
- package/dist/completion/status-advance-phase.js.map +1 -1
- package/dist/completion/terminated-work-reconcile.js +2 -2
- package/dist/completion/terminated-work-reconcile.js.map +1 -1
- package/dist/delivery/delivery-advance-block.d.ts +3 -3
- package/dist/delivery/delivery-advance-block.d.ts.map +1 -1
- package/dist/delivery/delivery-advance-block.js +13 -8
- package/dist/delivery/delivery-advance-block.js.map +1 -1
- package/dist/delivery/delivery-lifecycle.d.ts +10 -0
- package/dist/delivery/delivery-lifecycle.d.ts.map +1 -1
- package/dist/delivery/delivery-lifecycle.js +12 -6
- package/dist/delivery/delivery-lifecycle.js.map +1 -1
- package/dist/delivery/delivery-merge-ops.d.ts.map +1 -1
- package/dist/delivery/delivery-merge-ops.js +39 -21
- package/dist/delivery/delivery-merge-ops.js.map +1 -1
- package/dist/delivery/external-hold.d.ts +8 -2
- package/dist/delivery/external-hold.d.ts.map +1 -1
- package/dist/delivery/external-hold.js +12 -5
- package/dist/delivery/external-hold.js.map +1 -1
- package/dist/delivery/operator-hold.d.ts +6 -1
- package/dist/delivery/operator-hold.d.ts.map +1 -1
- package/dist/delivery/operator-hold.js +31 -10
- package/dist/delivery/operator-hold.js.map +1 -1
- package/dist/delivery/paused-revival.d.ts +6 -0
- package/dist/delivery/paused-revival.d.ts.map +1 -1
- package/dist/delivery/paused-revival.js +3 -1
- package/dist/delivery/paused-revival.js.map +1 -1
- package/dist/directive/directive-dispatch.d.ts.map +1 -1
- package/dist/directive/directive-dispatch.js +6 -3
- package/dist/directive/directive-dispatch.js.map +1 -1
- package/dist/directive/directive-queue.d.ts.map +1 -1
- package/dist/directive/directive-queue.js +4 -1
- package/dist/directive/directive-queue.js.map +1 -1
- package/dist/drift/staleness-sensor.d.ts +14 -0
- package/dist/drift/staleness-sensor.d.ts.map +1 -1
- package/dist/drift/staleness-sensor.js +30 -1
- package/dist/drift/staleness-sensor.js.map +1 -1
- package/dist/focus/focus-executor.d.ts.map +1 -1
- package/dist/focus/focus-executor.js +6 -8
- package/dist/focus/focus-executor.js.map +1 -1
- package/dist/focus/focus-loop-registry.d.ts.map +1 -1
- package/dist/focus/focus-loop-registry.js +23 -13
- package/dist/focus/focus-loop-registry.js.map +1 -1
- package/dist/focus/focus-respawn-guard.d.ts.map +1 -1
- package/dist/focus/focus-respawn-guard.js +21 -4
- package/dist/focus/focus-respawn-guard.js.map +1 -1
- package/dist/focus/listener-auto-advance.d.ts.map +1 -1
- package/dist/focus/listener-auto-advance.js +10 -6
- package/dist/focus/listener-auto-advance.js.map +1 -1
- package/dist/focus/verify-open-issues.d.ts.map +1 -1
- package/dist/focus/verify-open-issues.js +21 -1
- package/dist/focus/verify-open-issues.js.map +1 -1
- package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts.map +1 -1
- package/dist/focus-stage-lifecycle/wedge-watchdog.js +35 -14
- package/dist/focus-stage-lifecycle/wedge-watchdog.js.map +1 -1
- package/dist/loops/index.d.ts.map +1 -1
- package/dist/loops/index.js +2 -1
- package/dist/loops/index.js.map +1 -1
- package/dist/merge/focus-merge.d.ts +1 -1
- package/dist/merge/focus-merge.d.ts.map +1 -1
- package/dist/merge/focus-merge.js +5 -1
- package/dist/merge/focus-merge.js.map +1 -1
- package/dist/merge/merge-back-loop.d.ts +2 -1
- package/dist/merge/merge-back-loop.d.ts.map +1 -1
- package/dist/merge/merge-back-loop.js +15 -12
- package/dist/merge/merge-back-loop.js.map +1 -1
- package/dist/merge/merge-conflict-escalation.d.ts.map +1 -1
- package/dist/merge/merge-conflict-escalation.js +4 -0
- package/dist/merge/merge-conflict-escalation.js.map +1 -1
- package/dist/nexus/return.d.ts +14 -15
- package/dist/nexus/return.d.ts.map +1 -1
- package/dist/nexus/return.js +41 -31
- package/dist/nexus/return.js.map +1 -1
- package/dist/prompt-sections/execution-sections.d.ts +13 -5
- package/dist/prompt-sections/execution-sections.d.ts.map +1 -1
- package/dist/prompt-sections/execution-sections.js +78 -18
- package/dist/prompt-sections/execution-sections.js.map +1 -1
- package/dist/prompt-sections/routing-decider-sections.d.ts +60 -0
- package/dist/prompt-sections/routing-decider-sections.d.ts.map +1 -0
- package/dist/prompt-sections/routing-decider-sections.js +197 -0
- package/dist/prompt-sections/routing-decider-sections.js.map +1 -0
- package/dist/queries/agent-resolvable-aging.d.ts +4 -3
- package/dist/queries/agent-resolvable-aging.d.ts.map +1 -1
- package/dist/queries/agent-resolvable-aging.js +5 -4
- package/dist/queries/agent-resolvable-aging.js.map +1 -1
- package/dist/queries/agent-resolvable-promotion.d.ts +172 -124
- package/dist/queries/agent-resolvable-promotion.d.ts.map +1 -1
- package/dist/queries/agent-resolvable-promotion.js +332 -307
- package/dist/queries/agent-resolvable-promotion.js.map +1 -1
- package/dist/queries/agent-resolvable-retirement.d.ts +105 -0
- package/dist/queries/agent-resolvable-retirement.d.ts.map +1 -0
- package/dist/queries/agent-resolvable-retirement.js +227 -0
- package/dist/queries/agent-resolvable-retirement.js.map +1 -0
- package/dist/queries/cause-key.d.ts +109 -0
- package/dist/queries/cause-key.d.ts.map +1 -1
- package/dist/queries/cause-key.js +93 -1
- package/dist/queries/cause-key.js.map +1 -1
- package/dist/queries/deliveries.d.ts +14 -0
- package/dist/queries/deliveries.d.ts.map +1 -1
- package/dist/queries/deliveries.js +20 -2
- package/dist/queries/deliveries.js.map +1 -1
- package/dist/queries/delivery-gate-state.d.ts +130 -5
- package/dist/queries/delivery-gate-state.d.ts.map +1 -1
- package/dist/queries/delivery-gate-state.js +111 -2
- package/dist/queries/delivery-gate-state.js.map +1 -1
- package/dist/queries/escalation-consumption.d.ts +95 -15
- package/dist/queries/escalation-consumption.d.ts.map +1 -1
- package/dist/queries/escalation-consumption.js +162 -24
- package/dist/queries/escalation-consumption.js.map +1 -1
- package/dist/queries/escalation-dispositions.d.ts +19 -7
- package/dist/queries/escalation-dispositions.d.ts.map +1 -1
- package/dist/queries/escalation-dispositions.js +7 -0
- package/dist/queries/escalation-dispositions.js.map +1 -1
- package/dist/queries/escalation-suppression.d.ts +63 -19
- package/dist/queries/escalation-suppression.d.ts.map +1 -1
- package/dist/queries/escalation-suppression.js +64 -35
- package/dist/queries/escalation-suppression.js.map +1 -1
- package/dist/queries/escalations.d.ts +127 -70
- package/dist/queries/escalations.d.ts.map +1 -1
- package/dist/queries/escalations.js +170 -188
- package/dist/queries/escalations.js.map +1 -1
- package/dist/queries/filing-observation.d.ts +82 -0
- package/dist/queries/filing-observation.d.ts.map +1 -0
- package/dist/queries/filing-observation.js +157 -0
- package/dist/queries/filing-observation.js.map +1 -0
- package/dist/queries/holds.d.ts +69 -2
- package/dist/queries/holds.d.ts.map +1 -1
- package/dist/queries/holds.js +106 -11
- package/dist/queries/holds.js.map +1 -1
- package/dist/queries/incident-correlation.d.ts +291 -0
- package/dist/queries/incident-correlation.d.ts.map +1 -0
- package/dist/queries/incident-correlation.js +408 -0
- package/dist/queries/incident-correlation.js.map +1 -0
- package/dist/queries/routing-measurement.d.ts +48 -1
- package/dist/queries/routing-measurement.d.ts.map +1 -1
- package/dist/queries/routing-measurement.js +64 -2
- package/dist/queries/routing-measurement.js.map +1 -1
- package/dist/queries/routing-quality.d.ts +8 -0
- package/dist/queries/routing-quality.d.ts.map +1 -1
- package/dist/queries/routing-quality.js +12 -3
- package/dist/queries/routing-quality.js.map +1 -1
- package/dist/queries/shared.js +1 -1
- package/dist/shell/crash-recovery.d.ts.map +1 -1
- package/dist/shell/crash-recovery.js +6 -6
- package/dist/shell/crash-recovery.js.map +1 -1
- package/dist/shell/install-probe-tick.d.ts.map +1 -1
- package/dist/shell/install-probe-tick.js +3 -1
- package/dist/shell/install-probe-tick.js.map +1 -1
- package/dist/spawn/respawn-cycle-escalation.d.ts +10 -2
- package/dist/spawn/respawn-cycle-escalation.d.ts.map +1 -1
- package/dist/spawn/respawn-cycle-escalation.js +16 -2
- package/dist/spawn/respawn-cycle-escalation.js.map +1 -1
- package/dist/spawn/routing-decider-spawn.d.ts +93 -0
- package/dist/spawn/routing-decider-spawn.d.ts.map +1 -0
- package/dist/spawn/routing-decider-spawn.js +185 -0
- package/dist/spawn/routing-decider-spawn.js.map +1 -0
- package/dist/spawn/routing-decider.d.ts +42 -0
- package/dist/spawn/routing-decider.d.ts.map +1 -0
- package/dist/spawn/routing-decider.js +95 -0
- package/dist/spawn/routing-decider.js.map +1 -0
- package/dist/spawn/shared.d.ts +8 -0
- package/dist/spawn/shared.d.ts.map +1 -1
- package/dist/spawn/shared.js +1 -1
- package/dist/spawn/shared.js.map +1 -1
- package/dist/spawn/spawn-decision.d.ts +23 -16
- package/dist/spawn/spawn-decision.d.ts.map +1 -1
- package/dist/spawn/spawn-decision.js +27 -11
- package/dist/spawn/spawn-decision.js.map +1 -1
- package/dist/spawn/worktree-session.d.ts +19 -7
- package/dist/spawn/worktree-session.d.ts.map +1 -1
- package/dist/spawn/worktree-session.js +36 -8
- package/dist/spawn/worktree-session.js.map +1 -1
- package/dist/testing/fixtures/index.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/verify/failure-signature.d.ts +91 -0
- package/dist/verify/failure-signature.d.ts.map +1 -0
- package/dist/verify/failure-signature.js +233 -0
- package/dist/verify/failure-signature.js.map +1 -0
- package/dist/verify/shortfall-repeat.d.ts +12 -9
- package/dist/verify/shortfall-repeat.d.ts.map +1 -1
- package/dist/verify/shortfall-repeat.js +38 -14
- package/dist/verify/shortfall-repeat.js.map +1 -1
- package/dist/verify/stall-detectors.d.ts +19 -43
- package/dist/verify/stall-detectors.d.ts.map +1 -1
- package/dist/verify/stall-detectors.js +26 -101
- package/dist/verify/stall-detectors.js.map +1 -1
- package/dist/verify/unreviewed-settle-detector.d.ts +8 -0
- package/dist/verify/unreviewed-settle-detector.d.ts.map +1 -1
- package/dist/verify/unreviewed-settle-detector.js +15 -1
- package/dist/verify/unreviewed-settle-detector.js.map +1 -1
- package/dist/verify/verification-deps-default.d.ts.map +1 -1
- package/dist/verify/verification-deps-default.js +14 -2
- package/dist/verify/verification-deps-default.js.map +1 -1
- package/dist/verify/verification-evidence-unavailable-feedback.d.ts.map +1 -1
- package/dist/verify/verification-evidence-unavailable-feedback.js +8 -2
- package/dist/verify/verification-evidence-unavailable-feedback.js.map +1 -1
- package/dist/verify/verification-feedback.d.ts +62 -14
- package/dist/verify/verification-feedback.d.ts.map +1 -1
- package/dist/verify/verification-feedback.js +101 -28
- package/dist/verify/verification-feedback.js.map +1 -1
- package/dist/verify/verify-gate-stall.d.ts +116 -0
- package/dist/verify/verify-gate-stall.d.ts.map +1 -0
- package/dist/verify/verify-gate-stall.js +169 -0
- package/dist/verify/verify-gate-stall.js.map +1 -0
- package/dist/verify/verify-restatement.d.ts.map +1 -1
- package/dist/verify/verify-restatement.js +2 -1
- package/dist/verify/verify-restatement.js.map +1 -1
- package/package.json +2 -2
package/dist/types/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
|
|
2
|
-
// Pinned by:
|
|
2
|
+
// Pinned by: 163 tests -- run: npm run gen:pinned-by -- --list packages/daemon/src/types/index.ts
|
|
3
3
|
// PINNED-BY-END
|
|
4
4
|
/**
|
|
5
5
|
* Domain-specific type re-exports.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { type VerificationSignatureRun } from '../queries/delivery-gate-state.js';
|
|
2
|
+
/** Stage label when failing tests were parsed but no npm script header names a stage. */
|
|
3
|
+
export declare const UNNAMED_STAGE_LABEL = "failing-tests";
|
|
4
|
+
/**
|
|
5
|
+
* Normalize ONE output line so two runs of the same failure compare equal:
|
|
6
|
+
* strips ANSI, replaces the run's cwd, uuids, ISO timestamps, clock times, tmp
|
|
7
|
+
* paths, hex shas and durations with placeholders, then every remaining digit run
|
|
8
|
+
* with '#' (line counts, over-by deltas, pids, versions), collapsing whitespace.
|
|
9
|
+
* Pure -- exported for direct testing.
|
|
10
|
+
*/
|
|
11
|
+
export declare function normalizeVolatileDetail(line: string, cwd?: string | null): string;
|
|
12
|
+
/** Where the failing stage's own output begins, and the stage's label. */
|
|
13
|
+
export interface FailingStage {
|
|
14
|
+
/** "<package> <script>" with the version stripped (volatile across deliveries). */
|
|
15
|
+
label: string;
|
|
16
|
+
/** Index of the first line after the failing stage's header. */
|
|
17
|
+
detailStart: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Locate the failing npm script in a gate log (see the module doc for why the
|
|
21
|
+
* LAST header names it). Null when the log carries no npm script header at all.
|
|
22
|
+
* Pure -- exported for direct testing.
|
|
23
|
+
*/
|
|
24
|
+
export declare function locateFailingStage(lines: readonly string[]): FailingStage | null;
|
|
25
|
+
export interface FailureSignatureInput {
|
|
26
|
+
/** The run's output: the full verification log when available, else the captured tails. */
|
|
27
|
+
logText: string;
|
|
28
|
+
/** Failing-test ids that GATE the rejection (baseline-attributed new failures, or all parsed). */
|
|
29
|
+
failingTests?: readonly string[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Derive the failure signature "<stage>#<hash>" of a rejected verify run.
|
|
33
|
+
*
|
|
34
|
+
* The hash covers the failing stage's normalized detail: the gating failing-test
|
|
35
|
+
* ids when there are any (so a test stage is keyed on WHICH tests fail, not on
|
|
36
|
+
* the ok-lines of whatever tests the targeted selector picked), otherwise the
|
|
37
|
+
* stage's own output lines. Detail lines are normalized (normalizeVolatileDetail),
|
|
38
|
+
* de-duplicated and sorted, so volatile values and interleaving order never make
|
|
39
|
+
* one failure look like two. A different stage -- or the same stage failing on a
|
|
40
|
+
* different file, function, claim or test -- yields a different signature.
|
|
41
|
+
*
|
|
42
|
+
* Null when underivable: an empty log, or one with neither an npm script header
|
|
43
|
+
* nor a parseable failing test. Pure -- no I/O.
|
|
44
|
+
*/
|
|
45
|
+
export declare function deriveFailureSignature(input: FailureSignatureInput): string | null;
|
|
46
|
+
/**
|
|
47
|
+
* Advance the run-length record by one rejection. A signature equal to the prior
|
|
48
|
+
* run's increments `consecutive`; a different one resets it to 1; a null
|
|
49
|
+
* (underivable) signature records 0 -- an unknown failure never counts as a
|
|
50
|
+
* repeat, and the next known signature starts a fresh run. Bounded by
|
|
51
|
+
* construction: one current + one previous signature, never a history. Pure.
|
|
52
|
+
*/
|
|
53
|
+
export declare function advanceSignatureRun(prior: VerificationSignatureRun | null, signature: string | null): VerificationSignatureRun;
|
|
54
|
+
/**
|
|
55
|
+
* The signature run recorded on a delivery's LATEST deterministic rejection
|
|
56
|
+
* (gate_state.verification), or null when none is usable: no verification
|
|
57
|
+
* detail (a guard-only, shortfall or evidence-unavailable gate_state), a legacy
|
|
58
|
+
* row written before signatures existed, or an underivable (null) signature.
|
|
59
|
+
* The stall detector falls back to the iteration cap on null. Pure.
|
|
60
|
+
*/
|
|
61
|
+
export declare function readRecordedSignatureRun(gateState: unknown): {
|
|
62
|
+
signature: string;
|
|
63
|
+
consecutive: number;
|
|
64
|
+
} | null;
|
|
65
|
+
/** The slice of a verify StrategyResult the signature reads its text from. */
|
|
66
|
+
export interface VerificationLogSource {
|
|
67
|
+
logPath?: string;
|
|
68
|
+
stdoutTail?: string;
|
|
69
|
+
stderrTail?: string;
|
|
70
|
+
}
|
|
71
|
+
/** The full verification log when it exists on disk, else the captured tails. */
|
|
72
|
+
export declare function readVerificationLogText(source: VerificationLogSource): string;
|
|
73
|
+
/** Injected I/O for stamping a signature onto a rejection; the default reads the real log. */
|
|
74
|
+
export interface FailureSignatureDeps {
|
|
75
|
+
readLogText: (source: VerificationLogSource) => string;
|
|
76
|
+
}
|
|
77
|
+
export declare const defaultFailureSignatureDeps: () => FailureSignatureDeps;
|
|
78
|
+
/**
|
|
79
|
+
* Compute the signature fields a rejection's gate_state.verification carries.
|
|
80
|
+
* The run extends the one recorded on the delivery's PRIOR gate_state, whether
|
|
81
|
+
* live or carried forward across the coding -> verify advance
|
|
82
|
+
* (readVerificationHistory). Best-effort: an unreadable log yields a null
|
|
83
|
+
* signature, so consecutive is 0 and the detector falls back to the iteration
|
|
84
|
+
* cap. A prior gate_state with no usable run counts as none. A signature fault
|
|
85
|
+
* must never block the rejection write.
|
|
86
|
+
*/
|
|
87
|
+
export declare function computeFailureSignatureRecord(deliveryId: string, source: VerificationLogSource, failingTests: readonly string[], priorGateState: unknown, deps: FailureSignatureDeps): {
|
|
88
|
+
failureSignature: string | null;
|
|
89
|
+
signatureRun: VerificationSignatureRun;
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=failure-signature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failure-signature.d.ts","sourceRoot":"","sources":["../../src/verify/failure-signature.ts"],"names":[],"mappings":"AAoDA,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,mCAAmC,CAAC;AAK3C,yFAAyF;AACzF,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AAyBnD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,CAavF;AAED,0EAA0E;AAC1E,MAAM,WAAW,YAAY;IAC3B,mFAAmF;IACnF,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;CACrB;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AgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,YAAY,EAAE,wBAAwB,CAAA;CAAE,CAS7E"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
// PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
|
|
2
|
+
// Pinned by: packages/daemon/src/integration/verification-history-round-trip.test.ts,
|
|
3
|
+
// packages/daemon/src/verify/failure-signature.test.ts, packages/daemon/src/verify/stall-detectors.test.ts,
|
|
4
|
+
// packages/daemon/src/verify/verification-feedback.test.ts
|
|
5
|
+
// PINNED-BY-END
|
|
6
|
+
/**
|
|
7
|
+
* Failure SIGNATURE of a rejected deterministic verify run, and the run-length
|
|
8
|
+
* record that tells a delivery failing IDENTICALLY from one CONVERGING.
|
|
9
|
+
*
|
|
10
|
+
* iteration_count counts rejections; it cannot say whether they were the SAME
|
|
11
|
+
* rejection. Delivery e8e8fa15 (2026-09-11) ran 16 cycles through verify:gate and
|
|
12
|
+
* failed a DIFFERENT stage each time -- types drift, then daemon-file-size, then
|
|
13
|
+
* daemon-function-size, then lint:counted-claims -- every fix correct, each one
|
|
14
|
+
* uncovering the next gate. A count-keyed stall detector read that as "will not
|
|
15
|
+
* converge". A signature is the discriminator: which stage failed and what it
|
|
16
|
+
* said, with the detail that varies between two runs of the SAME failure
|
|
17
|
+
* (timestamps, durations, line and over-by counts, tmp paths, pids, shas, the
|
|
18
|
+
* package version in npm's script header) normalized away.
|
|
19
|
+
*
|
|
20
|
+
* Three parts:
|
|
21
|
+
* 1. deriveFailureSignature -- PURE: log text (+ the gating failing-test ids)
|
|
22
|
+
* -> "<stage>#<detail-hash>", or null when underivable.
|
|
23
|
+
* 2. advanceSignatureRun -- PURE: prior run + this signature -> the bounded
|
|
24
|
+
* run-length record (reset on change, +1 on repeat; a null signature never
|
|
25
|
+
* counts as a repeat).
|
|
26
|
+
* 3. The PRIOR run's home: gate_state, and nothing else. The rejection stamps
|
|
27
|
+
* the run on gate_state.verification. The stall detector reads it there,
|
|
28
|
+
* from the delivery row it already has. Between two rejections the delivery
|
|
29
|
+
* walks verify_failed -> queued -> coding -> verify, and every writer that
|
|
30
|
+
* clears or replaces the gate on the way (above all the guard-pass coding ->
|
|
31
|
+
* verify advance) carries the run forward under
|
|
32
|
+
* gate_state.verificationHistory (queries/delivery-gate-state.ts
|
|
33
|
+
* carryVerificationHistory). The next rejection reads it back off its prior
|
|
34
|
+
* gate_state (computeFailureSignatureRecord). A verify pass resets it
|
|
35
|
+
* (clearVerificationHistory).
|
|
36
|
+
*
|
|
37
|
+
* Stage location: npm 10 prints NO "Lifecycle script failed" line for a nested
|
|
38
|
+
* npm-run failure, only the "> <pkg>@<version> <script>" header of every script
|
|
39
|
+
* it starts. verify:gate chains its stages with &&, so nothing starts after the
|
|
40
|
+
* failing script and the LAST header in the log names it. When an older npm's
|
|
41
|
+
* "Lifecycle script ... failed" line is present, its first (innermost) occurrence
|
|
42
|
+
* wins. Known imprecision: a stage that itself spawns an npm script
|
|
43
|
+
* (check:types-drift -> gen:types:ephemeral) is labelled by the nested script --
|
|
44
|
+
* stable across repeats, so the discriminator still holds.
|
|
45
|
+
*
|
|
46
|
+
* @module verify/failure-signature
|
|
47
|
+
*/
|
|
48
|
+
import { createHash } from 'node:crypto';
|
|
49
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
50
|
+
import { createLogger } from '../shell/log.js';
|
|
51
|
+
import { parseSignatureRun, readVerificationHistory, } from '../queries/delivery-gate-state.js';
|
|
52
|
+
import { parseFailingTests } from './verification-failure-parser.js';
|
|
53
|
+
const log = createLogger({ module: 'verification' });
|
|
54
|
+
/** Stage label when failing tests were parsed but no npm script header names a stage. */
|
|
55
|
+
export const UNNAMED_STAGE_LABEL = 'failing-tests';
|
|
56
|
+
const STAGE_LABEL_MAX_CHARS = 120;
|
|
57
|
+
const DETAIL_HASH_CHARS = 12;
|
|
58
|
+
/** ANSI CSI/SGR sequences, built from a char code so no control char sits in a regex literal. */
|
|
59
|
+
const ANSI_RE = new RegExp(`${String.fromCharCode(27)}\\[[0-9;?]*[A-Za-z]`, 'g');
|
|
60
|
+
const UUID_RE = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
|
|
61
|
+
const ISO_TS_RE = /\b\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(?::\d{2}(?:[.,]\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?/g;
|
|
62
|
+
const CLOCK_RE = /\b\d{1,2}:\d{2}:\d{2}(?:\.\d+)?\b/g;
|
|
63
|
+
const TMP_PATH_RE = /(?:\/private)?\/(?:tmp|var\/tmp|var\/folders)\/[^\s'"`),;]+/g;
|
|
64
|
+
/** Lowercase hex runs holding at least one letter AND one digit (git shas, hex ids). */
|
|
65
|
+
const HEX_SHA_RE = /\b(?=[0-9a-f]*[a-f])(?=[0-9a-f]*\d)[0-9a-f]{7,64}\b/g;
|
|
66
|
+
const DURATION_RE = /\b\d+(?:\.\d+)?\s?(?:ms|ns|s|secs?|seconds?|m|mins?|minutes?|h|hrs?|hours?)\b/g;
|
|
67
|
+
const DIGITS_RE = /\d+/g;
|
|
68
|
+
/** npm's per-script header: "> <name>@<version> <script>" (name may be scoped). */
|
|
69
|
+
const NPM_HEADER_RE = /^> ((?:@[^\s@/]+\/)?[^\s@]+)@\S+ (\S+)\s*$/;
|
|
70
|
+
/** npm 7-9 innermost-failure line (npm 10 omits it for nested runs). */
|
|
71
|
+
const NPM_LIFECYCLE_FAILED_RE = /^npm (?:error|ERR!) Lifecycle script `([^`]+)` failed/;
|
|
72
|
+
/** npm / gate chrome lines -- never failure detail. */
|
|
73
|
+
const CHROME_RE = /^(?:npm (?:error|ERR!|warn|WARN|notice)\b|> |TELORA_GATE_COMPLETE:)/;
|
|
74
|
+
/** The "(cwd: <path>)" line runDeterministicStrategy writes at the top of every log. */
|
|
75
|
+
const CWD_HEADER_RE = /^\(cwd: (.+)\)$/m;
|
|
76
|
+
/**
|
|
77
|
+
* Normalize ONE output line so two runs of the same failure compare equal:
|
|
78
|
+
* strips ANSI, replaces the run's cwd, uuids, ISO timestamps, clock times, tmp
|
|
79
|
+
* paths, hex shas and durations with placeholders, then every remaining digit run
|
|
80
|
+
* with '#' (line counts, over-by deltas, pids, versions), collapsing whitespace.
|
|
81
|
+
* Pure -- exported for direct testing.
|
|
82
|
+
*/
|
|
83
|
+
export function normalizeVolatileDetail(line, cwd = null) {
|
|
84
|
+
let s = line.replace(ANSI_RE, '');
|
|
85
|
+
if (cwd)
|
|
86
|
+
s = s.split(cwd).join('<cwd>');
|
|
87
|
+
return s
|
|
88
|
+
.replace(UUID_RE, '<uuid>')
|
|
89
|
+
.replace(ISO_TS_RE, '<ts>')
|
|
90
|
+
.replace(CLOCK_RE, '<time>')
|
|
91
|
+
.replace(TMP_PATH_RE, '<tmp>')
|
|
92
|
+
.replace(HEX_SHA_RE, '<sha>')
|
|
93
|
+
.replace(DURATION_RE, '<dur>')
|
|
94
|
+
.replace(DIGITS_RE, '#')
|
|
95
|
+
.replace(/\s+/g, ' ')
|
|
96
|
+
.trim();
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Locate the failing npm script in a gate log (see the module doc for why the
|
|
100
|
+
* LAST header names it). Null when the log carries no npm script header at all.
|
|
101
|
+
* Pure -- exported for direct testing.
|
|
102
|
+
*/
|
|
103
|
+
export function locateFailingStage(lines) {
|
|
104
|
+
const headers = [];
|
|
105
|
+
let lifecycle = null;
|
|
106
|
+
for (let index = 0; index < lines.length; index++) {
|
|
107
|
+
const line = lines[index];
|
|
108
|
+
const header = NPM_HEADER_RE.exec(line);
|
|
109
|
+
if (header)
|
|
110
|
+
headers.push({ index, name: header[1], script: header[2] });
|
|
111
|
+
const failed = lifecycle === null ? NPM_LIFECYCLE_FAILED_RE.exec(line) : null;
|
|
112
|
+
if (failed)
|
|
113
|
+
lifecycle = { script: failed[1], index };
|
|
114
|
+
}
|
|
115
|
+
const label = (name, script) => `${name} ${script}`.slice(0, STAGE_LABEL_MAX_CHARS);
|
|
116
|
+
if (lifecycle !== null) {
|
|
117
|
+
const failedAt = lifecycle;
|
|
118
|
+
const owner = headers.filter((h) => h.index < failedAt.index && h.script === failedAt.script).pop();
|
|
119
|
+
return owner
|
|
120
|
+
? { label: label(owner.name, owner.script), detailStart: owner.index + 1 }
|
|
121
|
+
: { label: failedAt.script.slice(0, STAGE_LABEL_MAX_CHARS), detailStart: 0 };
|
|
122
|
+
}
|
|
123
|
+
const last = headers[headers.length - 1];
|
|
124
|
+
return last ? { label: label(last.name, last.script), detailStart: last.index + 1 } : null;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Derive the failure signature "<stage>#<hash>" of a rejected verify run.
|
|
128
|
+
*
|
|
129
|
+
* The hash covers the failing stage's normalized detail: the gating failing-test
|
|
130
|
+
* ids when there are any (so a test stage is keyed on WHICH tests fail, not on
|
|
131
|
+
* the ok-lines of whatever tests the targeted selector picked), otherwise the
|
|
132
|
+
* stage's own output lines. Detail lines are normalized (normalizeVolatileDetail),
|
|
133
|
+
* de-duplicated and sorted, so volatile values and interleaving order never make
|
|
134
|
+
* one failure look like two. A different stage -- or the same stage failing on a
|
|
135
|
+
* different file, function, claim or test -- yields a different signature.
|
|
136
|
+
*
|
|
137
|
+
* Null when underivable: an empty log, or one with neither an npm script header
|
|
138
|
+
* nor a parseable failing test. Pure -- no I/O.
|
|
139
|
+
*/
|
|
140
|
+
export function deriveFailureSignature(input) {
|
|
141
|
+
const text = typeof input.logText === 'string' ? input.logText.replace(ANSI_RE, '') : '';
|
|
142
|
+
if (text.trim().length === 0)
|
|
143
|
+
return null;
|
|
144
|
+
const cwd = CWD_HEADER_RE.exec(text)?.[1] ?? null;
|
|
145
|
+
const lines = text.split(/\r?\n/);
|
|
146
|
+
const stage = locateFailingStage(lines);
|
|
147
|
+
const segment = lines.slice(stage?.detailStart ?? 0);
|
|
148
|
+
const tests = input.failingTests && input.failingTests.length > 0
|
|
149
|
+
? [...input.failingTests]
|
|
150
|
+
: [...parseFailingTests(segment.join('\n'))];
|
|
151
|
+
if (stage === null && tests.length === 0)
|
|
152
|
+
return null;
|
|
153
|
+
const rawDetail = tests.length > 0 ? tests : segment.filter((line) => !CHROME_RE.test(line));
|
|
154
|
+
const detail = [...new Set(rawDetail.map((line) => normalizeVolatileDetail(line, cwd)).filter((line) => line.length > 0))].sort();
|
|
155
|
+
const hash = createHash('sha256').update(detail.join('\n')).digest('hex').slice(0, DETAIL_HASH_CHARS);
|
|
156
|
+
return `${stage?.label ?? UNNAMED_STAGE_LABEL}#${hash}`;
|
|
157
|
+
}
|
|
158
|
+
// ---------------------------------------------------------------------------
|
|
159
|
+
// Run-length record
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
/**
|
|
162
|
+
* Advance the run-length record by one rejection. A signature equal to the prior
|
|
163
|
+
* run's increments `consecutive`; a different one resets it to 1; a null
|
|
164
|
+
* (underivable) signature records 0 -- an unknown failure never counts as a
|
|
165
|
+
* repeat, and the next known signature starts a fresh run. Bounded by
|
|
166
|
+
* construction: one current + one previous signature, never a history. Pure.
|
|
167
|
+
*/
|
|
168
|
+
export function advanceSignatureRun(prior, signature) {
|
|
169
|
+
const previousSignature = prior?.signature ?? null;
|
|
170
|
+
if (signature === null)
|
|
171
|
+
return { signature: null, previousSignature, consecutive: 0 };
|
|
172
|
+
const consecutive = prior && prior.signature === signature && prior.consecutive >= 1
|
|
173
|
+
? prior.consecutive + 1
|
|
174
|
+
: 1;
|
|
175
|
+
return { signature, previousSignature, consecutive };
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The signature run recorded on a delivery's LATEST deterministic rejection
|
|
179
|
+
* (gate_state.verification), or null when none is usable: no verification
|
|
180
|
+
* detail (a guard-only, shortfall or evidence-unavailable gate_state), a legacy
|
|
181
|
+
* row written before signatures existed, or an underivable (null) signature.
|
|
182
|
+
* The stall detector falls back to the iteration cap on null. Pure.
|
|
183
|
+
*/
|
|
184
|
+
export function readRecordedSignatureRun(gateState) {
|
|
185
|
+
if (gateState == null || typeof gateState !== 'object')
|
|
186
|
+
return null;
|
|
187
|
+
const verification = gateState.verification;
|
|
188
|
+
if (verification == null || typeof verification !== 'object')
|
|
189
|
+
return null;
|
|
190
|
+
const v = verification;
|
|
191
|
+
if (typeof v.failureSignature !== 'string' || v.failureSignature.length === 0)
|
|
192
|
+
return null;
|
|
193
|
+
const run = parseSignatureRun(v.signatureRun);
|
|
194
|
+
if (!run || run.signature !== v.failureSignature || run.consecutive < 1)
|
|
195
|
+
return null;
|
|
196
|
+
return { signature: run.signature, consecutive: run.consecutive };
|
|
197
|
+
}
|
|
198
|
+
/** The full verification log when it exists on disk, else the captured tails. */
|
|
199
|
+
export function readVerificationLogText(source) {
|
|
200
|
+
if (source.logPath && existsSync(source.logPath)) {
|
|
201
|
+
try {
|
|
202
|
+
return readFileSync(source.logPath, 'utf8');
|
|
203
|
+
}
|
|
204
|
+
catch (err) {
|
|
205
|
+
log.debug('verification log unreadable; using tails', { error: String(err?.message ?? err) });
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return `${source.stdoutTail ?? ''}\n${source.stderrTail ?? ''}`;
|
|
209
|
+
}
|
|
210
|
+
export const defaultFailureSignatureDeps = () => ({
|
|
211
|
+
readLogText: readVerificationLogText,
|
|
212
|
+
});
|
|
213
|
+
/**
|
|
214
|
+
* Compute the signature fields a rejection's gate_state.verification carries.
|
|
215
|
+
* The run extends the one recorded on the delivery's PRIOR gate_state, whether
|
|
216
|
+
* live or carried forward across the coding -> verify advance
|
|
217
|
+
* (readVerificationHistory). Best-effort: an unreadable log yields a null
|
|
218
|
+
* signature, so consecutive is 0 and the detector falls back to the iteration
|
|
219
|
+
* cap. A prior gate_state with no usable run counts as none. A signature fault
|
|
220
|
+
* must never block the rejection write.
|
|
221
|
+
*/
|
|
222
|
+
export function computeFailureSignatureRecord(deliveryId, source, failingTests, priorGateState, deps) {
|
|
223
|
+
let failureSignature = null;
|
|
224
|
+
try {
|
|
225
|
+
failureSignature = deriveFailureSignature({ logText: deps.readLogText(source), failingTests });
|
|
226
|
+
}
|
|
227
|
+
catch (err) {
|
|
228
|
+
log.warn(`failure signature derivation failed for delivery ${deliveryId}:`, err.message);
|
|
229
|
+
}
|
|
230
|
+
const prior = readVerificationHistory(priorGateState).signatureRun ?? null;
|
|
231
|
+
return { failureSignature, signatureRun: advanceSignatureRun(prior, failureSignature) };
|
|
232
|
+
}
|
|
233
|
+
//# sourceMappingURL=failure-signature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failure-signature.js","sourceRoot":"","sources":["../../src/verify/failure-signature.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,sFAAsF;AACtF,8GAA8G;AAC9G,6DAA6D;AAC7D,gBAAgB;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,uBAAuB,GAExB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,MAAM,GAAG,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;AAErD,yFAAyF;AACzF,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAEnD,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,iGAAiG;AACjG,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;AACj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AC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC9C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,GAAG,CAAC,KAAK,CAAC,0CAA0C,EAAE,EAAE,KAAK,EAAE,MAAM,CAAE,GAAa,EAAE,OAAO,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC;QAC3G,CAAC;IACH,CAAC;IACD,OAAO,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,KAAK,MAAM,CAAC,UAAU,IAAI,EAAE,EAAE,CAAC;AAClE,CAAC;AAOD,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAyB,EAAE,CAAC,CAAC;IACtE,WAAW,EAAE,uBAAuB;CACrC,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,UAAU,6BAA6B,CAC3C,UAAkB,EAClB,MAA6B,EAC7B,YAA+B,EAC/B,cAAuB,EACvB,IAA0B;IAE1B,IAAI,gBAAgB,GAAkB,IAAI,CAAC;IAC3C,IAAI,CAAC;QACH,gBAAgB,GAAG,sBAAsB,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;IACjG,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,GAAG,CAAC,IAAI,CAAC,oDAAoD,UAAU,GAAG,EAAG,GAAa,CAAC,OAAO,CAAC,CAAC;IACtG,CAAC;IACD,MAAM,KAAK,GAAG,uBAAuB,CAAC,cAAc,CAAC,CAAC,YAAY,IAAI,IAAI,CAAC;IAC3E,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC;AAC1F,CAAC"}
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
* that count reaches the threshold, the caller diagnoses a DEFECT IN THE CLAIM
|
|
19
19
|
* (a modelling act for a human) instead of charging the team another re-work.
|
|
20
20
|
*
|
|
21
|
-
* SELF-CONTAINED
|
|
22
|
-
*
|
|
23
|
-
* daemon-core mock-loader chain into a test. It is pure and deterministic
|
|
24
|
-
*
|
|
21
|
+
* SELF-CONTAINED and mock-safe: this module imports only the gate-state vocabulary,
|
|
22
|
+
* which itself imports nothing, and NO daemon-core VALUE. It never drags the
|
|
23
|
+
* daemon-core mock-loader chain into a test. It is pure and deterministic, tested
|
|
24
|
+
* directly with no DB.
|
|
25
25
|
*
|
|
26
26
|
* @module verify/shortfall-repeat
|
|
27
27
|
*/
|
|
28
|
-
import type
|
|
28
|
+
import { type DeliveryGateState } from '../queries/delivery-gate-state.js';
|
|
29
29
|
import type { TargetShortfall } from './verify-restatement.js';
|
|
30
30
|
/** The persisted repeat state carried in gate_state (shortfallReconciliation.repeat). */
|
|
31
31
|
export interface ShortfallRepeat {
|
|
@@ -67,10 +67,13 @@ export declare const UNCLEARABLE_SHORTFALL_REPEAT_THRESHOLD = 3;
|
|
|
67
67
|
*/
|
|
68
68
|
export declare function shortfallSignature(shortfalls: readonly TargetShortfall[]): string;
|
|
69
69
|
/**
|
|
70
|
-
* Read the repeat state
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
70
|
+
* Read the repeat state the previous shortfall iteration left on a delivery's
|
|
71
|
+
* gate_state. It is either LIVE (`shortfallReconciliation.repeat`, the gate is
|
|
72
|
+
* still that shortfall) or CARRIED forward under `verificationHistory` after the
|
|
73
|
+
* guard-pass coding -> verify advance cleared the gate. Before the carry
|
|
74
|
+
* existed, that clear wiped the record and every count restarted at 1.
|
|
75
|
+
* Defensive over the loosely typed slot: returns null when the record is absent
|
|
76
|
+
* or malformed (a first shortfall, a verify pass reset it, or a legacy row).
|
|
74
77
|
*/
|
|
75
78
|
export declare function readPriorRepeat(priorGateState: DeliveryGateState | null | undefined): ShortfallRepeat | null;
|
|
76
79
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shortfall-repeat.d.ts","sourceRoot":"","sources":["../../src/verify/shortfall-repeat.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"shortfall-repeat.d.ts","sourceRoot":"","sources":["../../src/verify/shortfall-repeat.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACpG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,yFAAyF;AACzF,MAAM,WAAW,eAAe;IAC9B,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,sCAAsC,IAAI,CAAC;AAMxD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,SAAS,eAAe,EAAE,GAAG,MAAM,CAKjF;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAAG,eAAe,GAAG,IAAI,CAE5G;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,EACpD,UAAU,EAAE,SAAS,eAAe,EAAE,EACtC,SAAS,GAAE,MAA+C,GACzD;IAAE,MAAM,EAAE,eAAe,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,CAKnD"}
|
|
@@ -1,7 +1,35 @@
|
|
|
1
1
|
// PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
|
|
2
|
-
// Pinned by: packages/daemon/src/
|
|
3
|
-
// packages/daemon/src/verify/shortfall-routing.test.ts
|
|
2
|
+
// Pinned by: packages/daemon/src/integration/verification-history-round-trip.test.ts,
|
|
3
|
+
// packages/daemon/src/verify/shortfall-repeat.test.ts, packages/daemon/src/verify/shortfall-routing.test.ts
|
|
4
4
|
// PINNED-BY-END
|
|
5
|
+
/**
|
|
6
|
+
* Shortfall REPETITION discriminator for the verify gate.
|
|
7
|
+
*
|
|
8
|
+
* A verify shortfall is, by construction, treated as an EXECUTION gap: the
|
|
9
|
+
* delivery re-queues and the team re-writes code against the declared target,
|
|
10
|
+
* bounded only by the far-off iteration cap (verify_gate_unclearable). But some
|
|
11
|
+
* shortfalls are not execution gaps at all -- the tree assigned the delivery an
|
|
12
|
+
* outcome its diff can NEVER produce (an over-claimed injection, a structurally
|
|
13
|
+
* unflippable UDE). Those manufacture the SAME shortfall every iteration and
|
|
14
|
+
* burn the full re-work cycle to no effect (the 2026-08-25 Tinker Tailor
|
|
15
|
+
* incident: 10 iterations, all correct-but-unclearable).
|
|
16
|
+
*
|
|
17
|
+
* Repetition is the available discriminator: a GENUINE shortfall changes as the
|
|
18
|
+
* team responds to feedback, while an UNCLEARABLE one reproduces identically.
|
|
19
|
+
* This module computes a stable signature of a shortfall set and, comparing it
|
|
20
|
+
* against the signature persisted from the previous iteration (in gate_state),
|
|
21
|
+
* counts how many consecutive iterations the shortfall has stood UNCHANGED. Once
|
|
22
|
+
* that count reaches the threshold, the caller diagnoses a DEFECT IN THE CLAIM
|
|
23
|
+
* (a modelling act for a human) instead of charging the team another re-work.
|
|
24
|
+
*
|
|
25
|
+
* SELF-CONTAINED and mock-safe: this module imports only the gate-state vocabulary,
|
|
26
|
+
* which itself imports nothing, and NO daemon-core VALUE. It never drags the
|
|
27
|
+
* daemon-core mock-loader chain into a test. It is pure and deterministic, tested
|
|
28
|
+
* directly with no DB.
|
|
29
|
+
*
|
|
30
|
+
* @module verify/shortfall-repeat
|
|
31
|
+
*/
|
|
32
|
+
import { readVerificationHistory } from '../queries/delivery-gate-state.js';
|
|
5
33
|
/**
|
|
6
34
|
* How many consecutive identical shortfall iterations mark a claim as unclearable.
|
|
7
35
|
*
|
|
@@ -43,20 +71,16 @@ export function shortfallSignature(shortfalls) {
|
|
|
43
71
|
return JSON.stringify(key);
|
|
44
72
|
}
|
|
45
73
|
/**
|
|
46
|
-
* Read the repeat state
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
74
|
+
* Read the repeat state the previous shortfall iteration left on a delivery's
|
|
75
|
+
* gate_state. It is either LIVE (`shortfallReconciliation.repeat`, the gate is
|
|
76
|
+
* still that shortfall) or CARRIED forward under `verificationHistory` after the
|
|
77
|
+
* guard-pass coding -> verify advance cleared the gate. Before the carry
|
|
78
|
+
* existed, that clear wiped the record and every count restarted at 1.
|
|
79
|
+
* Defensive over the loosely typed slot: returns null when the record is absent
|
|
80
|
+
* or malformed (a first shortfall, a verify pass reset it, or a legacy row).
|
|
50
81
|
*/
|
|
51
82
|
export function readPriorRepeat(priorGateState) {
|
|
52
|
-
|
|
53
|
-
if (repeat &&
|
|
54
|
-
typeof repeat.signature === 'string' &&
|
|
55
|
-
typeof repeat.count === 'number' &&
|
|
56
|
-
Number.isFinite(repeat.count)) {
|
|
57
|
-
return { signature: repeat.signature, count: repeat.count };
|
|
58
|
-
}
|
|
59
|
-
return null;
|
|
83
|
+
return readVerificationHistory(priorGateState).shortfallRepeat ?? null;
|
|
60
84
|
}
|
|
61
85
|
/**
|
|
62
86
|
* Classify this iteration's shortfall set against the previous one.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shortfall-repeat.js","sourceRoot":"","sources":["../../src/verify/shortfall-repeat.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,
|
|
1
|
+
{"version":3,"file":"shortfall-repeat.js","sourceRoot":"","sources":["../../src/verify/shortfall-repeat.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,sFAAsF;AACtF,8GAA8G;AAC9G,gBAAgB;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,uBAAuB,EAA0B,MA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K,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3E,OAAO,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,IAAI,SAAS,EAAE,CAAC;AAC3E,CAAC"}
|
|
@@ -8,11 +8,18 @@
|
|
|
8
8
|
* detectors with their own actionable reasons. This module is that safety
|
|
9
9
|
* backfill:
|
|
10
10
|
*
|
|
11
|
-
* 1.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
11
|
+
* 1. verify-gate stall -- a delivery the verify gate keeps rejecting the SAME
|
|
12
|
+
* way is stuck in a re-code loop its re-work is not moving. A stall is an
|
|
13
|
+
* unchanging failure SIGNATURE across consecutive cycles, not an elapsed
|
|
14
|
+
* cycle count (verify-gate-stall.ts decides): it fires once one signature
|
|
15
|
+
* has held for VERIFY_GATE_STALL_REPEAT_THRESHOLD consecutive rejections,
|
|
16
|
+
* and stays silent on a delivery converging through a different gate each
|
|
17
|
+
* cycle however high iteration_count climbs. With no signature recorded it
|
|
18
|
+
* falls back to iteration_count > TELORA_VERIFY_FAILED_ITERATION_CAP. File
|
|
19
|
+
* ONE verify_gate_unclearable filing (proposed needs_operator, no human
|
|
20
|
+
* act named -- an observation the focus's next session decides) naming the
|
|
21
|
+
* repeated signature (or the count, on the fallback) and the gate_state --
|
|
22
|
+
* not a generic no-progress ping.
|
|
16
23
|
*
|
|
17
24
|
* 2. review-window staleness -- a focus stuck in the `reviewing` phase whose
|
|
18
25
|
* review_requested_at has sat past TELORA_REVIEW_WINDOW_STALE_HOURS with no
|
|
@@ -61,47 +68,16 @@ export interface VerifyFailedCapDeps {
|
|
|
61
68
|
* unclearable delivery silent (dismissal memory) until it moves on.
|
|
62
69
|
*/
|
|
63
70
|
fileEscalation: (params: FileEscalationIdempotentParams) => Promise<FileEscalationIdempotentResult>;
|
|
64
|
-
/** Override the cap for tests; defaults to the
|
|
71
|
+
/** Override the no-signature fallback iteration cap for tests; defaults to the env-config value. */
|
|
65
72
|
cap?: number;
|
|
73
|
+
/** Override the consecutive-identical-signature threshold for tests; defaults to VERIFY_GATE_STALL_REPEAT_THRESHOLD. */
|
|
74
|
+
repeatThreshold?: number;
|
|
66
75
|
}
|
|
67
76
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* are carried OUTSIDE `blocking` (queries/deliveries.ts DeliveryGateState) because a
|
|
73
|
-
* hold is not a guard verdict. Treating operatorHold as a block here would
|
|
74
|
-
* reintroduce the very fixpoint the sibling operator-hold exclusion removes: the
|
|
75
|
-
* verify_gate_unclearable alarm writes gate_state with `blocking: []` + a populated
|
|
76
|
-
* operatorHold, and if that counted as "still blocking" the detector would keep
|
|
77
|
-
* re-firing on its own alarm. So the guard-verdict array is the sole live-block
|
|
78
|
-
* signal. (verify_evidence_unavailable DOES populate `blocking` with its own guard,
|
|
79
|
-
* but it consumes no iteration_count, so it can never by itself push over the cap.)
|
|
80
|
-
*
|
|
81
|
-
* Defensive over the `unknown` gate_state shape (FocusDeliveryInfo.gateState). Pure
|
|
82
|
-
* -- exported for direct unit testing.
|
|
83
|
-
*/
|
|
84
|
-
export declare function hasLiveBlockingGuard(gateState: unknown): boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Pure decision: does this delivery exceed the verify_failed re-code cap AND is a
|
|
87
|
-
* guard still actively rejecting it?
|
|
88
|
-
*
|
|
89
|
-
* iteration_count is a MONOTONIC proxy for "the gate keeps rejecting this work",
|
|
90
|
-
* but the condition it proxies is NOT monotonic: the counter never decreases while
|
|
91
|
-
* the gate can go clear. Keying only on the counter let the detector assert "the
|
|
92
|
-
* gate keeps rejecting the work" at a moment when gate_state.blocking was empty and
|
|
93
|
-
* the gate was rejecting nothing (observed 2026-07-26). So the counter remains the
|
|
94
|
-
* TRIGGER (it is the right bounded-loop signal -- a delivery that has re-coded N
|
|
95
|
-
* times is the thing worth escalating), but the LIVE gate must also show a blocking
|
|
96
|
-
* guard for the claim to be true by construction. A terminal delivery
|
|
97
|
-
* (done/cancelled) is never escalated -- it has stopped cycling.
|
|
98
|
-
*
|
|
99
|
-
* Exported for direct unit testing.
|
|
100
|
-
*/
|
|
101
|
-
export declare function exceedsVerifyFailedCap(delivery: Pick<FocusDeliveryInfo, 'executionStatus' | 'iterationCount' | 'gateState'>, cap: number): boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Check ONE focus's ALREADY-FETCHED deliveries for any whose iteration_count
|
|
104
|
-
* exceeds the verify_failed re-code cap, filing a verify_gate_unclearable
|
|
77
|
+
* Check ONE focus's ALREADY-FETCHED deliveries for a stalled verify gate
|
|
78
|
+
* (decideVerifyGateStall: one failure signature held across consecutive
|
|
79
|
+
* rejections, or -- with no signature recorded -- iteration_count over the cap,
|
|
80
|
+
* both only while a guard is live-blocking), filing a verify_gate_unclearable
|
|
105
81
|
* escalation (needs_operator) for each -- at most one open per delivery.
|
|
106
82
|
* Operates on the deliveries the caller (runCascadeChecks) already loaded; it
|
|
107
83
|
* does NOT fetch.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stall-detectors.d.ts","sourceRoot":"","sources":["../../src/verify/stall-detectors.ts"],"names":[],"mappings":"AAUA
|
|
1
|
+
{"version":3,"file":"stall-detectors.d.ts","sourceRoot":"","sources":["../../src/verify/stall-detectors.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAM3D,OAAO,EAEL,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACpC,MAAM,sCAAsC,CAAC;AAwB9C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,4BAA4B,CAAC;AACtE,eAAO,MAAM,0BAA0B,0BAA0B,CAAC;AAElE,yEAAyE;AACzE,MAAM,WAAW,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