Conversation
…_chars Disambiguates from the strict caller-input validator in memtomem.constants introduced by PR #491-#503. The two had the same name but different signatures and contracts (charset-only bool vs. shape-aware raises), which made debugging harder when stack traces or grep results pointed at "validate_namespace" without telling you which one. The storage helper has no in-tree callers outside its sibling _ensure_valid_namespace wrapper. It was nominally exported via memtomem.storage.sqlite_backend.__all__, but a repo-wide grep showed zero external imports — internal-only rename, no behavior change. Renamed the storage side rather than the constants side because test_validate_namespace_architectural_guard.py AST-matches the literal callee name "validate_namespace" against declared surfaces; renaming that side would mean changing the guard plus 12+ call sites across 6 modules immediately on top of #491-#503. Co-Authored-By: Claude <[email protected]>
…nion Per PR #505 review: the rename docstring on ``_is_valid_ns_chars`` already explains how it relates to the strict public-surface ``constants.validate_namespace``, but the back-link was missing. A future reader landing on either function should be able to find the other without grep — this closes the gap from the constants side and makes the cross-reference symmetric. Co-Authored-By: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
memtomem.storage.sqlite_namespace.validate_namespace(name) -> boolto_is_valid_ns_charsto disambiguate from the strict caller-input validatormemtomem.constants.validate_namespace(value) -> str(raisesInvalidNameError) introduced in PR fix: validate agent_id before agent-runtime namespace concat (CLI + MCP) #491–fix: namespace defense-in-depth — AppContext setter + architectural guard + message constant #503.validate_namespacefrommemtomem.storage.sqlite_backend.__all__(was nominally public, but a repo-wide grep shows zero external imports)._ensure_valid_namespacewrapper, so the renamed bool helper stays a single-use private detail ofsqlite_namespace.Why
The two functions had:
validate_namespace)agent-runtime:strict-arity)Stack traces and grep results pointed at
validate_namespacewithout telling you which one. That ambiguity gets worse as the strict validator becomes the load-bearing public-surface gate (mem_session_start,mem_agent_share,mem_ns_*, …) — it should own the name.Why this side, not the other
memtomem.constants.validate_namespacetest_validate_namespace_architectural_guard.pyAST-matches literal callee namememtomem.storage.sqlite_namespace.validate_namespace_ensure_valid_namespace) + 0 external (verified by grep)Test plan
uv run ruff check packages/memtomem/src/memtomem/storage/...— cleanuv run ruff format --check ...— already formatteduv run pytest -m "not ollama"— 2887 passed### Internalentry added under[Unreleased]documenting rename rationale🤖 Generated with Claude Code