Repository navigation
test(novelty): pin the all-vs-all seed, console cap and name tie-break - #287
antonwolfy wants to merge 2 commits into
Conversation
The review of intel#172 left three outputs of `novelty routing --all-vs-all` unpinned: the full suite passed with `seed=0` hard-coded in `_cmd_routing_all_vs_all`, with the console's top-five cap cut to three, and with the name tie-break of attractors (and of an attractor's `from` list) reversed. - A CLI run with a mocked selector and `--seed 5` asserts that the saved model arm records seed 5. - A field where six skills take another skill's queries, six down to one, asserts the exact five attractor lines the console prints for each arm. - Two attractors tied on count, listed in the field against name order, and an attractor whose two golds tie, assert the exact attractor rows: name order in `attractors` and in `from`. Each test fails under the change it pins. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
@exai-bot /review |
exai-bot
left a comment
There was a problem hiding this comment.
Note
AI-generated review of 8bc08b711909, requested by @antonwolfy, using the default review skill. It can be wrong: verify a finding before acting on it. React with a thumbs up or down on a finding to tell the bot whether it helped.
Model us.anthropic.claude-sonnet-5-5, effort default, 6 of 80 turns, 0.7 of 40 minutes, 128k in / 2k out tokens.
This PR adds three tests to test_novelty_routing_all_vs_all.py. They pin the CLI --seed reaching the saved model arm, the top-five console cap per arm, and the name tie-break on attractor rows and on from. I found no defects. I could not run pytest because the container has no network. I traced each test by hand against _attractor_table, _print_attractors and _cmd_routing_all_vs_all, and each expected value matches the code, so the tests should pass and should fail under the mutants the description lists.
No issues found.
Not verified
I did not run the new tests or the mutants, because pytest could not be installed offline. I relied on tracing the code by hand and on the author's reported mutant results.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #287 +/- ##
=======================================
Coverage 93.26% 93.26%
=======================================
Files 272 272
Lines 35117 35117
Branches 5964 5964
=======================================
Hits 32752 32752
Misses 1547 1547
Partials 818 818 🚀 New features to boost your workflow:
|
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s). Review details
|
The lexical and model arms printed the same five lines, so _print_attractors printing one arm's rows under both labels still passed. The selector now sends each word to the mirror skill's card, so the model arm ranks alpha..echo and leaves out foxtrot, while the lexical arm ranks foxtrot..bravo and leaves out alpha. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
Summary
Follow-up to the review of #172, which found that the
novelty routing --all-vs-alltests leave some outputs unpinned (review). Thegold != namefilter onsibling_queriesthat the review also named is already pinned onmain(test_an_attractor_with_queries_of_its_own_is_rated_over_the_other_skills_queries_only). The other three are pinned here.On
main, each change below still passes all 298 tests oftests/test_novelty_routing_all_vs_all.py,test_novelty_cli.py,test_novelty_routing.py,test_novelty_routing_field.pyandtest_novelty_routing_cost.py:mainmainseed=args.seed->seed=0_cmd_routing_all_vs_all,commands/novelty.py:372section["attractors"][:5]->[:3](or[:6])_print_attractors,commands/novelty.py:456section = result[arm]->result["lexical"], or ->result["model"]when there is a model arm: one arm's rows under both labels_print_attractors,commands/novelty.py:455_attractor_table,novelty/all_vs_all.py:246fromsort with the name key dropped_attractor_table,novelty/all_vs_all.py:243Reversing the
fromname order at:243is already caught onmain, bytest_the_model_arm_attractor_is_the_skill_the_selector_always_picks(two golds tied 2–2). Dropping the name key there is not.Changes
tests/test_novelty_routing_all_vs_all.py,test_the_seed_on_the_command_line_is_the_seed_the_saved_model_arm_records: a CLI run with--model m --seed 5and the selector mocked; the savedresult.modelrecordsmodel == "m"andseed == 5. The seed is in the payload only in the model arm; the lexical arm takes no seed.test_console_prints_the_top_five_attractors_of_each_arm_by_count: six skills each take some ofgold's queries, six down to one (21 queries). The lexical arm gives each query to the skill whose card holds its word. The mocked selector gives it to the mirror skill's card instead (alpha's word to foxtrot's card, foxtrot's to alpha's), so the two arms rank the skills in opposite orders. The console prints exactly these ten attractor lines, five per arm, in count order, and each arm leaves out its sixth skill:lexical: foxtrot picked for 6 of 21 sibling queries (from gold)...lexical: bravo picked for 2 of 21 sibling queries (from gold), thenmodel: alpha picked for 6 of 21 sibling queries (from gold)...model: echo picked for 2 of 21 sibling queries (from gold)._word_clienttakes an optionalswapof word to word for this.test_attractors_tied_on_count_and_golds_tied_in_from_are_in_name_order:zetaandalphaare each picked for 2 sibling queries, withzetafirst in the field.zetatakes one query each frommuandbeta, withmufirst in the queries file, andzetaalso has a query of its own. The test asserts the exact rows:alpha(5 sibling queries, rate 0.4, frommu) beforezeta(4, rate 0.5, frombeta,mu).dokimi/dokimi/, so no changelog fragment.Risk
None: no code changes, only three new tests and their selector helper.
Testing
On a Linux review host, at
7737770(onmain0a63f4e):make ci-local: 25 passed, 3 failed, 7 skipped (the external-catalog smoke, which needs Docker;test-latest,docs.yml:deployandpip-audit.yml:report, whose job conditions are false on a PR; the cli-surface "Package the result" step; conda-forge-deps, with micromamba not installed; semgrep secrets).10181 tests passed, 4 skipped; changed-line coverage: 0 package lines changed.
Install gitleaksandScan commitsfailed because the review host's proxy answers the gitleaks release download with 504. The same gitleaks 8.30.1, downloaded through another proxy and checked againstci.yml'sGITLEAKS_SHA256, ran the step's PR scan (--log-opts="--diff-merges=remerge origin/main..HEAD"): 2 commits, no leaks.The other FAIL is
pip-audit.yml:pip-audit: 10 advisories againstfilelock==3.32.7inrequirements.lock.txtandrequirements-ci.lock.txt, which this PR does not touch. The workflow'spaths:filter runs it only on a PR that edits a lock, a requirements file orpyproject.toml, so it does not run on this PR; the fix is a lock PR.ruff checkis clean on the touched file.7737770, againsttests/test_novelty_routing_all_vs_all.py(69 tests):seed=0atcommands/novelty.py:372: the seed test fails, alone.[:3]and[:6]atcommands/novelty.py:456: the top-five test fails, alone.section = result["lexical"], andsection = result["model"] if "model" in result else result[arm], atcommands/novelty.py:455: the top-five test fails, alone. At8bc08b7, where both arms printed the same five lines, both passed all 69 tests.:246reversed ((wrongly_picked, skill), reverse=True) and name key dropped: the tie-break test fails, alone.:243reversed: the tie-break test fails, as does the existing model-arm test.:243name key dropped: the tie-break test fails, alone.main(table above).Revert
git revertof the squash-merged commit. It leaves nothing behind.Checklist
pytestpassesruff,mypy, and schema checks passAGENTS.md.github/.licenserc.yaml)