generator: typed-table emit exceeds SQLite column cap on wide config singletons Filed by…
- User
generator: typed-table emit exceeds SQLite column cap on wide config singletons
Filed by
/printing-press-retrofrom a run of HaloPSA (scorecard 91/100 Grade A, 100% verify pass).Summary
The typed-table emit path generates one column per leaf JSON field in a resource's response schema with no upper bound. On HaloPSA's tenant-global
/Controlconfig singleton, this produced a 3,747-columnCREATE TABLEthat exceeded SQLite's defaultSQLITE_MAX_COLUMN=2000. Generation passed every quality gate;sync --full --dry-rundied cold withSQL logic error: too many columns on control (1). The failure mode is silent until first sync.Where to look
- Component: generator
- Likely area: Typed-table-emit path in
internal/generator/templates/store/— whereverCREATE TABLEtext is composed per discovered resource. - Triggered when: A spec resource's response schema flattens to >~1500 leaf fields. Enterprise config singletons are the obvious class.
What we observed
Run-1 output (post-generate):
codePASS go mod tidy / govulncheck / go vet / go build PASS halopsa-pp-cli --help / version / doctor Generated halopsa at .../working/halopsa-pp-cliFirst
sync --full --dry-run:codeError: opening local database: running migrations: migration failed: SQL logic error: too many columns on control (1)Per-table column counts (top 5 widest, recorded by Python introspection of
internal/store/store.go):table columns control 3747 tickets 847 projects 847 opportunities 847 client 447 Tickets / projects / opportunities sit just under the 2000 cap but with no headroom; the next major-version Halo response schema could push them over.
Workaround applied this run: hand-stripped paths from the spec (5 paths) and added a stub schema so residual targets resolved. Regenerated successfully.
- Assistant
I’ll trace the store template and its tests, then add the 1500-column dispatch with coverage for both wide fallback and unchanged narrow resources. I’ll keep this as a generator-level fix and run formatting, focused tests, the golden verifier if output contracts are affected, and the full Go suite.
- Assistant
The width is determined in
BuildSchema, but dependent-parent columns are appended later, so the cap must be enforced after that augmentation too. I’m modeling the fallback explicitly on each table; that lets every template consistently suppress indexes, FTS, and typed projections while still emitting and populating the three-column resource table. - Assistant
The first focused generation test now passes: a synthetic 3000-field resource produces a three-column table, batch upserts populate it, and the generated store package opens an empty SQLite database successfully. I also covered the exact 1500-column boundary and the case where a dependent-parent column is the one that pushes a table over the cap.
- Assistant
The unrestricted generator suite exhausted the container’s process/thread limit because many existing tests launch generated builds in parallel. I’ve rerun it with bounded test parallelism; it is progressing without the resource crash. The earlier focused regression tests remain green.
- Assistant
The bounded full repository suite is running now. One existing gate is expected to fail independently of this change: the installed Go 1.26.4 standard library is flagged by local
govulncheck(fixed in Go 1.26.5). Golden verification is also unavailable in this container becausejqis not installed; the script exits before generating or comparing fixtures. - Assistant
The repository-wide run confirmed the new regression path passes, while the overall result is blocked by two unrelated environment/baseline failures: the Go 1.26.4 vulnerability gate and an existing
internal/pipelinelive-check assertion. I’m doing one final edge check for ID-less singleton responses—the exact wide-config shape that motivated this fix—before handing it back.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.