fix(harness): resolve URL base scripts relative to scaffold root#2613
Conversation
resolveBaseScripts used urlDirPrefix to resolve script relative paths against the YAML file's URL directory. But script paths in harness YAMLs are relative to the scaffold root (the parent of harness/), not the YAML file itself — matching local resolution where ResolveRelativeTo is called with absFullsendDir (the workspace root). Add urlParentDirPrefix that goes up one additional directory level and use it in resolveBaseScripts. Fix existing tests that encoded the bug by mounting scripts under /harness/scripts/ instead of /scripts/. Fixes #2610 Assisted-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Ralph Bean <rbean@redhat.com>
PR Summary by QodoFix harness URL base script resolution to scaffold root Description
Diagram
High-Level Assessment
Files changed (2)
|
Site previewPreview: https://235819b8-site.fullsend-ai.workers.dev Commit: |
Code Review by Qodo
Context used✅ Tickets:
🎫 harness: URL base script resolution resolves relative to YAML dir instead of scaffold root✅ Compliance rules (platform):
51 rules✅ Skills:
writing-user-docs, writing-adrs 1. Query breaks script URL join
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
waynesun09
left a comment
There was a problem hiding this comment.
LGTM — clean, well-scoped bugfix. The core change correctly aligns URL-based script resolution with local resolution. Tests are comprehensive and CI is green. Two non-blocking suggestions posted inline.
[MEDIUM] urlDirPrefix is now dead production code
After this change, urlDirPrefix (line 712) has zero production callers — only referenced in TestURLDirPrefix and a test comment. Dead unexported code adds maintenance burden.
Non-blocking suggestion: remove in a follow-up cleanup, or add a comment explaining why it is retained.
Assisted-by: Claude (review), Gemini (review), Codex (review)
| if err != nil { | ||
| return "" | ||
| } | ||
| dir := path.Dir(path.Dir(parsed.Path)) |
There was a problem hiding this comment.
[MEDIUM] Hardcoded one-level parent assumption
path.Dir(path.Dir(parsed.Path)) assumes the harness YAML is always exactly one directory below the scaffold root. Today this holds (scaffold layout enforces it, and resolveHarnessPath in lock.go also hardcodes single-depth), so this is safe.
Non-blocking suggestion: consider a doc comment noting this constraint, or renaming to urlScaffoldRootPrefix to make the intent explicit.
Summary
resolveBaseScriptsresolved script relative paths against the YAML file's URL directory (urlDirPrefix), but script paths are relative to the scaffold root (parent ofharness/), matching local resolution viaResolveRelativeTo(absFullsendDir)urlParentDirPrefixthat goes up one additional directory level and use it inresolveBaseScripts/harness/scripts/instead of/scripts/Fixes #2610
Test plan
TestLoadWithBase_URLBase_ScriptsRelativeToScaffoldRoot— mirrors real scaffold layout whereharness/andscripts/are siblingsTestURLParentDirPrefixunit testsgo vetclean