Repository navigation
feat(local): give Studio's job refusals codes the interface can translate - #2241
Conversation
…late A create, regenerate or cancel that Studio refuses for a reason other than a missing model sent a bare sentence, so it was English in every language. Five of them now carry a code beside the sentence: already_generating, nothing_running, no_sources, sources_indexing and sources_gone. studio-error-text.ts has a line for each, in all ten catalogs; a code it has no line for still shows the backend's sentence. Refs MODSetter#1967
|
@ybai08 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Reviewed this. The code is right:
Two things before it can merge. 1. The docs don't follow the change
2. "None of its sources are left." has nothing for "its" to point at
Not blocking: Push the fixes to this branch and it will be reviewed again. |
…s in the Studio doc Review of MODSetter#2241. The interface's line for sources_gone had shortened the backend's "None of this artifact's sources are left." to "its", which points at nothing under the alert title, and in pt-BR read as "your sources". English keeps "this artifact's" and the nine other catalogs say it the same way. docs/architecture/studio.md names the codes where it described the refusals (the job's steps, the three routes and the panel). localization.md's Known gaps line is general again: it listed the uncoded refusals and left out the quiz, flashcard, artifact and file ones, and said the panel's alert title covers a Refine's and Accept all / Reject all's refusals, which show their own. Its Backend text paragraph says no_sources is a 422.
|
Thank you. 1. The docs
2. "None of this artifact's sources are left." English keeps "this artifact's" (with the catalog's typographic apostrophe, like its other strings), and the nine other catalogs say it the same way, each with the word that catalog already uses for an artifact:
I do not read all nine; they were written from the English against each catalog's existing lines for "this artifact" ( One thing in the panel test: the interface's English is now the backend's sentence word for word, so the assertion that the alert shows the interface's line and not the backend's tells them apart only by the apostrophe. There is a comment saying so. How to test From
Not run: the backend suites (no backend file changed in this commit) and the app itself. |
|
Merged into
Naming the five ("the five job refusals with a code") fixes all three places. |
What
A Studio job that is refused for a reason other than a missing model sent a bare sentence, so the panel showed it in English in every language under its translated alert title. It is the seventh producer on #1967, and the Studio half of the gap line in
localization.md.Five refusals in
modules/artifacts/service.pynow send the{"message", "code"}detail a missing model already sends:already_generatingnothing_runningno_sourcessources_indexingsources_gonestudio-error-text.tshas a line for each,studio_error_<code>, somessageFromshows it for a create, a regenerate and a cancel. A code it has no line for still shows the backend's sentence.localization.mdnames the codes where it describes Studio's, and the gap line now lists what is left.The backend's sentences and status codes are unchanged.
tests/integration/artifacts/test_regenerate_scope.pyread one of them as the wholedetail; it readsdetail["message"]now.Left for later producers, as in the plan on the issue: the two refusals of the shared
load_selected_sources(a source in another workspace, and "sources are still indexing: [ids]", which the chat and agent threads raise too), a format's own option errors, the refine refusals (studio_documents/service.pyhas its own bare "already generating"), and the revised copies.Why
#1967: backend prose reaches the screen untranslated. A code lets each language say it.
Refs #1967
How to test
Run on macOS arm64. The branch is on
devatf887af104; each line says which base it was run on.Backend, from
surfsense_local/backend:tests/integration/artifacts/test_refusal_codes.py(new, 6 tests): before the change all 6 fail, each with the bare sentence where the code is expected. After it they pass.uv run pytest tests/integration/artifacts, after the rebase: 171 passed.uv run pytest tests/integration, before the rebase (onf2a021f3f): 1330 passed, 122 skipped.uv run pytest tests/unit, before the rebase: 4020 passed, 7 skipped, 1 failed:tests/unit/llm/catalog/local/engines/llamacpp/models_folder/test_preset.py::test_repricing_unchanged_models_does_not_rewrite_the_preset. It compares a file's modification time and is flaky on this Mac without this change too: run alone three times with my changes stashed it failed twice and passed once, and with them it passed once and failed twice. It does not touch this code; test(local): hold host memory still where repricing must leave the preset alone #2242 fixes the test (itscache-ramfollows the host's free memory).uv run ruff check .: clean.ruff format --checkon the three files I touched: clean.Frontend, from
surfsense_local/frontend:studio-error-text.test.ts(new, 7 tests): before the lines were added, the 5 that name a code fail withnull.pnpm test, before the rebase: 836 passed in 105 files. After it I reranpnpm test src/features/studio: 166 passed in 16 files.pnpm typecheck,pnpm lint: clean.prettier --checkon the three files: clean.pnpm translations:verifyandnode scripts/check_translations.mjs, after the rebase: 1315 keys in 10 languages, 0 problems;pnpm translationsleavesen.jsonunchanged.python scripts/check_docs.py, after the rebase: 154 files, 0 problems.Mutations, one at a time, each with the tests rerun, before the rebase: 18 applied, 18 caught. In the backend: each refusal sent bare again or under another refusal's code, an all-indexing scope reported as no sources, and the helper dropping the code, sending the sentence bare, or putting the code under another key. In the frontend: each of the five lines removed, and two codes' lines swapped.
Not run: the app itself. I did not trigger these refusals in a running build, in English or in another language; the translations are checked by the two catalog checks and by reading, not on screen. Nobody who reads those nine languages has reviewed them.
Summary by CodeRabbit