Skip to content

Audit batches 4+5: test hardening (P-6/R-3/X-2) + DX docs (X-3/X-4/X-5)#220

Merged
lesnik512 merged 2 commits into
mainfrom
fix/audit-fixes-batch4-5
Jun 14, 2026
Merged

Audit batches 4+5: test hardening (P-6/R-3/X-2) + DX docs (X-3/X-4/X-5)#220
lesnik512 merged 2 commits into
mainfrom
fix/audit-fixes-batch4-5

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Summary

Batches 4 + 5 of the 2026-06-14 deep audit — the remaining actionable low-severity findings, in two commits.

Test hardening (commit 1):

  • P-6test_compile_kwargs_is_memoized_across_resolves pins the compile-once invariant (spies on Factory._compile_kwargs; asserts one compile per provider across two resolves).
  • R-3 — rewrite a singleton cache_item.cache is not UNSET white-box assert into a behavioral reopen check (clear_cache=False instance survives close and returns again after reopen).
  • X-2test_typo_suggestion and the dependency-path test assert structured fields (exc.suggestions, exc.dependency_path) + message substrings instead of brittle full-string matches (drops the <locals>.Repostory repr and exact-indentation coupling).

DX / docs (commit 2):

  • 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 a list[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

  • 209 passed, 100% coverage (just test-ci)
  • just lint-ci clean (ruff + ty); mkdocs build --strict OK

🤖 Generated with Claude Code

lesnik512 and others added 2 commits June 14, 2026 15:56
- 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>
@lesnik512 lesnik512 merged commit 2207464 into main Jun 14, 2026
7 checks passed
@lesnik512 lesnik512 deleted the fix/audit-fixes-batch4-5 branch June 14, 2026 12:58
lesnik512 added a commit that referenced this pull request Jun 14, 2026
Deep-audit fixes (#216-#220): cross-scope set_context, gapped-enum child scope,
new public API (fetch_context_value, display_name, exceptions export), perf, DX.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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