Take a rehearsed kickoff back completely

A rehearsal (and a kickoff refused for a pending question) now also returns
the turn driver and the managers' desks; before, the desk and the matches
played ran one step apart after a rehearsal. The contract tests rehearse
three kickoffs and check that the desk reads as before and that the
announced fixture is the one played; modern_live_dump can rehearse, play
live and report the announced and the played fixture per kickoff.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-14 08:03:41 +01:00
1 parent 29680d659e
commit 6970dfa20a
3 files changed
+83 -8

No files matched your search

+22
View File
@@ -540,6 +540,28 @@ int main(int argc, char** argv) {
const std::string date_after = s(at(at(session.ui_read(O{{"kind", "desktop"}}, rev), "meta"), "date"));
check(date_after > date_before, "the date moved on");
}
// a rehearsal is played and taken back: no revision, and the desk reads as before
for (int k = 0; k < 3; ++k) {
const uint64_t before = rev;
const std::string desk_before = cli::dump_json(session.ui_read(O{{"kind", "desktop"}}, rev));
const std::string lineup_before = cli::dump_json(session.ui_read(O{{"kind", "lineup"}}, rev));
const J tried = session.ui_command(cmd("request:dry" + std::to_string(k), "session.advance", O{{"dryRun", true}}), rev);
check(s(at(tried, "messageType")) == "command_result" && s(at(tried, "outcome")) == "rehearsed" && rev == before,
"rehearsal accepted without a revision");
check(cli::dump_json(session.ui_read(O{{"kind", "desktop"}}, rev)) == desk_before, "rehearsal leaves the desk as it was");
check(cli::dump_json(session.ui_read(O{{"kind", "lineup"}}, rev)) == lineup_before, "rehearsal leaves the line-up as it was");
// the kickoff after a rehearsal plays the fixture the desk announced
const J next = at(at(session.ui_read(O{{"kind", "desktop"}}, rev), "data"), "nextFixture");
const J played = session.ui_command(cmd("request:dry-play" + std::to_string(k), "session.advance", O{}), rev);
check(s(at(played, "messageType")) == "command_result", "kickoff after a rehearsal accepted");
const J recording = session.read_live(O{{"kind", "fixture"}});
if (truth(at(recording, "ok")) && next.object()) {
bool found = false;
for (const J& m : *at(recording, "matches").array())
found = found || s(at(at(m, "home"), "id")) == s(at(at(next, "home"), "id"));
check(found, "the announced fixture was the one played");
}
}
// the live ticker: advance until a kickoff played a match of the human manager, then its recording
{
J fixture;