From 6a30fdf376afb8fe027648eacc506398672627c3 Mon Sep 17 00:00:00 2001 From: Quintine <15965533+Quintine@users.noreply.github.com> Date: Mon, 16 Nov 2026 20:51:03 +1100 Subject: [PATCH] Compose market, early cache and phase bid promises --- components/mixed-richese-bid-promises.tsx | 8 + components/phase-any-bid-promises.tsx | 11 +- components/richese-bid-promise-panel.tsx | 13 +- docs/CURRENT_STATUS.md | 11 +- docs/RULE_DECISIONS.md | 9 +- docs/TRUTHTRANCE_BID_PROMISES.md | 35 ++- game/engine.ts | 144 ++++++++++- game/joint-market-early-bids.ts | 104 ++++++++ game/reference.ts | 2 +- tests/joint-market-early-bids.test.ts | 115 +++++++++ ...richese-advanced-market-boundaries.test.ts | 15 +- ...hese-advanced-market-current-clock.test.ts | 99 +++++++ ...-advanced-market-current-controls.test.tsx | 131 ++++++++++ ...ly-richese-advanced-market-current.test.ts | 242 ++++++++++++++++++ ...-richese-advanced-market-integrity.test.ts | 165 ++++++++++++ ...ese-advanced-market-release-native.test.ts | 100 ++++++++ 16 files changed, 1183 insertions(+), 21 deletions(-) create mode 100644 game/joint-market-early-bids.ts create mode 100644 tests/joint-market-early-bids.test.ts create mode 100644 tests/truth-early-richese-advanced-market-current-clock.test.ts create mode 100644 tests/truth-early-richese-advanced-market-current-controls.test.tsx create mode 100644 tests/truth-early-richese-advanced-market-current.test.ts create mode 100644 tests/truth-early-richese-advanced-market-integrity.test.ts create mode 100644 tests/truth-early-richese-advanced-market-release-native.test.ts diff --git a/components/mixed-richese-bid-promises.tsx b/components/mixed-richese-bid-promises.tsx index 4db1e8f0..f3588406 100644 --- a/components/mixed-richese-bid-promises.tsx +++ b/components/mixed-richese-bid-promises.tsx @@ -16,15 +16,23 @@ export function MixedRicheseBidPromises(props: { game: GameView; busy: boolean; const live = !!auction && own.some(promise => promise.turn === game.turn && promise.event === auction.event && !promise.fulfilled && !promise.released); const action = guide?.action, signature = action && JSON.stringify(action); + const progress = action?.earlyRicheseBidPromiseId !== undefined && auction ? + JSON.stringify([auction.active,auction.bid,auction.bidder,auction.acted,auction.submitted,auction.ownBid]) : null; const isCurrentGuide = () => { if (props.game !== game || !auction || game.richeseAuction !== auction || !guide || game.richeseBidPromiseGuide !== guide || !action || guide.action !== action || JSON.stringify(action) !== signature || action.type !== 'richeseBid' || action.event !== auction.event || + (progress !== null && JSON.stringify([auction.active,auction.bid,auction.bidder, + auction.acted,auction.submitted,auction.ownBid]) !== progress) || typeof action.richeseBidPromiseId !== 'string') return false; if (action.phaseAnyBidPromiseEvent !== undefined && (typeof action.phaseAnyBidPromiseEvent !== 'string' || action.phaseAnyBidLotEvent !== auction.event || !game.phaseAnyBidPromises.some(promise => promise.event === action.phaseAnyBidPromiseEvent && promise.player === game.me && promise.turn === game.turn && !promise.fulfilled && !promise.released))) return false; + if (action.earlyRicheseBidPromiseId !== undefined && + (typeof action.earlyRicheseBidPromiseId !== 'string' || + !game.ownEarlyRicheseBidPromises.some(promise => promise.id === action.earlyRicheseBidPromiseId && + promise.player === game.me && promise.turn === game.turn && !promise.boundEvent && !promise.fulfilled && !promise.released))) return false; return game.mixedRicheseBidPromises.some(promise => promise.player === game.me && promise.id === action.richeseBidPromiseId && promise.turn === game.turn && promise.event === auction.event && !promise.fulfilled && !promise.released); diff --git a/components/phase-any-bid-promises.tsx b/components/phase-any-bid-promises.tsx index c4c47dbc..b8646aae 100644 --- a/components/phase-any-bid-promises.tsx +++ b/components/phase-any-bid-promises.tsx @@ -14,7 +14,8 @@ export function PhaseAnyBidGuideButton(props: Props) { const signature = JSON.stringify(action), ordinary = game.auction, special = game.richeseAuction; const ordinarySignature = ordinary && JSON.stringify([ordinary.bid, ordinary.bidder, ordinary.active, ordinary.remaining]); const specialSignature = special && JSON.stringify([special.event, special.method, special.active, - special.bid, special.bidder, special.submitted, special.ownBid]); + special.bid, special.bidder, special.submitted, special.ownBid, + ...(action.earlyRicheseBidPromiseId !== undefined ? [special.acted] : [])]); const canAct = () => { const current = props.game, me = current.players.find(player => player.id === actor); if (props.busy || current !== game || current.me !== actor || current.turn !== turn || @@ -31,6 +32,11 @@ export function PhaseAnyBidGuideButton(props: Props) { promise.id === action.richeseBidPromiseId && promise.player === actor && promise.turn === turn && promise.event === special.event && !promise.fulfilled && !promise.released)) return false; } + if (action.earlyRicheseBidPromiseId !== undefined && + (typeof action.earlyRicheseBidPromiseId !== 'string' || + !current.ownEarlyRicheseBidPromises.some(promise => + promise.id === action.earlyRicheseBidPromiseId && promise.player === actor && promise.turn === turn && + !promise.boundEvent && !promise.fulfilled && !promise.released))) return false; if (action.bidPromiseEvent !== undefined) { if ((action.type !== 'bid' && action.type !== 'passBid') || typeof action.bidPromiseEvent !== 'string' || typeof action.phaseAnyBidLot !== 'number' || current.bidPromiseLot?.turn !== turn || @@ -47,7 +53,8 @@ export function PhaseAnyBidGuideButton(props: Props) { if (action.type !== 'richeseBid' || !special || current.richeseAuction !== special || special.event !== action.event || special.event !== action.phaseAnyBidLotEvent || JSON.stringify([special.event, special.method, special.active, special.bid, special.bidder, - special.submitted, special.ownBid]) !== specialSignature) return false; + special.submitted, special.ownBid, + ...(action.earlyRicheseBidPromiseId !== undefined ? [special.acted] : [])]) !== specialSignature) return false; return special.method === 'silent' ? !special.submitted.includes(actor) : special.active === actor; }; return