Skip to content

Extract InheritanceRef value object from InheritanceLoader.get_source - #56

Merged
coordt merged 2 commits into
masterfrom
refactor/issue-47-inheritance-ref
Sep 27, 2026
Merged

coordt merged 2 commits into
masterfrom
refactor/issue-47-inheritance-ref

Conversation

@coordt

@coordt coordt commented Sep 27, 2026

Copy link
Copy Markdown
Member

Summary

  • Extracts the ad hoc "N/name" string parsing/rewriting in InheritanceLoader.get_source into a small InheritanceRef value object (parse/format), per the coupling cleanup filed in InheritanceLoader/InheritanceMap: private numeric-prefix protocol split across two files #47.
  • Rewritten extends tags now reuse the text actually captured from the {% extends %} tag rather than the loader's map key, preserving exact pre-refactor output even when the two differ (caught in code review of the first pass).

Test plan

  • uv run pytest — 342 passed (pre-existing, unrelated test_git_commands.py errors only, reproduced identically on master)
  • New unit tests for InheritanceRef.parse/format
  • New regression test proving the rewrite uses the captured extends text, not the map key (verified it fails against the intermediate buggy commit and passes with the fix)
  • ruff check/ruff format --check clean on changed files
  • mypy clean on changed file (one pre-existing, unrelated SuperUndefined.__call__ note untouched by this diff)

Refs #47

Replaces the ad hoc "N/name" string splitting/f-string rewriting in
InheritanceLoader.get_source with a small parse/format value object,
per issue #47's deepening review.

Refs #47
Code review of the prior commit found that ref.next().format() rewrote
the extends tag using the loader's map key instead of the text actually
captured from the {% extends %} tag, diverging from pre-refactor
behavior whenever they don't match. Also drops the now-unused
InheritanceRef.next(), since name always comes from the captured text.

Refs #47
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-27 14:12 UTC

@github-actions

Copy link
Copy Markdown
Contributor

Version hint: patch
Current version: 0.9.4
New version (when merged): 0.9.5

Comment ID: Display version hint-auto-generated

@coordt
coordt merged commit 8e2112c into master Sep 27, 2026
5 checks passed
@coordt
coordt deleted the refactor/issue-47-inheritance-ref branch September 27, 2026 14:11
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