test: delete tests of dead eval code (A)

- A1: the retired Eng lexical oracle (evaluateEngSeedCoverage,
  isEngSeedDecisionAUQ), the completion-handoff detector and the retained
  corpus had no paid caller since v1.87.6; delete their 26 replay files,
  ~2.6k helper LOC and fixtures, and the dead blocks in 8 mixed files
  (live hasNativePlanTerminal / batching assertions stay).
- A2: dead viewport approvers in autoplan-artifact-permission and their 11
  replay files + fixtures; recorder/launcher cases stay.
- A3: never-wired oracles and seeders (autoplan-phase-order,
  eng-finding-fixture, ceo-paired-fixture, design-ui-scope,
  plan-skill-completion, pty-current-screen, required-reads,
  transcript-section-logger); plan-seed-submission now decodes through the
  production createPtyScreen; section manifests name their actual guard.
- A4: zero-reference helper exports, plus execGit and invokeAndObserve
  found by the reachability pass.
- 52 fixtures orphaned by the deletions; touchfile and selection-table
  entries for every deleted path.
This commit is contained in:
garrytan committed 2026-09-29 05:09:36 +00:00
1 parent 5ec930d569
commit 5d032ef299
156 files changed
+107 -32055

No files matched your search

-88
View File
@@ -97,91 +97,3 @@ export function createAutoplanEditDigest(file: string, removed: string, added: s
})};
return digest;
}
/** Require complete numbered rows and the marker column of this exact diff. */
export function matchesAutoplanDigestRows(rows: string[], before: Buffer, digest: AutoplanEditDigest,
allowReplacementReset = false): boolean {
if (!validAutoplanEditDigest(digest) || sha(before) !== digest.beforeSHA256) return false;
const fullRow = /^( {0,3})([1-9]\d*) ([+ -])(.*)$/;
const first = rows.findIndex(row => fullRow.test(row));
const leading = first > 0 ? rows.slice(0, first) : [];
const chunks: Array<{kind: string; text: string; line: number}> = [];
let column: number | undefined, previousLine = 0;
let removedStart: number | undefined, replacementReset = false;
for (const row of leading.length ? rows.slice(first) : rows) {
const full = fullRow.exec(row);
if (full) {
const line = Number(full[2]), markerColumn = full[1]!.length + full[2]!.length + 1;
const kind = full[3]!, previousKind = chunks.at(-1)?.kind;
// The complete native replacement panel numbers the old block first,
// then restarts additions at that block's first line. Only the caller
// that owns this full panel opts in; all row hashes still must match.
const reset = allowReplacementReset && !replacementReset && previousKind === '-' && kind === '+' && line === removedStart;
if (!Number.isSafeInteger(line) || (line < previousLine && !reset) ||
(column !== undefined && column !== markerColumn)) return false;
if (allowReplacementReset) {
if ((kind === '-' || kind === '+') && kind === previousKind && line !== previousLine + 1) return false;
if (kind === '-' && previousKind !== '-') {
if (removedStart !== undefined || chunks.some(c => c.kind === '+')) return false;
removedStart = line;
}
if (previousKind === '-' && kind !== '-' && !reset) return false;
if (kind === '+' && previousKind !== '+' && removedStart !== undefined && !reset) return false;
if (reset) replacementReset = true;
}
column = markerColumn; previousLine = line;
chunks.push({kind, text: full[4]!, line});
} else {
if (column === undefined || !row.startsWith(' '.repeat(column))) return false;
const last = chunks.at(-1), kind = row[column];
if (!last || kind !== last.kind) return false;
last.text += row.slice(column + 1);
}
}
const originals = new Set(before.toString('utf8').split('\n').map(autoplanEditLineHash));
if (allowReplacementReset) {
const oldRows = chunks.filter(c => c.kind !== '+').map(c => autoplanEditLineHash(c.text));
const newRows = chunks.filter(c => c.kind !== '-').map(c => autoplanEditLineHash(c.text));
const starts = (rows: string[], hashes: string[]) => rows.flatMap((_, index) =>
hashes.every((hash, offset) => rows[index + offset] === hash) ? [index] : []);
const oldStarts = starts(oldRows, digest.oldLineHashes), newStarts = starts(newRows, digest.newLineHashes);
if (oldStarts.length !== 1 || newStarts.length !== 1 || oldStarts[0] !== newStarts[0]) return false;
const originalLines = before.toString('utf8').split('\n').map(autoplanEditLineHash);
const delta = digest.newLineHashes.length - digest.oldLineHashes.length;
let oldLine = chunks[0]!.line, newLine = oldLine, added = false;
for (const row of chunks) {
if (row.kind !== '+') {
if (row.line !== oldLine + (added ? delta : 0) || autoplanEditLineHash(row.text) !== originalLines[oldLine - 1]) return false;
oldLine++;
}
if (row.kind !== '-' && row.line !== newLine++) return false;
if (row.kind === '+') added = true;
}
}
let authenticatedClip = false;
if (leading.length) {
const c = digest.clippedAdditions, next = chunks[0];
if (!c || c.status !== 'complete' || column === undefined || !next || chunks.length < 2 ||
leading.length > MAX_SUFFIX_SCALARS || leading.some(row =>
!row.startsWith(' '.repeat(column)) || row[column] !== '+')) return false;
const fragment = leading.map(row => row.slice(column + 1)).join('').replace(/\s/g, '');
const length = Array.from(fragment).length, record = c.lines.find(row => row.line === next.line - 1);
if (!record || !length || length > MAX_SUFFIX_SCALARS || record.nextLineHash !== autoplanEditLineHash(next.text) ||
originals.has(record.lineHash) || digest.oldLineHashes.includes(record.lineHash) ||
record.suffixHashes[length - 1] !== suffixHash(record.line, record.lineHash, record.nextLineHash, fragment)) return false;
const beforeLines = before.toString('utf8').split('\n');
if (chunks.some((row, index) => {
if (row.line !== next.line + index || row.kind === '-') return true;
const relative = row.line - c.startLine, hash = autoplanEditLineHash(row.text);
if (relative < digest.newLineHashes.length) return digest.newLineHashes[relative] !== hash;
const originalIndex = row.line - (digest.newLineHashes.length - digest.oldLineHashes.length) - 1;
return row.kind !== ' ' || originalIndex < 0 || originalIndex >= beforeLines.length ||
autoplanEditLineHash(beforeLines[originalIndex]!) !== hash;
})) return false;
authenticatedClip = true;
}
return chunks.length >= 2 && (authenticatedClip || chunks.some(c => c.kind === '+' && /\S/.test(c.text) &&
!originals.has(autoplanEditLineHash(c.text)) && !digest.oldLineHashes.includes(autoplanEditLineHash(c.text)))) &&
chunks.every(c => c.kind === '+' ? digest.newLineHashes.includes(autoplanEditLineHash(c.text)) :
originals.has(autoplanEditLineHash(c.text)) && (c.kind !== '-' || digest.oldLineHashes.includes(autoplanEditLineHash(c.text))));
}