mirror of
https://github.com/baserow/baserow.git
synced 2026-12-05 00:38:35 +00:00
stop-reporting-builder-custom-code-errors
7
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e7381b5384 |
feat(mcp): always turn on OAuth sign-in and add the MCP tools changelog (#6930)
* chore: add changelog entry for the MCP shared tools The tools PRs left it for when the milestone was done. * feat(mcp): always turn on OAuth sign-in BASEROW_MCP_OAUTH_ENABLED is removed before it ships, so OAuth sign-in is on everywhere. The settings page opens the endpoint tab when the OAuth connections fail to load. |
||
|
|
74d6625a49 |
feat(assistant): run Kuma replies in the background (#6383)
* feat(assistant): stream Kuma background replies over HTTP Behind assistant_background_runs, commit and enqueue the message then follow Redis on the existing POST/200 cumulative JSON response. Resume the same run without sending the prompt again. Keep refresh, multi-tab discovery, onboarding and durable outcome recovery in the Kuma adapter and UI integration. Part of #6346 * Remove unused Kuma chat run response header * Register Kuma with the shared async streaming router * Always execute Kuma messages in background runs * Use chat run constant enums in Kuma Kuma's model_unavailable error code moves to its own run constants, because the engine no longer defines run type specific codes. * Move the tool executor into Kuma Kuma is its only user, and it is specific to pydantic-ai agents, so it does not belong to the shared chat run engine. * Return nothing from Kuma's interruption warning hook The engine now prunes a run whatever the hook does, so it no longer reports whether the warning was kept. * Stop patching the removed ChatRunBuffer.finish * Fix and simplify Kuma's background run adapter - Save "nothing changed" when the model was unavailable or the prompt never reached it. - Keep the progress line after a reconnect and build the compatibility records from their models, with the right text for runs that did nothing. - Delete the in-request path, its cache-key Stop and the event bus. - Map a second message to 409 directly and return one run shape in the chat API. - Fix docstrings, help texts and the POST schema; drop overlapping tests and share run test helpers. * Fix and simplify Kuma's run follower in the browser - Keep local-only messages on refresh and show a queued run as queued. - Settle a request aborted before it is sent and never show raw error pages. - Fall back to the API for a new view whose broadcast is late. - Stop a run through the engine. - Delete the reader for the previous backend, the old cancel call and the UI location history. - Share run test helpers and drop overlapping tests. * Tighten Kuma's e2e tests, CI setup and docs - Prove a live resume after a reload and drop a test that proved nothing new. - Keep Kuma's panel closed in every browser context through the storage state. - Drop the unused OpenAI key from the e2e setup. - Rewrite the background replies section of the AI assistant docs. * Handle Kuma runs whose sender lost access, and other review fixes - A queued run whose sender can no longer use Kuma ends as access_lost without calling the model. - A chat keeps asking runs for a title while its title is provisional. - Test that a run captures and saves its onboarding target. - Pass Phoenix settings to the dev export worker; pin CI's Kuma stub to Node 24.22.1. * Fix Kuma's browser edge cases found in the re-review - A send whose stream is refused after its run started re-reads the chat and counts as accepted. - A chat read that ends after another chat was chosen is dropped, and only a 4xx forgets the tab's stored chat. - An unsaved outcome stays shown while its run is the chat's latest. - The status line shows that Kuma is answering. - Empty stopped or failed answers show only their outcome. - Logout clears Kuma's chats, messages and pending navigation. * feat(assistant): follow Kuma replies through shared chat runs * refactor(assistant): remove obsolete stream-limit recovery * fix(assistant): simplify Kuma cutover and preserve legacy Stop * fix(assistant): preserve existing Kuma API contracts * refactor(assistant): match stream event kinds * refactor(assistant): simplify execution and navigation * fix(assistant): show that Kuma is cancelling after Stop * test(assistant): cover the stale refresh guard and trashed workspaces * refactor(assistant): close the run follower and drop the unused baseline * refactor(chat-runs): share the run-in-progress error code * docs(assistant): document the run limit and the deprecated chat status * fix(assistant): give a duplicated tab its own Kuma tab id |
||
|
|
2c5fca6538 |
feat(mcp): OAuth sign-in for MCP clients with CIMD, DCR and consent (#6312)
* feat(mcp): add django-oauth-toolkit metadata and scopes for MCP OAuth POC Adds the OAuth provider settings, endpoint scope validator and discovery URLs behind BASEROW_MCP_OAUTH_ENABLED. * feat(mcp): redirect OAuth authorize to Baserow consent and issue endpoint-bound codes The consent API validates the authorization query, binds the code to an MCP endpoint, and returns the client redirect URL. * fix(mcp): reject non-S256 and foreign-resource OAuth requests and read consent client from credentials Shared validation backs both authorize and consent; the token audience is pinned to the MCP resource. * test(mcp): cover CIMD host allowlist for MCP OAuth * feat(mcp): serve Streamable HTTP /mcp with OAuth or endpoint-key bearer auth MCP clients doing OAuth need a single resource URL; endpoint keys keep working as bearers. * feat(mcp): revoke OAuth tokens when their MCP endpoint is deleted Scope is matched as a whole word so endpoint:1 never hits endpoint:12. * feat(mcp): add title and read-only/destructive annotations to MCP tools MCP directories require a title and readOnlyHint/destructiveHint on every tool. * feat(mcp): add consent page for MCP OAuth sign-in * fix(mcp): only issue OAuth tokens through the consent flow Open DCR let a client register for the password grant and request an endpoint scope, skipping consent. DCR and the token endpoint now allow only authorization_code and refresh_token, and only the consent view can add an endpoint scope. * fix(mcp): strip trailing slash from the OAuth issuer and resource URL A PUBLIC_BACKEND_URL ending in / produced a //mcp audience and a mismatched issuer. * fix(mcp): add iss to OAuth deny and error redirects The metadata advertises RFC 9207 support, so every redirect back to the client carries iss. * fix(mcp): pass the authorize query to /mcp-authorize as base64url The login redirect re-encoded the plain query, so the consent request failed after signing in. /mcp-authorize also stays clear of the backend /mcp/* route. * feat(mcp): limit an endpoint to its allowed tools Null keeps every enabled tool, so existing endpoints and keys are unchanged. tools/call now also refuses disabled tools, which match_by_name let through. * feat(mcp): consent picks a workspace and tools Users never see the endpoint row behind an OAuth connection; consent creates or reuses it per client and workspace and stores the chosen tools. * feat(mcp): pick a workspace and tools on the consent page Replaces the MCP endpoint picker; the backend manages the endpoint row now. * fix(mcp): reuse a consent grant only for the same OAuth client Keying on the client name let manual endpoints and same-named clients share a grant. * feat(mcp): drop dynamic client registration, keep CIMD only Clients without CIMD use the endpoint key in the Authorization header. * feat(mcp): redesign the consent page Card with client avatar pair, verified badge, database counts and tool badges. * feat(mcp): list and disconnect OAuth connections, refuse grant keys Endpoints created by OAuth consent only accept their OAuth tokens, so their key is refused on SSE and as a bearer, and they move from the endpoint list to a connected apps API. * feat(mcp): connect URL and connected apps in MCP server settings Shows the one OAuth URL with per-client setup steps and lets users disconnect apps they granted. Endpoint keys stay below under their own title. * fix(mcp): hide OAuth grants from endpoint routes and left workspaces The legacy endpoint routes no longer return grant rows or their key, and the connections list skips grants in workspaces the user left, which can't be used or disconnected. * fix(mcp): load consent on the client so tool checkboxes render ticked Server-rendered checkboxes lacked the checked class, which hydration kept while the state was ticked. * fix(mcp): define django-oauth-toolkit swappable model settings migrate resolves them when checking for model changes on an already migrated DB, which broke CI. * fix(mcp): reset the SSE endpoint key when the key is unknown The early 401 left current_key set, leaking it into later work in the same context. * feat(mcp): give OAuth grants no key and one row per client and workspace * fix(mcp): resolve the /mcp endpoint once and drop the /mcp/ route * feat(mcp): hash OAuth tokens, expire refresh tokens and accept offline_access Resource metadata lists only mcp; the CIMD host allowlist is now BASEROW_MCP_OAUTH_CIMD_ALLOWED_HOSTS. * test(mcp): assert offline_access reaches the token and add refresh expiry control * feat(mcp): rate-limit the OAuth token endpoint per client IP * fix(mcp): validate consent once and only keep a grant when a code is issued * fix(mcp): roll back the grant when the library answers consent with an error oauthlib re-validates while issuing and returns non-fatal errors as a redirect, which committed the grant. * fix(mcp): revoke OAuth grants when a user leaves the workspace * fix(mcp): count only usable tools on connected apps * fix(mcp): start reconnects from the existing grant's tools on the consent page * fix(mcp): give the connections section its own BEM elements * feat(mcp): send mcp_connected for Streamable HTTP clients * fix(mcp): route /mcp, /oauth and OAuth metadata to the backend * fix(mcp): route /mcp-authorize to frontend before /mcp to prevent 404 * feat(mcp): let MCP clients without CIMD register with DCR Registration is anonymous, limited to public code-grant clients with https or loopback redirects, and unused clients are removed after a day. * fix(mcp): reject DCR redirect URIs containing whitespace DOT splits stored redirect URIs on whitespace, so one URI could smuggle in a second. * docs(mcp): document OAuth sign-in for MCP clients * test(mcp): load the URLconf before tests turn OAuth off The OAuth routes are only mounted if the flag is on at URLconf import, so a test that turned it off first left later tests in the worker with 404s. * feat(mcp): periodically clear expired OAuth tokens Rotation and reuse protection leave revoked refresh tokens, used codes and expired access tokens behind. DCR registration tokens now expire so they're cleared too. * style(mcp): drop dead and invalid rules in the OAuth SCSS * fix(mcp): keep unnamed library metadata routes instead of crashing * refactor(mcp): remove unused MCPEndpointHandler.get_by_key * fix(mcp): only accept an OAuth token for its own client's grant * fix(mcp): leave resource_metadata out of the 401 when OAuth is off The metadata route isn't mounted then, so the hint pointed at a 404. * fix(mcp): rate-limit the OAuth authorize redirect per client IP Each anonymous authorize request can fetch and store a CIMD client. * fix(mcp): delete CIMD clients that have no grant Anonymous authorize requests store CIMD clients and nothing removed them. * fix(mcp): say a CIMD host published the client, not that it verified it With the default * allowlist the host is not vouched for. * fix(mcp): name a DCR client without client_name by its redirect host The consent title read "Connect " and the grant had an empty name. * fix(mcp): route MCP and OAuth paths to the backend in the no-caddy nginx config * fix(mcp): reject an access token that has no application It crashed the /mcp request instead of returning invalid_token. * fix(mcp): return the 404 JSON for RFC 7592 PUT and DELETE Django's CSRF check answered them with a 403 page first. * refactor(mcp): move the shared client avatar placeholder out of mcp_authorize The connections list extended a placeholder defined in another component. * fix(mcp): issue a refresh token only for offline_access ADR 009 decision 6 ties refresh tokens to the offline_access scope. * fix(mcp): stop the consent page from being framed The consent page grants a client access, so it is a clickjacking target. * fix(mcp): make the consent page tool toggles keyboard reachable * docs(mcp): say the CIMD host allowlist only covers CIMD clients * docs(mcp): route MCP and OAuth paths in the k8s and AWS examples /mcp is only served by the ASGI app, so the examples sent it to a 404. * fix(mcp): refuse to show the consent form inside a frame Logging in inside a frame reaches the consent page by client-side navigation, which skips the frame headers. * fix(mcp): always issue OAuth refresh tokens Users stay signed in until they disconnect or the app goes unused for 30 days, whether or not the client asks for offline_access. * fix(mcp): keep the endpoint scope when a refresh narrows scopes A refresh asking for scope=mcp issued a token without endpoint:<id>, which failed on /mcp and escaped revocation on Disconnect. * fix(mcp): keep OAuth clients that are still in use after a disconnect Cleanup deleted a disconnected client the next day while the app kept using its client_id. Clients now go after 30 days without a token, and an unknown client on authorize tells the user to re-add the server. * fix(mcp): serve the SSE route with a trailing slash Turning off redirect_slashes made /mcp/<key>/sse/ a 404 instead of a redirect. * fix(mcp): drop the error code from the 401 when no token was sent RFC 6750 section 3.1 says no error code when the request has no credentials. * fix(mcp): delete grantless CIMD clients a day after creation Any anonymous authorize re-fetch bumps a CIMD client's updated, so it can't mark use. CIMD clients are fetched again on demand anyway. * fix(mcp): mark the OAuth client as used after saving its tokens Matches the cleanup's lock order, tokens before the application row. * style(mcp): rewrap the OAuth validator docstring * fix(mcp): describe offline_access as it now behaves Refresh tokens are issued whether or not it is requested. * feat(mcp): audit log MCP OAuth connect and disconnect ADR 009 decision 6: connecting and disconnecting are recorded in the audit log. * test(mcp): give the OAuth action tests a unique module name test_actions.py clashed with other test modules of the same name and broke collection in CI. * fix(mcp): let users disconnect their OAuth grants without endpoint permissions Listing grants and using them only needs membership, so disconnecting must not need the MCP endpoint operations either. * fix(mcp): require the mcp scope on OAuth tokens used at /mcp A refresh asking only for offline_access issued a token without mcp that /mcp still accepted. Refreshes now keep mcp, and /mcp rejects tokens without it. * fix(mcp): ignore the redirect URI's own query when checking for an issued code A client registered with a redirect URI like https://app.example/cb?error=0 never got a code. * fix(mcp): send the OAuth connect PostHog event only after consent commits The consent transaction rolls back when no code is issued, and the event was already sent by then. The audit log entry stays in the transaction. * fix(mcp): keep OAuth grants out of the key endpoint lookup Callers had to remember to pass a key-only queryset; grants have their own lookup. * fix(mcp): show a CIMD client's host in a neutral badge Any host can publish a client metadata document, so a green check made lookalike hosts look trusted. * fix(mcp): show the readable reason when the consent request is rejected * style(mcp): tidy an import and an outdated comment * fix(mcp): name every client on the consent page by its client name Matches Settings, which shows the client name with the host as a badge. A nameless CIMD client falls back to the host that published its metadata. * fix(mcp): show fatal authorize errors on the styled consent page The authorize endpoint answered unknown clients and bad redirect URIs with a bare text 400. * test(mcp): add an e2e spec for the OAuth connect and disconnect flow Enables BASEROW_MCP_OAUTH_ENABLED on the e2e and CI backends so the spec runs. * fix(mcp): send only an error code to the consent error page Free text in the URL could be injected and came back double-encoded after login. The page now maps codes to its own text and shows errors without sign in. * fix(mcp): keep a CIMD client's host in the consent title Any host can publish metadata under any name, so the title reads "Connect {name} from {host}". The neutral badge only repeated the host and is dropped. * test(mcp): check the MCP status before parsing the body in the e2e spec * test(mcp): await the login redirect in the consent middleware spec The unawaited navigation ran the settings middleware after the request mock was restored, making a real request. * fix(mcp): address final review findings on the OAuth flow Authorize errors no longer redirect to client-registered URIs, CIMD redirect URIs follow the DCR rule, consent is rate-limited per user, and deleting a grant any way revokes its tokens. * fix(mcp): accept ChatGPT, Claude and VS Code CIMD documents django-oauth-toolkit 3.4.1 ignores token_endpoint_auth_methods_supported and refuses extra grant types; fixed upstream in #1856 and #1858 but not released. * fix(mcp): update ChatGPT connect steps to the Plugins page * feat(mcp): split MCP server settings into OAuth and Endpoint tabs * fix(mcp): route /mcp without a trailing slash on K8s The OAuth resource is /mcp, which the /mcp/ prefix missed. * fix(mcp): give the CIMD document download one deadline The library's timeout applies per read, so a slow-drip document held a worker. * fix(mcp): bound anonymous client registrations Caps the body at 16 KB and redirect URIs at 10; unsupported URIs are dropped instead of failing the registration. * fix(mcp): rate-limit token revocation, count only failed token calls Revocation loads the client, which can fetch and store a CIMD client. * fix(mcp): preselect the granted workspace when reconnecting It picked the first workspace with databases, so one Allow could move the app with every tool ticked. * fix(mcp): carry the consent request in the path so SSO keeps it SSO sign-in only keeps the return path. The frame headers move to the page so every spelling of the path gets them. * fix(mcp): canonicalize the resource URL, scrub OAuth fields from Sentry SDK clients send the resource normalized; the Sentry denylist only matches exact keys. * fix(mcp): lock the membership while granting an OAuth client A member removed during consent could otherwise keep the new grant. * chore(mcp): count databases through the registry, add missing translations * test(mcp): check the OAuth routes follow the flag * test(e2e): skip the MCP OAuth test only when the route is missing Any other status hid a broken metadata endpoint. * fix(mcp): explain rejected CIMD clients and load failures on the consent page Both showed the invalid request message, which suggested re-adding the server. * fix(mcp): answer a refresh that lost a race with invalid_grant With hashed storage the library returned a blank token and the token view raised a 500. * feat(mcp): mark connected apps whose sign-in has ended Grants stay listed after their refresh token expires, but the app has to sign in again. * docs(mcp): add a self-hosting note for MCP OAuth sign-in Covers the public URL, routing, outbound HTTPS for CIMD, the client IP the limits use and what turning the flag off does. * fix(mcp): sign OAuth apps out on password change or reset Browser sessions already end then; grants stay so apps show as signed out. * feat(mcp): tick only the read tools on a first connection Changing data becomes opt-in; reconnecting still starts from the existing grant. * fix(helm): keep the MCP consent page on the frontend on a shared domain Caddy ingress turns Prefix /mcp into /mcp*, which also caught /mcp-authorize. |
||
|
|
5459f9ecb5 |
feat[4c/6] Button field: send a Slack message (#6005)
* feat: let a database carry integrations, and take them along in an export
* feat: let a button field post to Slack through a bot of its own database
* feat: offer the Slack action in the button field editor, with the bots of its database
* docs: record where a button's external integrations live, and what an import drops
* fix: draw the button's action list the way the design does
* fix: put a Slack message's answer where its schema says it is
* test: drive the Slack action end to end, and send for real when a bot token is given
* test: let the e2e stack answer for Slack, so a click is proven in CI
* fix: charge a click for a Slack post its API refused
The refusal is raised once the post has been made, so treating it as
'nothing left the instance' handed the outbound slot back and let one row
drive unbounded requests at Slack.
* fix: read one rule for the integration a button may carry
Saving, importing and dispatching each spelled the rule out again, and
dispatch had lost the half about the field's own database. The refusal is
one answer now: three different ones let a caller walk the ids and learn
what the installation holds.
* fix: keep the Slack action standing on an answer that is not Slack's
The endpoint is configurable now, so a refusal need not carry an error
code, and a blocked address reads like the HTTP service's. The channel is
held to its column, and a half-filled form is described rather than
thrown over.
* fix: forget a database's integrations when its application is replaced
Remembering the fetch in a module-level map outlived the object it
described, so after any refetch the bot dropdown stayed empty and the only
thing offered was creating a second bot. A failed fetch is now reported
rather than left as an unhandled rejection.
* test: point the e2e suites at the renamed label and the stub's real path
The email spec picks its action by exact label, which this branch renamed,
and the stub was mounted from a path that does not exist once the recipe
has moved to the repo root.
* test: let the API guard for an unsupported application keep a type to refuse
A database accepts integrations now, so the endpoint test that used one to
prove the guard was asserting the opposite of what ships.
* fix: hold a database to the integrations its buttons can actually carry
Opening a database to integrations opened it to every type, so a Local
Baserow one, carrying an authorized_user, could be created on it and ride
along in every duplicate and snapshot. Refusing it on the action was not
enough. The list is read from the action types themselves, so the two
cannot drift.
* fix: answer a refused address and a stranger's JSON the way the HTTP action does
An address Advocate blocked was charged to the click although nothing was
sent, an answer that is not an object raised out of the service, and the
frame holding the bot token was logged with its locals. The channel form
also refused a length the API accepts.
* fix: check the integration an action carries on every save, not just the first
An edit that resent only the channel and the message skipped the read
check, so someone who may edit the field but not read the bot could
retarget it.
* fix: check who is copying an action against the integration it carries
Duplicating a field and changing a field's type both recreate the actions
without passing through the endpoint that checks the credential, so a copy
kept a bot the person asking for it may not read. The duplication hook now
carries the acting user, and a copy it cannot account for comes back
unconfigured.
* fix: hold a Slack answer to a size and a deadline, the way an HTTP one is held
The endpoint is configurable now, so its answer is not bounded by Slack's
own limits, and the request timeout restarts on every byte. A body that
drips could outlive the lock its dispatch time sizes, letting a second
click post against the same row. The reader the HTTP service already had
now lives beside the request function both of them use.
* fix: read the clicked field once, and survive an id an export made up
The dispatch guard read the field back through every action, two cold
queries apiece inside the lock, when the context already holds it. And an
integration id from an import file is not the validated integer the
endpoint's serializer produces, so a hand-edited export failed the job
with a database error.
* test: land a second click while a Slack post is still in flight
The lock that keeps two clicks off one row had no Slack coverage, which is
what the size and deadline on the answer are there to protect. The stub
holds one channel open long enough for the second click to arrive.
* docs: say what an empty integration list means, and what an authorized user does
It read as though only the row and frontend-only actions carried nothing,
when HTTP and email carry nothing either, for reasons of their own. And an
integration's authorized user does not outrank the clicker, it replaces
them: the dispatch never compares the two.
* fix: check what a duplicating user may read on every path that copies an action
The permission check only ran where a person copies an action in place, since
that was the only path carrying an actor. Duplicating a table or a database
goes through the serialized import instead, which had nobody to check, so the
copy kept a bot its owner may not read.
`ImportExportConfig` now carries who asked for the copy. An import from a file
and a template install still carry nobody, and keep what they came with.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: refuse an imported integration the application would not accept
The endpoint refuses a Local Baserow integration on a database, because its
authorized user would replace the clicker (ADR 006 section 5). The import path
never asked, so a hand written export placed one anyway, and it rode into
every duplicate and snapshot from there.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: read an integration id out of an export before keying the mapping with it
A list or a dict is not hashable, so looking one up aborted the whole import
job with a `TypeError`. `true` hashes equal to 1 and quietly picked up
whatever integration 1 was remapped to. A numeric string missed the mapping
and then resolved the id the export was written with, which is another
database's.
Coerced before the lookup rather than after, and booleans, containers and
floats refused outright.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* perf: read the bot once however many actions of a click share it
`select_related` only saves the base row. The token lives on the subtype, and
resolving that row by row cost a query per action, inside the lock that guards
the row. Three actions sharing one bot read it three times.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: hold a Slack post to the time its lock was sized for
The timeout Requests applies is per socket operation, not for the call as a
whole, and redirects were followed, thirty of them if offered. A configured
endpoint could spend a fresh timeout on every hop and outlive the lock that
guards the row, letting a second click through.
Redirects refused, since `chat.postMessage` answers directly, and the lock
sized off the socket operations the way the email service already does.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: remove only the containers the local e2e run started
A trap replaces the one before it rather than adding to it, so the Slack stub's
had to name httpbin too. It named it whether or not this run started one: point
E2E_HTTP_STUB_URL at your own stub and the block that starts httpbin never
runs, but the exit still removed whatever was using that name.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: let a fetched integration list land on the application still on screen
The fetch mutated the object it was handed, so a `forceSetAll` in flight left
the bots on an object nobody renders while the one on screen stayed empty. And
it cleared and repopulated with no ordering guard, so a bot created while the
request was open was wiped when the answer landed, with nothing to fetch it
again.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: ask again for a bot list the editor failed to fetch
The action cards are hidden rather than unmounted, so a fetch tied to a form's
own `created` ran once for the life of the editor. After a network blip the
dropdown read as a database with no bot, and the only thing offered was
creating a second one. Every form also reported the same failure, so three
Slack actions raised three toasts for one request.
The list owns the fetch now: it knows when a card opens, so reopening one asks
again, and there is one place to report from.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: make the integration dropdown selectable, editable and reachable
Every parent binds it with `v-model`, which listens for `update:modelValue`.
Creating an integration from the footer emitted `input` instead, so the bot was
created and then not selected. The auto select of a lone integration went the
same way.
The footer was an anchor with no href, so tab skipped it and no key opened it,
which left creating a first bot unreachable without a mouse.
And the footer only ever opened the modal to create. A database has no
integration settings page of its own, so an imported bot, whose token the
export stripped, could not be repaired from anywhere.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: say when a Slack action carries a bot with no token
An export strips the credential, so an imported bot arrives named and unusable
while the action still looks configured. Every click was then an outbound
request that was never going to work, and the reason only arrived after it.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* test: cover the Slack request deadline and its refused redirects
The tests for these were written with the fix and then left out of it, so the
lock sizing and the refused redirects went in uncovered.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: report a failed integrations fetch once for the request, not once per waiter
Moving the fetch to the list left the reporting with the caller, and a list can
be asked for the same request more than once. Each caller then caught the same
rejection and raised its own toast. Reported from inside the shared request
instead, so one failure is one message however many are waiting on it.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: describe the Slack answer where the dispatch actually puts it
`generate_schema` advertised `ok`, `channel` and `ts` at the root while the
dispatch kept them under `data`, so every path the data explorer offered for a
Slack node resolved to nothing. Chaining off one has never worked.
The schema describes the wrapper now, rather than the dispatch dropping it.
That leaves every sample an earlier version stored exactly as it is, so no
migration is needed. The cost is that this service describes its answer one
level deeper than the HTTP and email ones, which unwrap theirs instead.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* feat: say who else can use a Slack bot when its token is entered
A database's integrations are shared by everyone who can build in it, and nothing said
so at the moment that matters. The warning goes where the decision is made, and is
worded around reuse rather than exposure, since the token is never shown back.
It comes out again once ownership or private integrations land.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* docs: keep the integration rule in one place, and say what the new methods take
The comment on `allowed_integration_types` listed every action type's reason, which goes
stale the first time someone adds one. It now says what an empty list means and points
at the ADR, which carries the reasoning.
The methods this branch added or changed say what they take and what they answer with.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* docs: bring ADR 006 up to what phase 4c actually built
Section 5 said databases carry integrations while later sections still read as though
external actions were unbuilt: nothing to strip, nothing to reconfigure, no integrations
on a database at all.
Now recorded: which integration types an action may carry and why the list is empty for
most of them, that the database derives what it holds from those lists rather than
keeping a second one, which copy paths carry the requesting user and which deliberately
do not, what happens to a stripped token on import, and the Slack action's own
lifecycle.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* test: prove a Slack answer reaches the paths its schema offers
Three gaps found reviewing the fixes against what was asked for.
The e2e still reopened the dropdown to pick the bot it had just created, which
was the manual step the Vue 3 event was meant to remove. The dropdown now says
so on its own, and a form test covers it, asserting the selected value rather
than the item list, which holds the name either way.
And nothing exercised an automation node reading a Slack result, which is what
the shape question was really about. The new test builds the stored result with
`dispatch_transform` and walks the paths out of `generate_schema`, so moving
either side without the other fails it.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* refactor: cut the comments back to what is not already in the code
Roughly half of what this branch added restated the line below it or explained
at paragraph length what a sentence covers. Kept the ones that say why, dropped
the rest, and fixed a stale reference to an exception this service no longer
raises.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: keep the integration dropdown reaching its parent
Declaring `update:modelValue` in `emits` was half a fix. Vue keeps a declared
event's listener out of `$attrs`, so the parent's `onUpdate:modelValue` stopped
falling through to the dropdown below, which was the only thing carrying a
list selection back. Creating a bot worked; picking an existing one silently
did nothing, for the builder's data sources and user sources as much as for a
button field.
Everything now goes through `select`, and `autoSelectFirst` reads what the
parent actually bound rather than the `value` prop nobody passes.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: do not remember a load that backed off, or share one across requests
A fetch that backed off returned the list it declined to fill, which read as
success: the caller marked the database loaded, so bots that existed before
the request never appeared and nothing asked again. It answers null now, and
only a fetch that committed marks the load.
The in-flight map was also module scope, which one server process shares
across every request it renders. Keyed by store instead.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: let an action's bot be cleared without permission to read it
`get` cannot tell a key the request never sent from one sent as null, so
clearing the integration resolved to the one already carried and was refused
to anyone who could not read it. Removing a credential takes nothing away
from anyone, so it needs no such permission. An absent key still keeps and
checks what the action carries.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: stop a failed Slack request repeating the message back in its error
`except ConnectionError` caught the builtin, which requests' own
ConnectionError does not inherit from, so that branch never ran and the
failure fell through to a clause that raised `str(e)`. Requests builds that
message out of the whole URL, and this one's query string carries the channel
and the resolved message text.
`response.json()` sat in the same block, so a proxy's HTML or a redirect body,
which `allow_redirects=False` now stops following, surfaced as an opaque parse
error. Read outside it, and reported as an answer that is not Slack's.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: let a database still turn integrations off entirely
The override answered from the action types alone, so `supports_integrations`
was dead for databases. The two tests that turn it off to exercise the guard
were passing on the allow-list instead, and would have passed with the guard
deleted. Both now name a type the allow-list accepts, so only the flag can
refuse it.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* docs: say that a bot's token can be read, because it can
The warning claimed the token stays hidden. The integrations endpoint
serializes it in the clear, as it does for every other type, and this branch
is what exposes that endpoint on databases. Reworded, and the ADR with it,
noting that masking it on read is worth doing and is not scoped here.
Also finishes the comment trim, which a script gave up on halfway through, and
sources the Slack logo from the integration type that already owns it.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: send the Slack channel and message in the body, not the query string
Both are row data. A query string is what a proxy writes to its access log, and
this PR makes the destination host configurable, so the message travelled
further than it needed to. The error path already worked around this by
refusing to repeat `str(e)`; sending the payload as form data removes the
reason for that.
* fix: keep a bot out of a duplicate made by someone who may not read it
A duplicate is taken with `exclude_sensitive_data=False`, so the bot was cloned
into the new database with its token. The action's `ReadIntegration` check then
ran against that clone, which lives in an application the duplicator owns and
can read, so it always passed. Denying read on a bot and duplicating the
database was a way to obtain its token.
The credential is left out of the export instead, and the copied action drops it
for want of one it may carry. One `check_multiple_permissions` call for the
whole list rather than one per integration.
The existing test passed only because it denied the operation by name, which
denied the clone too. The new one denies a single object, the way a per-object
role assignment does.
* perf: stop reading the same integration row three times on every save
The check resolves the integration to check it, then hands the id on and the
service type reads the same row twice more, base and subtype. It passes the
instance it already has instead. Its own checks are looser than the ones that
have just run.
The click path resolved integrations with `specific_iterator` directly, which
skips each type's `enhance_queryset`, trading one query per action for one per
related row. It goes through `IntegrationHandler.get_integrations` now.
Also says in the comment why an edit that does not resend the id is still
checked: the channel and the message are the whole of what a bot does.
* fix: skip an integration an application will not take, rather than fail the import
The gate refused the whole job. No export this instance writes can fail it
today, but a release that stops registering an action type would turn every
snapshot holding that integration into one that cannot be restored, and a
restore is the one path a user cannot work around.
The row still does not land, which is what the gate is for. An action naming a
skipped integration imports unconfigured, the same as for any integration it may
not carry. Only the database type narrows what it accepts, so nothing else can
see the None this now returns.
* refactor: tidy what the database does with its integrations
Share one cache across the integrations it exports and imports, the way builder,
automation and dashboard already do, so a type that serializes a file writes it
once. Count them in the import progress, which reported 100% before they were
done.
Keep `supports_integration_type` out of the middle of the class attributes and
read the accepted types once per call instead of scanning the registry inside a
generator. Not cached across calls: a test can register an action type.
Drop `_read_response_within_limit`, which had become a one-line pass-through to
the util the module already imports.
* fix: do not let a delayed integrations fetch undo a change made while it ran
Only a create or a delete bumped the generation the fetch reads, so an edit or a
reorder landing mid-request was overwritten by an answer written before it. For
a bot's token that reads as a missing credential on a bot that has one.
The fetch also restored the counter to what it found after writing its answer,
which dropped a bump a create had committed in the meantime and let a second
fetch write a list without the new bot. It commits the rows directly instead:
its own writes were never a change to back off from.
* fix: say when a Slack action points at a bot that is not there
An empty list read as healthy, so a bot deleted since, or one named by an import
made elsewhere, left the action looking configured until the click failed. It
now waits for the list to have been fetched rather than for it to be non-empty,
and reports a bot it cannot find.
A fetch that failed stays quiet: the list is unknown then, not empty, and the
failure already raises its own message.
* fix: offer to edit an integration only where there is nowhere else to
The edit button went into the shared dropdown, so it appeared in the builder
data source and user source forms, automation, dashboard, the AI agent form and
the SMTP form. All of those have an integration settings page; a database does
not, which is the reason the button exists.
It is behind a prop now, and the Slack form passes it only for a database.
* fix: match the slow Slack stub on the body the request now sends
Moving the payload out of the query string left this stub matching on a
`channel` query parameter that is no longer there, so it never matched and the
catch-all answered at once. The concurrent-click test lost the delay its lock
assertion depends on, and would have passed without ever holding a lock.
* fix: ask again for an integrations list that changed, rather than dropping it
Bumping the generation on an edit or a reorder made the back-off common, and
only the button field caller reads the null it returns. The builder awaits this
inside `loadExtraData` and then marks itself loaded either way, so renaming an
integration while that fetch was open left every data source and user source
dropdown empty until a reload.
It asks again instead, up to three times, and answers null only when the list
will not settle. The tests give the retry the answer a server would have by
then.
* fix: do not call a bot missing when it may only be hidden
`get_integrations` filters the list by what the caller may list, so a bot absent
from it is either deleted or invisible to this user and there is no telling
which. Someone with no list access to a colleague's bot was told a working
action was broken, and following the message would have overwritten it.
* refactor: read the accepted integration types without building a set
One membership test does not need a frozenset of every type: the generator it
replaced short-circuited and allocated nothing. Not keeping the answer was the
right call; building the set was not.
Also `or []` for the imported integrations, since a hand-edited export can name
the key with an explicit null, and two test names and a docstring that still
described the behaviour before this branch changed it.
* test: open the Slack answer's data node before reading its fields
The schema describes the wrapper the dispatch actually writes, so `ok`,
`Channel` and `Message timestamp` sit one level in. The test still expected
them beside the action, and had been failing since the schema was corrected.
Opening the node is what a user does to reach them.
* fix: mount the Slack stub from the directory the recipe actually runs in
`just --justfile e2e-tests/justfile` runs recipes from that file's own
directory, so `$(pwd)/e2e-tests/stubs/slack` pointed a level too deep. Docker
created the missing path and mounted it empty, WireMock started with no
mappings, and every Slack call answered 404. CI was unaffected: it mounts the
stub by workspace path.
* docs: say why the application type is compared as a literal here
`integrations` must not import from `database`, and the sibling forms compare
`application.type === 'automation'` the same way.
* Revert "fix: mount the Slack stub from the directory the recipe actually runs in"
This reverts commit
|
||
|
|
0f8d63e4e4 |
feat[4b/6] Button field: send an email (#5973)
* feat: let a button field send an email
A button can now send an email when it is clicked, through the SMTP
server this installation is configured with. A button's actions carry no
integration, so the form drops the integration branch of the shared SMTP
form and the action always sends through the instance.
Without an instance SMTP server the action would fail on every click, so
it is refused when it is configured instead, and the editor shows the
reason rather than a generic error. The refusal covers creating an
action, swapping an existing one to this type, and clicking a button that
already carries one.
A failure names neither the mail host nor its port: the clicker is told
which action could not be completed and nothing more.
* fix: refuse the email action on an instance that only prints what it sends
Without SMTP configured, Baserow keeps a backend that writes the message
locally and reports that it sent, so the guard never fired on the very
installation it was written for: the action was offered, the click said it
worked, and nothing arrived. What the instance does with a message it is
given now decides, rather than EMAIL_HOST, which Django defaults to
localhost whether or not anything is listening.
The instance setting is also pinned when an action is prepared. The form
does not offer the choice, but the endpoint took whatever it was given,
and a service that sends through nothing fails on every click.
A click that may not dispatch no longer learns how this installation is
configured: the refusal now runs after the permission check, and once per
type rather than per action.
Drops the editor's own toast for a refused type. The shared error handler
already shows the reason on a 4xx, and replacing the handler with a stub
broke every caller that asks it what kind of failure it was.
Also sets the SMTP form's instance flag where the form takes its defaults,
so opening an action no longer reports a change the user never made, and
fixes the mail fixture, which read one page of a catcher the whole suite
shares.
* fix: scope the mail cleanup, and only hide the failures that name an address
Emptying the catcher in `beforeAll` runs once per worker, and the suite
runs three of them locally, so one worker could delete the message another
was waiting for. Pointed at a dev stack it also took whatever mail the
developer had captured. A test now drops the message it read, by id.
The clicker was told "the request could not be completed" for failures
that name nothing about this installation, such as a server refusing the
encryption. What is withheld is now named: the failures whose message
carries the address the request was going to. Everything else a service
raises is about the values it was handed, and is the only thing telling
the clicker what to fix.
* fix: keep the mail lookup independent of the catcher, and say when sending is off
The catcher is asked for the message by subject rather than read a page at
a time. A dev stack's is long lived and holds whatever the developer
captured, so the one being looked for can be arbitrarily far down, and the
purge that used to hide that was itself taking other workers' mail.
Whether this installation can send is now decided in one place, the SMTP
service type, so the flag the API already exposes for it is true rather
than a check the button field kept to itself. A backend the settings do
not name at all counts as unable to send: the service asks for it by name
and would fail on every click. The editor reads that flag and says so on
an action whose instance has stopped being able to send, which until now
only a click would reveal.
A sequence carrying two deactivated types names the same one every time.
Tests cover what the endpoints answer: the create, type swap and dispatch
refusals, their error code and reason, and that a refused click leaves the
rate limit alone.
* fix: say an instance cannot send email before the action is saved
An action being configured has not been saved yet, so there is no service to
ask whether this installation can send. Until now the first thing to say so
was the refusal on save. The settings the editor already loads now carry it,
and the email option in the action dropdown is disabled with the reason beside
it.
The two ways of being unable to send are told apart. Sending turned off by an
administrator and an instance with no mail server each get their own reason,
returned as a code so the editor words and translates it.
The mail backend is matched as whole path segments, so a custom backend such
as `myapp.console_relay` is not read as the console one.
The setting behind all of this is documented, including that turning it off
disables a button field's email action altogether.
* fix: pin the mail server as part of the write that creates the service
A database action carries no integration, so the service is pinned to the
instance server whatever the caller asked for. That pin was applied after the
base had already saved the service, which updated the row a second time. It
now travels in the values the base saves, so a create writes the service once.
* test: cover what an exported email action carries and what it drops
The HTTP action had import and duplication coverage, the email one had none.
These pin the field references a copy has to rewrite, that an export keeps the
action pinned to the instance server, and that an instance which cannot send
still imports the action as configured rather than dropping or repairing it.
* fix: hold a button's lock for as long as its email actions can wait
The lock's TTL read a `timeout` field off each service. An email service has
none, so a click that only sends email got the default floor however many
sends it chained, and a lock expiring mid sequence lets a second click send
the same mail again.
Services are asked now. The HTTP one answers with its timeout, the email one
with three times the SMTP timeout, which is per socket operation rather than
for the send as a whole.
* docs: say what the deactivation hooks take and give back
The hooks a type overrides to say it cannot be used here were documented
unevenly: no return described, no raise named, and the SMTP overrides took
untyped arguments.
* fix: let an unsaved email action be read by the one after it
A service has no schema until it is saved, so an email added in the editor was
missing from the next action's explorer until the field was saved and reopened.
An email answers with whether it went out and nothing else, which is known
before anything is sent, so the type offers that shape itself.
* test: prove the chained email arrived, and say where the catcher is
The chained test only showed that the action after the email ran. It now waits
for the message itself, under a subject unique to the run, and drops it in a
`finally` so a failed assertion leaves nothing behind for later runs to read.
Which mail catcher the suite reads is documented: the local runner follows the
dev stack's own MailHog port rather than assuming the default instance, and
the two mail variables are written down with when each applies.
* fix: keep the email action pinned through an edit, and size its lock for a real send
An update is not refused the way a create is, and the service type drops the
instance server while sending is off. An action edited then came out unpinned
and failed on every click once sending was back. The action type restores the
pin after the base has saved, writing only in that case.
The lock's share for an email is sized for the conversation a send really is:
the timeout applies to every socket operation, and there are a dozen or more
of them, not three.
Whether the instance can send is asked two ways now. The Application Builder
and automations keep the setting-and-host check they always had, so an
installation without a mail server behaves as before for them. The stricter
check, where a backend that only prints counts as no server, is the button
field's alone: it has no integration to fall back on. `is_deactivated` is
derived from the reason rather than computed a second time.
* refactor: let every email editor see the answer's shape, and decide deactivation once
The `{success}` shape an unsaved email answers with lived on the button field's
action type alone, so the builder and automations still showed nothing for an
unsaved email. It moves to the shared service type, which every editor reads
through.
The action type's `getErrorMessage` repeated what the base already does with
`isDeactivatedReason`, and only differed for tests that passed no workspace.
The override goes, and the tests pass the workspace the action list passes.
* test: read the dev stack's mail catcher by default
A plain `yarn run test` after the local runner has finished fell back to the
containerized stack's port, which the README says it does not. `just e2e` and
CI set the URL themselves.
* fix: line up what an email action promises with what it can do
Four follow-ups from the review of the email action.
The editor and the send now ask the same question about the instance mail
server. A mail backend with no host to give it reported the action as
available and then failed the click, because a database action has no
integration to fall back on.
What an email says no longer travels in an export that leaves the
instance. The table schema handed to formula AI is serialized that way,
and reading a formula field needs far less permission than configuring a
button, so recipients, subject and body are blanked there as an HTTP
action's headers already are. A snapshot and a duplicate keep them.
A server that answers and then refuses, over TLS or over credentials,
now counts against the rate limit. The instance had already opened the
connection, so giving the slot back made that traffic free to repeat.
And ADR 006 records that the email action sends through the instance
server rather than an SMTP integration, which is the opposite of what it
said.
|
||
|
|
373f3178ef | Try to use services for e2e tests | ||
|
|
fda53607c7 | CI for e2e tests |