Skip to content

Commit 9d0319d

Browse files
emp3thyclaude
andcommitted
polish: address final-review minors before merge
Four single-line cleanups flagged by per-task and final reviewers: - types.ts:95 — playerProfiles JSDoc said "ignored" but engine merges AI keys. Reword to match actual behaviour (the spec prose at §4.2 already documents this as "merged but Setup UI doesn't surface them"). - ai/dispatcher.test.ts:69 — tighten /human/i to /planAi.*human/i so the test fails if the planAi guard is removed (previously dispatch.ts's existing throw also matched /human/i). - ai/lookahead.test.ts:88 — drop redundant duplicate planAi() call inside the not.toThrow wrapper. The next-line assertion already exercises the call. - ai/lookahead.test.ts:94 — let s → const s; s is never reassigned. 160/160 tests still green. Typecheck clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 85140d9 commit 9d0319d

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/engine/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export interface SealedOrders {
9292

9393
export interface GameConfig {
9494
startPopOverride?: Partial<Record<LeaderId, number>>;
95-
/** Per-game name/country overrides for player slots. Keys should be 'player1'..'player5'; entries for AI leaders are ignored. Setup screen populates this from user input. */
95+
/** Per-game name/country overrides for player slots. Keys should be 'player1'..'player5'; entries for AI leaders are merged but the Setup UI does not surface them. Setup screen populates this from user input. */
9696
playerProfiles?: Partial<Record<LeaderId, { name?: string; country?: string }>>;
9797
dominanceThreshold: number;
9898
fastPlay: boolean;

tests/engine/ai/dispatcher.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,6 @@ describe('planAi dispatcher', () => {
6666
difficulty: 'normal',
6767
seed: 'planAi-human',
6868
});
69-
expect(() => planAi(s, 'player1')).toThrow(/human/i);
69+
expect(() => planAi(s, 'player1')).toThrow(/planAi.*human/i);
7070
});
7171
});

tests/engine/ai/lookahead.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,12 @@ describe('bestTargetByLookahead', () => {
8585
s.leaders.player1.population = 8;
8686
s.leaders.player1.stockpile.shields = 0;
8787
// No lastOrders[player1] populated. Should not throw, should pick a target.
88-
expect(() => planAi(s, 'chump')).not.toThrow();
8988
const orders = planAi(s, 'chump');
9089
expect(orders.find((o) => o.kind === 'launch')).toBeDefined();
9190
});
9291

9392
it('mixed cast with history: lookahead simulates human as repeating their last orders', () => {
94-
let s = initialState({
93+
const s = initialState({
9594
cast: ['chump', 'carnage', 'player1'],
9695
difficulty: 'hard',
9796
seed: 'lookahead-human-with-history',

0 commit comments

Comments
 (0)