Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

gui tests: a plugin's words are its own when said as words (#3897)

JoeyWu-tech6f0e40572c72
diff --git a/docs/subsystems/plugin-runtime.md b/docs/subsystems/plugin-runtime.md
index 720ce969e..165446bf4 100644
--- a/docs/subsystems/plugin-runtime.md
+++ b/docs/subsystems/plugin-runtime.md
@@ -101,7 +101,9 @@ Each page moves in a commit of its own, whole: its code into
says from i18n.js into its `i18n.js` (a key app.js, another page, index.html
or Go also says stays in i18n.js). It stays so after: `i18n-keys`' "a
plugin's words are its own" fails when anything outside a plugin's folder
-says one of its words, which goes back to i18n.js.
+says one of its words, which goes back to i18n.js. A word inside a longer
+one doesn't count: a comment's "fetchClaudeRuns asks" doesn't say "Runs
+as" (#3897).
- **Sessions** (`plugins/sessions`, `Client: i18n.js, sessions.css,
client.js`): the page that was `sessions.js`, its markup all drawn by its
diff --git a/internal/gui/tests/i18n-keys.test.cjs b/internal/gui/tests/i18n-keys.test.cjs
index ed21b1bb4..f1499b64e 100644
--- a/internal/gui/tests/i18n-keys.test.cjs
+++ b/internal/gui/tests/i18n-keys.test.cjs
@@ -50,12 +50,22 @@ test("a plugin's words are its own", () => {
}
};
walk(repo);
+ // said as words, not inside longer ones: a comment's "fetchClaudeRuns
+ // asks" doesn't say Library's "Runs as" (#3897)
+ const letter = /[\p{L}\p{N}_]/u;
+ const says = (s, w) => {
+ for (let i = s.indexOf(w); i >= 0; i = s.indexOf(w, i + 1)) {
+ const glued = (letter.test(w[0]) && letter.test(s[i - 1] ?? "")) || (letter.test(w.at(-1)) && letter.test(s[i + w.length] ?? ""));
+ if (!glued) return true;
+ }
+ return false;
+ };
const shared = [];
for (const { file, dict } of strings().files.slice(1)) {
const own = path.join(assets, path.dirname(file)) + path.sep;
const rest = texts.filter(([p]) => !p.startsWith(own));
for (const k of Object.keys(dict.zh)) {
- const at = rest.find(([, s]) => s.includes(k) || s.includes(JSON.stringify(k).slice(1, -1)));
+ const at = rest.find(([, s]) => says(s, k) || says(s, JSON.stringify(k).slice(1, -1)));
if (at) shared.push(`${file} ${JSON.stringify(k)}: ${path.relative(repo, at[0])} says it too`);
}
}