Skip to content

Every page the server serves names the resolved language - #3262

Merged
FlexOr2 merged 12 commits into
mainfrom
claude/issue-3259-every-page-the-server-serves-names-the-r
Nov 17, 2026
Merged

FlexOr2 merged 12 commits into
mainfrom
claude/issue-3259-every-page-the-server-serves-names-the-r

Conversation

@FlexOr2

@FlexOr2 FlexOr2 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Work-Item: #3259
Closes #3259

Routing: build sonnet/high; fix sonnet/high; review opus/medium; test sonnet/high; gate gpt-6-astra/high; land sonnet/medium

Follow-ups: outage 500s of /auth/logout and /api/auth/me -> #3178; test_server.py built-shell fixture duplication -> #2232.

Slice A of #2976. The shell, the failed sign-in page and the sign-out page now carry the language the server resolved, instead of a fixed en.

  • src/songmaker_cli/page_language.py owns APP_LANGUAGES, request_language (session account tag via account_language_of_session, else Accept-Language, else the source language) and PageShell.
  • PageShell reads frontend/build/index.html once at create_app and refuses to start unless it holds exactly one %page-language% (the value of app.html's <html lang>). spa_fallback (now a sync def) and the sign-in refusal both answer it with the resolved language in <html lang>, no ETag or Last-Modified and Vary: Accept-Language, Cookie; the shell sends Cache-Control: no-cache, and on the callback path the sign-in policy replaces it with no-store, so the refusal's final header is no-store (security.md says so; the test pins it).
  • A failing session store is logged and the header decides.
  • Sign-in start sends ui_locales; the sign-out page carries the resolved lang and the catalog label logoutPage.logOut.
  • Frontend: app.html holds <html lang="%page-language%">, a placeholder and no fixed language; pageLanguage() returns Language and fails loud on an unoffered tag; +layout.ts loads words for it.
  • docs/architecture.md and docs/security.md updated.

Also adapted: the built-shell literal of tests/support/web_app.py (BUILT_SHELL) and the test files that write an index.html, which now carry the placeholder.

Tests written first at the HTTP boundary (tests/songmaker_cli/test_page_language.py, red run: 16 failed, 1 passed before the wiring); test_auth_api_sign_in.py adapted.

Also adapted: scripts/dead-symbols.allow (the LANGUAGES entry now suppresses nothing), scripts/dead-exports.allow (sourceLanguage is test-only now, generated), frontend/src/lib/utils/format.test.ts and recency.test.ts (they set <html lang> to a language the catalogs do not offer and now mock the offered list).

Static checks: bash scripts/static_checks.sh passes after merging main.

Deferred with owners: proof that the shell and the sign-out page (its <html lang> and its logoutPage.logOut label) follow the account tag or Accept-Language in a second language goes to the German slice's render pass (only en is offered, so text('de', ...) has no words yet; the HTTP tests here prove the shell and sign-in wiring with a patched offer, and the sign-out page only in the source language); a readable page for an empty lang, the offline service-worker shell keeping its install-time lang, and the vite dev server (its page carries the unreplaced %page-language%, so pageLanguage() fails loud there) are gaps on #2976.

🤖 Generated with Claude Code

FlexOr2 and others added 5 commits November 17, 2026 21:01
The shell, the failed sign-in page and the sign-out page took a fixed
`en`, the sign-in start sent no `ui_locales`, and the page loaded its
words for the source language whatever `<html lang>` said. One module,
`page_language.py`, now decides a request's language with webauth's
resolver (the session's account tag, then Accept-Language, then the
source language) and writes it into the built page: the shell is read
once at start, which fails unless it holds exactly one bare `<html>`,
and both shell answers carry no ETag, `no-cache` and
`Vary: Accept-Language, Cookie`. A failing session store logs and
leaves the header to decide. The sign-out label is a songmaker catalog
key; the page reads its language back through `pageLanguage()`, which
fails loud on a language the app does not offer.

Work-Item: #3259

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…atching the store class

The session-store outage reaches request_language through the existing request.app.state.ctx.db boundary, so the test supplies the failure there and no longer replaces production behaviour on an imported class.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…hell English and free of their markup

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ge resolver's read-only session read

The refused sign-in's shell sends no-cache, which the sign-in policy replaces with no-store on the callback path; the test pins the final header. The Logout bullet names the catalog label logoutPage.logOut, and the account_language bullet says request_language reads the column without renewing the session.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ts page literally

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
FlexOr2 and others added 3 commits November 17, 2026 21:28
… disposes its engine

The review's delta request required very long values at the HTTP boundary; the outage test now disposes the unreachable engine it creates.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… server writes over

Web:S5254 flags an html element without lang. The template now holds lang="%page-language%"; PageShell requires exactly one placeholder and replaces it with the resolved language, so app.html still fixes no language.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…the-r

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@FlexOr2
FlexOr2 merged commit a078a0f into main Nov 17, 2026
33 checks passed
@FlexOr2
FlexOr2 deleted the claude/issue-3259-every-page-the-server-serves-names-the-r branch November 17, 2026 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Every page the server serves names the resolved language in <html lang>, and sign-in and sign-out follow it

1 participant