Skip to content

logic rename: classify template calls across files like the compile - #425

Merged
discostu105 merged 1 commit into
mainfrom
fix/rename-scoped-settings
Dec 6, 2026
Merged

discostu105 merged 1 commit into
mainfrom
fix/rename-scoped-settings

Conversation

@discostu105

Copy link
Copy Markdown
Owner

lox logic rename failed on every name in the house module with

error: pages: compile error: `licht_kueche.lc.Desc`: `licht_kueche` is not a template instance, so `licht_kueche.lc` names no block

plan_rename parsed each file with parse_fragment and concatenated the items. A call of a template declared in another file (licht_kueche = Licht(…) with template Licht in _vorlagen.loxl) stays an Item::Block until classify_instances runs. The compile does that in Module::from_fragments, and rename never did. So every scoped setting on an instance's block failed validation.

Change, mirroring load_module:

  • classify each fragment with the templates of all fragments
  • read file(…) relative to each fragment
  • merge with Module::from_fragments (fragment ends keep page per file)
  • validate the expanded module after the rename too, not only before

Test: rename_keeps_settings_on_instance_blocks (template and call in different files, a setting on a body block, rename of an unrelated name and of the instance). It fails without the fix with exactly that error.

Checked on a copy of the house module: rename zaehler_kueche_licht zaehler_licht_buero_conny → 1 file rewritten, 1 lock entry rekeyed, output byte-identical.

plan_rename parsed each file on its own and merged the items without
classifying instances, so a template called from another file stayed a
block and every scoped setting on its body (a.lc.Desc = ...) failed as
"not a template instance". It now classifies with the module's templates,
reads file(...) per fragment and merges with fragment ends, as load_module
does, and validates the expanded module after the rename too.
@discostu105 discostu105 added the release:patch Auto-release: patch bump even if Added label Dec 6, 2026
@codecov

codecov Bot commented Dec 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 77.30%. Comparing base (5ee8797) to head (53794d3).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
crates/loxone-config/src/cli.rs 93.33% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #425   +/-   ##
=======================================
  Coverage   77.29%   77.30%           
=======================================
  Files         163      163           
  Lines       53347    53359   +12     
=======================================
+ Hits        41235    41247   +12     
  Misses      12112    12112           
Files with missing lines Coverage Δ
crates/loxone-config/src/cli.rs 57.09% <93.33%> (+0.29%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@discostu105
discostu105 merged commit 767da4b into main Dec 6, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:patch Auto-release: patch bump even if Added

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant