Modern UI contract: session.advance

The desk's kickoff as a command: the calendar runs to the next human desk,
the season end desk or the end of the career (matches without live view for
now). A missing desk decision or a failed step answers decision_pending or
advance_failed and leaves the state as it was.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-27 08:45:07 +01:00
1 parent a1590a34ef
commit ae817c6d6d
3 files changed
+37

No files matched your search

+13
View File
@@ -235,6 +235,19 @@ int main(int argc, char** argv) {
check(s(at(refused, "messageType")) == "error" && modern::save_stream(session.state()) == kept && rev == before_bank + 2,
"withdrawal above the deposit refused without change");
}
// session.advance: three kickoffs, each one revision, the date moves on
{
const std::string date_before = s(at(at(session.ui_read(O{{"kind", "desktop"}}, rev), "meta"), "date"));
for (int k = 0; k < 3; ++k) {
const uint64_t before = rev;
const J done = session.ui_command(cmd("request:a" + std::to_string(k), "session.advance", O{}), rev);
if (s(at(done, "messageType")) != "command_result")
std::fprintf(stderr, "advance: %s\n", cli::dump_json(done).c_str());
check(s(at(done, "messageType")) == "command_result" && rev == before + 1, "advance accepted");
}
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");
}
} catch (const std::exception& ex) {
std::fprintf(stderr, "FAIL: %s\n", ex.what());
return 1;