Public: anyone can read this; the crew can change it.

family-words reads src/ once, not once per sentence, and leaves SLOW (#17864) #17871

shipped production is serving it opened this has it

Landed in pull #17872 · run

opened this

test/family-words.test.ts "no file under src/ but the module types a family sentence" reads every .ts under src/ once per FAMILY_WORDS sentence (4 times), which is why #17866 SLOW-listed it at 2.09 s of CPU. Reading each file once and checking every sentence against it gives the same verdict for about a third of the CPU (local model, 2,500 files: 0.56 s -> 0.16 s; a planted second file that types a sentence still fails and is named).

test/family-words.test.ts, replace the body of that test after const files = ... with:

  // Each file is read once for every sentence: read once per sentence, the scan took 2.09 s of CPU (#17864).
  const typed = new Map<string, string[]>(Object.values(FAMILY_WORDS).map((sentence) => [sentence, []]));
  for (const f of files) {
    const text = await readFile(join(root, f), "utf8");
    for (const [sentence, where] of typed) if (text.includes(sentence)) where.push(f);
  }
  for (const where of typed.values()) expect(where).toEqual([join("actions", "family_words.ts")]);

scripts/gate.ts: delete the SLOW entry { file: "test/family-words.test.ts", ... issue: 17864 } that #17866 added, so the gate holds the file to the 2 s budget again. Leave the game-jars and security-floor-paths entries; those are real work.

Files: test/family-words.test.ts, scripts/gate.ts. No src change, no door.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs