Skip to content

Fix Spanish locale cookie fallback, dynamic tooltips and browser smoke false positives - #15

Merged
Astro1Deep merged 13 commits into
mainfrom
fix/i18n-cookie-persistence-ci-release-guards
Oct 31, 2026
Merged

Astro1Deep merged 13 commits into
mainfrom
fix/i18n-cookie-persistence-ci-release-guards

Conversation

@Astro1Deep

@Astro1Deep Astro1Deep commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Root cause and scope

Historic October 30 test failures in feat/english-default-i18n-release-readiness were on intermediate commits; merged PR #9 and current main CI already passed. Sourcery found two legitimate edge cases. Empty BEATOS_LANG was fixed in main, but localStorage-disabled sessions still reset explicit Spanish to English because the browser ignored the stored beatos_locale cookie on reload.

Fixes

  • Read exact beatos_locale=en|es cookie when localStorage is missing or unavailable; explicit localStorage preference has precedence. Do not match suffixes (es-MX) or similarly named cookies.
  • Ensure blank/unknown installer CLI language defaults to EN, and empty server BEATOS_LANG doesn't suppress console translations.
  • Translate previously missed generated pad tooltips (Asignar al Pad Objetivo Activo, Vaciar Pad 1) and expand i18n guard coverage.
  • Browser smoke now detects a rendered output node, not a pass marker embedded in unexecuted inline script, and requires exact locale cookie values.
  • New regression tests for these failures, plus regenerated checked-in blank catalog; the existing release ZIP manifest and canonical render checks still gate delivery.

Release boundary: this PR changes no hardware exporters, does not bump or republish the v3.8.0 stable asset, and does not certify Pocket Operator physical restore. PR #14 remains separate and draft pending device validation.

Summary by Sourcery

Harden locale fallback and browser smoke validation while completing English translations for generated interface tooltips.

Bug Fixes:

  • Preserve explicit Spanish locale selection from an exact cookie when localStorage is unavailable, while prioritizing valid localStorage preferences.
  • Default blank or unsupported installer language arguments and empty server language settings to English.
  • Correct missing English translations for generated pad tooltips and expand validation of visible localized labels.
  • Prevent browser smoke tests from passing on unexecuted script text by requiring an exact rendered result and locale cookie value.

Tests:

  • Add regression coverage for locale cookie fallback and precedence, language defaults, translated tooltips, and rendered browser smoke results.

Chores:

  • Regenerate the checked-in catalog output.

@sourcery-ai

sourcery-ai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The PR hardens English/Spanish locale resolution across client, installer, and server paths, adds the missing generated pad tooltip translations, and replaces browser smoke false-positive detection with strict rendered-output and exact-cookie validation backed by regression tests.

Sequence diagram for locale fallback on browser reload

sequenceDiagram
    participant Browser
    participant LocalStorage
    participant Cookie
    participant UI

    Browser->>LocalStorage: getItem(beatos_locale)
    alt explicit localStorage preference exists
        LocalStorage-->>Browser: en or es
    else localStorage missing or unavailable
        Browser->>Cookie: document.cookie
        Cookie-->>Browser: exact beatos_locale=en or beatos_locale=es
    end
    Browser->>UI: apply resolved locale
    UI-->>Browser: render translated labels and tooltips
Loading

Flow diagram for installer and server language fallback

flowchart TD
    A[Installer language input] --> B[get_language]
    B --> C{Normalized value is es}
    C -->|yes| D[Use es]
    C -->|no| E[Use en]
    F[BEATOS_LANG] --> G{Empty or unset}
    G -->|yes| H[Use en for translate_text]
    G -->|no| I[Use configured language]
    D --> J[Translated installer or server output]
    E --> J
    H --> J
    I --> J
Loading

Flow diagram for browser smoke validation

flowchart TD
    A[Run browser smoke] --> B[Execute page interaction]
    B --> C{Rendered output node exists}
    C -->|no| D[Fail smoke test]
    C -->|yes| E{Exact beatos_locale cookie value}
    E -->|no| D
    E -->|yes| F[Pass smoke test]
Loading

File-Level Changes

Change Details Files
Harden locale selection and fallback behavior across installer, server console, and browser runtime.
  • Treat only explicit, trimmed Spanish values as Spanish; default blank or unknown values to English.
  • Use an exact locale cookie when localStorage is unavailable, while preserving localStorage precedence.
  • Prevent blank server environment settings from disabling English translations.
installer.py
serve_mpc.py
templates/catalogo.html
BeatOS/data/catalogo.html
Add translations for generated pad controls and broaden checks for missing visible i18n content.
  • Translate the active-target-pad assignment and pad-clearing tooltips.
  • Extend static title/ARIA translation coverage and regenerate the checked-in catalog.
templates/catalogo.html
BeatOS/data/catalogo.html
tests/test_i18n.cjs
Make browser locale smoke validation verify executed, rendered output rather than source-text markers.
  • Parse the exact output element emitted by the browser probe.
  • Require exact en/es cookie values during locale transitions.
  • Add regression tests rejecting embedded script literals, wrong elements, partial output, and failures.
tests/smoke_browser_i18n.py
tests/test_browser_probe_result.py
Expand regression coverage for locale fallback and release-facing i18n behavior.
  • Test malformed or absent cookies, localStorage precedence, and Spanish persistence without storage.
  • Test blank installer CLI values and blank server environment behavior.
tests/test_i18n.cjs
tests/test_installer_language.py
tests/test_server_language.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-31T14:17:07.799317Z
We couldn’t complete this review. Comment @codex review to try again.
df1af91 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@Astro1Deep
Astro1Deep merged commit 794d0d9 into main Oct 31, 2026
9 checks passed
@Astro1Deep
Astro1Deep deleted the fix/i18n-cookie-persistence-ci-release-guards branch October 31, 2026 14:20
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.

1 participant