Skip to content

docs: stale JSDoc on checkTiebreaks claims simVersion<V22 guard that doesn't exist #158

@LightAxe

Description

@LightAxe

Location

src/sim/game-over.ts line ~228 (JSDoc for checkTiebreaks)

Description

The JSDoc states:

Returns GameOutcome.None if no tiebreak condition is met, or if world.simVersion < V22.

The implementation has no such guard:

export function checkTiebreaks(world: WorldState, playerColonyId: ColonyId): GameOutcome {
  const playerColony = world.colonies[playerColonyId];
  if (playerColony === undefined) return GameOutcome.None;
  if (world.ants.alive[playerColony.queenEntityId] !== 1) return GameOutcome.None;
  // ... no simVersion check

The call site in tick.ts (step 18, line ~1275) also does not gate on simVersion before calling.

The simVersion clause was likely aspirational documentation from when V22 was being introduced. With MIN_ACCEPTED_SIM_VERSION = 22 (D2), all loadable worlds are already V22+, so the guard is never needed — but the JSDoc is still wrong about what the code does.

Impact

No runtime impact. A future caller consulting the JSDoc to understand early-return conditions would be misled — they might rely on the documented simVersion guard and not add their own check for a pre-V22 path that in practice doesn't exist.

Fix

Remove or if world.simVersion < V22 from the JSDoc @returns description. Optionally add a note that the function is a V22+ feature and is only callable from worlds at that version floor.

Severity

Low — documentation only. No behaviour change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions