-
Notifications
You must be signed in to change notification settings - Fork 13
feat(eval): add measurement manifests for online scoring #722
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
+826
−2
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
67ee554
feat(eval): add measurement manifests for online scoring
ascerra a2d3e4f
fix(eval): normalize ID casing and add YAML document markers
ascerra 63bc143
docs(eval): clarify agent coverage in measurements README
ascerra 150b93d
docs(eval): clarify measurement manifest ownership
ascerra 8c86a98
docs(eval): hyperlink ADR 0087 in eval README
ascerra 7f35527
docs(eval): lowercase em-001 and drop 404 ADR links
ascerra 9fcc1ad
ci(eval): lint measurement manifests in pre-commit
ascerra 8fc7e8a
fix(eval): address second-round measurement-manifest review
ascerra bef9da0
fix(eval): close measurement-lint fail-opens from Wayne sweep
ascerra 478f64c
fix(eval): tighten measurement lint against LoadRegistry holes
ascerra f4511e9
fix(eval): close nested-map and duplicate-key lint holes
ascerra 086085d
fix(eval): reject flow and YAML-literal measurement scalars
ascerra 2df9633
fix(eval): make measurement comment stripping quote-aware
ascerra 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
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
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
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
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
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
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,301 @@ | ||
| #!/usr/bin/env bash | ||
| # lint-measurements-test.sh — Tests for eval/lint-measurements.sh | ||
| # | ||
| # Run from the repo root: | ||
| # bash eval/lint-measurements-test.sh | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| LINTER="${SCRIPT_DIR}/lint-measurements.sh" | ||
|
|
||
| FAILURES=0 | ||
| WORKDIR="$(mktemp -d)" | ||
| trap 'rm -rf "${WORKDIR}"' EXIT | ||
|
|
||
| VALID_YAML='--- | ||
| agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| ' | ||
|
|
||
| # run_case NAME YAML EXPECTED_EXIT [EXPECTED_OUTPUT_SUBSTRING] [FILENAME] | ||
| run_case() { | ||
| local name="$1" yaml="$2" expected_exit="$3" expected_substring="${4:-}" filename="${5:-code.yaml}" | ||
|
|
||
| local case_dir="${WORKDIR}/${name}" | ||
| mkdir -p "${case_dir}/eval/measurements" "${case_dir}/agents" | ||
| printf '%s\n' "# Code Agent" > "${case_dir}/agents/code.md" | ||
| if [[ -n "$yaml" ]]; then | ||
| printf '%s' "$yaml" > "${case_dir}/eval/measurements/${filename}" | ||
| fi | ||
|
|
||
| local output | ||
| local actual_exit=0 | ||
| output="$(REPO_ROOT="${case_dir}" MEASUREMENTS_DIR="${case_dir}/eval/measurements" AGENTS_DIR="${case_dir}/agents" "${LINTER}" 2>&1)" || actual_exit=$? | ||
|
|
||
| if [[ "${actual_exit}" != "${expected_exit}" ]]; then | ||
| echo "FAIL: ${name} (exit ${actual_exit}, expected ${expected_exit})" | ||
| echo "${output}" | sed 's/^/ /' | ||
| FAILURES=$((FAILURES + 1)) | ||
| return | ||
| fi | ||
|
|
||
| if [[ -n "${expected_substring}" ]] && [[ "${output}" != *"${expected_substring}"* ]]; then | ||
| echo "FAIL: ${name} (missing expected output: '${expected_substring}')" | ||
| echo "${output}" | sed 's/^/ /' | ||
| FAILURES=$((FAILURES + 1)) | ||
| return | ||
| fi | ||
|
|
||
| echo "PASS: ${name}" | ||
| } | ||
|
|
||
| run_case "valid-manifest-passes" \ | ||
| "${VALID_YAML}" 0 "code.yaml: OK" | ||
|
|
||
| run_case "unknown-scorer" \ | ||
| "--- | ||
| agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace-fitness | ||
| version: 1 | ||
| " 1 "unknown scorer 'trace-fitness'" | ||
|
|
||
| run_case "unknown-agent" \ | ||
| "--- | ||
| agent: not-an-agent | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| " 1 "has no agents/not-an-agent.md" "not-an-agent.yaml" | ||
|
|
||
| run_case "filename-agent-mismatch" \ | ||
| "--- | ||
| agent: review | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| " 1 "does not match filename stem" "code.yaml" | ||
|
|
||
| run_case "duplicate-id" \ | ||
| "--- | ||
| agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| " 1 "duplicate id 'em-001'" | ||
|
|
||
| run_case "uppercase-id" \ | ||
| "--- | ||
| agent: code | ||
| measurements: | ||
| - id: EM-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| " 1 "must be lowercase like em-001" | ||
|
|
||
| run_case "missing-version" \ | ||
| "--- | ||
| agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| " 1 "missing version" | ||
|
|
||
| run_case "empty-dir" \ | ||
| "" 1 "no eval/measurements/*.yaml files found" | ||
|
|
||
| run_case "flow-style-unsupported" \ | ||
| "agent: code | ||
| measurements: [{id: em-001, scorer: trace_fitness, version: 1}] | ||
| " 1 "unsupported YAML shape" | ||
|
|
||
| run_case "nested-assert-unsupported" \ | ||
| "agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| assert: | ||
| - path: x | ||
| " 1 "unsupported YAML shape" | ||
|
|
||
| run_case "trailing-unknown-top-level" \ | ||
| "agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| not_a_real_key: true | ||
| " 1 "unsupported top-level field" | ||
|
|
||
| run_case "typo-mesurements-after-list" \ | ||
| "agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| mesurements: | ||
| - id: em-002 | ||
| scorer: totally_bogus_scorer | ||
| version: 1 | ||
| " 1 "unsupported top-level field" | ||
|
|
||
| run_case "optional-name-allowed" \ | ||
| "agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| name: Trace Fitness | ||
| " 0 "code.yaml: OK" | ||
|
|
||
| run_case "name-pipe-rejected" \ | ||
| "agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| name: bad|name | ||
| " 1 "contains characters fullsend LoadRegistry rejects" | ||
|
|
||
| run_case "hash-in-agent-rejected" \ | ||
| "agent: code#x | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| " 1 "must not contain '#'" | ||
|
|
||
| run_case "hash-in-scorer-rejected" \ | ||
| "agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness#typo | ||
| version: 1 | ||
| " 1 "must not contain '#'" | ||
|
|
||
| run_case "quoted-version-rejected" \ | ||
| "agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: \"1\" | ||
| " 1 "unquoted integer" | ||
|
|
||
| run_case "duplicate-agent-key-rejected" \ | ||
| "agent: code | ||
| agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| " 1 "duplicate top-level key" | ||
|
|
||
| run_case "real-comment-still-ok" \ | ||
| "agent: code # stock agent | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| " 0 "code.yaml: OK" | ||
|
|
||
| run_case "nested-block-map-under-name-rejected" \ | ||
| "agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| name: | ||
| id: em-001 | ||
| " 1 "nested block map" | ||
|
|
||
| run_case "empty-then-filled-agent-duplicate" \ | ||
| "agent: | ||
| agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| " 1 "duplicate top-level key" | ||
|
|
||
| run_case "duplicate-id-in-item-rejected" \ | ||
| "agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| id: em-002 | ||
| " 1 "duplicate key" | ||
|
|
||
| run_case "duplicate-name-in-item-rejected" \ | ||
| "agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| name: Trace Fitness | ||
| name: Also Fitness | ||
| " 1 "duplicate key" | ||
|
|
||
| run_case "flow-map-name-rejected" \ | ||
| "agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| name: {a: 1} | ||
| " 1 "flow collection" | ||
|
|
||
| run_case "flow-seq-name-rejected" \ | ||
| "agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| name: [Trace] | ||
| " 1 "flow collection" | ||
|
|
||
| run_case "yaml-null-name-rejected" \ | ||
| "agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| name: null | ||
| " 1 "YAML literal" | ||
|
|
||
| run_case "quoted-hash-in-name-rejected" \ | ||
| "agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| name: \"foo # bar\" | ||
| " 1 "must not contain '#'" | ||
|
|
||
| run_case "quoted-name-with-trailing-comment-ok" \ | ||
| "agent: code | ||
| measurements: | ||
| - id: em-001 | ||
| scorer: trace_fitness | ||
| version: 1 | ||
| name: \"Trace Fitness\" # display label | ||
| " 0 "code.yaml: OK" | ||
|
|
||
| echo "" | ||
| if [[ ${FAILURES} -gt 0 ]]; then | ||
| echo "${FAILURES} test(s) failed" | ||
| exit 1 | ||
| fi | ||
| echo "All tests passed" |
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.