[rig-sampler] feat(s): add s.integer schema helper#25
Merged
Conversation
Adds IntegerSchema type and s.integer helper following the same
SchemaHelperFactory pattern as s.number. Serializes to
{"type":"integer"} in JSON Schema and validates with
Number.isInteger(), rejecting floats at the validation layer.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
pelikhan
approved these changes
Jul 23, 2026
pelikhan
marked this pull request as ready for review
July 23, 2026 07:37
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.
Sample run:
06-list-source-files.tsThe stub runner executed sample 06 successfully in a single turn — no repair loops. The sample outputs
{ summary: s.string }, a single-field object wrapping a string summary of the repository's TypeScript source files.What the run revealed
While sample 06 itself ran cleanly, reviewing the broader set of samples (e.g.
03-diagnose-test-failure.tswithconfidence: s.number,41-parse-coverage.ts) reveals a gap: the harness has no way to express integer constraints. When agents return counts, line numbers, or coverage percentages as whole numbers,s.numberaccepts floats silently. A model that returns1.5for a turn count passes validation today, and the caller gets a float where an integer was intended.Change
Added
s.integer— anIntegerSchemawithtype: "integer"— following the exact sameSchemaHelperFactorypattern ass.number:IntegerSchema = { type: "integer"; description?: string }s.integerhelper, callable as bare value ors.integer("description"){ "type": "integer" }(standard JSON Schema integer type)Number.isInteger(), so1.5now fails with a clearexpected integermessage instead of silently passingInferSchema<IntegerSchema>maps to TypeScriptnumber(no narrower integer type in TS)createTypedPrimitiveSchemageneric constraint widened to includeIntegerSchemaTests added
Three new tests in
src/rig.test.ts:toJsonSchemacoverage fors.integerands.integer("description")