fix(env): restore the handler registry and nest its prefix-grouped siblings

d1f1fde4c1 added `i18n_tuning` to the registry while the module itself was
never staged, so a fresh checkout of this branch cannot import
utils.env.handlers at all:

  ImportError: cannot import name 'i18n_tuning' from 'utils.env.handlers.infinito'

That takes `make dotenv` with it. Commit the module.

test_prefix_groups_belong_in_subfolders flagged the pair it landed beside:
cache_conf.py and cache_stack.py share a delimiter-bounded prefix, which the
repository treats as a folder in disguise. Both move into cache/, and
i18n_libretranslate.py joins the new module in i18n/ before it becomes the
same finding. The registry switches to the `from .infinito.ca import x as
ca_x` form 9b78933153 established; the names and the order in
ORDERED_HANDLERS are unchanged.

primary_checkout() ran git with `check=False`, which suppresses a non-zero
exit but not a missing cwd or a missing binary, so a caller whose repo_root
does not exist broke the whole handler chain rather than falling back. The
docstring already promised the fallback; now the code does it too.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-09-24 19:40:54 +02:00
1 parent 942ca18b85
commit 645f55826d
9 files changed
+59 -15

No files matched your search

@@ -1,4 +1,4 @@
"""Unit tests for :mod:`utils.env.handlers.infinito.cache_conf`."""
"""Unit tests for :mod:`utils.env.handlers.infinito.cache.conf`."""
from __future__ import annotations
@@ -10,7 +10,7 @@ from tempfile import TemporaryDirectory
from unittest.mock import patch
from utils.env.builder import BuildContext, EnvBuilder
from utils.env.handlers.infinito import cache_conf as handler
from utils.env.handlers.infinito.cache import conf as handler
_BLANK = {handler.SOURCE_KEY: "", handler.KEY: ""}
@@ -63,6 +63,11 @@ class TestPrimaryCheckout(unittest.TestCase):
self.assertEqual(handler.primary_checkout(outside), outside)
def test_a_root_git_cannot_be_run_in_falls_back_to_itself(self) -> None:
missing = self.root / "gone"
self.assertEqual(handler.primary_checkout(missing), missing)
class TestApply(unittest.TestCase):
def setUp(self) -> None:
@@ -1,4 +1,4 @@
"""Unit tests for :mod:`utils.env.handlers.infinito.cache_stack`."""
"""Unit tests for :mod:`utils.env.handlers.infinito.cache.stack`."""
from __future__ import annotations
@@ -8,7 +8,7 @@ from pathlib import Path
from unittest.mock import patch
from utils.env.builder import BuildContext, EnvBuilder
from utils.env.handlers.infinito import cache_stack as handler
from utils.env.handlers.infinito.cache import stack as handler
_BLANK = {"CI": "", handler.KEY: ""}