Skip to content

Parse command input once before scope, validate and apply - #1855

Merged
Noisemaker111 merged 1 commit into
mainfrom
claude/command-input-parse
Sep 25, 2026
Merged

Noisemaker111 merged 1 commit into
mainfrom
claude/command-input-parse

Conversation

@Noisemaker111

Copy link
Copy Markdown
Owner

LLMville's audit turned up an Infinity placement coordinate that made a loop run forever, fractional rack slot indexes, and a NaN revenue share. Each happened because the game hand-rolls input readers and has to call them in every command stage.

  • CommandDef.parse plus defineCommand<TInput>() (core). The runner refuses a null parse result with MALFORMED_COMMAND_INPUT_REASON before scope, validate or apply run, and those stages receive the parsed, typed input.
  • Bounded readers in runtime/commandInput. readInputNumber is always finite and takes an optional range and integer flag. The others are readInputString (length cap), readInputOneOf, readInputPoint2/readInputPoint3 (maxAbs), readInputArray (maxItems) and isInputRecord.
  • The jgengine-multiplayer skill now points commands at defineCommand and these readers.

Commands without parse behave as before.

Verification

  • bun test packages/core/src/runtime: pass. New tests cover the readers, parse running before validate, and scope using parsed input.
  • check-types (core): pass.
  • bun run gen: done; ship:preflight: ok.
  • There's no rendered surface to screenshot.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GvRbbu8yG1WYz7wQnZUpC8


Generated by Claude Code

Every game hand-rolled its own input readers and had to call them in each
command stage, so a stage that skipped one accepted Infinity coordinates,
fractional indices or NaN. CommandDef.parse (with defineCommand for typed
input) runs first and refuses malformed input, and commandInput gains bounded
readers for numbers, strings, enums, points and arrays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GvRbbu8yG1WYz7wQnZUpC8
@Noisemaker111
Noisemaker111 enabled auto-merge (squash) September 25, 2026 20:36
@Noisemaker111
Noisemaker111 merged commit f43d82d into main Sep 25, 2026
6 checks passed
@Noisemaker111
Noisemaker111 deleted the claude/command-input-parse branch September 25, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants