Skip to content

fix(pipeline): resolve all policies in LoadAndResolve - #223

Merged
trevor-vaughan merged 1 commit into
mainfrom
opsx/199-bug-load-and-resolve-skip
Aug 4, 2026
Merged

fix(pipeline): resolve all policies in LoadAndResolve#223
trevor-vaughan merged 1 commit into
mainfrom
opsx/199-bug-load-and-resolve-skip

Conversation

@trevor-vaughan

@trevor-vaughan trevor-vaughan commented Aug 3, 2026

Copy link
Copy Markdown
Member

Summary

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.

Assisted-By: Claude Opus 4.8

Related Issues

Fixes: #199

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>
@trevor-vaughan trevor-vaughan added bug Something isn't working llm_assisted Issue triaged or authored with LLM assistance labels Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

✅ CRAP Load Analysis: PASS (no baseline)

No baseline file found at .gaze/baseline.json. Showing current scores without regression detection.

How to Enable Regression Detection

Generate 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

Metric Value
Functions analysed 1
Avg complexity 6
Avg line coverage 92.9%
Avg CRAP score 6
CRAPload (>= 15) 0
Avg contract coverage 0%
Avg GazeCRAP score 0
GazeCRAPload (>= 15) 0

View full analysis logs

@trevor-vaughan
trevor-vaughan marked this pull request as ready for review August 3, 2026 17:34
@trevor-vaughan
trevor-vaughan requested a review from a team as a code owner August 3, 2026 17:34

@yvonnedevlinrh yvonnedevlinrh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@trevor-vaughan
trevor-vaughan merged commit 072e552 into main Aug 4, 2026
18 checks passed
@trevor-vaughan
trevor-vaughan deleted the opsx/199-bug-load-and-resolve-skip branch August 4, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working llm_assisted Issue triaged or authored with LLM assistance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: LoadAndResolve silently skips policy resolution when no catalogs loaded

2 participants