Audit batches 4+5: test hardening (P-6/R-3/X-2) + DX docs (X-3/X-4/X-5)#220
Merged
Conversation
- P-6: pin the compile-once kwargs-memoization invariant (spy on _compile_kwargs). - R-3: rewrite a singleton white-box cache assert into a behavioral reopen check. - X-2: assert structured suggestions/dependency_path + message substrings instead of brittle full-string matches (drops the <locals> repr and exact-indentation coupling); other exact-match asserts kept as intentional DX guards. Spec: planning/audits/2026-06-14-deep-audit-report.md Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- X-3: concise class docstrings on every concrete exception naming its public inspection attributes (IDE hover). - X-4: explicitly export `exceptions` from modern_di and add it to __all__. - X-5: docstring on ResolutionStep; note dependency_path is list[ResolutionStep] in errors-and-exceptions.md. Spec: planning/audits/2026-06-14-deep-audit-report.md Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Batches 4 + 5 of the 2026-06-14 deep audit — the remaining actionable low-severity findings, in two commits.
Test hardening (commit 1):
test_compile_kwargs_is_memoized_across_resolvespins the compile-once invariant (spies onFactory._compile_kwargs; asserts one compile per provider across two resolves).cache_item.cache is not UNSETwhite-box assert into a behavioral reopen check (clear_cache=Falseinstance survives close and returns again after reopen).test_typo_suggestionand the dependency-path test assert structured fields (exc.suggestions,exc.dependency_path) + message substrings instead of brittle full-string matches (drops the<locals>.Repostoryrepr and exact-indentation coupling).DX / docs (commit 2):
exceptionsfrommodern_diand add it to__all__.ResolutionStep; notedependency_pathis alist[ResolutionStep]in the errors doc.Scope note
X-2/R-3 are deliberately surgical — the audit verifier defended exact-match asserts as a useful DX-regression guard for this library, so only the genuinely brittle cases were changed; the rest are kept as intentional guards. R-4/R-5/R-6 remain won't-fix (marginal internal tidiness); the A-1 nogil item stays in
deferred.md. This PR closes every actionable audit finding.Test Plan
just test-ci)just lint-ciclean (ruff + ty);mkdocs build --strictOK🤖 Generated with Claude Code