fix(flaky): coverage-audit wc -c and bounded-display credit, tpa-broken Aside absence, register docsync fixture (GSTA-240 follow-up)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
garrytanandcapy-ai[bot] committed 2026-11-01 16:17:51 +00:00
1 parent 091b5113e0
commit c3baa46815
9 files changed
+196 -11

No files matched your search

+22 -9
View File
@@ -140,8 +140,8 @@ function stagePieces(stage: string[], scope: ShellScope, alone: boolean): Piece[
}
if (name === 'grep' || name === 'ls') return [unknown()];
if (text === 'pwd' || text === 'wc -l') return [unknown(1, 1)];
if (name === 'wc' && args[0] === '-l' && args.length > 1) {
// One count line per literal in-cwd file, plus a total for several.
if (name === 'wc' && (args[0] === '-l' || args[0] === '-c') && args.length > 1) {
// One line or byte count line per literal in-cwd file, plus a total for several.
if (args.slice(1).some(operand => !scopedFile(operand, scope))) return undefined;
const lines = args.length - 1 + (args.length > 2 ? 1 : 0);
return [unknown(lines, lines)];
@@ -254,14 +254,27 @@ function shellReads(command: unknown, output: unknown, scope: ShellScope): Set<s
if (anchor.kind !== 'label') {
// Output of an exact line count (wc -l over literal in-cwd files, pwd)
// places the next run exactly that many lines after the cursor.
if (min !== max) return new Set();
let start = cursor;
for (let line = 0; line < min; line++) {
const end = out.indexOf('\n', start);
if (end < 0) return new Set();
start = end + 1;
if (min !== max) {
// Bounded output (grep | head) may end on any line in its bounds, so
// credit only when exactly one line after the cursor starts a
// complete copy of the run; the bounds are checked below.
if (!Number.isFinite(max)) return new Set();
const pattern = new RegExp(run.map(pieceSource).join(''), 'y'), copies: number[] = [];
for (let start = cursor; start <= out.length; start = out.indexOf('\n', start) + 1 || out.length + 1) {
pattern.lastIndex = start;
if (pattern.test(out)) copies.push(start);
}
if (copies.length !== 1) return new Set();
starts = copies;
} else {
let start = cursor;
for (let line = 0; line < min; line++) {
const end = out.indexOf('\n', start);
if (end < 0) return new Set();
start = end + 1;
}
starts = [start];
}
starts = [start];
} else {
let found = anywhere(anchor.text);
if (owns) {
+1
View File
@@ -121,6 +121,7 @@ export const FREE_FIXTURES: Readonly<Record<string, readonly string[]>> = {
'test/fixtures/docsync-replay/37237194905-late-result-calls.json': ['test/docsync-authority.test.ts'],
'test/fixtures/docsync-replay/37239016858-completion-native.json': ['test/docsync-nested-writes.test.ts'],
'test/fixtures/docsync-ship-receipt-not-found-public.json': ['test/docsync-lifecycle-interface.test.ts'],
'test/fixtures/docsync-spawned-missing-section-public.json': ['test/ship-document-release-dispatch.test.ts'],
'test/fixtures/docsync-store-38969924945-bash.json': ['test/docsync-command-grammar.test.ts'],
'test/fixtures/docsync-two-attempts-public.json': ['test/ship-document-release-dispatch.test.ts'],
'test/fixtures/dx-manual-handoff-ao.json': ['test/plan-count-completion.test.ts'],
+10 -2
View File
@@ -34,14 +34,22 @@ export function letteredOptions(text: string): string[] {
return options;
}
/**
* A statement that Aside is absent, the probe's result, names no Aside drive: "(Recommended, since Aside isn't
* available)" on the gstack drive option (gate 41246728073). Only Aside as the subject of a negated availability
* predicate is discounted, so any other Aside mention in the option still counts.
*/
const ASIDE_ABSENCE = /\bAside(?: browser| app)?\s+(?:(?:is|was)(?:n['’]t|\s+not)\s+(?:available|installed|detected|running|ready|reachable)|is\s+unavailable)\b/gi;
/** Inspect lettered consent options, not narration that quotes an unavailable option. */
export function asideDriveOptions(text: string): string[] {
return letteredOptions(text).filter(option => {
const currentOffer = option.replace(
const named = option.replace(ASIDE_ABSENCE, '');
const currentOffer = named.replace(
/\b(?:I|we)(?:['’]ll| will) (?:re[- ]?ask|ask again)(?: (?:you|this question))? with (?:the )?(?:"[^"]+"|“[^”]+”|[\w -]+?) option(?: included)?\b/gi,
'',
);
return /\bAside\b/.test(option) && (/\b(?:drive|driving|browse|browsing|navigate|click)\b/i.test(currentOffer)
return /\bAside\b/.test(named) && (/\b(?:drive|driving|browse|browsing|navigate|click)\b/i.test(currentOffer)
|| /\bI(?:['’]ll| will)? (?:do|handle|create|complete) (?:it|this)\b/i.test(currentOffer));
});
}