Sign panel sessions and isolate test runs
Some checks failed
Deploy to Production / test (push) Failing after 29s
Some checks failed
Deploy to Production / test (push) Failing after 29s
- Replace in-memory auth sessions with signed cookies and signed OAuth state - Add auth route coverage and update panel/web server wiring - Switch test script to per-file Bun processes and clean up type checks
This commit is contained in:
@@ -22,7 +22,7 @@ function blackjackHand(cards: Card[]): PlayerHand {
|
||||
}
|
||||
|
||||
function makeSeat(hands: PlayerHand[], activeHandIndex = 0, hasBet = true): PlayerSeat {
|
||||
return { hands, activeHandIndex, hasBet };
|
||||
return { hands, activeHandIndex, hasBet, cumulativePnl: 0 };
|
||||
}
|
||||
|
||||
/** Create a rigged state for deterministic testing. */
|
||||
|
||||
@@ -435,7 +435,7 @@ export const blackjackPlugin: GamePlugin<BlackjackState, BlackjackAction> = {
|
||||
const isMyTurn = activeId === playerId && state.phase === "player_turns";
|
||||
const mySeat = state.seats[playerId];
|
||||
const myActiveHand = mySeat && mySeat.activeHandIndex >= 0
|
||||
? mySeat.hands[mySeat.activeHandIndex]
|
||||
? mySeat.hands[mySeat.activeHandIndex] ?? null
|
||||
: null;
|
||||
|
||||
// Determine active hand index for the view
|
||||
@@ -454,7 +454,7 @@ export const blackjackPlugin: GamePlugin<BlackjackState, BlackjackAction> = {
|
||||
myPlayerId: playerId,
|
||||
phase: state.phase,
|
||||
canAct: isMyTurn,
|
||||
canSplit: isMyTurn && myActiveHand !== null && canSplitHand(myActiveHand, mySeat!.hands.length),
|
||||
canSplit: isMyTurn && myActiveHand !== null && mySeat !== undefined && canSplitHand(myActiveHand, mySeat.hands.length),
|
||||
canDoubleDown: isMyTurn && myActiveHand !== null && canDoubleHand(myActiveHand),
|
||||
roundNumber: state.roundNumber,
|
||||
myCumulativePnl: mySeat?.cumulativePnl ?? 0,
|
||||
|
||||
@@ -43,10 +43,12 @@ export const chessPlugin: GamePlugin<ChessState, ChessAction> = {
|
||||
createInitialState(players: string[], options?: Record<string, unknown>): ChessState {
|
||||
const game = new Chess();
|
||||
const timeControlKey = (options?.timeControl as string) ?? "blitz_5_3";
|
||||
const tc = TIME_CONTROLS[timeControlKey] ?? TIME_CONTROLS.blitz_5_3;
|
||||
const tc = TIME_CONTROLS[timeControlKey] ?? TIME_CONTROLS["blitz_5_3"]!;
|
||||
|
||||
// Randomly assign colors
|
||||
const shuffled = Math.random() < 0.5 ? [players[0], players[1]] : [players[1], players[0]];
|
||||
const shuffled: [string, string] = Math.random() < 0.5
|
||||
? [players[0]!, players[1]!]
|
||||
: [players[1]!, players[0]!];
|
||||
|
||||
const clock: ChessClock | null = tc.time > 0
|
||||
? { white: tc.time, black: tc.time, increment: tc.increment, lastMoveAt: Date.now() }
|
||||
@@ -108,7 +110,7 @@ export const chessPlugin: GamePlugin<ChessState, ChessAction> = {
|
||||
const moveEntry = {
|
||||
from: action.from,
|
||||
to: action.to,
|
||||
san: game.history().slice(-1)[0],
|
||||
san: game.history().slice(-1)[0]!,
|
||||
color: turn === "white" ? "w" as const : "b" as const,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user