---
id: TASK-15.2
title: Apply interpolation with profile-aware resolution
status: Done
assignee:
  - '@codex'
created_date: '2026-02-19 15:48'
updated_date: '2026-02-19 16:06'
labels: []
dependencies: []
references:
  - lua/zync/api/configurator.lua
  - lua/zync/api/manager.lua
parent_task_id: TASK-15
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Ensure interpolation uses the active profile context so shared/global values that reference ${board}, ${build_dir}, ${project_dir}, etc. resolve based on the selected profile at runtime.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 Global config values referencing profile keys resolve according to the active profile at runtime.
- [x] #2 Profile-specific values interpolate using their own scope when appropriate.
- [x] #3 Behavior is consistent for configs without profiles or without placeholders.
<!-- AC:END -->

## Implementation Plan

<!-- SECTION:PLAN:BEGIN -->
1) Review profile selection in Configurator.init_conf and where args are consumed to determine the correct interpolation scope/timing.
2) Add profile-aware interpolation so global args referencing ${board}/${build_dir}/${project_dir} resolve using the active profile’s merged config.
3) Ensure profile-specific tables interpolate with their own resolved context and leave configs without profiles/placeholders unchanged.
<!-- SECTION:PLAN:END -->

## Implementation Notes

<!-- SECTION:NOTES:BEGIN -->
Adjusted Configurator.init_conf to interpolate base config without profiles, then interpolate each profile table using a profile-aware scope (board/runner/zephyr overrides and build_dir = build/<profile> unless overridden). This ensures global args resolve against active profile while profile-specific values resolve against their own scope. Tests not run (per instruction).
<!-- SECTION:NOTES:END -->

## Final Summary

<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Updated Configurator.init_conf to perform profile-aware interpolation: base config is interpolated without profiles, then each profile table is interpolated with its own scope (board/runner/zephyr overrides and build_dir = build/<profile> unless overridden). This ensures global placeholders resolve using the active profile while profile-specific values resolve within their own scope. Tests not run (per instruction).
<!-- SECTION:FINAL_SUMMARY:END -->
