Skip to content

fix: automate schema generations and macOS inference admission - #438

Open
ajroetker wants to merge 6 commits into
mainfrom
codex/fix-issues-431-437
Open

fix: automate schema generations and macOS inference admission#438
ajroetker wants to merge 6 commits into
mainfrom
codex/fix-issues-431-437

Conversation

@ajroetker

@ajroetker ajroetker commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Closes #431
Closes #437

Summary

  • make schema versions backend-owned: creates start at generation 0, public create/update requests that set schema.version receive a clear 400, and OpenAPI marks the field read-only
  • increment the schema generation and create the matching full_text_index_vN for every semantic schema change; canonical source/runtime no-ops (including explicit defaults and reordered properties) do not rebuild, legacy schemas remain repairable, and generation overflow fails safely
  • converge schema updates on the generation actually committed by metadata; concurrent superseding updates return a retryable 409 and cannot trigger stale local reconciliation
  • use the macOS system memory-pressure availability percentage for live inference admission, retaining the conservative Mach page estimate only as a fallback
  • emit bounded live-memory denial telemetry and preserve actionable preload failures with both model-specific and standalone startup-step diagnostics
  • retain the existing API distinction between permanent MODEL_RESOURCE_LIMIT failures and retryable MODEL_RESOURCE_BUSY pressure responses

Root causes

Create-table normalization unconditionally rewrote caller versions to 0, but the version is an internal migration generation rather than a client contract version. Schema updates only advanced the full-text generation when document_schemas changed, leaving indexing-affecting changes such as dynamic templates on the old generation. The API also predicted convergence from a snapshot taken before the mutation, which could be stale under concurrent schema updates even though metadata owns and serializes the generation.

On macOS, live admission used raw Mach page queues. Warm hosts can have almost no raw free pages while still having gigabytes of reclaimable file cache, so valid loads were rejected before the model loader ran. The pressure-level API measures system-wide available memory and matches memory_pressure(1) behavior.

Validation

  • zig build root-test -- --test-filter api.table_contract.test. (23 passed)
  • zig build root-test -- --test-filter api.tables.test. (50 passed)
  • zig build root-test -- --test-filter create table (20 passed)
  • zig build root-test -- --test-filter metadata.schema update (10 passed)
  • public create and update HTTP version-ownership regressions passed
  • authoritative-generation, projection, and superseding-generation regressions passed
  • zig build root-test -- --test-filter 'schema update' (17 passed)
  • zig build root-test -- --test-filter 'api module compiles' (1 passed)
  • zig build test -- --test-filter runtime.tier.memory.test. from zig/pkg/inference (36 selected, 36 passed)
  • inference capacity contract tests (9 selected, 9 passed)
  • focused standalone runtime suite (42 passed)
  • make zig-openapi-check
  • git diff --check

@ajroetker ajroetker changed the title fix: preserve schema versions and use macOS pressure admission fix: automate schema generations and macOS inference admission Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant