-
Notifications
You must be signed in to change notification settings - Fork 15
ci: parallel functional tests with dynamic matrix strategy #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d453c2e
test(eval): add first happy-path functional test for review agent
ralphbean d71ba27
ci: run review eval in functional-tests workflow
ralphbean c913d42
ci: dynamically select eval agents from changed files
ralphbean d2a77ea
ci: run functional tests in parallel with dynamic matrix strategy
ralphbean e3b3be3
ci(functional-tests): catch cancelled matrix legs in roll-up and guar…
ralphbean ed0c98b
ci(functional-tests): harden workflow against injection and silent fa…
ralphbean dad29e6
ci(functional-tests): diff-based agent selection for push events and …
ralphbean 4c66768
fix: address review feedback on PR #148
ralphbean feaaed4
fix: handle all-variable harness files in extract_refs
ralphbean File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| #!/usr/bin/env bash | ||
| # select-eval-agents.sh — Given changed files on stdin, output agent names | ||
| # whose functional tests should run. | ||
| # | ||
| # Usage: | ||
| # echo "env/triage.env" | ./select-eval-agents.sh [--repo-root <path>] | ||
| # | ||
| # Logic: | ||
| # For each harness/*.yaml that has a corresponding eval/<agent>/eval.yaml, | ||
| # extract all file paths referenced in the harness config. If any changed | ||
| # file matches a referenced path (or is under a referenced directory like | ||
| # skills/ or plugins/), or if the harness file itself changed, or if a | ||
| # file under eval/<agent>/ changed, output that agent name. | ||
| set -euo pipefail | ||
|
|
||
| REPO_ROOT="." | ||
| while [[ $# -gt 0 ]]; do | ||
| case "$1" in | ||
| --repo-root) REPO_ROOT="$2"; shift 2 ;; | ||
| *) echo "Unknown option: $1" >&2; exit 1 ;; | ||
| esac | ||
| done | ||
|
|
||
| # Read changed files from stdin into an array | ||
|
ralphbean marked this conversation as resolved.
|
||
| mapfile -t CHANGED_FILES | ||
|
|
||
| if [[ ${#CHANGED_FILES[@]} -eq 0 ]]; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Extract all file-path references from a harness YAML. | ||
| # Skips variable references (${...}) and null values. | ||
| extract_refs() { | ||
| local harness_file="$1" | ||
| yq -r ' | ||
| [ | ||
| .agent, .doc, .policy, .pre_script, .post_script, | ||
| .validation_loop.script, .validation_loop.schema, | ||
| (.host_files[]?.src), | ||
| (.skills[]?), | ||
| (.plugins[]?), | ||
| .forge.github.pre_script, .forge.github.post_script | ||
| ] | .[] | select(. != null) | ||
| ' "$harness_file" | { grep -v '\$' || true; } | sort -u | ||
| } | ||
|
|
||
| # For each harness file with an eval config, check if any changed file is relevant. | ||
| for harness_file in "$REPO_ROOT"/harness/*.yaml; do | ||
| [[ -f "$harness_file" ]] || continue | ||
| agent="$(basename "$harness_file" .yaml)" | ||
|
|
||
| # Validate agent name — defense against injection via malicious filenames | ||
| if [[ ! "$agent" =~ ^[a-zA-Z0-9_-]+$ ]]; then | ||
| echo "::error::Invalid agent name: $agent" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Only consider agents that have eval configs | ||
| [[ -f "$REPO_ROOT/eval/$agent/eval.yaml" ]] || continue | ||
|
|
||
| # Collect all paths this agent cares about | ||
| if ! refs_output=$(extract_refs "$harness_file"); then | ||
| echo "::error::Failed to parse $harness_file" >&2 | ||
| exit 1 | ||
| fi | ||
| if [[ -n "$refs_output" ]]; then | ||
| mapfile -t REFS <<< "$refs_output" | ||
| else | ||
| REFS=() | ||
| fi | ||
|
|
||
| selected=false | ||
| for changed in "${CHANGED_FILES[@]}"; do | ||
| # Direct harness file change | ||
| if [[ "$changed" == "harness/${agent}.yaml" ]]; then | ||
| selected=true | ||
| break | ||
| fi | ||
|
|
||
| # File under eval/<agent>/ | ||
| if [[ "$changed" == eval/"$agent"/* ]]; then | ||
| selected=true | ||
| break | ||
| fi | ||
|
|
||
| # Check against referenced paths | ||
| for ref in "${REFS[@]}"; do | ||
| # Exact match | ||
| if [[ "$changed" == "$ref" ]]; then | ||
| selected=true | ||
| break 2 | ||
| fi | ||
| # Prefix match for directories (skills/, plugins/) | ||
| if [[ "$changed" == "$ref"/* ]]; then | ||
| selected=true | ||
| break 2 | ||
| fi | ||
| done | ||
| done | ||
|
|
||
| if [[ "$selected" == true ]]; then | ||
| echo "$agent" | ||
| fi | ||
| done | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.