Public: anyone can read this; the crew can change it.
Origin browsing's file-or-directory sentences live in one module, read by every provider #5606
Check · Review · Land · Live done — Landed and live in production.
The two sentences origin browsing uses when a path is the wrong kind ("that path is a file, not a directory" and "that path is a directory, not a file") now live in one new module, `src/origins/words.ts`. They are exported as `PATH_IS_FILE` and `PATH_IS_DIRECTORY`. I made a new module because nothing under `src/origins/` already held words like these. The only other `words.ts` in the codebase is `…
shipped production is serving it deploy ad44386
The two sentences origin browsing uses when a path is the wrong kind ("that path is a file, not a directory" and "that path is a directory, not a file") now live in one new module, src/origins/words.ts. They are exported as PATH_IS_FILE and PATH_IS_DIRECTORY. I made a new module because nothing under src/origins/ already held words like these. The only other words.ts in the codebase is src/checks/words.ts, which formats check-failure summaries.
- Providers:
src/origins/providers/forgejo.tsandsrc/origins/providers/github.tsimport the two constants. Only the import line and the twofail("not_found", …)lines in each file changed, and the wording is the same.grep -rn "that path is a" src/now finds onlysrc/origins/words.ts. - Test: the new
test/origin-words.test.tschecks that the module exports exactly two sentences and that neither is empty. It also reads each provider's source as text and fails if either sentence is typed back in.
Checks: bun x tsc --noEmit is clean. test/origin-words.test.ts, test/origins.test.ts, test/origins-security-provider.test.ts and test/browse-origin-timing.test.ts pass (54 tests), with no changes to the existing tests. Nothing under src/web/ changed, so the design lint was not needed.
🤖 Generated with Claude Code
Clean, mechanical refactor that does exactly what #5586 asked. The two sentences now live in src/origins/words.ts, and both providers import them with the wording unchanged, so answers stay byte-for-byte the same. On main, grep finds the four copies in forgejo.ts and github.ts; with this diff applied only the module would hold them. test/origin-words.test.ts reads each provider's source as text and would fail if a copy were typed back in, which matches the issue's done list.
Security: no new input, output, write or door. The terminal and README are not affected. No dependency was added, and there is no dead code or TODO. The preview answers / with 200.
A nit, not blocking: expect(sentences.length).toBe(2) will need a bump when a third sentence joins the module. That is fine, since it also stops an export from being added untested.
The two sentences origin browsing uses when a path is the wrong kind ("that path is a file, not a directory" and "that path is a directory, not a file") now live in one new module,
src/origins/words.ts. They are exported asPATH_IS_FILEandPATH_IS_DIRECTORY. I made a new module because nothing undersrc/origins/already held words like these. The only otherwords.tsin the codebase issrc/checks/words.ts, which formats check-failure summaries.src/origins/providers/forgejo.tsandsrc/origins/providers/github.tsimport the two constants. Only the import line and the twofail("not_found", …)lines in each file changed, and the wording is the same.grep -rn "that path is a" src/now finds onlysrc/origins/words.ts.test/origin-words.test.tschecks that the module exports exactly two sentences and that neither is empty. It also reads each provider's source as text and fails if either sentence is typed back in.Checks:
bun x tsc --noEmitis clean.test/origin-words.test.ts,test/origins.test.ts,test/origins-security-provider.test.tsandtest/browse-origin-timing.test.tspass (54 tests), with no changes to the existing tests. Nothing undersrc/web/changed, so the design lint was not needed.🤖 Generated with Claude Code
Closes #5586