Verify a contract term change in the engine round trip (by Codex)

This commit is contained in:
Codex committed 2026-10-28 13:05:04 +01:00
1 parent 622973c2cf
commit 7e170a00c7
1 file changed
+1 -1
+1 -1
View File
@@ -159,7 +159,7 @@ int main(int argc, char **argv) {
run(engine_ticket_command(cancelled,21,"request:owner-released"),"owner-released");
run(engine_contract_request(link->snapshot(),first,"request:quote-reject"),"quote-reject");auto now=link->snapshot();auto q2=engine_contracts_projection(now).at("quote");int year=1;while(year<=4&&q2.at("demands")[size_t(year-1)].is_null())++year;if(year>4)throw std::runtime_error("no available rejection term");
const auto refused=run(engine_contract_offer(now,first,q2.at("id"),year,0,"request:offer-reject"),"offer-reject");if(refused.value("outcome","")!="offer_rejected")throw std::runtime_error("zero offer not actually rejected");
run(engine_contract_request(link->snapshot(),second,"request:quote-accept"),"quote-accept");now=link->snapshot();q2=engine_contracts_projection(now).at("quote");year=2;while(year<=4&&q2.at("demands")[size_t(year-1)].is_null())++year;if(year>4)year=1;
run(engine_contract_request(link->snapshot(),second,"request:quote-accept"),"quote-accept");now=link->snapshot();q2=engine_contracts_projection(now).at("quote");year=3;while(year<=4&&q2.at("demands")[size_t(year-1)].is_null())++year;if(year>4)year=1;
const int64_t salary=q2.at("max_salary").get<int64_t>()/100;
const auto accepted=run(engine_contract_offer(now,second,q2.at("id"),year,salary,"request:offer-accept"),"offer-accept");if(accepted.value("outcome","")=="offer_rejected")throw std::runtime_error("maximum salary unexpectedly rejected");
const auto after=link->snapshot();write("contracts-after.json",after);bool found=false;const auto final_contracts=engine_contracts_projection(after);for(const auto &p:final_contracts.at("rows"))if(p.at("id")==second)found=p.at("salary")==salary*100&&p.at("months")==year*12;