pi-lens 4.2.0 → 4.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 +543 -0
- package/README.md +45 -2
- package/dist/clients/actionable-warnings.js +44 -16
- package/dist/clients/advisory-provenance.js +187 -51
- package/dist/clients/cache-manager.js +64 -5
- package/dist/clients/cascade-format.js +24 -0
- package/dist/clients/child-unref.js +17 -8
- package/dist/clients/config-diagnostic-codes.js +2 -0
- package/dist/clients/config-locations.js +237 -9
- package/dist/clients/config-resolve.js +7 -1
- package/dist/clients/degradation-ledger.js +33 -3
- package/dist/clients/dependency-checker.js +87 -64
- package/dist/clients/diagnostic-dispositions.js +39 -3
- package/dist/clients/dispatch/finding-policy.js +118 -1
- package/dist/clients/dispatch/indent-detect.js +8 -2
- package/dist/clients/dispatch/inline-suppressions.js +23 -4
- package/dist/clients/dispatch/rule-ignores.js +14 -7
- package/dist/clients/dispatch/runners/actionlint.js +26 -28
- package/dist/clients/dispatch/runners/biome-check.js +38 -25
- package/dist/clients/dispatch/runners/cpp-check.js +32 -49
- package/dist/clients/dispatch/runners/credo.js +16 -14
- package/dist/clients/dispatch/runners/cue-vet.js +25 -7
- package/dist/clients/dispatch/runners/dart-analyze.js +28 -47
- package/dist/clients/dispatch/runners/detekt.js +11 -4
- package/dist/clients/dispatch/runners/dotnet-build.js +27 -22
- package/dist/clients/dispatch/runners/elixir-check.js +31 -46
- package/dist/clients/dispatch/runners/eslint.js +29 -46
- package/dist/clients/dispatch/runners/gleam-check.js +91 -11
- package/dist/clients/dispatch/runners/go-vet.js +16 -2
- package/dist/clients/dispatch/runners/golangci-lint.js +38 -23
- package/dist/clients/dispatch/runners/hadolint.js +27 -15
- package/dist/clients/dispatch/runners/htmlhint.js +17 -8
- package/dist/clients/dispatch/runners/javac.js +31 -21
- package/dist/clients/dispatch/runners/ktlint.js +34 -60
- package/dist/clients/dispatch/runners/lsp.js +6 -5
- package/dist/clients/dispatch/runners/markdownlint.js +12 -5
- package/dist/clients/dispatch/runners/mypy.js +2 -1
- package/dist/clients/dispatch/runners/oxlint.js +22 -6
- package/dist/clients/dispatch/runners/php-lint.js +39 -16
- package/dist/clients/dispatch/runners/phpstan.js +1 -1
- package/dist/clients/dispatch/runners/rubocop.js +27 -18
- package/dist/clients/dispatch/runners/ruff.js +18 -19
- package/dist/clients/dispatch/runners/rust-clippy.js +6 -1
- package/dist/clients/dispatch/runners/shellcheck.js +6 -2
- package/dist/clients/dispatch/runners/spellcheck.js +10 -3
- package/dist/clients/dispatch/runners/sqlfluff.js +11 -2
- package/dist/clients/dispatch/runners/stylelint.js +10 -2
- package/dist/clients/dispatch/runners/swiftlint.js +11 -2
- package/dist/clients/dispatch/runners/taplo.js +12 -6
- package/dist/clients/dispatch/runners/tflint.js +30 -15
- package/dist/clients/dispatch/runners/tree-sitter.js +23 -0
- package/dist/clients/dispatch/runners/trivy-config.js +8 -2
- package/dist/clients/dispatch/runners/utils/diagnostic-parsers.js +11 -1
- package/dist/clients/dispatch/runners/vale.js +15 -3
- package/dist/clients/dispatch/runners/yamllint.js +12 -2
- package/dist/clients/dispatch/runners/zig-check.js +27 -39
- package/dist/clients/dispatch/suppress-writer.js +13 -3
- package/dist/clients/effective-config.js +3 -1
- package/dist/clients/extension-log.js +48 -1
- package/dist/clients/finding-delivery-gate.js +53 -23
- package/dist/clients/formatters.js +49 -11
- package/dist/clients/git-guard.js +247 -34
- package/dist/clients/gradle-ktfmt-style.js +121 -25
- package/dist/clients/inline-blocker-dispositions.js +186 -0
- package/dist/clients/install-diagnostics.js +19 -6
- package/dist/clients/installer/index.js +281 -32
- package/dist/clients/jscpd-client.js +8 -0
- package/dist/clients/latency-logger.js +8 -0
- package/dist/clients/lens-config.js +66 -8
- package/dist/clients/lsp/cascade-tier.js +3 -0
- package/dist/clients/lsp/client.js +139 -11
- package/dist/clients/lsp/config.js +9 -7
- package/dist/clients/lsp/content-limits.js +41 -0
- package/dist/clients/lsp/index.js +42 -8
- package/dist/clients/lsp/launch.js +23 -2
- package/dist/clients/lsp/server.js +106 -25
- package/dist/clients/lsp/sync-kind.js +14 -0
- package/dist/clients/lsp/wait-policy/strategies.js +105 -16
- package/dist/clients/mcp/analyze.js +9 -2
- package/dist/clients/mcp/ipc.js +232 -44
- package/dist/clients/mcp/review.js +53 -7
- package/dist/clients/opengrep-client.js +11 -6
- package/dist/clients/path-utils.js +51 -9
- package/dist/clients/persistent-reverify.js +271 -0
- package/dist/clients/pipeline.js +136 -67
- package/dist/clients/project-diagnostics/fresh-fetch.js +21 -3
- package/dist/clients/project-lens-config.js +11 -3
- package/dist/clients/review-graph/builder.js +34 -26
- package/dist/clients/review-graph/git-identity.js +16 -10
- package/dist/clients/ruff-client.js +31 -4
- package/dist/clients/runtime-coordinator.js +38 -4
- package/dist/clients/runtime-tool-call.js +16 -5
- package/dist/clients/runtime-tool-result.js +27 -12
- package/dist/clients/runtime-turn.js +571 -287
- package/dist/clients/safe-spawn.js +256 -65
- package/dist/clients/skills-resolver.js +38 -2
- package/dist/clients/spawn-output-cap.js +84 -1
- package/dist/clients/tree-sitter-client.js +119 -58
- package/dist/clients/turn-end/lane.js +51 -0
- package/dist/clients/turn-end/lanes/govulncheck.js +112 -0
- package/dist/clients/turn-end/lanes/secrets.js +204 -0
- package/dist/clients/warm-attach.js +59 -0
- package/dist/clients/widget-state.js +294 -17
- package/dist/clients/workspace-topology.js +57 -3
- package/dist/clients/zizmor-config.js +26 -13
- package/dist/index.js +6342 -3995
- package/dist/mcp/analyze-cli.js +4 -0
- package/dist/mcp/server.js +33 -21
- package/dist/scripts/lib/web-tree-sitter-dir.mjs +123 -0
- package/dist/tools/lens-diagnostic-mark.js +14 -2
- package/dist/tools/lens-diagnostics.js +127 -33
- package/dist/tools/lsp-diagnostics.js +150 -12
- package/docs/adr/0001-stale-advisory-live-arm.md +29 -0
- package/docs/adr/0002-workspace-hash-rendezvous.md +30 -0
- package/docs/adr/0003-git-guard-latch-writer.md +203 -0
- package/docs/adr/0004-disposition-policy-seam.md +38 -0
- package/docs/adr/0005-tool-availability-enforcement-seam.md +29 -0
- package/docs/adr/0006-derived-state-benchmark-first.md +31 -0
- package/docs/adr/0007-end-to-end-witness-per-seam-slice.md +38 -0
- package/docs/adr/0008-turn-end-lane-interface.md +165 -0
- package/docs/adr/0009-reported-path-attribution.md +114 -0
- package/docs/adr/README.md +26 -0
- package/docs/agent-tools.md +18 -1
- package/docs/ast-grep_rules_catalog.md +4 -3
- package/docs/configuration.md +55 -1
- package/docs/engineering-principles.md +202 -0
- package/docs/environment-variables.md +61 -4
- package/docs/features.md +2 -2
- package/docs/globalconfig.md +6 -1
- package/docs/language-coverage.md +17 -0
- package/docs/lsp-capability-matrix.md +98 -31
- package/docs/pi-lens-fixer.md +57 -3
- package/docs/pi-lens-investigator.md +9 -0
- package/docs/pi-lens-reviewer.md +16 -0
- package/docs/pi-lens-subagent.md +9 -0
- package/docs/public-api-stability.md +1 -0
- package/docs/release-qa-baseline.md +2 -0
- package/docs/servercapabilities.md +21 -11
- package/docs/settings.md +12 -3
- package/docs/subagent-compat.md +1 -1
- package/package.json +5 -3
- package/rules/ast-grep-rules/rule-tests/no-assert-tuple-test.yml +13 -0
- package/rules/ast-grep-rules/rule-tests/no-boolean-in-except-test.yml +26 -0
- package/rules/ast-grep-rules/rule-tests/no-http-headers-bracket-access-test.yml +10 -0
- package/rules/ast-grep-rules/rule-tests/unchecked-numeric-parse-python-test.yml +18 -0
- package/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-python-test.yml +4 -3
- package/rules/ast-grep-rules/rules/go-no-fmt-println.yml +2 -2
- package/rules/ast-grep-rules/rules/no-assert-tuple.yml +23 -13
- package/rules/ast-grep-rules/rules/no-boolean-in-except.yml +7 -3
- package/rules/ast-grep-rules/rules/no-console-except-error-js.yml +2 -2
- package/rules/ast-grep-rules/rules/no-console-except-error.yml +2 -2
- package/rules/ast-grep-rules/rules/no-http-headers-bracket-access.yml +12 -7
- package/rules/ast-grep-rules/rules/unchecked-numeric-parse-python.yml +44 -0
- package/rules/ast-grep-rules/rules/unchecked-throwing-call-python.yml +5 -3
- package/rules/tree-sitter-queries/typescript/console-statement.yml +2 -2
- package/scripts/install-selftest.mjs +21 -17
- package/scripts/lib/web-tree-sitter-dir.mjs +123 -0
|
@@ -23,10 +23,12 @@ import { classifyCascadeWaitTier } from "../clients/lsp/wait-policy/index.js";
|
|
|
23
23
|
import { attemptTsserverSyncDiagnostics } from "../clients/lsp/tsserver-sync.js";
|
|
24
24
|
import { convertLspDiagnostics } from "../clients/dispatch/utils/lsp-diagnostics.js";
|
|
25
25
|
import { demoteInferredProjectDiagnostics } from "../clients/lsp/inferred-project.js";
|
|
26
|
-
import {
|
|
26
|
+
import { normalizeMapKey } from "../clients/path-utils.js";
|
|
27
|
+
import { countRetainedSuppressedRows, isBlocking, reconcileScanDiagnostics, } from "../clients/widget-state.js";
|
|
27
28
|
import { makeProgressReporter } from "./scan-progress.js";
|
|
28
29
|
import { isWarmAttached, tryWarmAttachedDiagnostics, } from "../clients/warm-attach.js";
|
|
29
30
|
import { extensionsForLanguage, SCAN_LANGUAGE_PRIORITY, } from "../clients/language-registry.js";
|
|
31
|
+
import { exceedsLspSyncLimits } from "../clients/lsp/content-limits.js";
|
|
30
32
|
const MAX_FILES = 100;
|
|
31
33
|
export const MAX_BATCH_FILES = 100;
|
|
32
34
|
const MAX_DIAGNOSTICS = 200;
|
|
@@ -44,6 +46,30 @@ export const LSP_SEVERITY_FILTERS = [
|
|
|
44
46
|
...Object.values(SEVERITY_NAMES),
|
|
45
47
|
"all",
|
|
46
48
|
];
|
|
49
|
+
function assertNeverBatchFileOutcome(value) {
|
|
50
|
+
throw new Error(`Unhandled batch file outcome: ${String(value)}`);
|
|
51
|
+
}
|
|
52
|
+
/** Render the bounded per-file outcomes shared by batch, directory, and fold surfaces. */
|
|
53
|
+
export function renderBatchOutcomeLines(outcomes, formatFile = (file) => file) {
|
|
54
|
+
const lines = [];
|
|
55
|
+
for (const outcome of outcomes) {
|
|
56
|
+
switch (outcome.outcome) {
|
|
57
|
+
case "too_large":
|
|
58
|
+
lines.push(`${formatFile(outcome.file)}: ${outcome.reason ?? "file too large for LSP diagnostics"}`);
|
|
59
|
+
break;
|
|
60
|
+
case "clean":
|
|
61
|
+
case "findings":
|
|
62
|
+
case "unsupported":
|
|
63
|
+
case "unavailable":
|
|
64
|
+
case "failed":
|
|
65
|
+
case "inconclusive":
|
|
66
|
+
break;
|
|
67
|
+
default:
|
|
68
|
+
assertNeverBatchFileOutcome(outcome.outcome);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return lines;
|
|
72
|
+
}
|
|
47
73
|
function batchFileDeadlineMs() {
|
|
48
74
|
const raw = Number(process.env.PI_LENS_LSP_BATCH_FILE_MS);
|
|
49
75
|
return Number.isFinite(raw) && raw > 0 ? raw : DEFAULT_BATCH_FILE_DEADLINE_MS;
|
|
@@ -239,7 +265,18 @@ onConfirmedNoBlockers, getService = getLSPService) {
|
|
|
239
265
|
// Preserve input order (including duplicate entries); normalize each
|
|
240
266
|
// path before grouping so Windows separators and dot segments cannot
|
|
241
267
|
// change cache/group identity. Explicit lists never enter the walker.
|
|
242
|
-
|
|
268
|
+
// #3160/#3182: `path.resolve(cwd, entry)` folds dot segments (and
|
|
269
|
+
// separators) structurally — it ignores `cwd` whenever `entry` is
|
|
270
|
+
// already absolute, so the old `path.isAbsolute` ternary is
|
|
271
|
+
// redundant. `normalizeMapKey` then adopts on-disk CASING where the
|
|
272
|
+
// path exists — an agent-typed, possibly mis-cased `paths` entry
|
|
273
|
+
// must key `reconcileScanDiagnostics`'s widget-state write the same
|
|
274
|
+
// way a canonical writer (clients/pipeline.ts's ctx.filePath) or the
|
|
275
|
+
// #3160-fixed lens_diagnostic_mark reader would. `path.resolve`
|
|
276
|
+
// stays required for the relative→absolute step: `normalizeMapKey`
|
|
277
|
+
// folds dot segments itself since #3184, but never resolves against
|
|
278
|
+
// `cwd` (a cwd fold there broke every monorepo, #2490).
|
|
279
|
+
const absPaths = rawPaths.map((entry) => normalizeMapKey(path.resolve(cwd, entry)));
|
|
243
280
|
return runBatchFileDiagnostics(absPaths, severity, lspService, {
|
|
244
281
|
concurrency,
|
|
245
282
|
waitMs,
|
|
@@ -264,9 +301,12 @@ onConfirmedNoBlockers, getService = getLSPService) {
|
|
|
264
301
|
details: {},
|
|
265
302
|
};
|
|
266
303
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
304
|
+
// #3184: the single-`path` sibling of the `paths` batch above, and
|
|
305
|
+
// keyed the same way — `runFileDiagnostics` hands this straight to
|
|
306
|
+
// `reconcileScanDiagnostics`, whose `normalizeEphemeralMapKey` key
|
|
307
|
+
// derivation folds neither dot segments nor casing. Same expression as
|
|
308
|
+
// :444 so both modes of this tool write under ONE key per file.
|
|
309
|
+
const absPath = normalizeMapKey(path.resolve(cwd, rawPath));
|
|
270
310
|
let stat;
|
|
271
311
|
try {
|
|
272
312
|
stat = fs.statSync(absPath);
|
|
@@ -325,6 +365,24 @@ scanRoot, waitMs, serverScope = "all") {
|
|
|
325
365
|
let touched;
|
|
326
366
|
try {
|
|
327
367
|
content = fs.readFileSync(absPath, "utf-8");
|
|
368
|
+
const contentLimit = exceedsLspSyncLimits(content);
|
|
369
|
+
if (contentLimit.tooLarge) {
|
|
370
|
+
const reason = `file too large for LSP diagnostics (${contentLimit.reason})`;
|
|
371
|
+
recordDegradationOnce({
|
|
372
|
+
kind: "lsp-diagnostics-file-too-large",
|
|
373
|
+
subject: absPath,
|
|
374
|
+
reason,
|
|
375
|
+
});
|
|
376
|
+
return {
|
|
377
|
+
diagnostics: [],
|
|
378
|
+
timedOut: false,
|
|
379
|
+
confirmedByTouch: false,
|
|
380
|
+
unconfirmedServerIds: [],
|
|
381
|
+
diagnosticsUnsupportedServerIds: [],
|
|
382
|
+
content,
|
|
383
|
+
tooLargeReason: reason,
|
|
384
|
+
};
|
|
385
|
+
}
|
|
328
386
|
if (isWarmAttached()) {
|
|
329
387
|
// The local sweep's default service wait is bounded to the same
|
|
330
388
|
// 15-second per-file envelope used by the workspace sweep. An explicit
|
|
@@ -372,6 +430,12 @@ scanRoot, waitMs, serverScope = "all") {
|
|
|
372
430
|
maxClientWaitMs: waitMs,
|
|
373
431
|
source: "lsp_diagnostics",
|
|
374
432
|
clientScope: serverScope,
|
|
433
|
+
// #3405: the caller asked whether THIS file is clean right now, and the
|
|
434
|
+
// content above was just read from disk — so it is the file's saved
|
|
435
|
+
// state. Without the save a save-triggered server answers zero
|
|
436
|
+
// diagnostics for every file in the query, which this path would report
|
|
437
|
+
// as clean.
|
|
438
|
+
saved: true,
|
|
375
439
|
});
|
|
376
440
|
timedOut = touched?.inconclusive === true;
|
|
377
441
|
}
|
|
@@ -616,6 +680,17 @@ severity) {
|
|
|
616
680
|
// otherwise have SEEN, never one per finding (AGENTS.md "bounded
|
|
617
681
|
// observability"). `total` is the in-scope population for the same
|
|
618
682
|
// reason the count is, so the record and the rendered line agree.
|
|
683
|
+
//
|
|
684
|
+
// #3158 round 2 F4: `retainedSuppressed` is the widget store's
|
|
685
|
+
// SUCCESS-path number — how many suppressed rows the store is carrying
|
|
686
|
+
// INTO this scan, written by the scans before it. Until this, retention
|
|
687
|
+
// was observable only when its per-file cap truncated
|
|
688
|
+
// (`widget-suppressed-retention-capped`), so a healthy footer chip had no
|
|
689
|
+
// record behind it at all. Folded into the record this lane already emits
|
|
690
|
+
// rather than added as a second one: same cardinality (one per filtered
|
|
691
|
+
// file per scan, never one per row), no new sink, and the two numbers are
|
|
692
|
+
// read together — `suppressed` is what THIS scan dropped,
|
|
693
|
+
// `retainedSuppressed` is what the footer chip is still counting.
|
|
619
694
|
logLatency({
|
|
620
695
|
type: "phase",
|
|
621
696
|
toolName: "lsp_diagnostics",
|
|
@@ -625,6 +700,7 @@ severity) {
|
|
|
625
700
|
metadata: {
|
|
626
701
|
suppressed,
|
|
627
702
|
total: inScopeBefore,
|
|
703
|
+
retainedSuppressed: countRetainedSuppressedRows(file),
|
|
628
704
|
},
|
|
629
705
|
});
|
|
630
706
|
}
|
|
@@ -775,7 +851,10 @@ onConfirmedNoBlockers) {
|
|
|
775
851
|
};
|
|
776
852
|
}
|
|
777
853
|
}
|
|
778
|
-
const { diagnostics: rawDiags, timedOut, confirmedByTouch, unconfirmedServerIds, diagnosticsUnsupportedServerIds, content: collectedContent, binding, skipReason, } = await collectDiagnosticsForFile(file, lspService, cwd, waitMs, serverScope);
|
|
854
|
+
const { diagnostics: rawDiags, timedOut, confirmedByTouch, unconfirmedServerIds, diagnosticsUnsupportedServerIds, content: collectedContent, binding, tooLargeReason, skipReason, } = await collectDiagnosticsForFile(file, lspService, cwd, waitMs, serverScope);
|
|
855
|
+
if (tooLargeReason !== undefined) {
|
|
856
|
+
return { file, diagnostics: [], outcome: "too_large", tooLargeReason };
|
|
857
|
+
}
|
|
779
858
|
const health = lspService.getDiagnosticsHealth?.(file);
|
|
780
859
|
// #570: a timed-out priming check is never a confirmed "clean" — treat it
|
|
781
860
|
// as unconfirmed without consulting the (unrelated) silent-tier
|
|
@@ -891,7 +970,22 @@ onConfirmedNoBlockers) {
|
|
|
891
970
|
// Reserve the token before awaiting this file's LSP result. The direct-file
|
|
892
971
|
// path performs its own confirmation/reconciliation below (#1198).
|
|
893
972
|
const writeIndex = nextWriteIndex?.();
|
|
894
|
-
const { diagnostics: rawDiags, timedOut, confirmedByTouch, unconfirmedServerIds, diagnosticsUnsupportedServerIds, content: collectedContent, binding, skipReason, } = await collectDiagnosticsForFile(absPath, lspService, cwd, waitMs, serverScope);
|
|
973
|
+
const { diagnostics: rawDiags, timedOut, confirmedByTouch, unconfirmedServerIds, diagnosticsUnsupportedServerIds, content: collectedContent, binding, tooLargeReason, skipReason, } = await collectDiagnosticsForFile(absPath, lspService, cwd, waitMs, serverScope);
|
|
974
|
+
if (tooLargeReason !== undefined) {
|
|
975
|
+
return {
|
|
976
|
+
content: [{ type: "text", text: tooLargeReason }],
|
|
977
|
+
details: {
|
|
978
|
+
filePath: absPath,
|
|
979
|
+
mode: "file",
|
|
980
|
+
severity,
|
|
981
|
+
serverScope,
|
|
982
|
+
outcome: "too_large",
|
|
983
|
+
tooLargeReason,
|
|
984
|
+
diagnostics: [],
|
|
985
|
+
totalDiagnostics: 0,
|
|
986
|
+
},
|
|
987
|
+
};
|
|
988
|
+
}
|
|
895
989
|
const lspHealth = lspService.getDiagnosticsHealth?.(absPath);
|
|
896
990
|
const unavailable = lspUnavailableMessage(absPath, lspHealth);
|
|
897
991
|
// #533: an empty result needs a confirmed/unconfirmed verdict — a push-only,
|
|
@@ -1050,6 +1144,7 @@ onConfirmedNoBlockers) {
|
|
|
1050
1144
|
mode: "file",
|
|
1051
1145
|
severity,
|
|
1052
1146
|
serverScope,
|
|
1147
|
+
...(unavailable ? { unavailable } : {}),
|
|
1053
1148
|
primaryServerId: primaryId,
|
|
1054
1149
|
primaryDiagnosticsCount: primaryDiags.length,
|
|
1055
1150
|
auxiliaryDiagnosticsCount: auxiliaryDiags.length,
|
|
@@ -1093,7 +1188,12 @@ function tallyConfirmation(results) {
|
|
|
1093
1188
|
let unconfirmed = 0;
|
|
1094
1189
|
let timedOut = 0;
|
|
1095
1190
|
let navigationOnly = 0;
|
|
1191
|
+
let tooLarge = 0;
|
|
1096
1192
|
for (const result of results) {
|
|
1193
|
+
if (result.tooLargeReason) {
|
|
1194
|
+
tooLarge += 1;
|
|
1195
|
+
continue;
|
|
1196
|
+
}
|
|
1097
1197
|
if (result.diagnosticsUnsupported) {
|
|
1098
1198
|
navigationOnly += 1;
|
|
1099
1199
|
continue;
|
|
@@ -1111,11 +1211,13 @@ function tallyConfirmation(results) {
|
|
|
1111
1211
|
clean += 1;
|
|
1112
1212
|
}
|
|
1113
1213
|
}
|
|
1114
|
-
return { clean, unconfirmed, timedOut, navigationOnly };
|
|
1214
|
+
return { clean, unconfirmed, timedOut, navigationOnly, tooLarge };
|
|
1115
1215
|
}
|
|
1116
1216
|
function classifyBatchFileOutcome(result) {
|
|
1117
1217
|
if (result.error)
|
|
1118
1218
|
return "failed";
|
|
1219
|
+
if (result.tooLargeReason)
|
|
1220
|
+
return "too_large";
|
|
1119
1221
|
if (result.diagnosticsUnsupported)
|
|
1120
1222
|
return "unsupported";
|
|
1121
1223
|
// A timed-out/unconfirmed answer may contain partial findings, but it cannot
|
|
@@ -1271,6 +1373,7 @@ async function collectBatchDiagnostics(files, severity, lspService, options) {
|
|
|
1271
1373
|
"unsupported",
|
|
1272
1374
|
"unavailable",
|
|
1273
1375
|
"failed",
|
|
1376
|
+
"too_large",
|
|
1274
1377
|
"inconclusive",
|
|
1275
1378
|
].map((outcome) => [
|
|
1276
1379
|
outcome,
|
|
@@ -1326,6 +1429,7 @@ async function runBatchFileDiagnostics(absPaths, severity, lspService, options)
|
|
|
1326
1429
|
outcomeCounts.unavailable +
|
|
1327
1430
|
outcomeCounts.unsupported +
|
|
1328
1431
|
outcomeCounts.failed +
|
|
1432
|
+
outcomeCounts.too_large +
|
|
1329
1433
|
incompleteFiles;
|
|
1330
1434
|
if (notConfirmed > 0) {
|
|
1331
1435
|
lines.push("", `Checks not confirmed: ${notConfirmed} (inconclusive/unavailable/unsupported/failed or not started).`);
|
|
@@ -1335,6 +1439,18 @@ async function runBatchFileDiagnostics(absPaths, severity, lspService, options)
|
|
|
1335
1439
|
}
|
|
1336
1440
|
if (fileErrors.length > 0)
|
|
1337
1441
|
lines.push("", "File errors:", ...fileErrors);
|
|
1442
|
+
const outcomeDetails = results.map((result) => ({
|
|
1443
|
+
file: result.file,
|
|
1444
|
+
outcome: result.outcome,
|
|
1445
|
+
reason: result.tooLargeReason ??
|
|
1446
|
+
result.inconclusiveReason ??
|
|
1447
|
+
result.error ??
|
|
1448
|
+
result.unavailable,
|
|
1449
|
+
}));
|
|
1450
|
+
const tooLargeLines = renderBatchOutcomeLines(outcomeDetails);
|
|
1451
|
+
if (tooLargeLines.length > 0) {
|
|
1452
|
+
lines.push("", "Files too large for LSP diagnostics:", ...tooLargeLines);
|
|
1453
|
+
}
|
|
1338
1454
|
if (lspHealthWarnings.length > 0) {
|
|
1339
1455
|
lines.push("", "LSP health warnings:", ...lspHealthWarnings.slice(0, 10));
|
|
1340
1456
|
}
|
|
@@ -1349,7 +1465,7 @@ async function runBatchFileDiagnostics(absPaths, severity, lspService, options)
|
|
|
1349
1465
|
`${unconfirmedReasonClause(unconfirmed, timedOut)} NOT the same as 0 diagnostics.`);
|
|
1350
1466
|
}
|
|
1351
1467
|
if (display.length === 0) {
|
|
1352
|
-
if (unconfirmed === 0) {
|
|
1468
|
+
if (unconfirmed === 0 && outcomeCounts.clean === results.length) {
|
|
1353
1469
|
lines.push("", "No diagnostics found.");
|
|
1354
1470
|
}
|
|
1355
1471
|
}
|
|
@@ -1391,7 +1507,10 @@ async function runBatchFileDiagnostics(absPaths, severity, lspService, options)
|
|
|
1391
1507
|
outcomes: results.map((result) => ({
|
|
1392
1508
|
file: result.file,
|
|
1393
1509
|
outcome: result.outcome,
|
|
1394
|
-
reason: result.
|
|
1510
|
+
reason: result.tooLargeReason ??
|
|
1511
|
+
result.inconclusiveReason ??
|
|
1512
|
+
result.error ??
|
|
1513
|
+
result.unavailable,
|
|
1395
1514
|
primaryDiagnosticsCount: result.diagnostics.filter((diagnostic) => diagnostic.serverId === result.primaryServerId).length,
|
|
1396
1515
|
auxiliaryDiagnosticsCount: result.diagnostics.filter((diagnostic) => diagnostic.serverId !== result.primaryServerId).length,
|
|
1397
1516
|
})),
|
|
@@ -1455,11 +1574,20 @@ async function runDirectoryDiagnostics(absPath, severity, lspService, options) {
|
|
|
1455
1574
|
}
|
|
1456
1575
|
const wasCapped = collectedFiles.length > MAX_FILES;
|
|
1457
1576
|
const filesToProcess = collectedFiles.slice(0, MAX_FILES);
|
|
1458
|
-
const { results, fileErrors, lspHealthWarnings, total, truncated, display, primaryDisplay, auxiliaryDisplay, clean, unconfirmed, timedOut, } = await collectBatchDiagnostics(filesToProcess, severity, lspService, options);
|
|
1577
|
+
const { results, fileErrors, lspHealthWarnings, total, truncated, display, primaryDisplay, auxiliaryDisplay, clean, unconfirmed, timedOut, outcomeCounts, } = await collectBatchDiagnostics(filesToProcess, severity, lspService, options);
|
|
1459
1578
|
const navigationOnly = results.filter((result) => result.diagnosticsUnsupported).length;
|
|
1460
1579
|
// #3088: the directory scan's own suppressed bucket — one summed line.
|
|
1461
1580
|
const dispositionSuppressed = results.reduce((sum, result) => sum + (result.dispositionSuppressed ?? 0), 0);
|
|
1462
1581
|
const suppressedLine = dispositionSuppressedLine(dispositionSuppressed);
|
|
1582
|
+
const outcomeDetails = results.map((result) => ({
|
|
1583
|
+
file: result.file,
|
|
1584
|
+
outcome: result.outcome,
|
|
1585
|
+
reason: result.tooLargeReason ??
|
|
1586
|
+
result.inconclusiveReason ??
|
|
1587
|
+
result.error ??
|
|
1588
|
+
result.unavailable,
|
|
1589
|
+
}));
|
|
1590
|
+
const tooLargeLines = renderBatchOutcomeLines(outcomeDetails, (file) => path.relative(absPath, file));
|
|
1463
1591
|
let text;
|
|
1464
1592
|
if (total === 0) {
|
|
1465
1593
|
// #533/#570: an unconfirmed-containing directory result must never
|
|
@@ -1477,7 +1605,12 @@ async function runDirectoryDiagnostics(absPath, severity, lspService, options) {
|
|
|
1477
1605
|
"LSP unavailable for one or more files:",
|
|
1478
1606
|
...lspHealthWarnings.slice(0, 10),
|
|
1479
1607
|
]
|
|
1480
|
-
:
|
|
1608
|
+
: unconfirmed > 0 || outcomeCounts.clean === filesToProcess.length
|
|
1609
|
+
? [cleanLine]
|
|
1610
|
+
: []),
|
|
1611
|
+
...(tooLargeLines.length > 0
|
|
1612
|
+
? ["", "Files too large for LSP diagnostics:", ...tooLargeLines]
|
|
1613
|
+
: []),
|
|
1481
1614
|
...(suppressedLine ? ["", suppressedLine] : []),
|
|
1482
1615
|
].join("\n");
|
|
1483
1616
|
}
|
|
@@ -1520,6 +1653,9 @@ async function runDirectoryDiagnostics(absPath, severity, lspService, options) {
|
|
|
1520
1653
|
}
|
|
1521
1654
|
if (suppressedLine)
|
|
1522
1655
|
lines.push("", suppressedLine);
|
|
1656
|
+
if (tooLargeLines.length > 0) {
|
|
1657
|
+
lines.push("", "Files too large for LSP diagnostics:", ...tooLargeLines);
|
|
1658
|
+
}
|
|
1523
1659
|
text = lines.join("\n");
|
|
1524
1660
|
}
|
|
1525
1661
|
return {
|
|
@@ -1547,6 +1683,8 @@ async function runDirectoryDiagnostics(absPath, severity, lspService, options) {
|
|
|
1547
1683
|
truncated,
|
|
1548
1684
|
cleanFiles: clean,
|
|
1549
1685
|
unconfirmedFiles: unconfirmed,
|
|
1686
|
+
outcomes: outcomeDetails,
|
|
1687
|
+
outcomeCounts,
|
|
1550
1688
|
navigationOnlyFiles: navigationOnly > 0 ? navigationOnly : undefined,
|
|
1551
1689
|
timedOutFiles: timedOut > 0 ? timedOut : undefined,
|
|
1552
1690
|
fileErrors: fileErrors.length > 0 ? fileErrors : undefined,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# ADR 0001: stale advisory skips disposition policy
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Accepted — 2026-09-23
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
The #3247 review found an asymmetry: the live turn-end arm applies disposition
|
|
10
|
+
policy, but the freshness arm that demotes dependency-drift records does not.
|
|
11
|
+
The stale arm drives delivery-count commits and bounded retirement, so changing
|
|
12
|
+
it would change the freshness gate's accounting rather than merely filter text.
|
|
13
|
+
|
|
14
|
+
## Decision
|
|
15
|
+
|
|
16
|
+
Apply disposition policy on the live arm only. Keep the stale advisory visible
|
|
17
|
+
with its stale marker and its existing bounded delivery accounting.
|
|
18
|
+
|
|
19
|
+
## Consequences
|
|
20
|
+
|
|
21
|
+
Marked findings in a stale record may remain in the bounded stale advisory.
|
|
22
|
+
This is deliberate and does not recreate the unbounded replay fixed by #3247.
|
|
23
|
+
|
|
24
|
+
## Links
|
|
25
|
+
|
|
26
|
+
- Catalog shape: `AGENTS.md` shape 10.
|
|
27
|
+
- Issue: #3246.
|
|
28
|
+
- PR: #3247, section “Known asymmetry: the stale arm does not run the policy”.
|
|
29
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# ADR 0002: workspace hash is a rendezvous derivation
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Accepted — 2026-09-23
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
`workspaceHash` names the warm IPC endpoint and turn-end status file. Separate
|
|
10
|
+
processes derive it at different times and must reproduce identical bytes.
|
|
11
|
+
Path-map normalizers can consult filesystem state, so they cannot be used for
|
|
12
|
+
this cross-process rendezvous.
|
|
13
|
+
|
|
14
|
+
## Decision
|
|
15
|
+
|
|
16
|
+
Keep `workspaceHash` as pure string math. Neither the long-lived canonical path
|
|
17
|
+
key nor the process-local ephemeral path-key seam applies.
|
|
18
|
+
|
|
19
|
+
## Consequences
|
|
20
|
+
|
|
21
|
+
The derivation remains independently reproducible and avoids filesystem-state
|
|
22
|
+
staleness. Its deliberate lowercase fold can collide for case-distinct POSIX
|
|
23
|
+
directories; changing those bytes requires a separate invalidation decision.
|
|
24
|
+
|
|
25
|
+
## Links
|
|
26
|
+
|
|
27
|
+
- Catalog shapes: `AGENTS.md` shapes 1 and 2.
|
|
28
|
+
- Issue: #3255.
|
|
29
|
+
- PR: #3256; source record: `clients/mcp/ipc.ts:44-77`.
|
|
30
|
+
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# ADR 0003: git-guard latch is a separate writer
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Accepted — 2026-09-23. Amended 2026-09-23 (#3248 remainder 2): the identity
|
|
6
|
+
rule below is decided and implemented.
|
|
7
|
+
|
|
8
|
+
## Context
|
|
9
|
+
|
|
10
|
+
The turn-end disposition policy can change the survivor set while the
|
|
11
|
+
git-guard latch is read first by the commit gate. Existing edit-time code writes
|
|
12
|
+
the latch and synchronizes the `turn-end-findings` record; turn-end policy was a
|
|
13
|
+
separate actor that did neither.
|
|
14
|
+
|
|
15
|
+
### Writers by axis, re-verified against the tree at `5f5d847f9`
|
|
16
|
+
|
|
17
|
+
| Actor | Axis / timing | Latch | Durable record | Site |
|
|
18
|
+
|---|---|---|---|---|
|
|
19
|
+
| `handleToolResult` | per edit, after each dispatch | `updateGitGuardStatus(result.hasBlockers, result.output)` | `syncGitGuardRecord(…, filePath)` | `clients/runtime-tool-result.ts:2546-2549` |
|
|
20
|
+
| `retireInlineBlockerAndResyncGuard` | confirmed-clean verdict from `lsp_diagnostics` | `updateGitGuardStatus(false, "")` | `syncGitGuardRecord(…, filePath)` | `clients/git-guard.ts:864` |
|
|
21
|
+
| `markGitGuardCacheUnknown` | cache/session mismatch, untrusted provenance, pipeline error | — | marks the record unreadable | `clients/git-guard.ts:749`, `clients/runtime-tool-result.ts:928` |
|
|
22
|
+
| turn-end composer, blocker sections | per turn, after policy | — | `writeGitGuardRecord` (dedupe path `:4231`, main path `:4287`) | `clients/runtime-turn.ts` |
|
|
23
|
+
| turn-end composer, clean session | per turn, when nothing survives | — | `clearCache("turn-end-findings")`, gated on the LATCH | `clients/runtime-turn.ts:829`, `:4379` |
|
|
24
|
+
| turn-end disposition policy (#3246) | per turn, per finding | **nothing — the gap** | nothing | `clients/runtime-turn.ts:1068` |
|
|
25
|
+
| `evaluateGitGuard` | read (commit gate) | reads the LATCH first and short-circuits | read second | `clients/git-guard.ts:1164` |
|
|
26
|
+
|
|
27
|
+
PR #3254's table named five actors; re-verification adds the composer's own two
|
|
28
|
+
record writers, which is what decides the rule below.
|
|
29
|
+
|
|
30
|
+
### State table
|
|
31
|
+
|
|
32
|
+
Axes: blockers on the file pre-policy / post-policy · record demoted by the
|
|
33
|
+
freshness sweep · persisted record freshness · which reader the gate uses ·
|
|
34
|
+
session identity.
|
|
35
|
+
|
|
36
|
+
| # | State | Latch | Record | Gate |
|
|
37
|
+
|---|---|---|---|---|
|
|
38
|
+
| 1 | every blocker on the only file suppressed | clear | cleared by the composer's clean-session clear (now reachable) | allow |
|
|
39
|
+
| 2 | 2 of 4 suppressed | set | blocker sections of the survivors | block |
|
|
40
|
+
| 3 | file X fully suppressed, file Y still blocking | set (Y) | Y only; X's summary gone | block |
|
|
41
|
+
| 4 | record demoted (`stale`) by the freshness sweep | set | untouched | block |
|
|
42
|
+
| 5 | every blocker suppressed, test failures in the record | clear | `hasBlockers` stays true via `testFailures` | block |
|
|
43
|
+
| 6 | suppressed, then an unrelated clean edit next turn | stays clear (the verdict rides the record the per-edit writer re-derives from) | not rewritten with the suppressed file | allow |
|
|
44
|
+
| 7 | suppressed, then a NEW blocker dispatched on the same file | set again | lists the new blocker | block |
|
|
45
|
+
| 8 | policy ran, suppressed nothing, changed no verdict | untouched | untouched | unchanged |
|
|
46
|
+
| 9 | record for a file that no longer exists (snapshot drops it) | untouched | untouched | unchanged |
|
|
47
|
+
|
|
48
|
+
## Decision
|
|
49
|
+
|
|
50
|
+
The latch is an aggregate over the inline-blocker MAP, and the map carries the
|
|
51
|
+
policy verdict. One identity rule, no second clause:
|
|
52
|
+
|
|
53
|
+
> A record is in the gate's blocking set unless the LAST turn-end policy pass
|
|
54
|
+
> found every blocker it carries suppressed.
|
|
55
|
+
|
|
56
|
+
- One writer for the verdict: the turn-end composer, at the point where the
|
|
57
|
+
post-policy survivor set per file is final, calls
|
|
58
|
+
`resyncGitGuardAfterInlinePolicy`, which stamps
|
|
59
|
+
`InlineBlockerRecord.policySuppressed` on every live record (true for a fully
|
|
60
|
+
suppressed file, false for every other, so a verdict cannot outlive its pass)
|
|
61
|
+
and re-derives the latch through `updateGitGuardStatus(false, "")` — the same
|
|
62
|
+
re-derivation the retire path uses.
|
|
63
|
+
- Two readers, both deriving from the map: the latch
|
|
64
|
+
(`RuntimeCoordinator.updateGitGuardStatus`) and the persisted record
|
|
65
|
+
(`syncGitGuardRecord`'s `blockerContent`). The per-edit writer therefore
|
|
66
|
+
honors the verdict too, without a second identity clause.
|
|
67
|
+
- The record keeps the suppressed entry. The policy is content-bound and
|
|
68
|
+
re-derived every turn end, so retiring the entry would be silencing rather
|
|
69
|
+
than filtering (AGENTS.md shape 10), and a fresh dispatch replaces the record
|
|
70
|
+
wholesale, so a new blocker is never born pre-suppressed (#1198 ordering).
|
|
71
|
+
- No third durable writer at turn end. The composer rewrites or clears the
|
|
72
|
+
record later in the SAME turn end from the same survivor set, and its clear is
|
|
73
|
+
gated on the latch this pass just recomputed.
|
|
74
|
+
|
|
75
|
+
### Amendment, review round 2 (GG-3283-01): the verdict is content-bound
|
|
76
|
+
|
|
77
|
+
Round 1's rule said a verdict "cannot outlive the pass that made it" because
|
|
78
|
+
`applyInlineBlockerPolicyVerdicts` rewrites the whole axis each turn end. The
|
|
79
|
+
review probe showed that is only true while every byte change enters pi-lens
|
|
80
|
+
dispatch: `handleTurnEnd` returns before the policy loop when no file was
|
|
81
|
+
touched, and a commit can arrive with no turn end after the change at all.
|
|
82
|
+
|
|
83
|
+
Second state table, axes: did a turn end judge this record · how the bytes moved
|
|
84
|
+
since the verdict · is the durable record present.
|
|
85
|
+
|
|
86
|
+
| # | judged | bytes since verdict | record | gate | case |
|
|
87
|
+
|---|---|---|---|---|---|
|
|
88
|
+
| 1 | yes | unchanged | cleared | allow | `clears the latch and the record when every blocker on the file is marked` |
|
|
89
|
+
| 2 | yes | unchanged | present | block | `keeps the gate closed when only two of four blockers are marked` |
|
|
90
|
+
| 3 | yes, then an unrelated edit | unchanged | cleared | allow | `stays clear when the NEXT turn edits an unrelated clean file` |
|
|
91
|
+
| 4 | yes, then a dispatch of the same file | changed by dispatch | rewritten | block | `re-latches when a NEW blocker is dispatched on the same file after the mark` |
|
|
92
|
+
| 5 | no (no-file turn end) | unchanged | cleared | allow | `still allows the commit after an unjudged turn end that changed nothing` |
|
|
93
|
+
| 6 | no (no-file turn end) | changed outside dispatch | cleared | **unknown** | `keeps the gate closed when the suppressed file's bytes moved outside dispatch` |
|
|
94
|
+
| 7 | no turn end at all after the change | changed outside dispatch | cleared | **unknown** | same case, and `does not allow the commit after an external change to a marked file` (pi host) |
|
|
95
|
+
| 8 | yes, after an outside change | changed outside dispatch | re-rendered | block | the freshness sweep demotes the record before the policy loop, so it is never a survivor and the verdict is cleared |
|
|
96
|
+
| 9 | yes | unverifiable (no content baseline) | either | **unknown** | `keeps the gate closed for a suppressed record with no content baseline` |
|
|
97
|
+
|
|
98
|
+
One clause, added to the rule above rather than replacing it: **a suppression
|
|
99
|
+
verdict is a statement about BYTES, so it stands only while the file still
|
|
100
|
+
matches the content baseline the record carries** (`recordedHash`, the #2982
|
|
101
|
+
baseline the freshness sweep already compares against — and which the sweep
|
|
102
|
+
guarantees matched at stamping time, since a self-drifted record is demoted
|
|
103
|
+
before the policy loop can suppress it). The gate — the one reader that can let
|
|
104
|
+
a verdict OPEN a commit — confirms that before allowing, and an unverifiable
|
|
105
|
+
record (no baseline) fails closed. Rejected alternatives, from the table:
|
|
106
|
+
|
|
107
|
+
- a TURN generation on the stamp: reds cell 3, which is the defect #3248 is
|
|
108
|
+
about (an unrelated edit must not re-block).
|
|
109
|
+
- invalidating verdicts at every unjudged turn end (the review's suggestion):
|
|
110
|
+
leaves cells 7 and 9 open, because no turn end runs between the change and the
|
|
111
|
+
commit — and reds cell 5, re-blocking a commit after a read-only turn.
|
|
112
|
+
Mutation P1 in PR #3283 quotes both.
|
|
113
|
+
- clearing the verdict in the freshness sweep only: covers cell 8, which the
|
|
114
|
+
existing rewrite already covers, and none of 6, 7 or 9.
|
|
115
|
+
|
|
116
|
+
### Amendment 3 (#3282): the record's attribution contract
|
|
117
|
+
|
|
118
|
+
Written before the first edit of #3282's fix. `blockerContent` is the rendered
|
|
119
|
+
blocker text the gate may quote back; it is NOT the gate's source of truth about
|
|
120
|
+
which files block — `blockingFiles` is (`clients/git-guard.ts:31`). The parse of
|
|
121
|
+
that text exists for one consumer, `syncGitGuardRecord`'s
|
|
122
|
+
`clearedLastKnownBlocker`, which drops `blockerContent` when the file that just
|
|
123
|
+
dispatched clean owns everything left in it.
|
|
124
|
+
|
|
125
|
+
Writers of `blockerContent`, re-verified at `f8fef5f72`:
|
|
126
|
+
|
|
127
|
+
| Actor | Axis / timing | Shape it writes | Site |
|
|
128
|
+
|---|---|---|---|
|
|
129
|
+
| `syncGitGuardRecord` | per edit, after each dispatch | `<path>: <formatDiagnostics(…,"blocking").trim()>` per live entry, joined `"\n"` | `clients/git-guard.ts:1013` |
|
|
130
|
+
| turn-end composer, main path | per turn, after the policy | `capTurnEndMessage(blockerParts.join("\n\n"))` | `clients/runtime-turn.ts:4291` |
|
|
131
|
+
| turn-end composer, dedupe path | per turn, duplicate signature | the same expression | `clients/runtime-turn.ts:4234` |
|
|
132
|
+
| `mergeGitGuardTestFailure` / `clearGitGuardTestFailure` | test-runner edges | pass `existing.blockerContent` through | `clients/git-guard.ts:1068`, `:1113` |
|
|
133
|
+
| `resyncGitGuardAfterInlinePolicy` | per turn, before the composer | nothing durable — the latch only | `clients/git-guard.ts:919` |
|
|
134
|
+
|
|
135
|
+
Neither of the two real writers emits one line per file, and `blockerParts` is
|
|
136
|
+
multi-lane: only `Unresolved from this turn — <path>:` sections
|
|
137
|
+
(`clients/runtime-turn.ts:1085`) name a file at all — knip (`:2147`), trivy
|
|
138
|
+
CRITICAL (`:2141`), the secrets lane (`:2099`) and cascade (`:1340`) do not.
|
|
139
|
+
|
|
140
|
+
> **Contract.** `blockerContent` is a sequence of per-file blocker SECTIONS. A
|
|
141
|
+
> section is opened by an attribution line at column 0 — `<path>: <text>` or
|
|
142
|
+
> `Unresolved from this turn — <path>[ (suppressed by disposition: N
|
|
143
|
+
> finding(s))]:` — and every following line up to the next attribution line or
|
|
144
|
+
> the next ZERO-LENGTH line is its rendered body, attributing nothing. The text
|
|
145
|
+
> is attributable iff at least one line opens a section, no line precedes the
|
|
146
|
+
> first section, and every section's file is named in `blockingFiles`. A clean
|
|
147
|
+
> per-file dispatch may clear the text iff every section in it is that file's.
|
|
148
|
+
>
|
|
149
|
+
> Zero sections is UNATTRIBUTED, never clean (#3287 round 2, HIGH-3287-1): text
|
|
150
|
+
> that is non-empty but all-blank opens nothing, and reading that as "nothing
|
|
151
|
+
> left to attribute" let a clean dispatch of an unrelated file delete a record
|
|
152
|
+
> whose `blockingFiles` named a different file. A record with no blocker text at
|
|
153
|
+
> all never reaches the parse — `syncGitGuardRecord` gates on
|
|
154
|
+
> `existing?.blockerContent` being truthy — so the genuine clean case is decided
|
|
155
|
+
> before this contract applies.
|
|
156
|
+
|
|
157
|
+
One-directional on purpose. A bijection between sections and `blockingFiles` was
|
|
158
|
+
#3282's second cause: the composer persists `blockingFiles: affectedFiles`
|
|
159
|
+
(`:4292`) — every file the turn touched plus every cascade neighbour with
|
|
160
|
+
diagnostics — so any turn that edited a clean file alongside a blocking one was
|
|
161
|
+
judged untrusted for the rest of the session. The extra direction guarded
|
|
162
|
+
nothing either: the clear now asks about the sections themselves, so a
|
|
163
|
+
`blockingFiles` entry with no section, a duplicate section and a duplicate
|
|
164
|
+
`blockingFiles` entry cannot make it drop a blocker another file owns. Requiring
|
|
165
|
+
`blockingFiles` to be NON-EMPTY is subsumed for the same reason once at least
|
|
166
|
+
one section is required, so that clause is gone too: an empty provenance list
|
|
167
|
+
cannot own a section.
|
|
168
|
+
|
|
169
|
+
Fail direction (AGENTS.md shape 48): an unattributable line keeps `unknown`. The
|
|
170
|
+
harm it prevents is a live CVE or leaked secret being cleared out of the gate by
|
|
171
|
+
a clean dispatch of the file beside it; the harm it causes is a refused commit
|
|
172
|
+
whose stated remedy ("re-run pi-lens checks or start a fresh session") does not
|
|
173
|
+
clear it, which is why the reason must be reachable only for text no writer
|
|
174
|
+
produces for a single file. `TurnEndFindingsCache` is unchanged by #3282 as
|
|
175
|
+
well: parser-side only, no field added, no writer altered.
|
|
176
|
+
|
|
177
|
+
## Consequences
|
|
178
|
+
|
|
179
|
+
The latch cannot be treated as a read-only projection of the blocker map.
|
|
180
|
+
Old-record parsing, the latch-first consumer, and the paired resynchronization
|
|
181
|
+
remain strict consumers of the next fix. `TurnEndFindingsCache` is unchanged by
|
|
182
|
+
this slice — the verdict is in-memory only, so a 4.2.1 commit hook reads records
|
|
183
|
+
written after a policy pass with no new field.
|
|
184
|
+
|
|
185
|
+
The gate now reads the blocker map itself, not only the latch memo: one content
|
|
186
|
+
hash per suppressed record on a commit/push attempt, and nothing when no verdict
|
|
187
|
+
is live. `logDecision`'s existing `git-guard` `decision` record carries the new
|
|
188
|
+
`inline_policy_stale` reason category with the file and tier.
|
|
189
|
+
|
|
190
|
+
Clearing the latch exposed the gate's SECOND reader, which had its own defect:
|
|
191
|
+
`hasCompleteBlockingProvenance` parsed `blockerContent` line by line while both
|
|
192
|
+
writers of that field render multi-line blocker text, so the gate answered
|
|
193
|
+
`blocking_provenance_untrusted` once a session had recorded any blocker —
|
|
194
|
+
measured on `origin/master`, independent of dispositions, filed as #3282 and
|
|
195
|
+
fixed under amendment 3 above. The witness golden's turns 2 and 3 flip from that
|
|
196
|
+
reason to `block: false`, as this slice committed them to do.
|
|
197
|
+
|
|
198
|
+
## Links
|
|
199
|
+
|
|
200
|
+
- Catalog shape: `AGENTS.md` shape 24.
|
|
201
|
+
- Issue: #3248.
|
|
202
|
+
- PR: #3254, “The git-guard latch” remainder and writers-by-axis table.
|
|
203
|
+
- Follow-up: #3282 (record provenance parse) — amendment 3.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# ADR 0004: fold dispositions onto the policy seam
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Accepted — 2026-09-23
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
The #1892 brief found freshness and disposition to be different gates with
|
|
10
|
+
different failure directions. The #3247 and #3254 slices showed that missing
|
|
11
|
+
turn-end disposition stages are existing-surface wiring gaps, not proof that a
|
|
12
|
+
new findings store is required.
|
|
13
|
+
|
|
14
|
+
## Decision
|
|
15
|
+
|
|
16
|
+
Fold disposition application onto `applyFindingPolicy` and its existing pushed
|
|
17
|
+
finding-policy seam. Do not introduce a new findings store until #1892 has a
|
|
18
|
+
measured structured-store slice with a deletion sweep.
|
|
19
|
+
|
|
20
|
+
## Consequences
|
|
21
|
+
|
|
22
|
+
Existing producers keep their freshness, identity, and coverage contracts while
|
|
23
|
+
delivery surfaces converge on the shared policy. A future store migration must
|
|
24
|
+
measure the request and delete parallel identity/count logic in the same slice.
|
|
25
|
+
The measured host-adapter population is two: the pi extension adapter activates
|
|
26
|
+
through `activateExtension` and assembles `HostPorts` in `index.ts:725-767`, and
|
|
27
|
+
the MCP server imports the host-neutral facade and serves requests in
|
|
28
|
+
`mcp/server.ts:40-45,1881`. `LensEngine` (`clients/lens-engine.ts:2`) and
|
|
29
|
+
`HostPorts` (`clients/host-ports.ts:10`) are the shared internal engine/ports
|
|
30
|
+
seam, not additional adapters. Because the heuristic says two adapters are a
|
|
31
|
+
real seam, #1358 (the ports layer) is **re-assess**, not held on a one-adapter
|
|
32
|
+
claim.
|
|
33
|
+
|
|
34
|
+
## Links
|
|
35
|
+
|
|
36
|
+
- Catalog shapes: `AGENTS.md` shapes 10 and 26.
|
|
37
|
+
- Issue/brief: #1892, 2026-09-22 brief.
|
|
38
|
+
- PRs: #3247 and #3254.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# ADR 0005: tool availability is one seam by enforcement
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Accepted — 2026-09-23
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
The availability policy and `createAvailabilityLatch` already define the shared
|
|
10
|
+
taxonomy, but nine stores answer the same “can this tool run, at what path?”
|
|
11
|
+
question. Migrating all stores at once is not justified by the evidence.
|
|
12
|
+
|
|
13
|
+
## Decision
|
|
14
|
+
|
|
15
|
+
Enforce one seam with a registry ratchet. A change touching a registered store
|
|
16
|
+
migrates that store onto the shared policy in the same change and removes it
|
|
17
|
+
from the registry; the registry never grows.
|
|
18
|
+
|
|
19
|
+
## Consequences
|
|
20
|
+
|
|
21
|
+
The population can shrink without speculative migration. The runner/formatter
|
|
22
|
+
mid-session uninstall divergence remains the first red slice under #1894.
|
|
23
|
+
|
|
24
|
+
## Links
|
|
25
|
+
|
|
26
|
+
- Catalog shape: `AGENTS.md` shape 52.
|
|
27
|
+
- Issue: #1894, rewritten 2026-09-22.
|
|
28
|
+
- Catalog PR: #3253.
|
|
29
|
+
|