Fix default audit artifact paths to be under site root#89
Fix default audit artifact paths to be under site root#89PrzemyslawKlys merged 1 commit intomainfrom
Conversation
Pull Request ReviewSummaryThis PR fixes the default audit artifact paths (summary/sarif) to be relative to the built site root rather than using Code Quality: ✅ GoodPositive aspects:
Observations:
Correctness: ✅ VerifiedThe fix is correct because:
Potential Issues:
|
There was a problem hiding this comment.
Pull request overview
Adjusts the CLI pipeline runner’s audit “on-fail” default artifact paths so they resolve under the built site root (as required by WebSiteAuditor), preventing failures when defaults are used.
Changes:
- Update audit fallback
SummaryPathto a relative path under the site root (.powerforge/audit-summary.json) whensummaryOnFailis enabled and no path is provided. - Update audit fallback
SarifPathsimilarly (.powerforge/audit.sarif.json) whensarifOnFailis enabled and no path is provided. - Apply the same fallback behavior in both the pipeline audit step and the
doctortask audit path.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (string.IsNullOrWhiteSpace(resolvedSummaryPath) && summaryOnFail) | ||
| resolvedSummaryPath = ResolvePathWithinRoot(baseDir, null, Path.Combine(".powerforge", "audit-summary.json")); | ||
| resolvedSummaryPath = ".powerforge/audit-summary.json"; | ||
|
|
||
| var resolvedSarifPath = ResolveSarifPathForPipeline(sarif, sarifPath); | ||
| if (string.IsNullOrWhiteSpace(resolvedSarifPath) && sarifOnFail) | ||
| resolvedSarifPath = ResolvePathWithinRoot(baseDir, null, Path.Combine(".powerforge", "audit.sarif")); | ||
| resolvedSarifPath = ".powerforge/audit.sarif.json"; |
There was a problem hiding this comment.
These default fallback paths are hardcoded with forward slashes. Elsewhere in this file the repo consistently uses Path.Combine(...) for filesystem paths (e.g., ResolvePathWithinRoot(..., Path.Combine(".powerforge", ...)) around WebPipelineRunner.cs:92-95). Consider switching these to Path.Combine(".powerforge", ...) (still relative to SiteRoot) to avoid mixed separators and keep path construction consistent/cross-platform.
| if (string.IsNullOrWhiteSpace(resolvedSummaryPath) && summaryOnFail) | ||
| resolvedSummaryPath = ResolvePathWithinRoot(baseDir, null, Path.Combine(".powerforge", "audit-summary.json")); | ||
| resolvedSummaryPath = ".powerforge/audit-summary.json"; | ||
|
|
||
| var resolvedSarifPath = ResolveSarifPathForPipeline(sarif, sarifPath); | ||
| if (string.IsNullOrWhiteSpace(resolvedSarifPath) && sarifOnFail) | ||
| resolvedSarifPath = ResolvePathWithinRoot(baseDir, null, Path.Combine(".powerforge", "audit.sarif")); | ||
| resolvedSarifPath = ".powerforge/audit.sarif.json"; |
There was a problem hiding this comment.
Same as the earlier audit step: these fallback paths are hardcoded with /. For consistency with the rest of this file (and to avoid mixed separators when later combined with SiteRoot), prefer Path.Combine(".powerforge", "audit-summary.json") / Path.Combine(".powerforge", "audit.sarif.json") or a shared constant used by both code paths.
Fixes pipeline audit fallback artifact paths (summary/sarif) to be relative to the built site root, so audits don't fail with 'Path must resolve under site root' when defaults are used.