Modern UI contract: resigning ends the career of the last human manager
manager.resign.commit with confirmed true ends the career when the last human manager resigns (outcome career_ended, sessionState ended, every later command answers career_ended). Resigning while other humans play needs every per-manager table moved up a slot and answers resign_not_supported_yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7c5030ca4b
commit
dc3ecc3a8a
5 files changed
+37
-1
No files matched your search
@@ -546,6 +546,19 @@ int main(int argc, char** argv) {
|
||||
const J curves = session.read_statistics_screen(O{{"section", 2}});
|
||||
check(!club_desk || (at(curves, "series").array() && at(curves, "series").array()->size() == 6), "the six curves of the original");
|
||||
}
|
||||
// resigning: needs the confirmation; the last human manager ends the career
|
||||
{
|
||||
const auto resign = [&](const std::string& id, J payload) {
|
||||
return session.ui_command(J(O{{"messageType", "command"}, {"requestId", id}, {"expectedRevision", std::to_string(rev)},
|
||||
{"owner", O{{"managerId", "manager:1"}}}, {"kind", "manager.resign.commit"},
|
||||
{"payload", std::move(payload)}}), rev);
|
||||
};
|
||||
check(s(at(resign("request:r1", O{}), "code")) == "confirmation_required", "resigning needs the confirmation");
|
||||
const J done = resign("request:r2", O{{"confirmed", true}});
|
||||
check(s(at(done, "outcome")) == "career_ended", "the last human manager ends the career");
|
||||
check(s(at(at(session.ui_read(O{{"kind", "session"}}, rev), "data"), "sessionState")) == "ended", "session ended");
|
||||
check(s(at(resign("request:r3", O{{"confirmed", true}}), "code")) == "career_ended", "no command after the end");
|
||||
}
|
||||
} catch (const std::exception& ex) {
|
||||
std::fprintf(stderr, "FAIL: %s\n", ex.what());
|
||||
return 1;
|
||||
|
||||
Reference in new issue
Block a user