Skip to content

fix: preserve distinct default configuration identities - #430

Merged
codeforester merged 5 commits into
mainfrom
bug/425-20261005-bug-preserve-distinct-application-identities-in-default-conf
Oct 6, 2026
Merged

codeforester merged 5 commits into
mainfrom
bug/425-20261005-bug-preserve-distinct-application-identities-in-default-conf

Conversation

@codeforester

Copy link
Copy Markdown
Contributor

Summary

Use the collision-resistant application identity namespace for default user
configuration directories in both batteries-included entry points. Dotted
identities remain distinct, names that would collide after normalization receive
stable identity-specific components, and explicit user_config_dir values remain
authoritative.

The documentation records the path contract and explains that older normalized
directories are not moved, merged, or deleted automatically.

Issue

Fixes #425

Validation

  • UV_CACHE_DIR=/private/tmp/base-cli-uv-cache uv run --extra dev --extra typer pytest -q (661 passed, 2 skipped)
  • UV_CACHE_DIR=/private/tmp/base-cli-uv-cache uv run --extra quality mypy --strict lib/python/base_cli
  • UV_CACHE_DIR=/private/tmp/base-cli-uv-cache uv run --extra quality ruff check lib/python/base_cli/paths.py lib/python/base_cli/config.py lib/python/base_cli/profile.py tests/test_paths.py tests/test_batteries_included_config.py
  • git diff --check

Train

This car follows the v0.5.0 validation car for #424. It is based on that
branch so the two implementation changes can be reviewed and merged in order.

@codeforester codeforester left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewed head f17e78c against #425. The dotted-identity bug is real and fixed: acme.tools previously collapsed to acme, and now gets its own directory. Explicit user_config_dir stays authoritative. Two blocking issues.

1. Every capitalized application name silently loses its existing user config. config_namespace_component reuses runtime_namespace_component, which lowercases names and appends a digest whenever the readable slug differs from the input. I compared the default directory on main and on this branch:

cli_name main this PR
basectl, mytool, gh-dash, my_tool unchanged unchanged
acme.tools acme acme.tools ✅ (the #425 fix)
MyTool MyTool mytool--0e6f80c36435
Base Base base--7b47361aad19
Alpha-Tool (already normalized) Alpha-Tool alpha-tool--dd7ba9aae023
AWSCLI AWSCLI awscli--597bec206248

After upgrading, an app named MyTool stops reading ~/.config/MyTool/config.yaml, with no warning. The docs say old directories aren't migrated, which satisfies #425's "do not silently move", but the user-visible result is silent config loss. #425 also asks for coverage of "ordinary existing names", and the only ordinary name tested is lowercase beta. Options:

  • Keep the old directory when it's collision-free, and add a digest only for real collision cases (dots that used to be truncated, Alpha Tool vs Alpha-Tool).
  • Or, when the legacy default_config_root() / normalize_cli_name(cli_name) exists and the new one doesn't, keep using the legacy directory or at least log a one-time warning naming both paths.

Either way, please add MyTool/Alpha-Tool to the tests and say which behavior is intended.

2. CI: Quality and security gates fails with ruff format: "File would be reformatted --> lib/python/base_cli/profile.py:235:41".

Minor: config_namespace_component is a pure alias of runtime_namespace_component. That's fine if it's meant as a seam for the config policy to diverge later (option 1 above would use exactly that), but say so in the docstring.

Comment thread lib/python/base_cli/paths.py
@codeforester
codeforester force-pushed the ci/424-20261005-ci-wire-uv-lock-freshness-check-into-full-validate-sh branch from c640617 to 972b635 Compare October 5, 2026 17:43
@codeforester
codeforester force-pushed the bug/425-20261005-bug-preserve-distinct-application-identities-in-default-conf branch from f17e78c to 4862c5c Compare October 5, 2026 17:45
@codeforester

Copy link
Copy Markdown
Contributor Author

Follow-up on the review findings:

  • Preserved safe ordinary application identities such as MyTool and Alpha-Tool verbatim, avoiding silent config-directory changes; unsafe identities retain the slug-plus-digest fallback.
  • Added regression coverage and documentation.
  • Fixed the reported Ruff formatting failure.

Validation: 34 focused tests, strict mypy, Ruff check, Ruff format, and diff checks pass locally. The PR head is now 4862c5cc, based on updated #429.

@codeforester

Copy link
Copy Markdown
Contributor Author

Re-verified at 4862c5c: fixed ✅. I compared default config directory names on main and this branch. Ordinary names are now preserved verbatim: MyTool, Base, Alpha-Tool, AWSCLI, my_tool, basectl. Only names that collided or were unsafe before get the slug-plus-digest: acme.tools/acme.deploy (both collapsed to acme on main), Alpha Tool (collided with Alpha-Tool), ../evil, a/b, .hidden. Nothing escapes the config root. The ruff format failure is fixed, and CI is green (95/95). Ready to merge once #429 lands (it's stacked on #429). Non-blocking: MyTool and mytool remain distinct identities that share one directory on case-insensitive filesystems (macOS), exactly as on main, so it's not a regression, but worth a sentence in docs/local-config.md.

Base automatically changed from ci/424-20261005-ci-wire-uv-lock-freshness-check-into-full-validate-sh to main October 6, 2026 08:09
@codeforester
codeforester merged commit 93a2b03 into main Oct 6, 2026
139 of 140 checks passed
@codeforester
codeforester deleted the bug/425-20261005-bug-preserve-distinct-application-identities-in-default-conf branch October 6, 2026 08:09
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.

bug: preserve distinct application identities in default configuration directories

1 participant