Skip to content

chore: privatize Container scope_map/lock internals - #265

Merged
lesnik512 merged 6 commits into
mainfrom
chore/privatize-container-internals
Jul 5, 2026
Merged

lesnik512 merged 6 commits into
mainfrom
chore/privatize-container-internals

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Privatizes the two genuinely-internal Container attributes behind deprecated aliases, following the project's cache_settings= deprecation precedent. Backward compatible; no integration touches these.

Spec + plan: planning/changes/2026-07-05.02-privatize-container-internals/.

What changed

  • Container.scope_map_scope_map and Container.lock_lock. All internal callers (container.py, factory.py) switch to the private names.
  • The old names remain as read-only @property aliases that emit DeprecationWarning (stacklevel=2, "will be removed in a future release"). Because internal code uses the underscore names, the deprecated property never fires on the resolve hot path — a regression test (test_resolve_emits_no_deprecation_warning) guards this.
  • find_container(scope) reclassified as a supported extension point (it's the primitive a custom AbstractProvider.resolve calls to locate its scope's container) — moved out of "internals" in advanced-api.md.

Deliberately unchanged

  • find_container, parent_container (attribute and constructor kwarg), the use_lock= knob, and the Container(...) constructor. These stay public.
  • No hard break — old attribute reads keep working until a future major.

Docs / release notes

  • advanced-api.md: find_container promoted to extension points; internals bullets renamed to _scope_map/_lock with the deprecation note.
  • architecture/containers.md: prose updated to _scope_map.
  • planning/releases/2.23.0.md pre-staged (2.22.0 was already cut; maintainer confirms the version at tag time).

Verification

just test-ci — 256 passed, 100% line coverage (the two property warning branches covered). just lint-ci clean (ruff + ty + planning). just docs-build --strict clean. The SLF001 noqa on cross-object private access matches existing convention (context_provider.py, alias.py).

🤖 Generated with Claude Code

lesnik512 and others added 6 commits July 5, 2026 11:26
Deprecation-shim rename of Container.scope_map/lock to _scope_map/_lock with
warning aliases; find_container promoted to a documented extension point,
parent_container left public.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lesnik512
lesnik512 merged commit 91c694a into main Jul 5, 2026
7 checks passed
@lesnik512
lesnik512 deleted the chore/privatize-container-internals branch July 5, 2026 08:54
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