bug(cli): server_connect writes three config values non-atomically — partial update on failure #1203

Merged
HAL9000 merged 4 commits from bugfix/m6-server-connect-non-atomic into master 2026-04-26 17:52:59 +00:00

4 Commits

Author SHA1 Message Date
HAL9000 2db01fbc17 fix(cli): resolve merge conflict and address all reviewer blockers for #993
CI / push-validation (push) Successful in 22s
CI / helm (push) Successful in 27s
CI / lint (push) Successful in 1m7s
CI / build (push) Successful in 1m5s
CI / quality (push) Successful in 1m35s
CI / typecheck (push) Successful in 1m35s
CI / security (push) Successful in 2m13s
CI / benchmark-publish (push) Failing after 42s
CI / integration_tests (push) Successful in 4m36s
CI / e2e_tests (push) Successful in 5m33s
CI / unit_tests (push) Successful in 6m32s
CI / docker (push) Successful in 1m27s
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 1m15s
CI / quality (pull_request) Successful in 1m17s
CI / typecheck (pull_request) Successful in 1m32s
CI / security (pull_request) Successful in 1m25s
CI / build (pull_request) Successful in 38s
CI / helm (pull_request) Successful in 26s
CI / push-validation (pull_request) Successful in 30s
CI / coverage (push) Successful in 11m9s
CI / status-check (push) Successful in 13s
CI / integration_tests (pull_request) Successful in 3m38s
CI / e2e_tests (pull_request) Successful in 3m48s
CI / unit_tests (pull_request) Successful in 6m27s
CI / docker (pull_request) Successful in 1m21s
CI / coverage (pull_request) Successful in 11m32s
CI / status-check (pull_request) Successful in 5s
- Resolve merge conflict in config_service.py: integrate PR's emit_config_changed() helper with master's scoped config infrastructure
  (write_scoped_config, scoped set_value)
- Remove # type: ignore[assignment] by introducing typed _AutoDiscover sentinel class for project_root parameter
- Add exc_info=True to emit_config_changed warning log
- Fix server.py: remove invalid scope='global' from emit_config_changed rollback calls; use svc._config_path instead of hardcoded path
- Add ReactiveEventBus.close() method for proper resource cleanup
- Fix BDD test steps: call event_bus.close() in cleanup handler
- Update CHANGELOG.md and CONTRIBUTORS.md

Closes #993
2026-04-26 17:36:29 +00:00
freemo e3ab8a4e20 fix(cli): add scope parameter to compensating emit_config_changed() calls
Pass scope="global" to emit_config_changed() in the server_connect
rollback path to maintain consistency with the scoped event details
convention established by master's ConfigService.set_value().

ISSUES CLOSED: #993
2026-04-26 17:34:52 +00:00
freemo b9a4fa519d fix(test): update _FailingConfigService.set_value() to match scoped signature
Update the test double to accept the scope keyword argument added by
master's scoped config changes, and pass project_root=None to avoid
auto-discovery in test environments.

ISSUES CLOSED: #993
2026-04-26 17:34:52 +00:00
brent.edwards c2d84c6f09 bug(cli): server_connect writes three config values non-atomically — partial update on failure
Make server_connect config persistence all-or-nothing by snapshotting ~/.cleveragents/config.toml before the three set_value calls and restoring the exact prior bytes on any exception. This preserves existing config-change audit events on success while preventing partially written server URL/namespace/TLS state after mid-sequence failures.\n\nAlso promote the #993 TDD feature from expected-fail to active regression coverage and tighten a flaky resource DAG Robot scenario by using a shared session with explicit commits to keep integration gates stable under parallel execution.

ISSUES CLOSED: #993
2026-04-26 17:34:52 +00:00