Repository navigation
Fail a test whose run asks the scripted model for a wrong number of rounds - #86
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
The implementation looks good. Before merging, could you add two regression tests: one that requests a reply after a nonempty script is exhausted, and one that finishes with a reply unused? Each should assert the corresponding panic. I temporarily restored the old repeat-last behavior for nonempty scripts and disabled the unused-reply assertion. All 1,325 runtime tests still passed. The manual checks in the plan show that both safeguards work today. Committing those cases would make CI catch either safeguard being removed later. |
`ScriptedChat`, the scripted model of `runvil-runtime`'s tests, answers a round past its script with its last reply again and accepts a run that leaves replies unused, so a test passes when its run asks the model one time more or one time fewer than the test scripted. The plan makes both cases fail the test and updates the 43 tests that fail once they do. It fixes issue cppalliance#46. Plan: /plan/2026-11-30-2-scripted-model-exact-rounds.plan.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ounds
`ScriptedChat` answered a round past its script with its last reply again and accepted a run that left replies unused, so a test passed when its run asked the model one time more or one time fewer than it scripted. A round past a script now panics with the round and the length of the script, and `Driving::end` panics when a run leaves replies unused, in the words the facade suite's driver already uses. An empty script is accepted and means no round may reach the model. `ScriptedChat::repeating` answers every round with one reply, and only the bench uses it. The change touches the test support, the bench, one design page, and tests.
The 45 tests that failed under the stricter model now script the rounds their runs ask for, and every assertion they made stays:
- 31 take an empty script, because a run in each fails, is refused, or has its one round held or canceled before the script answers it.
- 10 drop a last reply that their run never asks for, usually `text("unreachable")`.
- 2 tool-loop tests script the 10 and 24 replies their caps allow, where they scripted 50 and 25.
- `join_any_joins_the_task_it_returns_and_only_that_task` and `an_arms_concurrency_limit_gates_its_fanout_and_the_whole_run` build a script for each run, where each shared one script across its seeded runs. The second still asserts 30 rounds in total.
The plan lists 43 of them, measured before a rebase onto `master` brought two more: `a_coalesced_author_assistant_message_invalidates_the_anchor` drops its unused last reply, and `timed_wait_inside_a_task_under_concurrency_one_wakes_and_cancels_slow_child`, whose one round is held, takes an empty script.
Plan: /plan/2026-11-30-2-scripted-model-exact-rounds.plan.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each of the four script edits fails only its own test, with the message the plan expects: two at a round past the script and two at replies left unused. The workspace runs 4,101 tests on the branch, as on `master`, and they pass. Clippy, the format check, both doc builds, the facade surface check, the structural checks, and the wording checks pass on this machine; `cargo dylint` runs in CI. Vibelight reports the same kinds of lead in the same functions as at `master`, with four leads on `"unreachable"` gone. Plan: /plan/2026-11-30-2-scripted-model-exact-rounds.plan.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`ScriptedChat` panics when a run asks for a round past the end of its script, and `Driving::end` panics when a run leaves replies of its script unused. Each check now has a test that expects its panic. `a_round_after_a_nonempty_script_is_spent_panics` asks a one-reply script for two rounds, and `a_run_that_ends_with_a_scripted_reply_unused_panics` ends a one-round run whose script holds two replies. With either check turned off, its test fails and the other 1,349 of the crate's 1,350 tests pass. Vinnie Falco's review of pull request cppalliance#86 found that before these tests, and before the rebase onto `master`, all 1,325 tests of `runvil-runtime` passed with both checks off. `ScriptedChat::new` is now `pub(crate)`. The benchmark calls `repeating` in its place since the earlier commit that added `repeating`, and `test_support.rs` keeps `pub` only for the items the benchmark names. The plan of this change now decides to add the two tests, and it records the review, the rebase, and the results. Plan: /plan/2026-11-30-2-scripted-model-exact-rounds.plan.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3d3e599 to
e372b39
Compare
|
Added both in e372b39. With your experiment rerun, turning off either check now fails only its own test. I also rebased onto |
Fixes #46.
ScriptedChatis the scripted model that the tests ofrunvil-runtimeuse. A test hands it a list of replies, and it answers each round of the run, one request the run sends to the model, with the next reply. Until now it answered every round past the end of its list with the last reply again, and it accepted a run that left replies unused. A test therefore passed when its run asked the model for more or fewer rounds than the test scripted, unless the test counted the rounds itself.A wrong round count now fails the test
Driving::end:Scenario::run,Driving::finish(aScenariostepped by the test), andRig::finish(a run stepped under a seeded shuffle) all call it. It now panics when the run left replies unused, with "the run ended with {left} scripted replies left". The driver of the facade suite, the tests of therunvil-enginecrate, already makes both checks with code of its own, in the same words.ScriptedChat::new(vec![])is now accepted and means no round may reach the model. It used to panic on an empty list.ScriptedChat::repeating(reply)answers every round with one reply. Only themodels_loopbench uses it.decisions/testing-and-debugging.mdsaid the script repeats its last reply. It now states the two checks.A run that a test builds with
Scenario::into_runand drives itself never reachesDriving::end, so it gets the round check alone. Production code is unchanged.45 tests now script the rounds their runs ask for
With the stricter model and the tests unchanged, 43 of the crate's 1,325 tests failed. After a rebase onto
masterate3c1e641c, two tests added there since failed the same way. Each of the 45 now scripts the rounds its runs ask for and keeps every assertion it made:text("unreachable").text("unreachable").the_ceiling_caps_a_larger_declared_capruns under a ceiling of 10 rounds and now scripts 10 replies, where it scripted 50.tool_loop_uses_the_default_cap_when_unspecifiedruns under the default cap of 24 rounds and now scripts 24, where it scripted 25.join_any_joins_the_task_it_returns_and_only_that_taskandan_arms_concurrency_limit_gates_its_fanout_and_the_whole_runeach ran a scenario under three seeds from one shared script, so the later runs got the repeated last reply. Each run now builds its own script, and each seeded run must use all of it: two replies in the first test, ten in the second. The second keeps its assertion of 30 rounds in total, now summed over the scripts of its three seeded runs. Their helpers also build a scenario for three serial runs that answer with canned replies and leave their scripts unused.A test of each check fails when that check is turned off
a_round_after_a_nonempty_script_is_spent_panics, inscripted_chat.rs, asks a one-reply script for two rounds and expects the round panic.a_run_that_ends_with_a_scripted_reply_unused_panics, inscenario.rs, runs a prompt that asks the model once, with a script of two replies, and expects the unused-reply panic.runvil-runtimepass. Before these tests, and before the rebase, all 1,325 passed with both checks turned off, as Vinnie Falco's review of this pull request found.ScriptedChat::newis nowpub(crate). The bench callsrepeatingin its place, so only code inside the crate callsnew, andtest_support.rskeepspubonly for the items the bench names.How the change was checked
a_batch_names_the_tool_behind_each_wire_name_an_adhoc_one_included, the issue's example, fails it at round 2;text("unreachable")back intoan_empty_list_raises_before_any_roundfails it with one reply left;the_ceiling_caps_a_larger_declared_capfails it at round 10.masterand the two new tests below, and all pass. These also pass locally: clippy with warnings denied,cargo fmt --check,cargo docfor the workspace and forrunvil-enginewith its default features,cargo xtask api --check(both facades match their public-API listings),cargo test -p build-xtask, andnode --test tools/docs-claims.mjs.cargo dylintis not installed on my machine, so CI runs it.The plan, which names 43 of the tests and records the review, the rebase, and the two others, is
plan/2026-11-30-2-scripted-model-exact-rounds.plan.md. It took the number2026-11-30-2becausemasteralready has a2026-11-30-1plan.🤖 Generated with Claude Code
Summary by CodeRabbit