fix(pipeline): resolve all policies in LoadAndResolve - #223
Merged
Conversation
LoadAndResolve wrapped the requirement.ResolvePolicy call in a `len(loaded.Catalogs) > 0 || len(loaded.Guidance) > 0` guard, silently skipping policy resolution when policies were loaded but no catalogs or guidance were. That contradicted the function's documented contract to "resolve all policies against the merged set" and left standalone policies unresolved. Remove the guard so every loaded policy is resolved. ResolvePolicy already handles the no-imports case, returning a valid empty ResolvedPolicy, and surfaces a descriptive error for unresolvable imports. Add pipeline-level tests covering both newly-live paths: a standalone policy with no catalogs or guidance resolves successfully, and a policy whose import cannot be resolved propagates the resolve error. Fixes: #199 Assisted-By: Claude Opus 4.8 Signed-off-by: Trevor Vaughan <tvaughan@redhat.com>
✅ CRAP Load Analysis: PASS (no baseline)No baseline file found at How to Enable Regression DetectionGenerate and commit a baseline file to track CRAP score changes over time: # 1. Install gaze
go install github.com/unbound-force/gaze/cmd/gaze@latest
# 2. Run tests and generate baseline
go test -coverprofile=coverage.out ./...
mkdir -p .gaze
gaze crap --format=json --coverprofile=coverage.out ./... > .gaze/baseline.json
# 3. Commit the baseline
git add .gaze/baseline.json
git commit -m "chore: add CRAP baseline for regression detection"For more information: Summary
|
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
LoadAndResolve wrapped the requirement.ResolvePolicy call in a
len(loaded.Catalogs) > 0 || len(loaded.Guidance) > 0guard, silently skipping policy resolution when policies were loaded but no catalogs or guidance were. That contradicted the function's documented contract to "resolve all policies against the merged set" and left standalone policies unresolved.Remove the guard so every loaded policy is resolved. ResolvePolicy already handles the no-imports case, returning a valid empty ResolvedPolicy, and surfaces a descriptive error for unresolvable imports.
Add pipeline-level tests covering both newly-live paths: a standalone policy with no catalogs or guidance resolves successfully, and a policy whose import cannot be resolved propagates the resolve error.
Assisted-By: Claude Opus 4.8
Related Issues
Fixes: #199