Implement package layering refactor (Phases 1-2) - #806
Conversation
1e28edb to
7c8260d
Compare
|
Package dependencies after the split: flowchart LR
cli <--> plugins
cli --> build & targets & registry_management
plugins --> build & targets
build --> image
targets --> image
registry_management --> image
image --> config & parallel
Edges implied by a longer path are omitted (e.g. |
Moved functionsPaths are relative to
|
4605d2d to
66c3358
Compare
Split build execution, target selection, and registry cleanup out of BakeryConfig. Pass configuration and targets explicitly to reduce coupling and break the config/image dependency cycle. - Move build orchestration and metadata handling to build/runner.py - Move target selection and CI matrix generation to targets/ - Move registry cleanup to registry_management/clean.py, collapsing clean_caches/clean_temporary into a shared helper - Thread the per-command context (build/test/lint/scan/tag) through exit_if_no_targets so its error message names the right command - Keep CLI and plugin behavior covered by the refactored test suite
66c3358 to
207e33e
Compare
ianpittwood
left a comment
There was a problem hiding this comment.
The bulk of this looks good, just a few things we may want to address.
| """ | ||
| return _clean_registries( | ||
| targets, | ||
| registry_name=lambda target: cn.split(":")[0] if (cn := target.cache_name()) else None, |
There was a problem hiding this comment.
I think there's some risk with the else None fallback. I don't see any filtering done later in this logic so there's an opportunity for a TypeError at REGISTRY_PATTERN.match() calls.
There was a problem hiding this comment.
I factored this out to a helper for easier cognition and exception handling:
images-shared/posit-bakery/posit_bakery/registry_management/clean.py
Lines 39 to 45 in 367b368
Skip targets without cache names before invoking GHCR cleanup.\n\nExtract registry-name resolution into a helper to make the missing-cache case explicit.
Use the module name in the no-target error context for consistent identification.
d101e54 to
bd46a51
Compare
* main: Fold long table cell content instead of truncating Widen default Rich console width for non-TTY output build(deps): bump anyio Rename deprecated GitHub-hosted runner labels chore: ignore .pi-subagents, .rpiv, .serena build(deps): bump the actions group across 3 directories with 8 updates build(deps): bump the python-deps group across 2 directories with 3 updates Package bakery skill as plugin
Break circular dependencies in posit-bakery by splitting config layer into separate build, targets, and registry management packages.
Phase 1: Extract build execution and registry cleanup from BakeryConfig into dedicated build/ and registry_management/ packages. Moves build_targets, bake_plan_json, metadata loading/merging, clean_caches, and clean_temporary out of config layer.
Phase 2: Extract target selection logic into targets/ package. Consolidates duplicate filtering logic from cli/ci.py::matrix with BakeryConfig.generate_image_targets into a single select_targets function. Moves BakerySettings and BakeryConfigFilter to config/settings.py.
Result: config/ no longer imports image, parallel, or registry_management. The
BakeryConfig.targetscompatibility property was removed to avoid recreating theconfig → targets → image → configcycle; callers now select targets explicitly withtargets.select_targets(config, settings).Dependency rule after split:
Plan: package-layering.md
Related issue: