Repository navigation
test(engine): coverage script and floors for the rules engine - #271
Merged
Merged
Conversation
Reads a line across the rows from either end, grows a white selection, gives up on a run that leaves the board, restores hand-edited history entries and falls back to black when a bot game has no colour.
The CI gate runs test:coverage for any package that has it, so the engine's floors (lines 99, branches 98, functions 100, statements 99) now gate every merge.
arrzdev
commented
Nov 2, 2026
arrzdev
left a comment
Owner
Author
There was a problem hiding this comment.
Approve. Test-only change: the engine suite runs under coverage in the gate (CI log: 106 passed, branches 98.12%, all files over the floors), and the coverage-v8 version matches the one apps/game already uses. The two remaining gaps listed in the description are fine as follow-ups.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
packages/abalone-engineholds every rule of the game but had no coverage report and no floor. This adds atest:coveragescript (v8), tests for the branches the report showed as uncovered, and thresholds at today's numbers rounded down.The CI gate already runs
test:coverageinstead oftestfor any package that defines it (.github/actions/gate/action.yml), so the workflow itself needs no change.Coverage
moves.tsandrules.tsnow reach 100% on every metric. New tests cover:destinationsFor: a line read toward a lower row gives the same squares in the same order as the same line read the other way.selectMarble: a white lead marble grows a white line and starts over on black.selectRun: a walk that runs off the board before it reaches its target gives up.goToMove: hand-edited history entries (no marbles, a destination that touches none, noshovedMarbles) still restore, just without the highlight.isValidSelectionandundoTargetIndex: a bot game with no recorded colour behaves as if the human plays black.None of the new tests found a rules bug.
What's still uncovered:
game-state.ts:260: unreachable, sincedirectionBetweenalready returned non-null for the anchor in the line above. Removing it would be a refactor, which is out of scope here.board-setups.tsandposition.ts: setup-table helpers, not rules. They're left for a follow-up.Verify