Repository navigation
fix(renderer): resolve oss-crs-infra: prefix in build-target context - #169
Merged
Merged
Conversation
`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>
Collaborator
|
I have questions... the reproduction |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
render_build_target_docker_composebuilds the rendered docker-composebuild.dockerfilevalue by joiningbuild_config.dockerfiledirectly undercrs.crs_path, skipping the_resolve_module_dockerfilehelper that otherrender paths already use. As a result, framework-infra references such as
oss-crs-infra:default-builderget rendered as a literal path<crs_path>/oss-crs-infra:default-builder, anddocker composethen abortswith
failed to read dockerfile: open oss-crs-infra:default-builder: no such file or directory.Reproduction
A CRS that declares an
inc-builderstep with a framework reference, e.g.triggers the bug when the build-target compose file is rendered for that
build step. Concretely, this is hit by the
crs-claude-coderegistry entryon its
inc-builderbuild, and surfaces in CRSBench's smoke tests as:Root cause
oss_crs/src/templates/renderer.pyalready exposes_resolve_module_dockerfile(crs_path, dockerfile)(lines 36–47), whichresolves
oss-crs-infra:<module>toOSS_CRS_ROOT_PATH/oss-crs-infra/<module>/Dockerfileand falls back tocrs_path / dockerfilefor plain paths. Thecrs_run_phaserendering pathroutes 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:fromtarget_build_phase; before that, onlycrs_run_phaseexercised theprefix and the resolver was always applied.
Fix
Route the build-target context's
builder_dockerfilethrough the samehelper:
No behavioral change for plain dockerfile paths —
_resolve_module_dockerfilefalls back to
crs_path / dockerfilefor any value that does not start withOSS_CRS_INFRA_PREFIX("oss-crs-infra:").Tests
Added
oss_crs/tests/unit/test_renderer_build_target.pywith four cases:test_infra_prefix_resolves_to_framework_dockerfile_path—oss-crs-infra:default-builderresolves to
OSS_CRS_ROOT_PATH/oss-crs-infra/default-builder/Dockerfile.test_plain_dockerfile_resolves_relative_to_crs_path— plain paths stillresolve to
crs.crs_path / dockerfile.test_infra_prefix_does_not_leak_colon_into_path(parametrized) — theliteral
oss-crs-infra:token never appears in the rendered dockerfilepath, and the path ends with
/Dockerfile.All four pass; existing
test_renderer_run_compose,test_template_rendering,and
test_templatescontinue to pass unchanged.Test plan
uv run pytest oss_crs/tests/unit/test_renderer_build_target.py -vuv 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.pyuv run ruff check oss_crs/tests/unit/test_renderer_build_target.pyuv run ruff format --check oss_crs/tests/unit/test_renderer_build_target.py oss_crs/src/templates/renderer.pyscripts/ci-tests/run-local.sh smoke-bugfixing) once submodule pointer is bumped to this commit