Skip to content

Comments

Harden runtime error paths and standardize API config reload semantics#141

Open
vsumner wants to merge 6 commits intospacedriveapp:mainfrom
vsumner:fix/tests-and-panic-hardening
Open

Harden runtime error paths and standardize API config reload semantics#141
vsumner wants to merge 6 commits intospacedriveapp:mainfrom
vsumner:fix/tests-and-panic-hardening

Conversation

@vsumner
Copy link

@vsumner vsumner commented Feb 22, 2026

Summary

This PR started as failing-test + panic hardening and now also standardizes config mutation/reload semantics across API endpoints, with new targeted coverage.

What Changed

Test and runtime hardening

  • Fixed failing tests/doctests and metadata-only search test setup.
  • Hardened runtime paths by replacing panic-prone expect/unwrap usage with guarded error handling in channel/worker/config/messaging paths.
  • Hardened channel prompt handling and streaming lock safety.
  • Removed remaining prompt-construction panic paths in channel and worker.
  • Applied rustfmt cleanup required by CI.

API config mutation standardization

  • Added shared helpers in src/api/config.rs:
    • write_validated_config (validate TOML -> write -> reload parsed Config)
    • reload_all_runtime_configs (reload all live RuntimeConfig instances)
    • sync_bindings_and_permissions (sync bindings ArcSwap + Discord/Slack permissions)
  • Refactored endpoints to use the shared flow:
    • update_agent_config
    • update_provider, delete_provider
    • toggle_platform, disconnect_platform
    • create_binding, update_binding, delete_binding
  • Removed ad-hoc best-effort reload branches in favor of explicit validated behavior.

New API coverage for standardized behavior

  • Added targeted api::bindings tests to verify:
    • invalid config mutation returns 400 BAD_REQUEST
    • provider update writes config and reloads live runtime routing
    • binding create writes config and syncs in-memory bindings + Discord/Slack permissions

Validation

  • cargo fmt --all -- --check
  • cargo test api::bindings::tests:: -- --nocapture
  • cargo test

@vsumner vsumner changed the title Fix failing tests and harden runtime error handling Harden runtime error paths and standardize API config reload semantics Feb 22, 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

Development

Successfully merging this pull request may close these issues.

1 participant