Reject cross-season reuse of rebellion declaration request IDs

This commit is contained in:
unimatrixgit 2026-11-21 00:36:23 +01:00
commit 22a1ec94de

View file

@ -26,3 +26,13 @@ test('stale confirmation and revoked evidence cannot transfer a deed or consume
assert.equal((await f.db.first('SELECT outcome FROM political_office_terms WHERE id=?',[f.term])).outcome,'winner');
}finally{f.db.close();}
});
test('a request UUID from an earlier season cannot create an orphan declaration key',async()=>{
const f=await fixture();try{
await f.service.declare(f.winner,f.input);const before=(await f.keys.list(f.winner.id)).length;
await f.db.query("UPDATE jarvis_pol_progression_seasons SET state='closed' WHERE season_id='S01'");
await f.db.query("INSERT INTO jarvis_pol_progression_seasons(season_id,starts_at,ends_at,level_cap,curve_base,state) VALUES('S02',0,?,0,25,'active')",[f.now()+100000]);
await assert.rejects(f.service.declare(f.winner,f.input),/reference conflict/);
assert.equal((await f.keys.list(f.winner.id)).length,before);
}finally{f.db.close();}
});