Skip to content

3.x.x: check unread PRISM settings on the serve path (#461 S-A) - #462

Merged
kiwidream merged 3 commits into
3.x.xfrom
cutover-safety/serve-path-settings-check
Sep 22, 2026
Merged

kiwidream merged 3 commits into
3.x.xfrom
cutover-safety/serve-path-settings-check

Conversation

@kiwidream

@kiwidream kiwidream commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Part of #461 (S-A). Target 3.x.x, base pin 587aef59.

What

qbit-prism-server with no subcommand (Command::Run) now calls config::check_environment() before Config::from_env() — the same unread-PRISM_* check check-config already performs: refuse in production mode naming every unread variable (values never printed), warn in lab mode. A deploy that skips check-config no longer starts silently on a 2.x.x environment (crates/qbit-prism-server/src/tools.rs).

No allow-list was added: under every Compose overlay combination, every PRISM_* name that reaches a container running qbit-prism-server is already in native-settings.txt (the four non-native PRISM_POSTGRES_* names reach only the replica entrypoint). retired-settings.txt is refreshed from 2.x.x e76234aa (+PRISM_CANDIDATE_ORPHAN_TERMINAL_CONFIRMATIONS, the pre-#420 name of PRISM_CANDIDATE_ORPHAN_CONFIRMATIONS); header records both inventory commits. docs/prism-configuration.md documents the serve-path behaviour and keeps check-config as the preflight.

Corrects #288's "retired-settings warning, deferred P3": check-config had it; only the serve path lacked it.

Tests (crates/qbit-prism-server/tests/config_cli.rs)

  • unread_environment_stops_the_serve_path_in_production — real binary, production mode, unread names plus a deliberately malformed known boolean: the unread diagnostic is the whole failure; the boolean parse error and the fixture's RPC transport error never appear (pins the ordering before Config::from_env and before any node contact).
  • unread_environment_only_warns_on_the_lab_serve_path — warning printed, then startup continues to the fixture's unreachable node.
  • retired_inventory_covers_the_final_python_runtime_name — inventory entry and C-sort.

Mutation checks (applied and restored): removing the call → 2 tests fail; moving it after from_env → production test fails; bail!→eprintln! → production test + existing check-config test fail; dropping the retired name → inventory test fails.

Gates: cargo fmt --all --check, cargo clippy --locked --workspace --all-targets -- -D warnings, check_gate_env_reads.py, check_prism_settings.py, check_toolchain_pin.py, config_cli (21), capacity::bound_configuration_uses_only_native_runtime_settings, tests.test_check_prism_settings — all pass.

Not covered

public-api, migrate, import-audits, backfill-ctv and the other subcommands still skip the check (unchanged scope). No Compose-level test proves a real 2.x.x overlay is refused end to end.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

kiwidream and others added 3 commits September 18, 2026 13:59
The retired inventory was taken from the Python runtime at 3e233d2, but
the 2.x.x line continued to e76234a and added one more runtime-read name,
PRISM_CANDIDATE_ORPHAN_TERMINAL_CONFIRMATIONS, the predecessor of native
PRISM_CANDIDATE_ORPHAN_CONFIRMATIONS. Without it the name could be
presented as live guidance again, and the cutover inventory would claim a
completeness it does not have. Record both inventory commits in the header
so the next audit knows where the sweep stopped.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Only check-config called config::check_environment(); Command::Run went
straight to Config::from_env(). A deploy that skips the preflight could
therefore start a native frontend silently on a 2.x.x environment, where
every leftover PRISM_* name is inert and the operator has no signal that
the settings they set are doing nothing. Run the same check first, in the
same order check-config uses, so production refuses to start and lab mode
warns before any listener binds. The check reads the process environment
the runtime itself reads and reuses config::production_mode(), so there is
no second reader and no separate notion of production. The diagnostic
names each offending variable and never its value.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The serve-path tests proved the diagnostic appeared but not that it came
first or that it stopped the process. Moving check_environment() after
Config::from_env() left every test green, and turning the production bail
into a warning also left them green, because the fixture's unreachable node
made `run` exit non-zero either way.

Give the production test a known setting the parser rejects and assert its
error is absent, so the parse can only be reached once the unread names are
gone; assert the node's transport failure is absent too, so the refusal is
the whole failure rather than one line before a later exit. The lab test now
asserts that same transport failure is present, which is the positive proof
that a warning let startup continue. The dead listener, port and elapsed-time
scaffolding is gone: server::run contacts the node before binding stratum, so
none of it observed anything.

Correct the guidance while it is being rewritten. check-config does not
validate every setting group; the public reader's database settings belong
to check-public-database-config. Scope the paragraph to the coordinator serve
path, which is the only command this change touches.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant