Skip to content

Make chat connections editable, testable, and explicitly selectable - #94

Open
mdiniz97 wants to merge 6 commits into
jhd3197:mainfrom
mdiniz97:fix/chat-connection-contract
Open

Make chat connections editable, testable, and explicitly selectable#94
mdiniz97 wants to merge 6 commits into
jhd3197:mainfrom
mdiniz97:fix/chat-connection-contract

Conversation

@mdiniz97

Copy link
Copy Markdown

Chat connections already had a delivery path, but not a complete management contract: administrators could create and delete them, but could not safely update credentials, test a disabled destination, or explicitly choose the default connection. That gap would force every new provider (including future additions) to invent its own lifecycle rules. This PR completes the shared contract first, while leaving provider-specific formatting and rich payloads for follow-up changes.

Highlights

  • Update connection metadata and encrypted credentials without allowing the provider kind to change.
  • Test active or inactive connections through the real formatter and transport path.
  • Record the latest test timestamp and outcome without exposing webhook URLs or bot tokens in API errors.
  • Select and reactivate a default connection, scoped by provider kind.
  • Reject malformed update payloads, including arrays, booleans, and explicit JSON null.
Technical changes
  • Adds the update, test, and default-selection service operations and admin API routes.
  • Validates updates before mutating the database and preserves omitted credentials.
  • Keeps the documented global Telegram bot-token fallback unchanged.
  • Uses a transient notification for tests and persists only the connection test result.
  • Returns a stable public error when formatter or transport failures occur.
  • Adds focused coverage for credential rotation, clearing, inactive tests, default scoping, secret-safe errors, and invalid JSON bodies.

Verification

  • Chat connection suite: 37 passed
  • Backend suite: 3098 passed, 98 skipped
  • Two incremental-backup tests were deselected because they require GNU tar and fail on the unchanged macOS bsdtar baseline

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