Handle autoPassBids engine-side for sealed auctions; drop the viewer send

The setting now lives entirely in fastAutoPass: a seat whose true hand value
cannot reach the list price is auto-passed (bid 0) the moment the auction
opens, recorded in info.autoPassed and applied verbatim on replay. The viewer
no longer sends anything for it — the previous client-side auto-pass raced
the host's state pushes and produced spurious "not your turn to play"
rejections. Timing may reveal that an auto-passed seat held a weak hand;
accepted (indistinguishable in the log from a public-bound or manual pass).
Engine 0.10.1.
This commit is contained in:
coyotte508 2026-09-06 17:43:23 +00:00
commit 17fa32eb21
2 changed files with 37 additions and 1 deletions

View file

@ -1,6 +1,6 @@
{
"name": "outpost-engine",
"version": "0.10.0",
"version": "0.10.1",
"description": "Unofficial Outpost rules engine for boardgamers.space",
"license": "AGPL-3.0",
"files": [

View file

@ -237,6 +237,42 @@ test("fastBid: full flow replays identically, including from a stripped log", ()
assert.equal(strippedReplay.market.length, state.market.length);
});
test("fastBid: the autoPassBids setting auto-passes a weak hand on open (engine-side, recorded for replay)", () => {
const state = fastGame();
const opener = state.activeSeat;
const weak = seatAfter(state, opener);
const strong = seatAfter(state, weak);
// Publicly this hand could reach the 25 list price (research max 17 each),
// but its true value is 6 — with the setting on, the engine auto-passes the
// seat without any client move.
(state.players[weak] as PlayerState).hand = Array.from(
{ length: 6 },
() => ({ t: "research", v: 1 }) as ProductionCard
);
(state.players[weak] as PlayerState).settings.autoPassBids = true;
const entry = applyMove(state, { action: "auction", marketIndex: price25Index(state), bid: 25 }, opener).log.at(-1);
assert.equal(state.auction?.bids?.[weak], 0);
assert.ok(entry?.type === "move" && entry.info?.autoPassed?.includes(weak));
// Only the strong seat is still expected to bid.
assert.equal(currentPlayer(state), strong);
// Replay reproduces the auto-pass verbatim from the recorded info.
const replayed = replay(state);
assert.equal(replayed.auction?.bids?.[weak], 0);
});
test("fastBid: without the setting, a weak-but-publicly-able hand is not auto-passed", () => {
const state = fastGame();
const opener = state.activeSeat;
const weak = seatAfter(state, opener);
(state.players[weak] as PlayerState).hand = Array.from(
{ length: 6 },
() => ({ t: "research", v: 1 }) as ProductionCard
);
applyMove(state, { action: "auction", marketIndex: price25Index(state), bid: 25 }, opener);
assert.equal(state.auction?.bids?.[weak], undefined);
assert.ok(((currentPlayer(state) as number[]) ?? []).includes(weak));
});
test("fastBid: payment due uses the resolved price with discount", () => {
const state = initGame(3, { fastBid: true }, "fastbid-discount");
const opener = state.activeSeat;