Skip to content

fix(settings): start on the active settings when a pending change is blocked, and allow withdrawal - #130

Draft
DMontgomery40 wants to merge 2 commits into
mainfrom
fleet-20261029/faxbot-issue-85
Draft

DMontgomery40 wants to merge 2 commits into
mainfrom
fleet-20261029/faxbot-issue-85

Conversation

@DMontgomery40

Copy link
Copy Markdown
Owner

A blocked pending settings change no longer stops Faxbot from starting

Before this change, a settings change saved for the next restart could leave the installation unable to start. One example is turning sending off or changing the Asterisk manager login while a SIP fax was still unresolved. Every start raised ConfigurationActivationError in the drain check, and the API was the only way to settle the fax or undo the change. On the partner installation the container restart-looped until the pending revision was replaced offline.

What changes:

  • Startup (config_runtime.py). The drain check now returns a sentence instead of raising. When the pending revision would replace the fax engine connection while a fax is unresolved, Faxbot starts on the active revision and logs the reason. The pending revision is kept and is not promoted. Once the fax is settled, the next start promotes it as before.
  • Reporting. GET /admin/settings returns _meta.pending_block_reason, for example "Pending settings wait until fax is settled. Drain or reconcile unresolved faxes before replacing the fax engine connection." The Settings console shows it in place of the restart notice, because a restart would not help. faxbot admin settings get and reload print it.
  • Withdrawal. POST /admin/settings/withdraw takes expected_revision_id, the desired revision the caller loaded. It clears the pending revision, keeps the active settings and the revision history, and writes a settings.withdraw audit row in the same transaction. Withdrawal is checked like any other write, against what it undoes: settings:write, plus providers:write or owner rights when the pending change needs them. A stale revision is refused with 409, and a second withdrawal reports changed: false. The console button is Withdraw pending changes, shown whenever changes are pending; readers see a sentence instead. The CLI command is faxbot admin settings withdraw, and docs/reference/cli.md is regenerated.
  • README. The operator paragraph now sits under Quick start, next to the notes on restarts. The roadmap entry is at the top of Implemented. Both were in the wrong section; this PR adds one commit to move them. The wording is unchanged.

The branch is rebased onto main 630644f. That base includes the lean CI gate and #127. The only conflict was in README: #127 added a SIP-registration paragraph and roadmap entry in the same two places. I kept both, with #127's text first. Six files overlap #127; main.py, client.ts, types.ts, test_cli.py and docs/reference/cli.md merged cleanly. make cli-docs produces no change.

One limitation is not fixed here. At startup, .env credentials and other startup adoptions are still written on top of the desired revision. While a change is blocked, the desired revision is the pending one. A credential changed in .env during that time is saved into the waiting revision and takes effect only when that revision is promoted or the change is withdrawn. Before this PR the same start failed outright.

Checks on this head

On this head, after rebasing onto 630644f:

  • make test-local with test_console_cli_parity, test_settings_coverage, test_configuration_runtime, test_configuration_ami_drain, test_route_policy_coverage and the settings/withdraw tests in test_cli: 57 passed, 4 skipped.
  • vitest on settingsParity, systemScreens and navigation: 126 passed. npx tsc --noEmit is clean.
  • make cli-docs produces no diff.
  • secret-scan.sh origin/main: no suspicious added lines.

The broader runs below were on the same two commits before the two rebases. The first rebase brought only CI, conftest.py markers, AGENTS.md, CONTRIBUTING.md and README. The second brought #127's outbound, routing and console changes.

  • Old code fails the new tests. I made a temporary detached worktree at origin/main (ed024b1 at the time), checked out this branch's five touched test files, and ran the new and changed tests: make test-local PYTEST_ARGS='… -k "withdraw or lifespan or abandon or legacy_failed or captured_manifest"'. Result: 13 failed, 7 skipped.
    • The startup tests failed with ConfigurationActivationError: Unresolved AMI faxes must be drained or reconciled….
    • The API/CLI test got 404 where it expects 409.
    • The access tests failed with AttributeError: … withdraw_pending_authorized.
    • I removed the worktree afterwards.
  • make test-local with the touched test files (test_access_configuration_access, test_access_configuration_writes, test_configuration_ami_drain, test_configuration_runtime, test_cli): 203 passed, 83 skipped. This ran before both rebases.
  • make test-local with test_console_cli_parity, test_settings_coverage, test_route_policy_coverage, test_route_policy, test_request_identity, test_config_activation, test_config_store, test_configuration_integration, test_configuration_audit_lifecycle, test_engine_login, test_cli_admin, test_config_env_secrets, test_api, test_runtime, test_release_upgrade, test_config_views, test_access_configuration and test_config_paths: 261 passed, 60 skipped. This also ran before both rebases.
  • make test-local with the rest of the /admin/settings, lifespan and settings-CLI callers (27 files, including test_admin_hybrid, test_capabilities, test_sip_http, test_sip_access, test_sip_network, test_sip_fax_mode, test_inbound_handover, test_answer_cap, test_fax_friendly, test_savings_mechanisms, test_telnyx_fax and test_plan_budget): 733 passed, 288 skipped. Then test_efax, test_humblefax and test_provider_accounts, the remaining config_activation importers: 199 passed, 19 skipped. Both ran after the first rebase, on main ed024b1.
  • vitest on all 9 console test files that render Settings (settingsParity, numbersRecipients, navigation, sinchBasicAuth, efaxSettings, providersRevised, telnyxFaxSettings, humblefaxReceiving, systemScreens): 171 passed. This ran after the first rebase.
  • The skips are the PostgreSQL variants, the Docker loopback proofs and one Ghostscript test.

Not checked

  • PostgreSQL variants. They were skipped locally because there is no schema or migration change; CI's full suite runs them.
  • I did not run the other files that import config_store only to build fixtures; the run had reached the time budget. They do not touch settings writes, startup or the settings routes. The files: test_access_bootstrap, test_access_context, test_access_outbound, test_access_runtime, test_access_sessions, test_analysis, test_batching, test_capacity, test_certainty, test_combinations_submit, test_database_busy, test_destination_capture_pricing, test_destination_plan_pricing, test_digital_direct, test_digital_fhir, test_direct_delivery, test_hylafax_engine, test_outbound_idempotency, test_outbound_now, test_outbound_store, test_partner_relay, test_peer_fax, test_routing_local, test_routing_multiprovider, test_routing_store, test_rules_delivery, test_sinch_route, test_t38_loopback, test_tollfree_dialing. The lean CI gate runs the ones not marked heavy. The config_values importers were not run either, because config_values.py is unchanged.
  • No live fax engine, Telnyx, HylaFAX or any other provider was used. Everything ran on synthetic data offline.
  • The console in a real browser.
  • Jev unavailable: I checked the wording by reading it.
  • The npm build: no build configuration or entry point changed.

Pre-existing failures

None found. Every test run on this branch passed.

Closes #85

🤖 Generated with Claude Code

DMontgomery40 and others added 2 commits October 30, 2026 20:41
Serve the active revision when unresolved fax work blocks an AMI replacement, and expose the waiting reason. Add revision-checked, audited pending withdrawal through the API, console and CLI, preserving active settings and captured provider authority. Cover startup recovery, later promotion, permissions, atomicity and console states with offline tests.
… roadmap

The roadmap entry for blocked pending settings sat above the roadmap key,
outside the Implemented list, and the operator paragraph sat in the
documentation-and-development section. Move the entry to the top of the
Implemented list and the paragraph next to the Quick start notes on
restarts and active settings, where an administrator recovering a start
looks for it. Wording is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

An accepted pending settings change can stop the installation from starting

1 participant