SIGN IN SIGN UP

Compile bounded JSON array tails compactly (#376)

## Summary

- Compile heterogeneous `prefixItems` explicitly and represent
homogeneous bounded array tails with the existing `bounded_sequence` /
`GrammarBuilder::repeat` machinery.
- Preserve `minItems`, `maxItems`, empty arrays, unbounded tails, and
unsatisfiable-prefix behavior.
- Add regression coverage for bounds of 30,000 items, large minimum
bounds, prefixed arrays, combined schemas, and final compact-grammar
conversion.

## Why

The JSON schema compiler currently expands bounded arrays into one
grammar entry per possible item. Valid schemas with large `maxItems`
values therefore produce unnecessarily large grammars, and combining
several such schemas can overflow the compact grammar's symbol
representation.

Bounded object properties already use logarithmic repetition. This
applies the same existing machinery to homogeneous array tails while
retaining explicit handling for heterogeneous prefix items.

## Verification

```text
cargo test -p llguidance
cargo fmt --check
cargo check --no-default-features -p llguidance
cargo clippy -p llguidance --all-targets -- -D warnings
```

---------

Co-authored-by: arvindg <184375545+arvindg-openai@users.noreply.github.com>
Co-authored-by: Michal Moskal <mmoskal@openai.com>
A
arvindg-openai committed
2221191ce56e4fe950ebc0a1b9054f91efe5de09
Parent: c75b0d9
Committed by GitHub <noreply@github.com> on 8/25/2026, 5:16:53 PM