Skip to content

Fix mixed-string scalar interpolation - #232

Open
amuraru wants to merge 1 commit into
mainfrom
fix/177-mixed-nested-interpolation
Open

amuraru wants to merge 1 commit into
mainfrom
fix/177-mixed-nested-interpolation

Conversation

@amuraru

@amuraru amuraru commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #177.

Preserve surrounding text when interpolating integer, boolean, or float values into a string. Return the original scalar type only when the entire string is exactly that placeholder.

Add regression coverage for nested references, zero, negative integers, floats, both booleans, repeated placeholders, and multiple placeholders in either dictionary order.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test improvement

Testing

  • Tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested the changes manually

Validation on macOS, Python 3.13:

  • .venv/bin/python -m pytest tests/test_interpolation.py -k 'scalar_interpolation' -q — confirmed all eight new cases fail before the fix.
  • .venv/bin/python -m pytest tests/test_interpolation.py tests/test_edge_cases.py tests/test_config_generator.py -q — passed, 109 tests.
  • .venv/bin/python -m pytest tests/ -q --cov=himl --cov-report=term-missing --cov-fail-under=80 — passed, 268 tests; 92.60% coverage.
  • PATH="$PWD/.venv/bin:$PATH" make lint — passed; fatal flake8 checks and mypy are clean. The advisory flake8 pass reports existing E501/F841 warnings, including duplicate reports from a local ignored worktree.
  • git diff --check — passed.
  • Manual reproduction with temporary foo.yaml and baz.yaml files through ConfigProcessor.process — passed: mixed interpolation produces hello 42 world, and standalone interpolation remains integer 42.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Additional Notes

No new dependencies, configuration, or public APIs. Comments and documentation changes are unnecessary for this localized bug fix; no downstream changes are required.

The multi-version CI matrix and Docker build were not run locally.

Preserve string context for embedded scalars and original types for standalone placeholders.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.

Nested interpolation lost when mixed inside string context

1 participant