Repository navigation
feat(control): the control plane answers with a coded message, not a sentence - #55
Merged
Merged
Conversation
…sentence An HTTP error from the control plane was a plain-text body, so the desktop app could only paste it on screen. In a window that ships in two languages, that sentence is unreadable to half the people who see it. `Fail` is `(StatusCode, Json<Msg>)` now: the body carries a code, the arguments that fill the sentence, and the English text. The app looks up the code in its own dictionary and falls back to the text for one it does not know. About 250 strings across the crate are English, and the error paths carry a code — `control.upstream_not_found`, `control.default_key_delete`, `control.callback_ports_busy`, and so on. Three helpers keep the common cases short: `internal` for a database or serialization failure that the app can only report, `no_such_upstream` for the lookup that eight handlers repeat, and `checked_name` / `slug`, which now take the English name of the resource kind and put it in `args` so the app can pick its own word for it. Two surfaces beyond the envelope: - The diagnostics bundle is English Markdown. It is a document a person reads before pasting it into an issue, and issues in this repository are in English. - The ChatGPT sign-in callback pages are English, and the page that carries them stopped claiming `lang="zh-CN"`. `crates/tw-control/src` no longer contains a Chinese string literal. Tests that read an error body read `v["text"]` or the code; the ones that asserted on Chinese sentences assert on the English or, where there is one, on the code. Still Chinese, and not in this change: `tw-adopt`, `tw-config`, `tw-yaml`, `tw-engine`, `tw-scan`, `tw-pricing`, `tw-dialect` and the `twcore` CLI — about 350 strings. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Sep 20, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An HTTP error from the control plane was a plain-text body, so the desktop app
could only paste it on screen. In a window that ships in two languages, that
sentence is unreadable to half the people who see it.
The body carries a code, the arguments that fill the sentence, and the English
text. The app looks the code up in its own dictionary and falls back to the text
for one it does not know.
About 250 strings across the crate are English, and the error paths carry a code
—
control.upstream_not_found,control.default_key_delete,control.callback_ports_busy, and so on.Three helpers keep the common cases short
internal(e)— a database or serialization failure the app can only report.One code,
control.internal, with the original sentence indetail.no_such_upstream(name)— the lookup eight handlers were repeating.checked_name(raw, kind)andslug(kind, v)now take the English name ofthe resource kind (
upstream,proxy,price sheet,gateway key…) andput it in
args, so the app can pick its own word for it.Two surfaces beyond the envelope
reads before pasting it into an issue, and issues in this repository are in
English.
them stopped claiming
lang="zh-CN"while showing English.crates/tw-control/srcno longer contains a Chinese string literal.Tests
Tests that read an error body read
v["text"]or the code; the ones thatasserted on Chinese sentences assert on the English or, where there is one, on
the code.
Still Chinese
tw-adopt,tw-config,tw-yaml,tw-engine,tw-scan,tw-pricing,tw-dialectand thetwcoreCLI — about 350 strings.Verified
cargo fmt --all -- --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace(78 suites, 0 failures) and./scripts/smoke.sh(51 passed, 0 failed).🤖 Generated with Claude Code