Files
gstack/test/fixtures/design-floor-focus-picker.ts
Garry Tanandcapy-ai[bot] 6f7488a70f v1.91.185.0 fix(evals): plan-design focus rating in plain words, docsync own-call rule where --help is named, floor Create crop and 0D menu (GSTA-65) (#3358)
* fix(evals): plan-design focus rating in plain words, docsync own-call rule at the candidate --help, floor Create menu cropped at its rule (GSTA-65)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* fix(evals): floor actor answers Step 0D's focus menu in the template's own words (GSTA-65)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* fix(evals): floor actor identifies Step 0D's focus menu by its structure, not one wording (GSTA-65)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* docs(changelog): GSTA-65 paid-side flaky repairs under [Unreleased]

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* fix(evals): the 0D focus picker moves into plan-design-finding-floor's owned fixture; no harness series reset (GSTA-65)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* test(evals): the 0D picker rows join the floor case's owner test (test-of-test ratchet)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* v1.91.185.0 fix(evals): plan-design focus rating in plain words, docsync own-call rule, floor Create crop and 0D menu (GSTA-65) (#3358)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
2026-10-23 18:35:59 +00:00

36 lines
2.7 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Case-owned setup answer for test/skill-e2e-plan-design-finding-floor.test.ts.
* It lives with the case's fixtures so a change to it starts that case's own
* pass-rate series instead of every case's (scripts/eval-trial-series.ts).
*/
import type { NativePlanQuestionCall } from '../helpers/plan-count-transcript';
/**
* The seed declares "Design: review all seven dimensions" for the pending Step 0D
* focus menu. Pick its single all-seven option only when every other option
* narrows the review and the brief approves no product action.
*/
export function pickDesignFocusAll(q: NativePlanQuestionCall['questions'][number]): number | null {
if (q.multiSelect || q.options.length < 2 || q.options.length > 4 || new Set(q.options.map(o => o.label)).size !== q.options.length) return null;
const text = q.question.trim();
const unquote = (value: string) => value.replace(/`+[^`]*`+|"[^"\n]*"|“[^”\n]*”|‘[^’\n]*’/g, '');
const sources = [...text.matchAll(/^Project\/branch\/task:\s*([^\n]+)$/gm)].map(match => unquote(match[1]!));
const explanatory = unquote([text, ...q.options.flatMap(o => [o.label, o.description ?? ''])].join('\n')).replace(/[✅❌*]/g, '');
// The menu is identified by its structure, not one wording: a title or question about the
// focus ("Review all 7 design dimensions, or focus?", census 36597762183; "Want me to focus on
// specific areas instead?" and "Review focus for the landing page plan", GSTA-65 focused
// trials), one all-seven option, and only narrowing alternatives.
const sentences = text.split(/(?<=[.!?])\s+|\r?\n/);
const title = text.split(/\r?\n/, 1)[0]!.replace(/^D[1-9]\d*\s*[—–:-]\s*/i, '');
const asks = sentences.filter(sentence => sentence.includes('?'));
if (![title, ...asks].some(line => /\bfocus\b/i.test(line)) ||
sources.length !== 1 || !/\b(?:PLAN\.md|Marketing landing page)\b/i.test(sources[0]!) ||
/\b(?:historical|archived|quoted|example|foreign|other|another|previous)\b/i.test(sources[0]!) ||
(text.match(/\?/g)?.length ?? 0) > 1 || /```|~~~|^\s*>/m.test(text) ||
/(?:^|[.!?;:\n]|\b(?:and|while))\s*(?:(?:also|please|then|now)\s+)*(?:approv(?:e|ing)|deploy(?:ing)?|implement(?:ing)?|ship(?:ping)?|merg(?:e|ing)|delet(?:e|ing))\b/im.test(explanatory)) return null;
const labels = q.options.map(o => o.label.trim().replace(/^[A-Z][).:]\s+/i, '').replace(/\s*\(recommended\)\s*$/i, ''));
const all = labels.flatMap((label, i) => /^(?:Review )?All (?:7|seven) (?:design )?(?:dimensions|passes|areas)$/i.test(label) ? [i + 1] : []);
if (all.length !== 1 || labels.some((label, i) => i + 1 !== all[0] && !/^(?:Only|Focus)\b|\bonly$/i.test(label))) return null;
return all[0]!;
}