Skip to content

Add tests for the connections/providers split #287

Description

@martsokha

The connections/providers split (2cdaf61, on PR #284) added a new workspace_providers resource and restructured connections, but the new surface has no dedicated tests yet. The existing suites pass but don't exercise it.

Provider CRUD handler (crates/nvisy-server/src/handler/providers.rs)

  • create / read / update / delete / list / verify — happy paths and authz (ManageProviders vs ViewProviders).
  • Update rejects a provider-change (provider_id mismatch → 400) and preserves provider_type.
  • verify_provider maps a build error vs. a credential rejection to the right ConnectionVerification.
  • Name-uniqueness (per-workspace) and the provider vs. connection namespaces are independent.

Provider queries (crates/nvisy-postgres/src/query/workspace_provider.rs)

  • find_provider_by_type returns the most-recent active provider of a kind, excludes disabled/soft-deleted, and applies the (updated_at desc, id desc) tiebreaker deterministically.
  • Update/delete are scoped to live rows (deleted_at IS NULL) — a concurrent delete is not overwritten. Mirror the same coverage for the connection update/delete (the same fix landed there).
  • cursor_list_workspace_providers pagination + provider filter.

Events / activity

  • Provider create/update/delete emit provider.{created,updated,deleted} webhook + activity events with the correct ProviderRef/ProviderActivityParams, and do not emit notifications (matching connection CRUD).

Split invariants

  • chat resolves the workspace LLM via find_provider_by_type(ProviderType::Llm) and errors cleanly when none is configured.
  • Connections are transfer-only: ConnectionConfig has no inference variant; connection_type drives supports_schedule.

Notes

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    choremaintenance, dependency updates, code cleanuppostgresORM, models, queries, migrationsserverAPI handlers, middleware, auth

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions