Skip to content

fix(renderer): resolve oss-crs-infra: prefix in build-target context - #169

Merged
acorn421 merged 1 commit into
mainfrom
fix/build-target-resolve-infra-prefix
Apr 15, 2026
Merged

acorn421 merged 1 commit into
mainfrom
fix/build-target-resolve-infra-prefix

Conversation

@acorn421

Copy link
Copy Markdown
Collaborator

Summary

render_build_target_docker_compose builds the rendered docker-compose
build.dockerfile value by joining build_config.dockerfile directly under
crs.crs_path, skipping the _resolve_module_dockerfile helper that other
render paths already use. As a result, framework-infra references such as
oss-crs-infra:default-builder get rendered as a literal path
<crs_path>/oss-crs-infra:default-builder, and docker compose then aborts
with failed to read dockerfile: open oss-crs-infra:default-builder: no such file or directory.

Reproduction

A CRS that declares an inc-builder step with a framework reference, e.g.

target_build_phase:
  - name: inc-builder
    snapshot: true
    dockerfile: oss-crs-infra:default-builder

triggers the bug when the build-target compose file is rendered for that
build step. Concretely, this is hit by the crs-claude-code registry entry
on its inc-builder build, and surfaces in CRSBench's smoke tests as:

[smoke:bugfixing:worker] failed to solve: failed to read dockerfile:
open oss-crs-infra:default-builder: no such file or directory
[smoke:bugfixing:worker] FAIL Prepare docker images defined in docker compose file

Root cause

oss_crs/src/templates/renderer.py already exposes
_resolve_module_dockerfile(crs_path, dockerfile) (lines 36–47), which
resolves oss-crs-infra:<module> to
OSS_CRS_ROOT_PATH/oss-crs-infra/<module>/Dockerfile and falls back to
crs_path / dockerfile for plain paths. The crs_run_phase rendering path
routes its values through this helper. The build-target context builder
(line 129) was the only call site that bypassed it, so the prefix mechanism
silently failed for any infra reference declared in target_build_phase.

This was latent until a CRS started referencing oss-crs-infra: from
target_build_phase; before that, only crs_run_phase exercised the
prefix and the resolver was always applied.

Fix

Route the build-target context's builder_dockerfile through the same
helper:

"builder_dockerfile": _resolve_module_dockerfile(
    crs.crs_path, build_config.dockerfile
),

No behavioral change for plain dockerfile paths — _resolve_module_dockerfile
falls back to crs_path / dockerfile for any value that does not start with
OSS_CRS_INFRA_PREFIX ("oss-crs-infra:").

Tests

Added oss_crs/tests/unit/test_renderer_build_target.py with four cases:

  • test_infra_prefix_resolves_to_framework_dockerfile_path — oss-crs-infra:default-builder
    resolves to OSS_CRS_ROOT_PATH/oss-crs-infra/default-builder/Dockerfile.
  • test_plain_dockerfile_resolves_relative_to_crs_path — plain paths still
    resolve to crs.crs_path / dockerfile.
  • test_infra_prefix_does_not_leak_colon_into_path (parametrized) — the
    literal oss-crs-infra: token never appears in the rendered dockerfile
    path, and the path ends with /Dockerfile.

All four pass; existing test_renderer_run_compose, test_template_rendering,
and test_templates continue to pass unchanged.

Test plan

  • uv run pytest oss_crs/tests/unit/test_renderer_build_target.py -v
  • uv run pytest oss_crs/tests/unit/test_renderer_run_compose.py oss_crs/tests/unit/test_template_rendering.py oss_crs/tests/unit/test_templates.py
  • uv run ruff check oss_crs/tests/unit/test_renderer_build_target.py
  • uv run ruff format --check oss_crs/tests/unit/test_renderer_build_target.py oss_crs/src/templates/renderer.py
  • CRSBench-sidecar smoke (scripts/ci-tests/run-local.sh smoke-bugfixing) once submodule pointer is bumped to this commit

`render_build_target_docker_compose` joined `build_config.dockerfile`
directly under `crs.crs_path`, so a framework infra reference such as
`oss-crs-infra:default-builder` was rendered as
`<crs_path>/oss-crs-infra:default-builder` and docker compose then
failed with `failed to read dockerfile`.

Other render paths (`crs_run_phase`, etc.) already route the value
through `_resolve_module_dockerfile`. Apply the same helper here so
infra references resolve to `OSS_CRS_ROOT_PATH/oss-crs-infra/<module>/Dockerfile`,
and plain dockerfile paths continue to resolve under `crs.crs_path`.

Add unit tests covering both resolution branches to guard against
regressions.

Signed-off-by: Youngjoon Kim <acorn421@gmail.com>
@acorn421
acorn421 requested a review from azchin April 15, 2026 06:54
@acorn421
acorn421 merged commit 049162a into main Apr 15, 2026
6 checks passed
@acorn421
acorn421 deleted the fix/build-target-resolve-infra-prefix branch April 15, 2026 07:06
@azchin

azchin commented Apr 15, 2026

Copy link
Copy Markdown
Collaborator

I have questions... the reproduction crs.yaml is from the main branch of crs-claude-code which doesn't have the sidecar branch changes merged yet.

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.

2 participants