feat(grammar): add support for minItems, maxItems, and numeric bounds #60
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/grammar-schema-keywords"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
also fix a CI inefficiency and resiliency issue
Automated review by pr-reviewer v0.44.2 | Safety Check | Claude Sonnet 5 | tracking id
r-726581-a0c78bThis is an AI-generated review and may contain mistakes.
Status: ✅ Completed
✅ Verdict: LGTM — The PR adds well-tested numeric-bounds/array-count grammar support and a defensive CI pre-flight check, with no signs of secrets, accidental commits, or logic that would break existing behavior.
Went through the diff for logic errors and anything alarming.
CI change (
build-push.yaml): Adds a pre-flight probe step to check whether the inference backend/model is reachable before invoking the changelog action, and skips the changelog step gracefully (if: steps.changelog-model.outputs.ok == 'true') rather than retrying blindly. This is purely additive/defensive and doesn't touch the release/build/push steps themselves, so it can't break the actual release; worst case is a missing changelog entry, which is explicitly the intended fallback.Grammar/schema changes (Go): The core addition is
internal/grammar/number.go, implementing prefix-feasibility checking for numeric bounds (minimum/maximum/exclusive forms) and item-count gating forminItems/maxItems. This is intricate math (mantissa/exponent tracking, half-open interval feasibility,settle/topScalebinary-search-like probing), but:73e-333underflow, exponent-frozen mantissa, dead-end avoidance).bounds_test.go) cover exactly the tricky edges called out in the comments (unreachable prefixes, exclusive bounds at the terminator, exponent-frozen mantissa, negative bounds).schema_gen_test.go) was updated to emit bounded arrays/numbers, and the walk-schema list inschema_invariant_test.gogained bounds/array-count cases, so the new logic is exercised by both table tests and the fuzz-based soundness/completeness checks the AGENTS.md documentation for this package explicitly relies on.schema.go) validates unsatisfiable bounds (minItems > maxItems, empty numeric ranges, conflicting exclusive/inclusive bounds) at compile time rather than silently producing an unsatisfiable/dead-end acceptor — consistent with the stated design philosophy ("a schema that looks enforced and is not is worse than one that is refused").schema_state.gowires the newnumStateinto the existing per-byte acceptor and cache signature (sig()), including the array frame's newcountfield. The signature changes are appended consistently, preserving the cache-isolation invariant described in AGENTS.md (schema identity + cursor state need to be part of the sig).Nothing here looks like a secret, credential, large binary, or unrelated debug artifact. Test file
schema_test.gocorrectly updates the previously-"unsupported" test cases forminItems/minimumto reflect the new support, and adds new compile-time rejection tests for the newly-invalid cases (negative counts, empty ranges, bounds on non-numeric types) — consistent with the code changes, no orphaned assertions.Given the depth of the math involved I'd normally be cautious, but the PR includes thorough targeted tests plus fuzz-generator updates for exactly this feature, and the diff is internally consistent with its own documentation updates (AGENTS.md, README.md). I don't see anything that looks like it was pushed by accident or introduces an obvious regression.