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

Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:13ovxm2u7m is past its budget: trevato/forge: "every instruction names a script or a tool that exists" failed on 7 pulls in the last hour — the lane's… #13188

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/13172-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 5 commits fork 1 thread · 1 unresolved

  • Merged. scout/13172-sentinel-shared-01m23vygyffx5hg2f5vm8r74 was merged into main as 7fc88a6.

Review

Sign in to review this change.
2 files changed +45 −14
test/deadends.test.ts +17 −7
@@ -48,6 +48,7 @@ import {
4848 type World,
4949 } from "./support/deadends.ts";
5050 import { runJob, type DeadendsDone, type DeadendsJob } from "./support/deadends-worker.ts";
51 import { toolMentions } from "./support/deadends-words.ts";
5152
5253 quietLogs();
5354
@@ -87,11 +88,13 @@ const keyOfProblem = (p: Problem): string =>
8788 * removed the day it is fixed: the test says so when it no longer happens.
8889 */
8990 const KNOWN: ReadonlySet<string> = new Set<string>([
90 // Product decision: a signed-in person who opens /signin is shown the form and its doors (sign-up, "start your own forge"), which are no use to them.
91 // Product decision: a signed-in person who opens /signin is shown the form and its doors
92 // (sign-up, "start your own forge"), which are no use to them.
9193 "wall /signin -> /signup (sign-in wall via /signup for a signed-in viewer)",
9294 "wall /signin -> /signup (403 for a signed-in viewer)",
9395 "anchor /signin -> /#yours",
94 // Product decision: the emailed recovery link is the only way back, and carries no return address; the form that asks for it cannot either.
96 // Product decision: the emailed recovery link is the only way back, and carries no return
97 // address; the form that asks for it cannot either.
9598 'return-address /recover form "form" -> /recover drops the return address',
9699 "return-address /recover form /recover drops the return address",
97100 ]);
@@ -103,7 +106,8 @@ const noted = (key: string, where: string) => {
103106
104107 function judgeCrawl(seed: number, findings: readonly Finding[]): void {
105108 for (const f of findings) {
106 // An entry the viewer is not meant to open (a private repository, a page for another role) is not a link.
109 // An entry the viewer is not meant to open (a private repository, a page for another role) is
110 // not a link.
107111 if (f.from === "(entry)") continue;
108112 noted(
109113 keyOfFinding(f),
@@ -231,12 +235,12 @@ test("the findings are the known ones, and every known one still happens", async
231235 if (!LONG) expect([...KNOWN].filter((k) => !seen.has(k))).toEqual([]);
232236 }, 300_000);
233237
234 /** Instruction strings that name a thing that is not there, as found; each is a sentence to fix or a false reading to teach the scan. */
238 /**
239 * Instruction strings that name a thing that is not there, as found; each is a sentence to fix or a
240 * false reading to teach the scan.
241 */
235242 // Named by file, not line: an edit above them elsewhere in the file must not turn this red.
236243 const KNOWN_WORDS: readonly string[] = [
237 // The scan reads "the MCP tool spawn" and "the one tool open without a token" as a tool called "the" and "one".
238 "tool the at src/core/roles.ts",
239 "tool one at src/http/mcp.ts",
240244 // Dead: a preview's sample app runs a file its repository does not hold.
241245 "script src/server.ts at src/spawn/preview-seed.ts",
242246 ];
outdated

Dead now: toolMentions filters "the" and "one", so these two entries ("tool the at src/core/roles.ts", "tool one at src/http/mcp.ts") can never match. Delete them and the comment above them. Keep only the entry for the dead sample app. Also add a toolMentions assertion for "the one tool" so the removal is covered.

@@ -247,3 +251,9 @@ test("every instruction names a script or a tool that exists", () => {
247251 .map((r) => `${r.kind} ${r.target} at ${r.at}`);
248252 expect(dead.filter((d) => !KNOWN_WORDS.includes(d.replace(/:\d+$/, "")))).toEqual([]);
249253 });
254
255 test("a sentence that says 'this tool' names no tool at all", () => {
256 expect(toolMentions("use this tool to open it")).toEqual([]);
257 expect(toolMentions("the one tool open without a token")).toEqual([]);
258 expect(toolMentions("call the `report` tool")).toEqual(["report"]);
259 });
test/support/deadends-words.ts +28 −7
@@ -40,7 +40,10 @@ function walk(dir: string, out: string[] = []): string[] {
4040 }
4141
4242 /** Words that make a sentence an instruction to a person or an agent. */
43 /** The quoted and template segments of one line, found by a scan (a regex over a long line backtracks for minutes). */
43 /**
44 * The quoted and template segments of one line, found by a scan (a regex over a long line
45 * backtracks for minutes).
46 */
4447 function literals(line: string): string[] {
4548 if (line.length > 700) return [];
4649 const out: string[] = [];
@@ -75,14 +78,35 @@ function routeExists(path: string): boolean {
7578 )
7679 return true;
7780 }
78 // A path under a literal folder the forge serves from disk (`/assets/`, `/docs/`, `/.well-known/`) or a repo path that names a user's own repository.
81 // A path under a literal folder the forge serves from disk (`/assets/`, `/docs/`,
82 // `/.well-known/`) or a repo path that names a user's own repository.
7983 return false;
8084 }
8185
8286 const HEADS = new Set([...pageRouter.literalHeads(), ...apiRouter.literalHeads(), "forges", "settings", "admin"]);
8387 const KNOWN_PREFIX = /^\/(?:assets|\.well-known|docs|git|mcp|_plat|-)\b/;
8488
85 /** Scan every source file under `src/` for instruction-shaped strings and resolve what they name. */
89 /**
90 * Words a sentence puts before "tool" that are not a tool's name ("use this tool", "the one
91 * tool").
92 */
93 const NOT_A_TOOL = new Set(["this", "that", "the", "one", "any", "each", "every", "its", "your", "same", "other", "new", "mcp", "which", "whose"]);
94
95 /**
96 * The tool names one sentence points at: "the `report` tool", "use start tool"; never "use this
97 * tool".
98 */
99 export function toolMentions(text: string): string[] {
100 const out: string[] = [];
101 for (const m of text.matchAll(/\b(?:the |use |call |with )`?([a-z][a-z_]{2,30})`? (?:tool|MCP tool)\b/g)) {
102 if (!NOT_A_TOOL.has(m[1]!)) out.push(m[1]!);
103 }
104 return out;
105 }
106
107 /**
108 * Scan every source file under `src/` for instruction-shaped strings and resolve what they name.
109 */
86110 export function instructions(): Instruction[] {
87111 const out: Instruction[] = [];
88112 for (const file of walk(join(ROOT, "src"))) {
@@ -120,10 +144,7 @@ export function instructions(): Instruction[] {
120144 status: existsSync(join(ROOT, target)) ? "ok" : "dead",
121145 });
122146 }
123 for (const m of text.matchAll(
124 /\b(?:the |use |call |with )`?([a-z][a-z_]{2,30})`? (?:tool|MCP tool)\b/g,
125 )) {
126 const target = m[1]!;
147 for (const target of toolMentions(text)) {
127148 out.push({
128149 at,
129150 text: text.slice(0, 120),

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs