Add gateway --bootstrap-config CLI#7380
Closed
AntoineToussaint wants to merge 1 commit into
Closed
Conversation
6628a3a to
1cea76b
Compare
Introduces a one-shot command that loads a TOML config glob, verifies
every stored-config table is empty, writes the config to Postgres, and
exits. This is the operator-facing mechanism for the "deploy gateway +
Postgres, point at a config file once, then forget the file" story in
the Configuration-in-Database design doc.
Semantics vs. the existing `--migrate-config`:
- `--migrate-config` is the file-authoritative sync path. It appends on
top of whatever is already in the DB and is safe to run repeatedly;
the file remains source of truth.
- `--bootstrap-config` is the "initialize the DB from this file"
command. It refuses to run if any stored-config table already has
rows (unless `--force` is passed), so an accidental re-run doesn't
silently clobber a live deployment.
Neither command starts the inference server — both exit after writing.
Shared plumbing:
- Extracts the parse + filesystem-access check + validation pipeline
into `load_config_for_storage`, used by both commands.
- Parameterizes `store_config_in_database` on `creation_source` + human
command label.
- Adds `find_nonempty_stored_config_table` in `stored_config_queries`,
which walks every stored-config table and returns the first one that
holds rows (or `None` if all are empty). Soft-deleted rows count as
present — bootstrap is for fresh schemas, not formerly-populated
ones.
Tests:
- 5 new CLI parse tests covering arg, conflicts with `--config-file` /
`--migrate-config`, `--force` gating behavior.
- 2 new e2e Postgres tests for `find_nonempty_stored_config_table`:
empty DB → `None`; metric-only DB → `Some("tensorzero.metrics_configs")`.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1cea76b to
4e1b4d7
Compare
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.
Summary
Adds
gateway --bootstrap-config <CONFIG_GLOB>, a one-shot operator command that loads a TOML config, verifies every stored-config table is empty, writes the config to Postgres, and exits. This is the operator-facing mechanism for the "deploy gateway + Postgres, point at a config file once, forget the file" story in the Configuration-in-Database design doc.Semantics vs. the existing
--migrate-config:--migrate-configis the file-authoritative sync path. It appends on top of whatever is already in the DB and is safe to run repeatedly; the file remains source of truth.--bootstrap-configis the "initialize the DB from this file" command. Refuses to run if any stored-config table has rows (override with--force) so an accidental re-run can't silently clobber a live deployment.Neither command starts the inference server — both exit after writing.
Shared plumbing:
load_config_for_storage, used by both commands.store_config_in_databaseoncreation_source+ command label.find_nonempty_stored_config_tableinstored_config_queries— walks every stored-config table and returns the first one that holds rows (orNoneif all empty). Soft-deleted rows count as present — bootstrap is for fresh schemas, not formerly-populated ones.Test plan
Follow-ups (not this PR)
This is PR 1 of the spec posted on #7363. Subsequent PRs (2–5) cover the e2e test-harness parameterization, REST-bootstrap CI flavors, and the narrow mutation APIs for Autopilot.
🤖 Generated with Claude Code