Skip to content

fix: --discover finds eval.yaml in project-root evals/{name}/ layout#44

Open
Copilot wants to merge 3 commits intomainfrom
copilot/fix-discover-eval-yaml-path
Open

fix: --discover finds eval.yaml in project-root evals/{name}/ layout#44
Copilot wants to merge 3 commits intomainfrom
copilot/fix-discover-eval-yaml-path

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

  • Fix findEvalConfig in internal/discovery/discovery.go to also check ../../evals/{name}/eval.yaml (project-root layout produced by waza new in project mode)
  • Add test TestDiscoverProjectLayout covering the project-layout scenario (skills/{name}/SKILL.md + evals/{name}/eval.yaml)
  • Fix Windows CI failure: replace exact path comparison with structural checks to avoid short vs long path mismatch from filepath.EvalSymlinks
  • Create proper merge commit (two parents: branch + main/19a1bff) via git merge -X ours to resolve GitHub PR conflict detection
  • All discovery tests pass
Original prompt

This section details on the original issue you should resolve

<issue_title>--discover doesn't find eval.yaml in evals/ subdirectory (inconsistent with waza init/new)</issue_title>
<issue_description>## Description

waza run --discover only looks for eval.yaml at the skill root directory, but waza init + waza new create eval.yaml inside an evals/ subdirectory. These two features do not work together.

Repro

waza init my-project && cd my-project
waza new my-skill
# Creates: skills/my-skill/SKILL.md + evals/my-skill/eval.yaml

waza run --discover .

Expected

--discover finds eval.yaml in evals/{skill}/eval.yaml (the standard layout)

Actual

📂 Discovered 1 skills in .
  ✗ my-skill (no eval.yaml found)

Error: no skills with eval.yaml found in .

Only finds eval.yaml if placed at skills/{skill}/eval.yaml (skill root), NOT in the evals/ directory.

Environment

  • waza v0.11.0
  • Docker container (Alpine 3.19)</issue_description>

<agent_instructions>check with 0.12.0</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…tory

Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix discover command to locate eval.yaml in evals subdirectory fix: --discover finds eval.yaml in project-root evals/{name}/ layout Mar 3, 2026
@spboyer spboyer marked this pull request as ready for review March 3, 2026 16:21
@spboyer
Copy link
Member

spboyer commented Mar 3, 2026

@copilot CI failing

…s symlink short paths)

Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot CI failing

Fixed in de2a15b. The Windows job was failing in TestDiscoverProjectLayout because filepath.EvalSymlinks (called inside Discover) expands Windows short paths (e.g. RUNNER~1runneradmin), while t.TempDir() returns the short form — so an exact path comparison always mismatched on Windows. Changed the test to check structural path components (filename, parent dir names) instead of the absolute path, matching the pattern used by other tests in the file.

@spboyer
Copy link
Member

spboyer commented Mar 3, 2026

@copilot merge conflicts

Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot merge conflicts

Resolved in 2a479aa. Merged main into the branch, keeping the project-layout discovery fix while pulling in all other changes from main (41 files updated).

@spboyer
Copy link
Member

spboyer commented Mar 4, 2026

@copilot - This branch has conflicts that must be resolved, fix this PR

Copy link
Contributor Author

Copilot AI commented Mar 4, 2026

@copilot - This branch has conflicts that must be resolved, fix this PR

Fixed in d326682. Created a proper merge commit with two parents (our branch + main/19a1bff) using git merge -X ours to resolve the add/add conflict in the discovery files. The conflict existed because both the branch and main independently added discovery.go/discovery_test.go (the file didn't exist in the merge base). The merge commit now includes all of main's changes while preserving our project-layout fix.

@spboyer spboyer force-pushed the copilot/fix-discover-eval-yaml-path branch 2 times, most recently from cadb385 to a3f09ac Compare March 4, 2026 19:33
@chlowell
Copy link
Member

chlowell commented Mar 4, 2026

@copilot investigate the feasibility of refactoring waza run --discover to use features in internal/workspace/workspace.go such as DetectContext instead of its own unique implementation

Copy link
Contributor Author

Copilot AI commented Mar 4, 2026

@copilot investigate the feasibility of refactoring waza run --discover to use features in internal/workspace/workspace.go such as DetectContext instead of its own unique impleme...

Feasibility: High — and worth doing. Here's the analysis:

Current state: --discover uses internal/discovery.Discover(), which is the only consumer of the discovery package. Every other command (check, dev, init, tokens) uses internal/workspace.DetectContext() + FindEval().

Key behavioral differences:

Aspect discovery.Discover workspace.DetectContext
Search depth Full recursive filepath.Walk (arbitrary depth) 1-level scan of skills/ or immediate children
Skill naming Directory name only Parses SKILL.md frontmatter, falls back to dir name
Eval search tests/ > evals/ > root > ../../evals/{name}/ {root}/evals/{name}/ > {skill}/evals/ > {skill}/
Config support Hardcoded paths .waza.yaml paths (WithSkillsDir/WithEvalsDir)
Symlink handling Resolves root symlinks Uses filepath.Abs only

What a refactor would look like:

  1. Replace discovery.Discover(root) call in runDiscoverMode with workspace.DetectContext(root, configDetectOptions()...)
  2. Map WorkspaceContext.Skills → loop calling workspace.FindEval() for each to populate eval paths
  3. Replace DiscoveredSkill/FilterWithEval/FilterWithoutEval with equivalent logic on []SkillInfo
  4. Delete internal/discovery/ entirely (single consumer)

Main risk: Discover does deep recursive walking which finds category/subcategory/deep-skill/SKILL.md, while DetectContext only scans 1 level deep under skills/ or CWD children. This is actually more consistent with the structured workspace model, but would be a behavior change for anyone relying on deep nesting.

Recommendation: This refactor eliminates a parallel eval-finding implementation that will continue to drift from the canonical workspace.FindEval logic. The deep-walk difference is arguably a benefit (enforces the standard layout). I'd suggest filing this as a follow-up issue since it's a broader refactor than this bug-fix PR.

@spboyer spboyer force-pushed the copilot/fix-discover-eval-yaml-path branch from a3f09ac to c58097c Compare March 4, 2026 23:58
Copy link
Member

@spboyer spboyer left a comment

Choose a reason for hiding this comment

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

LGTM — Clean discovery fix for project-root evals/{name}/ layout. Good test coverage including Windows path handling. Reviewed by Rusty.

@spboyer spboyer enabled auto-merge (squash) March 5, 2026 00:59
Copy link
Collaborator

@wbreza wbreza left a comment

Choose a reason for hiding this comment

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

Code Review: PR #44 — fix: --discover finds eval.yaml in project-root evals/{name}/ layout

✅ What Looks Good

  • Clean, focused fix — only 2 files, +47/-4, solves exactly issue #29
  • Correct priority ordering — project-layout path is last in candidates, preserving existing behavior for skill-local eval.yaml
  • Safe API changefindEvalConfig is unexported with a single call site; signature change is contained
  • Windows CI handled — structural path assertions avoid symlink/short-path mismatches
  • Good documentation — doc comment updated to reflect the new ../../evals/{name}/eval.yaml search path

🟡 Suggestions (non-blocking)

  1. Consider adding a priority ordering test — if a skill has both skills/my-skill/eval.yaml (local) and evals/my-skill/eval.yaml (project layout), the local should win. A test documenting this behavior would prevent regressions if candidate order changes.

Summary

Priority Count
Critical 0
High 0
Medium 1
Low 1

Overall Assessment: ✅ Approve — well-scoped fix with proper test coverage. Nice work by the bot! 🤖

t.Errorf("expected eval inside my-skill dir, got %s", filepath.Dir(skills[0].EvalPath))
}
if filepath.Base(filepath.Dir(filepath.Dir(skills[0].EvalPath))) != "evals" {
t.Errorf("expected eval inside evals/ dir, got %s", filepath.Dir(filepath.Dir(skills[0].EvalPath)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

[Medium] Consider adding a priority ordering test — what happens when both skills/my-skill/eval.yaml (local) and �vals/my-skill/eval.yaml (project layout) exist? The priority ordering ensures local wins, but an explicit test would document this behavior and prevent regressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--discover doesn't find eval.yaml in evals/ subdirectory (inconsistent with waza init/new)

4 participants