Skip to content

Quoted false in TOML ignore_obsolete silently enables translation removal #1525

Backlog

Description

@fernandezbaptiste

Hullo folks,

I'm doing some research for Tessl Code Review and we ran it against your repo. It flagged a potential issue, and I figured it made sense to share it with you:

A quoted false value in pyproject.toml can silently enable obsolete-translation removal:

[tool.babel.update_catalog]
ignore_obsolete = "false"

This is a configuration type mistake, but currently it is accepted and behaves like true, deleting obsolete translations when the updated catalog replaces the original. Rejecting the string with a configuration error would avoid that destructive surprise.

Reproduction

At current main 3a7d23988dc35bba80f0ab75517f3150020530ad, run pybabel update -l en -i messages.pot -o messages.po with the above configuration and these disposable files:

messages.po:

msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Language: en\n"

msgid "old"
msgstr "Old translation"

messages.pot:

msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"

msgid "new"
msgstr ""

I executed the actual CommandLineInterface.run() update path three times with fresh temporary files:

TOML value Result
ignore_obsolete = false Old translation retained as an obsolete entry
ignore_obsolete = "false" Old translation removed, no configuration error
ignore_obsolete = true Old translation removed

Cause and validation

_configure_command() passes the TOML string directly as the store_true option's default. UpdateCatalog then passes it to write_po(ignore_obsolete=...), where the nonempty string is truthy.

Expected: reject an incorrectly typed boolean before rewriting the catalog, or explicitly normalize supported boolean strings. It should not silently turn "false" into an enabled removal option.

Validation used Python 3.14.2 on macOS arm64, unchanged current-main Python source, and CLDR data files from the Babel 2.19.0 wheel. The files were local test fixtures; no production catalog was modified. I have not submitted a fix or run the full suite.

Full transparency: I work at Tessl, and we've spotted that using Tessl Code Review - using repository-level context and specific review lenses that improve over time through feedback. That’s how this finding surfaced.

We’re just getting started and want to offer the tool free to open-source projects. If this is useful, happy to give you access.

Baptiste

Activity

  1. akx commented on Dec 1, 2026

    @akx
    Member

    For context, TOML support is a brand new feature, and it's expected to have these sort of corner case issues.

  2. fernandezbaptiste commented on Dec 1, 2026

    @fernandezbaptiste
    Author

    Thanks for flagging, @akx. Understood that TOML support is new and these are early corner cases. That’s useful context for interpreting the report.

    We’re seeing early uptake of Tessl Code Review. Some maintainers have told us the repo-centric approach gives them better insights than looking at a PR in isolation.

    Full disclosure, we’re still early in the process. We’re looking to work with open-source maintainers to get feedback and support the open-source space, which is why we’re making Code Review available free to their projects.

    If you’re interested, feel free to create a Tessl account. Let me know the organisation name you create and I’m happy to bump you up.

    Bap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions