Repository navigation
fix(benchmarks): derive AA slugs so the API key is the only remaining blocker #27
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
2 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| #!/usr/bin/env python3 | ||
| """Tests for AA slug resolution. | ||
|
|
||
| Guards two properties: | ||
| 1. Derivation reproduces the hand-maintained map (except the one reordered | ||
| entry, which the hand map must keep winning). | ||
| 2. Resolution NEVER returns a slug absent from the AA payload, so a derived | ||
| near-miss can never attach one model's scores to another. | ||
| """ | ||
|
|
||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| sys.path.insert(0, str(Path(__file__).parent.parent / "scripts")) | ||
|
|
||
| import importlib.util | ||
|
|
||
| _spec = importlib.util.spec_from_file_location( | ||
| "fetch_model", Path(__file__).parent.parent / "scripts" / "fetch-model.py" | ||
| ) | ||
| fetch_model = importlib.util.module_from_spec(_spec) | ||
| _spec.loader.exec_module(fetch_model) | ||
|
|
||
| AA_SLUG_MAP = fetch_model.AA_SLUG_MAP | ||
| derive_aa_slug = fetch_model.derive_aa_slug | ||
| resolve_aa_slug = fetch_model.resolve_aa_slug | ||
|
|
||
| # The one entry derivation cannot produce: AA reorders the name components. | ||
| KNOWN_UNDERIVABLE = {"anthropic/claude-haiku-4.5"} | ||
|
|
||
|
|
||
| def test_derive_reproduces_hand_map(): | ||
| misses = { | ||
| mid: (derive_aa_slug(mid), slug) | ||
| for mid, slug in AA_SLUG_MAP.items() | ||
| if derive_aa_slug(mid) != slug | ||
| } | ||
| assert set(misses) == KNOWN_UNDERIVABLE, f"unexpected derivation misses: {misses}" | ||
|
|
||
|
|
||
| def test_hand_map_wins_over_derivation(): | ||
| mid = "anthropic/claude-haiku-4.5" | ||
| aa = {"claude-4-5-haiku": {}, "claude-haiku-4-5": {}} | ||
| assert resolve_aa_slug(mid, aa) == "claude-4-5-haiku" | ||
|
|
||
|
|
||
| def test_derivation_adds_coverage(): | ||
| # A model absent from the hand map but present in AA now resolves. | ||
| mid = "openai/gpt-5.5" | ||
| assert mid not in AA_SLUG_MAP | ||
| assert resolve_aa_slug(mid, {"gpt-5-5": {}}) == "gpt-5-5" | ||
|
|
||
|
|
||
| def test_near_miss_returns_none_not_a_guess(): | ||
| # THE LOAD-BEARING CASE. AA holds a similar-but-different slug; we must | ||
| # return None rather than attach the wrong model's scores. | ||
| mid = "openai/gpt-5.5" | ||
| assert resolve_aa_slug(mid, {"gpt-5-5-preview": {}, "gpt-5-4": {}}) is None | ||
| assert resolve_aa_slug(mid, {}) is None | ||
|
|
||
|
|
||
| def test_gate_varies_with_its_subject(): | ||
| # Proves the guard above is not vacuous: same model id, two payloads, | ||
| # opposite answers. | ||
| mid = "z-ai/glm-5.2" | ||
| assert resolve_aa_slug(mid, {"glm-5-2": {}}) == "glm-5-2" | ||
| assert resolve_aa_slug(mid, {"glm-5-3": {}}) is None | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| failed = 0 | ||
| for name, fn in sorted(globals().items()): | ||
| if name.startswith("test_") and callable(fn): | ||
| try: | ||
| fn() | ||
| print(f"PASS {name}") | ||
| except AssertionError as e: | ||
| failed += 1 | ||
| print(f"FAIL {name}: {e}") | ||
| print(f"\n{'FAILED' if failed else 'all tests passed'}") | ||
| sys.exit(1 if failed else 0) | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the inspected
Test benchmark pipelineworkflow step runspython -m unittest discover -s model-benchmarks/tests, these module-level functions are only imported:unittestdoes not collect them, and the custom__main__runner is not invoked. Consequently, CI can report success without executing any of the five new slug-safety checks; convert them to methods on aunittest.TestCase(or explicitly run this script).AGENTS.md reference: model-benchmarks/AGENTS.md:L77-L83
Useful? React with 👍 / 👎.