Skip to content

refactor: provider display_name (R-1) + public fetch_context_value (R-2)#219

Merged
lesnik512 merged 1 commit into
mainfrom
fix/audit-fixes-batch3
Jun 14, 2026
Merged

refactor: provider display_name (R-1) + public fetch_context_value (R-2)#219
lesnik512 merged 1 commit into
mainfrom
fix/audit-fixes-batch3

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Summary

Batch 3 of the 2026-06-14 deep audit — two behavior-preserving refactors that reduce duplication and remove a private-method reach-in.

  • R-1 — add AbstractProvider.display_name (bound_type.__name__ else repr(self); Factory overrides to fall back to the creator name). Replaces the duplicated bound_type.__name__ if … else repr(…) idiom at ~5 sites: _resolution_step in Factory and Alias, the cycle-path list in validate(), and both names in InvalidScopeDependencyError.
  • R-2 (minimal) — rename ContextProvider._find_context_value → public fetch_context_value; Factory calls it without the # noqa: SLF001 suppression.

Design decision (R-2 shape)

Chose the minimal option: keep isinstance(provider, ContextProvider) for compile-time routing (acceptable against a concrete sibling provider) and only promote the value-probe to public — one new method, not a ClassVar+method decouple. R-4/R-5/R-6 deferred (marginal; the compile vs. validate predicates genuinely diverge, so R-5 can't be cleanly unified). Recorded in the bundle.

Test Plan

  • Behavior-preserving — no new tests; existing suite exercises all display_name branches and the renamed method
  • 208 passed, 100% coverage (just test-ci)
  • just lint-ci clean (the SLF001 noqa is gone; ty clean)

🤖 Generated with Claude Code

…lue (R-2)

- R-1: add AbstractProvider.display_name (Factory overrides for creator name);
  replace the bound_type-or-repr idiom at ~5 sites (Factory/Alias _resolution_step,
  validate() cycle path, InvalidScopeDependencyError).
- R-2 (minimal): rename ContextProvider._find_context_value -> public
  fetch_context_value; Factory calls it without the SLF001 suppression. isinstance
  routing kept by design (see bundle).

Behavior-preserving; existing suite + 100% coverage exercise all branches.
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 505d8c5 into main Jun 14, 2026
7 checks passed
@lesnik512 lesnik512 deleted the fix/audit-fixes-batch3 branch June 14, 2026 12:42
lesnik512 added a commit that referenced this pull request Jun 14, 2026
Move bundle to archive (status: shipped, pr: 219); update README Index; mark
R-1/R-2 resolved in the 2026-06-14 audit report Status line.

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