Repository navigation
fix: reject fractional move coordinates - #35
Conversation
The range check let a fractional row or col through, so row 1.5 threw and col 0.5 was reported as an occupied square. Adds isOnBoard, a test script on the plugins' tsx --test setup, and the test step in CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
CODEX VERDICT: LGTM\n\nReviewed SHA: 9c314d3\n\n| Axis | Result |\n|---|---|\n| Correctness and edge cases | none |\n| Security (injection / path traversal / code evaluation) | none |\n| Tests: does a test go red if the new behaviour breaks | none |\n| API / schema / wire / on-disk compatibility | none |\n| Consistency with the rest of the codebase | none |\n| Input validation: every caller-controlled row/col shape (negative, fractional, NaN, Infinity, non-number) at every entry point | none |\n| CI: the new test step runs on every matrix cell and cannot pass vacuously | none |\n\nLocal verification: yarn test passed (6/6); yarn typecheck, yarn lint, and yarn build passed. No mutation sweep was run.\n\nFINDINGS COMPLETE: I read every hunk of the diff and this is every finding I have. |
Summary
Closes #34.
row < 0 || row > 2 || …) let a fractional value through.row: 1.5therefore threw aTypeErrorand failed the whole tool call, andcol: 0.5was reported as "already occupied by undefined".src/core/position.tsaddsisOnBoard(row, col, size), which is true only when both are whole numbers inside the board.playTicTacToeuses it in place of the range comparison, so these moves get the out-of-bounds response. Its text now says the values must be whole numbers.js/prototype-polluting-assignment(alert 1). A non-numberrowsuch as"__proto__"from a JavaScript caller is now rejected before any assignment.yarn test(tsx --test tests/*.test.ts, the setup the other plugins use) withtests/position.test.ts, and runs it in CI.Items to Confirm
main. CodeQL may not treatNumber.isIntegeras a sanitizer. The crash itself is fixed either way, asyarn testshows.yarn typecheck. That matches the other plugins; adding them would need@types/node.boardis out of scope.Verification
yarn format,yarn lint,yarn build,yarn typecheckandyarn testpass.src/core/logic.tsrestored tomain, the off-board / fractional test goes red.User Prompt
🤖 Generated with Claude Code
work in GUIChatPluginSpreadsheet