153 Commits
Author SHA1 Message Date
Peter EvansandJeremie Pardou 5a62c876e4 fix: align custom code in builder Preview with the editor on shared hostnames (#6881)
* fix: restrict editor-written code in the builder editor and on the editor hostname

* fix: simplify builder author code restrictions by hostname

* refactor: remove redundant backend custom code hostname checks

* refactor: unify builder HTML element rendering restrictions

* refactor: clarify builder web frontend hostname terminology

* fix: distinguish untrusted builder content in preview notices

* refactor: remove unused backend preview security setting

* docs: shorten builder code restriction changelog

* fix: restrict iframe cookie access across frontend ports

* refactor: share web frontend hostname matching

* fix: preserve protected HTML interactions and bound iframe height

---------

Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
2026-11-26 17:20:44 +00:00
Tsering Paljor 380ecc6c21 feat: Collect only anonymous page views on published applications (#6877)
* Collect only anonymous page views on published applications.

* Explain why a published page is counted once when it opens.
2026-11-26 18:57:53 +04:00
alamin-br 724ca69647 fix(agent): small Agent Builder fixes from the launch review (#6871)
* fix(agent): small Agent Builder fixes from the launch review

Imported actions ask first, SECRET_KEY_FALLBACKS is read, signed links keep their query,
Gemini retries transient errors, approval cards stop saying 'by you', and agent-builder turns identities on.

* test(assistant): turn identities off by having no flags

The agent-builder flag now turns identities on as well.

* fix(agent): address review of the launch quick fixes

Key fallbacks are JSON arrays, Gemini retries once per Kuma call, and an
imported action must carry the service its type runs.
2026-11-26 15:21:58 +01:00
alamin-br 99c48741a7 fix(agent): keep HTTP action requests on the builder's host (#6869)
* fix(agent): keep HTTP action requests on the builder's host

The host was checked with urlsplit while Requests sends elsewhere, so model input could send the builder's key to another host.
Model-picked hosts now refuse private addresses, and ALLOW_PRIVATE_ADDRESS=false no longer turns that protection off.

* chore: drop changelog entry

* chore: add breaking change entry for boolean env parsing

* fix(agent): read a single-input URL with the formula parser

Bracketed or uppercase spellings of one input were treated as mixed URLs and hidden from the model.
Docs now match the boolean parsing and the transport limits on model-picked hosts.
2026-11-25 21:34:03 +00:00
Przemyslaw Kukulski 6e67c8c440 fix: delete a user template's files with it (#6825) 2026-11-24 16:02:18 +01:00
Peter EvansandJeremie Pardou 95b892af41 feat: add automatic snapshot schedules (#6746)
* feat: add automatic snapshot schedules

* fix: show the count in relative date labels

* refactor: rename snapshot allowance setting to workspace

* feat: notify workspace admins when automatic snapshots fail

* feat: show the last automatic snapshot execution per application

* fix: simplify snapshot modal layout and capacity feedback

---------

Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
2026-11-24 14:12:03 +00:00
Peter EvansandJeremie Pardou 2b8e6ba569 feat: add per-workspace snapshot allowances and protected snapshots (#6783)
* feat: add per-workspace snapshot allowances and protected snapshots

* fix: guard snapshot replacement and separate quota management

* refactor: delegate snapshot permission descriptions to application types

* fix: highlight inherited workspace snapshot maximums

---------

Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
2026-11-23 11:23:05 +00:00
Davide Silvestri d21801281f feat(agent): trigger agents when rows are created, updated or deleted (#6695)
* feat(agent): trigger agents when rows are created, updated or deleted

* test(agent): find the trigger picker by the class it now has

The trigger picker renders the shared service picker since the send
email actions, so its menu is under .agent-service-picker.

* fix(agent): check a trigger's access again before its conversation starts

The task that starts a firing's conversation trusted the access check made
when the event happened. A run identity removed, trashed or without access
by the time the task ran still got a conversation with the event's rows.

* fix(agent): apply the row trigger review fixes

- A type change moves an overlap rule left at the old type's default to
  the new type's default.
- Queued replies wait while the run identity can't read what the trigger
  watches.
- An imported formula is kept as written when no path is remapped,
  through one import_formula in core.
- Row events hand their listeners services holding the event's table.
- Trigger form choices no longer read the workspace's views.
- A first row too long for a message is cut short instead of left out.
- A no-access error for a type the card no longer shows is ignored.
- The dispatcher no longer clamps the batch size.

* fix(agent): keep the merged trigger behaviour and UI for row triggers

- Skipping stays the default overlap rule: only the row trigger types say
  their events can't be skipped, so HTTP and periodic triggers start as
  they did before.
- The workspace-access note is a plain alert and the batch size field is
  spaced like the hosted forms, without style overrides.
- The type-change and queued-firing tests are develop's again, with the
  row trigger tests added after them.
- ADR 014 names the hooks row triggers add to the shared service type.

* fix(agent): show a row trigger without workspace access as misconfigured

The trigger can't run until the agent has workspace access, so its card
gets the error icon with a tooltip and the database field shows the error,
instead of an info note.
2026-11-17 23:42:51 +01:00
Davide Silvestri b587de3dba feat(agent): configure per-user active-run limits (#6458)
* feat(agent): configure per-user active-run limits

BASEROW_AGENT_MAX_ACTIVE_RUNS_PER_USER caps the Agent replies one user can
have queued or running across workspaces. Unset means no limit, so
self-hosted installs are unaffected. The run-type hook receives the user so
a plugin can set the limit per user.

* fix(agent): address review of the per-user run limit

- Negative Agent run limits mean no limit, like the trigger limits, so no
  configured value can refuse every send.
- Docs keep plan wording for the workspace hook only; the user hook sets
  one user's cap across workspaces.
- ChatRunLimitReached docstrings say "a reply limit" instead of listing
  which limits exist.
- Drop Agent tests that repeated core checks; core now checks that a
  finished run frees its slot.
2026-11-17 11:38:12 +01:00
Davide Silvestri 26ff58a3d9 feat(agent): let agents send emails through configured actions (#6720)
* feat(agent): add configurable send email actions

* fix(agent): send what an action call showed and harden actions

Review fixes for the send email action.

- Resolve an action call's formulas once and carry the values from the
  held call to its dispatch, so the approved preview is exactly what is
  sent. DispatchContext.resolved_values lets a dispatch skip resolving
  the formulas of that service again.
- Deny an approved call when its integration changed, or when it comes
  back without the values its approver read.
- Let the AgentActionType base own configuration checks, preview and
  dispatch. A type only supplies its defaults and readable values.
- Reserve the mcp<number>_ names of connected app tools, and accept any
  valid input name, run_ctx included.
- Keep whole numbers whole in Number inputs.
- Add BASEROW_AGENT_MAX_ACTIONS_PER_AGENT, unset by default, and load an
  agent's actions in a constant number of queries.
- Order and label an action's fields from its presenter in the step
  card and in configuration errors.
- Replace the plan with docs/development/agent-actions.md.

* fix(agent): show what a saved action returns and drop undone errors

- A debounced save updated a copy the action card doesn't render, so the
  configuration errors the server found never showed. Save through the
  object the list renders.
- Clear a rejected edit's error once the edit is undone.
- Word the action limit so it also reads well with a limit of one.

* test(database): update decorator tooltip snapshots for edge-aware tooltips

The tooltip directive now keeps top and bottom tooltips inside the
viewport and positions their arrow, which changes the inline style the
two decorator tooltip snapshots record.

* fix(agent): mark an action formula with a refused argument as invalid

A function's argument check raises Django's ValidationError, which the
readiness check let through. A formula like minus('abc', 1), stored by
an import, then failed the action list, the configuration and every
reply instead of showing the action as misconfigured.

* fix(agent): start an email action on the instance server only if it delivers

The starter asked the looser question the builder and automations use,
while the readiness check asks whether a message is delivered. With a
backend that only prints, a new action opened on the instance server
and was unavailable straight away.

* fix(agent): name a deleted action in the trash

* fix(agent): read a negative agent limit as no limit

A limit of -1 was kept as a limit, so nothing could be added: no action
with BASEROW_AGENT_MAX_ACTIONS_PER_AGENT, no reply with
BASEROW_AGENT_MAX_ACTIVE_RUNS_PER_WORKSPACE. Both now treat 0 or less
as no limit, like the trigger caps.

* feat(agent): ask first by default before an action runs

A new action sent as soon as it was added, so anyone chatting with the
agent could have it email any address. Built-in tools that change data
and MCP tools already start with Ask first on; every action now does
too, at the model level so the next action types inherit it.

* fix(agent): tell the approver's own session when "Always allow" applies

Approving with "Always allow" turned Ask first off on the server, but
the realtime event skipped the approver's session as if it had edited
the action itself. The Actions card kept showing Ask first on while
emails went out. No session made this edit, so every session is told.

* fix(agent): show an action call in full to whoever approves it

The approval preview kept 10 recipients and 1,000 characters while the
call sent everything. An action's step now shows every value, never
shortened. Limiting what a call may send is left to a follow-up.

* fix(agent): apply every action event a reconnect replays

Action events all write to one slot of the agent, and the watcher only
saw the last value of a tick. A reconnect replays what it missed in one
loop, so an action another user created was lost when a later event
followed it. The watcher now runs on every write.

* fix(agent): reload the configuration when the agent gains or loses an action

Actions count as tools for web search, but nothing refetched the
configuration when one was added, switched, repaired or deleted, here
or by another user. On a model that can't search while it uses tools,
the web search setting stayed stale until a reload. The Actions section
now emits the reload other sections already use, only when the agent
gains its first callable action or loses its last.

* docs(agent): leave the limits of a call to its action type

What a call may send and what its preview shows is for each action type
to limit. Send email limits neither yet.

* fix(agent): mark a stored formula that can't be checked as invalid

A formula nested too deeply raised RecursionError in the readiness check,
so listing the actions, the configuration and every reply failed. Any
failure to check a formula now marks its field as invalid, as a stored
formula can make the parser or a function's own check raise anything.

* fix(agent): keep an approval when its integration is renamed or moved

The approval key digested the whole exported integration. Its name and
its place in the list don't change where a call is sent, and the place
of every integration can change when another one is added or moved.

* fix(core): keep the custom scrollbar in WebKit browsers

Since Chromium 121 the standard scrollbar properties replace the
::-webkit-scrollbar rules, so the rich text editor lost its 10px thumb.
The standard properties now only apply where those rules don't exist.
Stylelint is told that a mixin's body ends up inside a rule.

* chore(agent): name the collapse-all button after its block
2026-11-16 14:41:41 +00:00
Bram 07a05e0ca4 Compress large realtime messages in Redis (#6722) 2026-11-13 17:53:37 +01:00
Davide Silvestri 9af8a8422e feat(agent): rate-limit agent triggers and let a busy trigger skip or wait (#6672)
* feat(agent): rate-limit agent triggers and let a busy trigger skip or wait

* feat(agent): choose a trigger's overlap rule and show skipped firings

* feat(agent): let a trigger run its replies in parallel

A third overlap rule, Run in parallel, starts up to
BASEROW_AGENT_TRIGGER_MAX_PARALLEL_RUNS replies at once (default 5) and
queues the rest up to the queue cap. Skip, Wait and Parallel now share one
rule (OverlapLimits): start while there is room to go and nothing is
queued ahead, queue while the queue has room, else skip. A firing held
back by the workspace's run limit queues where the rule queues. The
hand-off and the sweep start as many queued replies as fit.

* test(agent): pin the trigger lock order a hand-off and a builder's save rely on

* fix(agent): lock agent before firing its trigger

* fix(agent): tighten trigger overlap counts and limit parsing

- A reply in a trashed conversation no longer counts as going, so it
  can't block a trigger until the trash is emptied.
- A message that fails to resolve fails its reply before the overlap
  rule, so the builder sees it instead of a skip.
- The hand-off locks only the queued replies that can start.
- Rate-limit pairs must be positive integers.
- The API help text describes `parallel`.

* fix(agent): hand a trigger's queue on in its own task

- When a trigger's reply ends, a task started with the trigger's id
  starts its queued replies, instead of the ending reply's save doing
  it. With the broker down, a hand-off fails at most one reply instead
  of the whole queue, and the reply's save no longer loads the trigger.
- The hand-off and the sweep check what a firing checks: Agents on, the
  trigger type available and the agent ready. A trigger that can't fire
  keeps its queue until it can.
2026-11-13 17:38:50 +01:00
alamin-br 8977543422 feat(integrations): encrypt the keys and tokens of MCP servers (#6667)
* feat(core): encrypt stored secrets with a dedicated key

A database dump or read access shouldn't reveal the credentials Baserow sends
to other services. Values say which key encrypted them, so keys can rotate.

* feat(integrations): encrypt the keys and tokens of MCP servers

They are the first secrets stored with the new encrypted field.

* docs: explain that one key encrypts every stored secret

The key, field and rotation command are shared by every secret encrypted at rest, so losing or changing the key affects all of them.

* fix(core): never decrypt written secrets and keep rows with unreadable ones loading

A written ciphertext was decrypted on save, and one unreadable value broke every query on its row.
Also reads secrets after a SECRET_KEY change, fixes the context per field, and stops the image generating a key per container.

* fix(core): keep unreadable secrets stored, never sent, and load dumps once

An unreadable secret read as empty, so moving its server skipped the credential
check and refreshing erased the tokens. Dumps were encrypted twice on load.

* fix(core): refuse encryption keys that share an id

A value names its key by id only, so the second key could never be used.

* fix(core): make reencrypt_secrets decrypt every secret and fail on any it can't

--check only counted prefixes, so missing keys and tampered values passed.

* docs: explain backups, restores and changing the encryption key

* fix(core): keep damaged secrets unusable and verify against the primary

A damaged envelope read as plain text and passed --check, and --check could
read a lagging replica instead of the database rotation writes to.

* docs: stage a first dedicated key and upgrades from development builds
2026-11-13 17:26:51 +01:00
Bram 8e797da4f7 feat: [4/5] GPU variant for the embeddings (#6524)
* Added embeddings GPU variant

* Fixed feedback
2026-11-12 13:24:51 +01:00
Bram 3d9e37163e feat: [3/5] Semantic search action for automations and applications (#6451)
* Semantic search action for automations and applications

* Fixed feedback
2026-11-12 11:03:12 +01:00
Tsering Paljor 72fbe9106b Add sweep that cleans up stuck Automation workflows. (#6665) 2026-11-11 09:47:39 +04:00
Tsering Paljor 6d729c3b1d feat: Add Wait node (#6575)
* Add suspect and presume primitives for wait service.

* Add the Wait service and node that pauses a workflow.

* Ensure resume_at is returned in node history serializer

* Add the frontend Wait node and show waiting nodes in the workflow history.

* Add migrations for wait service and node

* On cancellation request, ensure waiting node is cancelled immediately

* Tolerate a deleted run history when the dispatch chain ends

* Ensure that lost wake-up tasks are recoverable

* Add changelog

* Fix test

* Cancel run of deleted workflow

* Mark the node as error when hourly sweep finds stale waiting node that is in a loop

* Show the iteration of a waiting node in the run history

* Stop counting waiting runs toward the unfinished runs rate limit

* Add tests that waiting runs finish after the workflow is switched off

* Merge migrations

* Update comment

* Disable node error policy for types that don't need it

* Simplify error message

* Remove the skipped status, as it isn't really useful

* create index concurrently
2026-11-10 15:31:28 +04:00
Peter EvansandJeremie Pardou 5e271e22c9 feat: add permanent workspace invite links (#6521)
* feat: add permanent workspace invite links behind the rbac_improvements feature flag

* feat: ask logged-in users to confirm before joining a workspace through an invite link

* feat: make the invite link code length configurable with a default of 12 and a minimum of 7

* feat: let admins name invite links so they remember what each one is for

* feat: show only the invite path in the link column to make room for the name

* fix: harden invite links and let people sign up through them with single sign-on

* fix: ask people who sign up through an invite link with single sign-on to confirm joining

* feat: let invite links raise a member's role after they confirm, without ever lowering it

* fix: move shared clipboard helper into core

* fix: validate workspace invitation link roles

* refactor: share confirmation modal across core features

* refactor: use literal frontend translation keys

* fix: label invitation route Invite links

* fix: copy invitation links when clicking their paths

* fix: align invitation migration with latest develop

---------

Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
2026-11-04 08:37:21 +01:00
Davide Silvestri 4cbe4af199 feat(agent-builder): Agents reply to messages (#6466)
* feat(agent-builder): answer messages with background replies

Each message starts a core chat run that streams the configured model's reply and saves it with its turn: status, error code, model messages, usage, and the provider and model that answered. Messages record their author. One reply runs per conversation, and BASEROW_AGENT_MAX_ACTIVE_RUNS_PER_WORKSPACE caps a workspace (default 5). Copies keep turns and authors and end replies still running.

* feat(agent-builder): stream, stop and resume replies in the chat

The chat follows each reply through the core run stream, shows authors, lets the user stop a reply, resumes after a reload or in another tab, and explains replies that did not finish.

* refactor(agent): keep replies focused on chat

* refactor(agent): keep each reply's outcome on its message

A reply is an assistant message created empty with its prompt, and the run
writing it saves its text, status and error code there, replacing the turn
table. Send responses name the run they started, so a reply that ends before
the response is still followed. Retries read the run before the reply, listed
replies that still look unfinished are read again from the primary, and blank
replies are saved empty.

* feat(chat): add shared chat components

Store-free message, markdown, composer and copy button components styled
after the agent builder designs, so the Agent chat and later Kuma can share
one UI. Replies render markdown without images, which could carry
conversation data to any URL, and app links open in the router.

* feat(agent-builder): show replies with the shared chat components

Replies render in place from the conversation history under the agent's
name and avatar, with Thinking and Writing above the composer while they
run, a note when stopped and an error card when they fail. Stop stays
available while a reply runs, even when the configuration stops being
ready.

* feat(agent): hand finished replies to followers and announce reply runs

A finished run carries the saved reply as the messages list shows it, so
followers can apply it without reading the messages again. Conversations
expose the run writing a reply, and agent_conversation_updated carries that
run's id when a reply starts and null when it ends, with the conversation's
updated_on to order them, so every session can show it without requests.
A blank model answer now ends the reply as failed, and replies reuse
ChatRunStatus. Reply permission checks move to the service, sends check the
agent-builder flag, finishing a reply relies on the engine's run lock
instead of a row lock, and the workspace limit defaults to 10.

* feat(chat): share Kuma's typing and loading indicators

Kuma's bouncing dots and reasoning spinner move to core as ChatTyping and
ChatLoading, and Kuma renders them from there with the same look.
ChatComposer's status prop becomes activity and keeps focus on the input
when Send and Stop swap, ChatMessage drops its author props until
conversations can be shared, and markdown leaves mailto and other non-web
links to the browser.

* feat(agent-builder): show reply progress like Kuma and apply replies in place

A reply shows the typing dots until its first text, then a spinner beside
the streaming text. The finished run's saved reply replaces it in place, a
run's start no longer reads the messages, and a streamed chunk re-renders
only the reply being written. Realtime updates set a listed conversation's
run without reading the list again, so its dot pulses grey while it
replies, in every session, and the page drops its chat subscription when no
conversation is open.

* fix(agent): handle empty replies and legacy message retries

* fix(agent): address reply review feedback

* refactor(chat): share response UI with Kuma

* fix(assistant): separate thinking from streamed answers

* feat(chat): share message footers with Kuma

* fix(chat): keep thinking blue and streamed answers expanded
2026-11-03 17:03:13 +01:00
Bram d0571201ad feat: [2/5] Added semantic search vector indexing for text fields (#6450)
* Added semantic search vector indexing

* Introduced incompatible state

* Covered template scenarios

* Set data_schema in local baserow ingration

* Check if field is still enabled when updating

* Update docs about env var hash change

* Added enterprise query test

* Fixed index name
2026-11-03 11:41:13 +01:00
Peter Evans dbde9e5161 feat: configurable body size and rate limits for HTTP triggers (#6518)
* feat: configurable body size and rate limits for HTTP triggers

* fix: keep default throttles on HTTP trigger and release slots for unknown uids
2026-10-28 14:51:05 +00:00
alamin-br ba24b135b2 fix: rotate refresh tokens and revoke the session when an old one is reused (#6519)
* fix: rotate refresh tokens and revoke the session when an old one is reused

A refresh token could be replayed to get new access tokens until it expired,
so a leaked token gave access for up to seven days.

* test: mint the refresh token inside the frozen time

The token was minted at the real time, so refreshing at an earlier frozen time failed once the clock passed it.

* fix: document the rotated refresh token in the token refresh response

The schema checked simplejwt's own rotation setting, which is off, so the API docs left out refresh_token.

* fix: keep the user session valid across refresh token rotation

The previous release crashed on the new cookie payload, and the cookie stopped
working as soon as its refresh token rotated.

* test: sign out through the API in the secure file serve test

Signing out revokes the session, which is what the user session cookie checks now.
2026-10-28 13:39:52 +01:00
Jérémie PardouandTsering Paljor 4049b1a391 feat: support most of field types in grouped data source (#6392)
Co-authored-by: Tsering Paljor <tsering@baserow.io>
2026-10-22 16:48:31 +02:00
alamin-br 6b20dcc391 fix: limit password reset and verify email requests (#6441)
* fix: limit password reset and verify email requests

Anyone could flood an address with reset emails, and parallel requests got past
the verify email limit. Adds a per-recipient reset limit, a per-IP limit on both
endpoints, and makes the rate_limit decorator atomic.

* fix: keep reset and verify email limits separate

Both senders were named send_email, so they shared one rate limit bucket per user.

* fix: make the per-IP email limit opt-in and name rate limits

Behind nginx and Caddy every caller shares one IP, and behind an appending
proxy the caller picks it, so the IP limit now needs BASEROW_THROTTLE_IP_ENABLED.
2026-10-21 16:56:03 +02:00
Davide Silvestri 9eabe6b06b feat(core): add Redis-backed background chat runs (#6382)
* feat(core): add Redis-backed background chat runs

Run AI work once in Celery and follow bounded Redis Streams over HTTP. Keep
lifecycle, Stop, leases and final outcomes in Postgres without per-token writes.
Include the shared frontend follower, adapter registry, recovery API, migration,
queue/deployment wiring and adapter guide. No product uses it yet.

Part of #6346

* Remove unused chat run response header exposure

* Extract shared async streaming HTTP router

* Simplify chat run follower and group engine constants

- Check read access once when a stream opens; read run state from Postgres
  only after 5 s without output or on run.finished.
- Split follow_run into small steps around _OutputReader.
- Turn event kinds, error codes and stop reasons into StrEnums; the
  Kuma-only model_unavailable code moves to Kuma.
- Document ChatRunType hooks with param, return and raises fields.
- Add BASEROW_ASGI_HTTP_MAX_CONCURRENT_STREAMS and size the follower Redis
  pool by it.
- Give handler publish/recover calls their own event loop, so cleanup
  cannot close pools shared by HTTP followers.
- Update ADR 010 and the background chat runs docs.

* Clean up chat run interfaces and test setup

* Prune chat runs once after 7 days and skip overdue claims

- Delete each expired page with one statement. Incomplete runs get one more
  ensure_interruption_warning call first, and are deleted even if it fails,
  so run metadata never accumulates. The hook now returns None.
- Keep runs for 7 days instead of 30.
- Never claim a queued run older than NOT_STARTED_AFTER; the sweeper ends it.

* Retry brief Redis failures in chat run followers

- A connection error, or a buffer that does not exist yet, is retried with
  the same cursor, sending heartbeats meanwhile.
- run.replay_unavailable is only sent once the follower stops reading, so
  the browser can treat it as final.

* Let finished chat run output expire with the active TTL

Nothing reads a buffer once its run has finished: followers return the saved
outcome first and recovery only reads running runs. Drop finish() and the
24 h TTL, so a finished buffer expires an hour after its last append.
_publish_terminal now reuses _publish.

* Run the chat run scale tests on fakeredis

Build the buffer's real read and write pools on fakeredis connections, so
these tests always run and backend CI needs no Redis service. The Kuma e2e
tests cover a real Redis.

* Address the remaining chat run review comments

- Serialize the saved outcome after the transaction, so only a failed save
  is logged as one.
- Make the primary-pin test transactional; inside the test transaction the
  router always used the primary, so it could not fail.
- Cover the race past the per-user lock, a lost run after Stop and an old
  writer appending to a recreated buffer.
- End the admission test's request with a disconnect, so a regression fails
  instead of looping.
- Document that one worker process runs AI replies one at a time.

* Move the chat run migration after develop's core 0130

* Log only the class of an outcome serialization error

* Test that the run deadline asks a run to stop

* Keep a run's status when a resumed follower rebuilds its output

* Note that slow DNS lookups turn off a run's live output
2026-10-21 14:52:59 +02:00
Peter EvansandJeremie Pardou a36e7e3688 feat: implementing the new invite-to-scope feature. (#6361)
* Implementing the new invite-to-scope design and functionality.

* Simplifying the invitation acceptance, we don't need the redirect.

* Fix the action type description

* Addressing my own review feedback, and making sure the workspace invitation form behaves like the scoped one.

* Further tweaks after testing edge cases manually

* Lint fix

* Taking a DRYer approach to validating the subject chips.

* Lint fix

* Addressing feedback

* fix: block invitation batches containing invalid emails

Malformed addresses could be silently cleared after a partial batch send.
Keep them visible and block submission until corrected or removed.

* fix: respect workspace invitation permission in scope sharing

Scoped Admins could attempt email invites denied by workspace permissions.
Gate new-email invitations while keeping existing subjects assignable.

* feat: unify workspace and scoped access lists

Workspace and scope lists duplicated markup and lacked consistent controls.
Share rows, add workspace edit/cancel actions, and cap lists at six rows.

* fix: reconcile invitation branch with develop

Develop enables agents and adds an Enterprise migration at the same number.
Align invitation subjects and renumber the branch migration after develop.

* refactor: resolve workspace user roles in the backend

The frontend duplicated the backend mapping from basic roles to RBAC roles.
Expose role_uid in user payloads and reuse it for inherited access counts.

* fix: validate invitation emails before submission

The permissive database validator let malformed invitation addresses reach the API.
Use the existing strict validator for email suggestions, chips, and batch submission.

* fix: align invitation input focus styling

The invite input used a gray border tied to whether suggestions were open.
Use the standard blue border with focus-within so Escape preserves the focus highlight.

* feat: limit email invitation batches

Large invitation batches can exhaust the sending allowance partway through.
Default to five new emails per batch, configurable, with a message before submission.

* feat: let roles declare the invitation default

RBAC invitations should default to Viewer without Enterprise-specific logic in core.
Let role types declare the default: Member for basic workspaces and Viewer for RBAC.

* refactor: keep invitation role semantics in their owning modules

Core invitation UI should not interpret Enterprise role IDs or depend on Database roles.
Move basic roles to core and let Enterprise supply invitation subtitles through role metadata.

---------

Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
2026-10-21 13:33:41 +01:00
alamin-br 48491a94a6 feat(mcp): send openWorldHint and serve the OpenAI apps challenge (#6395)
OpenAI's ChatGPT app review needs all three tool hints set explicitly and fetches
a domain verification token from /.well-known/openai-apps-challenge.
2026-10-16 10:55:57 +02:00
alamin-br 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.
2026-10-15 08:40:09 +00:00
Peter Evans 17fa17b273 docs: update the DWAB env var documentation. (#6367) 2026-10-13 17:46:56 +01:00
Davide Silvestri 64c9fff85e feat [6/8]: prepare AI provider management for rollout (#6070)
* feat: retire AI provider flag and add rollout audit

* test: remove obsolete AI provider flag setup and docs

* chore: clean up AI provider configuration and tests

* feat: deprecate legacy AI provider environment configuration

* docs: explain AI provider migration sizing and timing

* docs: mark AI provider migration audit for removal

* docs: explain AI provider migration audit usage

* fix: log AI provider env deprecations after logging setup

log_ai_provider_env_deprecations() ran at the tail of _setup_health_checks(),
which ready() calls before setup_logging(). The notice went out through
loguru's default sink and missed BASEROW_BACKEND_LOG_LEVEL, the Baserow
format, and the OpenTelemetry log exporter, so operators shipping logs to a
collector never saw it.

Also drop two references the flag removal invalidated: the getEffectiveAIAgentModels
JSDoc still described filtering as conditional on the removed provider flag, and
the AI field architecture doc still pointed provider authors at the deleted
legacy workspace-setting hook. That doc now names BuiltInGenerativeAIModelType,
which is what grants an integration override model inheritance.

* fix: reuse environment AI settings in generation workers

* feat: import legacy AI provider settings on upgrade

Removing the ai-providers flag makes database-backed providers the default, which
would leave every existing installation on an empty AI providers page with a
management command as the only way to populate it. A data migration imports the
environment and each workspace's stored settings instead, so a standard upgrade
needs no commands.

Both scopes are imported in one migration. Legacy workspace settings replaced the
instance ones entirely, while database providers inherit, so each imported workspace
is also switched off the instance provider of the same type. Without that a workspace
would silently gain models billed to the instance account.

Settings that cannot fit their columns are skipped and logged rather than raising
DataError and rolling back the whole upgrade. The migration reverses as a no-op
because the previous version does not read these tables, so deleting rows would only
discard edits made during a rollback window.

migrate_ai_provider_settings stays as the recovery path and now shares its planning
logic with the migration, so both agree on which legacy settings are complete. It
deliberately does not switch workspaces off inherited providers, and warns instead.

* chore: remove the temporary AI provider audit command

audit_ai_provider_settings existed to inventory legacy configuration before a manual
import. The upgrade now imports automatically, so the command has no remaining step
to support. Removal was already tracked in #5749.

* docs: reduce AI provider docs to lasting behaviour

The upgrade procedure, rehearsal plan and sizing query described a one-time
transition and do not help anyone after the release; they live in the pull request
instead. What remains explains how providers work: the two scopes, how they combine,
the inheritance switch, what the deprecated environment variables still do, and how
integration overrides and published applications behave.

Also corrects claims that no longer hold: published applications keep materialised
credentials only when they were published before the upgrade, the import is no longer
optional, and a workspace-owned provider suppresses the environment fallback too.

* docs: shorten the AI provider changelog entries

Bullet points render as single list items under the entry. The released entries
average around twenty characters; these ran to four hundred, so the detail belongs
in the AI providers guide rather than the changelog.

* docs: clarify where imported AI credentials are stored

The previous wording implied Baserow's own exports carry provider credentials.
They do not: AIIntegrationType lists ai_settings as a sensitive field and
ImportExportConfig excludes those by default, and AIProviderConfig is not part of
any export path.

* docs: explain the AI provider upgrade and where to configure providers

State that the upgrade imports the BASEROW_* provider variables once and no longer
reads them, list the exceptions, and give the exact navigation for instance admins
(Admin tools -> AI providers) and workspace admins (workspace Settings -> AI
providers). Map each deprecated variable to the field that replaces it.

* fix: renumber the legacy AI provider import after 0121_agent

Develop's core 0121_agent and this branch's import migration both depended on
0120, leaving two leaf nodes, so migrate refused to run and the startup check and
E2E shards failed. The import is now 0122 and depends on 0121_agent.

* feat: remove the legacy workspace generative AI settings endpoint

GET/PATCH /api/workspaces/{id}/settings/generative-ai/ had no caller left, yet a
PATCH was still honoured for any provider type without a workspace provider and
never shown in the AI providers UI. Remove it with the handler parameter,
receivers and frontend handler that only it could trigger.

* fix: stop instance AI provider changes from fanning out per workspace

An instance-level change queued one Celery task per 25 workspaces behind a global
blocking lock, sent a payload to every connected user, and made the premium receiver
serialize every AI field on the instance. Instance changes now notify staff only;
other users see them after a reload. The render lock is per scope, and the in-use
guards no longer read one row per workspace.

* fix: keep inherited Kuma when a workspace switches off the instance provider

The upgrade switches imported workspaces off the same-type instance provider, which
made an inherited instance Kuma model invalid there, so Kuma fell back to the
deprecated env model or turned off. Inheriting the instance Kuma selection now
ignores workspace switch-offs; explicit workspace selections stay strict and are
the only ones that block a switch-off.

* fix: skip malformed Ollama URLs during AI provider migration

* fix: preserve skipped legacy AI provider connections

* test: cover independent legacy AI workspace connections

* fix: skip malformed legacy AI provider settings

* fix: move legacy AI import after current core migrations

The linear rebase omitted the migration renumbering from the previous merge commit, while develop advanced through core 0124. Rename the existing AI import to 0125, depend on 0124, and update its historical migration test so core has a single leaf.
2026-09-25 17:05:10 +02:00
Bram ac6cdb5aca All workspaces homepage [4/7] Remember user last viewed (#6001)
* Track when a user last viewed a view, page, dashboard or workflow

* moved `ai_provider_states` into _get_application_serializer_context

* Fixed feedback

* Fix migration conflict

* Fixed feedback

* Skip impersonated last viewed
2026-09-25 12:37:13 +02:00
Jérémie PardouandTsering Paljor e83d592353 feat: add response node (#5595)
Co-authored-by: Tsering Paljor <tsering@baserow.io>
2026-09-24 15:41:25 +02:00
Jérémie PardouandBram Wiepjes 61bdb0715a fix(dashboard): batch initial data source dispatches (#6156)
Co-authored-by: Bram Wiepjes <bramw@protonmail.com>
2026-09-23 16:44:34 +00:00
Peter EvansandJeremie Pardou 620fcc9a56 feature: inbound email trigger (#5730)
Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
2026-09-22 13:41:10 +01:00
Davide Silvestri be57a25648 fix: compact expired realtime replay events (#6074)
* feat: compact realtime history into audience summaries

* test: cover retention guard and replay refresh reasons

Adds the settings-import test for a non-positive retention window, pins the
refresh_reason of three replay refusals, and names the per-row channel group
as the summary growth driver.
2026-09-17 16:30:22 +02:00
13d23fa3bc chore(deps): bump djangorestframework from 3.16.1 to 3.17.2 in /backend (#5999)
* chore(deps): bump djangorestframework from 3.16.1 to 3.17.2 in /backend

Bumps [djangorestframework](https://github.com/encode/django-rest-framework) from 3.16.1 to 3.17.2.
- [Release notes](https://github.com/encode/django-rest-framework/releases)
- [Commits](https://github.com/encode/django-rest-framework/compare/3.16.1...3.17.2)

---
updated-dependencies:
- dependency-name: djangorestframework
  dependency-version: 3.17.2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>


---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Przemyslaw Kukulski <przemyslaw+gh@baserow.io>
2026-09-11 12:03:04 +02:00
Davide Silvestri bb1f2c47a3 fix: webSocket stalls and reduce realtime replay storage overhead (#6040)
* fix: prevent realtime replay from stalling websocket workers

* fix: index replay recipients and reset disposable history

* docs: explain realtime recipient trigger

* docs: identify realtime recipient trigger on model

* fix: reject expired replay anchors retained by cleanup locks
2026-09-09 16:46:09 +02:00
Jérémie PardouandTsering Paljor 40c18a3c9f feat: add separate domain for preview (#5682)
Co-authored-by: Tsering Paljor <tsering@baserow.io>
2026-09-09 08:53:47 +02:00
Przemyslaw Kukulski 9c14b5804e fix: add workspace permission checks to data sync type properties endpoint (#5972) 2026-09-07 11:31:42 +02:00
alamin-br 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 643efa8781.

* fix: look up an imported bot only in the database the action lands in

An unmapped id is the normal case for a duplicated field or table, and an
export written before 4c carries no mapping at all. The fallback looked that id
up across the whole installation, so it could match another workspace's bot and
write the FK; only a later check nulled it, and anything reading the service in
between saw it.

The field the action is being imported into now reaches the lookup through the
import cache, which the base class already threads down, and the query is
scoped to its database.

* fix: filter the Slack schema by the name a caller can actually send

`allowed_fields` holds first-level names, and `extract_properties` reads them
off `path[0]`. Since the answer moved under `data`, that is the only name any
path into it produces, so filtering the names inside the wrapper matched
nothing and answered an empty schema.

* refactor: resolve a click's specific services once

`_resolve_integrations` and `_lock_ttl_for` each rebuilt the same list, and
only `specific` being a cached property kept that free — a fact neither call
site stated. The dispatch resolves them once and hands both the list.

* fix: skip an integration the import refused, rather than list a None

`import_integration` can now answer None, and builder and automation appended
it straight into a list typed as integrations. Only the database narrows what
it accepts today, but this branch is what makes narrowing possible, so the two
loops have to allow for it rather than rely on nobody using it.

* fix: do not mark an application loaded when its integrations fetch gave up

The fetch answers null when the list kept changing under it, having written
nothing. Builder and automation awaited it and marked themselves loaded either
way, so a rename or a reorder landing during page load left every integration
dropdown empty for the session with no error and no refetch.

* refactor: declare the dropdown's model value instead of reading $attrs

It read the selection out of `$attrs.modelValue` while binding an always-null
`value` to the dropdown below, so what showed depended on the same attribute
also falling through. Both now come from one declared prop.

* fix: follow the application object when the store replaces it

`forceSetAll` builds new application objects and `populate` gives them an empty
integration list, while the editor kept the object it was handed. It read a
list that no longer reflected the store, so a token pasted in elsewhere never
showed and the dropdown could not be refilled. The list reads the object the
store holds now, and asks again when it is replaced.

* Revert "fix: skip an integration the import refused, rather than list a None"

Builder, automation and dashboard all inherit the base
`supports_integration_type`, which answers True for every type, so
`import_integration` cannot hand them a None. The guard was unreachable and
untestable, and reading it suggests a None is expected there.

The docstring keeps the contract, so a type that starts narrowing what it
accepts knows to look at its own call site.
2026-09-07 11:18:39 +02:00
Davide Silvestri ab45c2346a feat [4/8]: per-feature AI model settings (#5796)
* feat: per-feature and workspace-level AI model settings

Baserow could only point every AI feature at one instance-wide model. An
administrator can now register provider models, declare which AI features each
model may serve, and pick the default model per feature; a workspace admin can
inherit that choice, override it, or disable the feature locally.

The assistant resolves its model once per logical request and threads that
snapshot through its nested agents and tools, so a single run can no longer
re-read settings repeatedly or pick a model other than the one it validated.
The scoped provider state is memoized for the duration of a request, keeping
workspace serialization from loading it once per workspace.

Also:
- add Google and Groq provider types, and keep these database-only providers
  out of the legacy workspace settings they cannot round-trip through;
- prune orphaned feature selections so an unloaded feature type's RESTRICT FK
  no longer blocks provider and model deletion;
- record whether a configured model answers text and tool-calling probes, and
  invalidate that result when its credentials or identifier change;
- broadcast provider and availability changes over the existing realtime
  channel so open clients update without reloading;
- read the assistant model from the shared configmap, so frontend pods no
  longer miss it on Helm installs.

Manual test instructions live in docs/testing/kuma-model-settings-test-plan.md.

* fix: address AI provider settings review feedback
2026-09-04 10:53:53 +02:00
alamin-br 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.
2026-09-03 13:49:27 +02:00
alamin-br 886925500f feat[4a/6] Button field: send an HTTP request (#5968)
* feat: let a button field send an HTTP request

A button can now call an endpoint when it is clicked, and the actions
after it can read what came back. The request runs as part of the click,
in the order the actions are listed, and a failure stops the ones behind
it without rolling back what already ran.

What an endpoint answers with has no shape until it has answered once, so
a click by someone who may configure the field remembers the response and
the editor builds the data explorer from it. Only a successful answer is
kept, it is capped in size, and it never travels in an export, a snapshot
or a duplicate.

Because a click now makes this installation send a request, it is rate
limited per user and per workspace, and only clicks that reach outside
count. The address guard that stops a request reaching Baserow's own
network applies here too, and a failure is reported by position without
naming the URL it could not reach.

* feat: say what a button's request has answered, and what it has not

The data explorer only offers an HTTP action's body once a click has
answered, and until then nothing said why. The action's form now carries
the same block the builder uses: what the last click remembered, or a
note explaining that a click is what captures it.

The note also says the button's other actions run on that click, which a
preview elsewhere in Baserow has no reason to warn about.

* fix: stop a refused click from spending the budget, and sharpen what it is told

A click refused by a permission check kept the slots it reserved, so a
member who may not dispatch could spend the whole workspace's budget on
refusals and lock out the members who may.

The lock is now sized from what the click may wait for. The setting was a
fixed two minutes while a button can chain requests that are each allowed
to wait that long on their own, so the lock expired mid sequence on
exactly the buttons it was there to protect.

An external failure no longer hides a message about the values the action
was given, such as a body that is not JSON. Only a message naming the
address is withheld, since that is the part written for whoever configured
the button rather than whoever clicked it.

A result is returned to the browser only when a client action can read it.
An answer from outside Baserow carries whatever the endpoint sent back,
response headers included, and a clicker with nothing to run has no use
for it.

Also gives the remembered answer its own savepoint, so a value the column
refuses cannot leave an enclosing transaction unusable, logs why it was
refused, declares the 429 the endpoint can now return, and matches a
duplicated field by the name the job gives it.

* fix: charge a click for what it really sent, and stop leaking what it was told

Answers the review on the button field's external actions.

A click now takes one rate limit slot per action that reaches outside
Baserow, rather than one per click, and gives back whatever it did not
spend. The action list is read once and used for the budget, the
permission checks and the run, so the three cannot disagree.

A failure that names an address no longer reaches the log with the URL
and request headers attached, only the ids and the exception class. A
result the browser has no client action to hand it to is not sent at
all. The classification is now a list of the failures that can name an
address, so everything else keeps its own message and a malformed body
says so.

An HTTP response is read in chunks against a ceiling instead of being
buffered whole, so an endpoint cannot decide how much memory a worker
spends. A captured answer is dropped when a request-shaping value
changes, and is not rewritten when it has not changed. A nested service
type that disagrees with the action is refused rather than silently
dropped.

In the editor, the payload viewer shows what the explorer's paths name,
a newly added request already offers its status code, raw body and
headers, and reopening a field re-reads what a click captured.

Docs get the four button field variables, the corrected lock TTL, and an
ADR section that says secrets reach an export with external actions
rather than external integrations.

Claude-Session: https://claude.ai/code/session_01EwBqQJNK8seaAC5j8ppjF4

* fix: leave a button's API key out of an export

An HTTP request action has no integration, so its key lives in the
service's own headers and query parameters. Both were exported in clear
text, and travelled wherever the export went: snapshots, workspace
exports, templates.

`CoreHTTPRequestServiceType` now names them sensitive, and the export
config reaches them. `FieldType.export_serialized` takes it, the
application export passes it, and the button field hands it to its
actions, which blank whatever the backing service calls sensitive. The
paths that stay inside the installation, duplicating a field and
restoring a snapshot, pass no config and keep the key, so a copy still
works.

Which header holds the key is not knowable, so the whole list goes
rather than a guess at the secret one, and the import reads a stripped
list as none of them.

Claude-Session: https://claude.ai/code/session_01EwBqQJNK8seaAC5j8ppjF4

* test: guard the editor's explorer without leaving the page

Every other test here navigates or reloads between building a button and
reading what it captured, which fetches from the backend again and hides
what the editor was holding.

This one stays on one page: it adds an HTTP action and a dependent
action through the editor, checks the later one is already offered the
status code and raw body before either has been saved, then saves,
clicks, and reopens the field to find the answer the click just got.

Without the baseline schema the request has no node at all until the
field is saved and reopened. Without the re-read on reopen the captured
body stays missing until the page is reloaded.

* fix: hang up on a response that never stops arriving

Requests treats a scalar timeout as inactivity, so it starts again on
every byte. A server sending one every few seconds held the connection
open for as long as it liked, and the click outlived the lock sized to
`2 x sum(timeouts)`. Once Redis expired that lock a second click could
start and repeat actions that are not reversible, which is the case the
lock exists for.

The body is now read against a wall-clock deadline as well as the size
ceiling, both inside the streaming loop, and a deadline reached is
reported the same way as any other timeout.

The connect and header phases still use Requests' own inactivity
timeout. Closing those needs a renewable lock, which is left as a
follow-up.

* feat: say why a click captured nothing

A click that answered 404, timed out, or came back larger than the
sample data ceiling captured nothing and said so nowhere. The note
asking for a click stayed exactly as it was, so there was no way to tell
the click had already happened.

The action type now says why a result describes no shape rather than
only that it does not, and the reason is stored under the `_error`
sentinel the builder and automation already use. The editor shows it in
place of the note, through the viewer's existing error state.

Only written when there is nothing to lose: a shape an earlier click
learned outlives an explanation of the latest one, and every action
pointing at that shape would break with it. The reason names the status
code but never the address, which is for whoever configured the button
rather than whoever clicked it.

`generate_schema` now skips a stored failure. It is truthy, so the body
would otherwise come back as an empty object rather than being left out.

* fix: close the holes a review found in the button field's external actions

Seven of these are regressions from the earlier review fixes on this
branch.

An external action no longer logs its own exception, whatever type it
is. The previous rule keyed on the failure, but loguru prints the frame
locals beside the traceback and the frame that resolved the formulas
holds the URL and every resolved header, so a malformed body or an
oversized answer still wrote the key to the log.

A click no longer asks for more rate limit slots than the limit could
ever hold. Slots are taken one at a time, so a button carrying more
requests than the budget was refused the slot past the limit and could
never be clicked at all, however long anybody waited. Past that point
the limit is back to counting clicks.

A click is charged only for requests that were really sent. The callback
fired before the formulas were resolved, so a header naming a deleted
field, or a body that is not valid JSON, spent the budget without
reaching anything.

Reading the response no longer skips its ceiling when the ceiling is
switched off. It returned before consuming the body, so a truncated or
corrupt answer surfaced later as a 500 rather than a handled failure,
and the drip deadline was never armed.

An export keeps the keys of what it strips and blanks only the values,
so an imported button says what has to be entered again instead of
quietly sending a request without its `Content-Type`. Form data and the
body are stripped too, not only headers and query params.

The AI formula prompt no longer sends a button's headers to the
provider. It serialized every field with no export config, and reading a
formula field needs far less permission than configuring a button does.

The editor's re-read on reopen takes only what a click captured, matched
by id, so an unsaved action edit survives it.

Also: loguru ignores `exc_info`, so two handlers were swallowing their
tracebacks; the sample data cap measured escaped JSON, which refused a
Japanese answer at half the documented size; the unchanged-answer check
compared whole values, and `Date` alone moves every second, so nearly
every click rewrote the blob it was meant to skip; and an e2e test found
the duplicated field by an index that a new column had shifted.

* fix: charge, log and explain a click the way the last review asked

Four follow-ups from the review of the external actions.

A button carrying more requests than a rate limit could ever hold is now
refused rather than reserved for what fits: capping the reservation still
sent every request, so the limit was paying for a burst of any size.

An address Advocate refuses is told apart from a connection that failed,
so a click that never sent anything gives its slot back.

The HTTP service no longer logs its own unknown failures with the
traceback. The frame holds the URL, the resolved headers and the body,
and so does the one that could not keep an answer, so both log the class
of the failure and the ids only.

A reason left by an earlier failed click is replaced by the next one: a
404 followed by a timeout kept describing the 404. A shape an earlier
click learned is still never overwritten.

The e2e concurrency test waits for the first request to finish before
closing the competing context.
2026-09-03 11:46:21 +02:00
alamin-br 1cdb8fd9cd feat[2/6]: Run configured actions when a button is clicked (#1722) (#5786)
* feat: add an optional actor to the service dispatch context (#1722)

* feat: add a context manager to run actions outside the undo stack (#1722)

* feat: resolve the acting user and permission workspace for local baserow services (#1722)

* feat: dispatch local baserow services without an integration (#1722)

* fix: assert actor strictly and cover the integration-less read path (#1722)

* chore: add changelog entry for actor-based local baserow dispatch (#1722)

* fix: carry the dispatch actor through clone explicitly (#1722)

Subclasses replace `own_properties` rather than extend it, so listing
`actor` there only worked for contexts that repeated the entry. Carry it
over in `clone()` instead, popping it before construction so no subclass
constructor ever sees an unexpected `actor` kwarg.

* test: cover an unauthorised actor on the local baserow read path (#1722)

The existing negative test is on the create-rows path, where the rejection
comes from the action itself. This one exercises the `build_queryset`
permission check, the only place the branch feeds a resolved actor
straight into `check_permissions`.

* fix: resolve the delete row acting user before the row ids guard (#1722)

The delete path resolved its user inside `if row_ids:`, so an empty id
list skipped the check the other paths make up front.

* feat: add the database workflow action models (#1722)

* feat: register the database workflow action types (#1722)

* fix: mix in CustomFieldsInstanceMixin for database workflow action queryset enhancement (#1722)

DatabaseWorkflowActionType only extended WorkflowActionType, which
does not provide enhance_queryset. DatabaseWorkflowServiceActionType's
enhance_queryset override calls super().enhance_queryset(), which
raised AttributeError once anything iterated a field's workflow
actions. The builder's equivalent type mixes in
PublicCustomFieldsInstanceMixin for the same reason.

* feat: add the database workflow action handler (#1722)

* feat: add the database workflow action service layer (#1722)

* fix: capture the workflow action id before deleting it (#1722)

* feat: add the database workflow action API (#1722)

* fix: put ERROR_USER_NOT_IN_GROUP in the 400 schema bucket (#1722)

* feat: add the workflow action ordering endpoint (#1722)

* feat: export, import and duplicate button field workflow actions (#1722)

* chore: add changelog entry for button field workflow actions (#1722)

* fix: remove the unused database workflow action object scope (#1722)

DatabaseWorkflowActionObjectScopeType was registered in the
object_scope_type_registry but referenced by no OperationType and no
queryset filter. Permission checks for workflow actions run against the
parent field's own ReadFieldOperationType / UpdateFieldOperationType by
design, so the scope had no consumer.

test_all_scope_types_referenced_by_operations_are_registered asserts a
strict equality between registered scope types and operation context
scope names, and correctly failed on the orphaned registration. Deleting
the scope (rather than adding a matching operation type) keeps the
phase's permission design intact. A later phase adding a dispatch
operation can reintroduce the scope legitimately once something
references it.

* fix: create a matching service when a workflow action type changes (#1722)

PATCHing an action's type reached the service with the old type, so the
new action was built from the old type's service and blew up on a missing
field. Mirror the builder: resolve the new type, prepare values without an
instance so a fresh service is created, and carry field and order over.

Also covers cross-workspace PATCH and DELETE on the item endpoints, the
only routes with no field-scoped path parameter.

* test: back each workflow action fixture with its own service type (#1722)

The fixture hardcoded an upsert row service for every action type, so a
delete_row action wrapped a local_baserow_upsert_row service, a state
prepare_values can never produce. Resolve the action type and build the
service its service_type names instead.

* test: assert the service is deleted when a button field converts away (#1722)

The test used plain django_db, so the on_commit receiver that deletes the
service never ran and ADR 006 section 8 was only half verified.

* fix: gate the workflow action endpoints behind FF_BUTTON_FIELD (#1722)

Button field creation is already gated, but the action config API stayed
open once the flag was turned off.

* docs: correct the import cycle comments and flag the unwired formula generator (#1722)

The cycle runs field_types to workflow_action_types to local_baserow
service_types and back, not through fields/models. Also record that
formula_generator has no consumer yet and what wiring it needs.

* docs: record the export path constraint and track the field duplication gap (#1722)

ADR 006 section 6 gains the constraint that FieldType.export_serialized
carries no files_zip, storage or import_export_config, so the action export
path cannot strip credentials once external integrations arrive.

Single field duplication drops workflow actions, contradicting section 8.
Track it with a strict xfail so it fails the moment the missing FieldType
duplication hook lands.

* refactor: hoist the workflow action imports in ButtonFieldType (#1722)

The local imports carried a comment claiming they broke an import cycle. There
is no cycle: neither workflow_actions.handler nor workflow_actions.registries
reaches fields.field_types. Only workflow_action_types does, via
integrations/local_baserow/service_types, and neither local import touched it.

Verified by hoisting both to module scope: manage.py check passes and the field,
workflow action, core, integrations and builder suites are green.

* docs: record that url_formula retires into an open_url action (#1722)

Phase 1 shipped the button with a `url_formula` because it landed before
the action layer. The ADR never said whether that attribute was
permanent, which left the phase 2 click behaviour undefined and would
have got more expensive to settle once real data existed.

It is scaffolding. Opening a URL becomes an `open_url` action and the
attribute retires under the zero-downtime rules, so a button never
carries both. Because that type is frontend-only the client runs it
without the dispatch endpoint, which is what keeps a URL-only button
working in public views under section 7.

* docs: correct the public view reasoning for frontend-only actions (#1722)

The open_url section justified the client-side execution path by saying it
kept a URL-only button working in public views. Phase 1 review concluded the
opposite: button fields should not appear in public views at all, and
ButtonFieldType now sets can_be_in_public_view = False.

The conclusion stands on its own merits, but the reason was wrong, and leaving
it would have had phase 2c design around a constraint that no longer exists.

* feat: add the database dispatch context for button clicks (#1722)

* fix: guard DatabaseDispatchContext against a missing field or row (#1722)

field and row default to None only so clone() can reconstruct the context
without passing actor. A real dispatch never has either as None, so raise
early instead of surfacing an opaque AttributeError deeper in a data
provider.

* feat: add the raw row data provider for button dispatch (#1722)

* test: exercise both row data providers against the same row (#1722)

* feat: dispatch a single database workflow action (#1722)

* test: cover the base database workflow action type's dispatch refusal (#1722)

* feat: add the dispatch operation and restore the workflow action scope (#1722)

* feat: run a button field's actions in order on click (#1722)

* fix: authorise an actionless button click and prove the click lock holds

* feat: add the button field dispatch endpoint

* fix: pair each dispatch result with its action inside the service

* test: pin the row snapshot semantics for button dispatch and add a changelog entry

* fix: ignore a supplied integration on a button action's service

integration_id is writable on the service request serializer and the
handler that resolves it does no permission check, so a create or update
could point a button action at any integration in the instance. At
dispatch the service then acts as that integration's authorized_user
instead of as the person who clicked, which inverts ADR 006 section 5 and
misattributes every row the click writes.

Drop the id in prepare_values, the way deserialize_property already
hardcodes None on import.

Also adds a dispatch endpoint test that a database token cannot
authenticate there.

* fix: make the row data providers safe against each other's context

Both providers share one registry, so get('row.…') now validates inside
an AI field's prompt and resolves against a HumanReadableRowContext,
which has no row. That raised an AttributeError the caller saw as a 500.
The mirror case, get('fields.…') in a button action argument, had the
same problem. Both now return None instead.

Also resolves row.id, since row_id on the update and delete services is a
formula and this is the only way an action can name the clicked row.

* fix: harden the button dispatch error path and its click lock

Two problems in the dispatch loop.

The catch wrapped every exception into WorkflowActionDispatchError, whose
error template renders the message verbatim, so a DatabaseError or an
internal ValueError put its text in the API response. Only the dispatch
exceptions written for the clicker are wrapped now; everything else is
logged and left to the normal 500 handler.

The lock was deleted unconditionally, so a sequence that outlived the TTL
deleted the lock of the click that took the key after it. The value is
now a token this click checks before deleting. The TTL moves to
BASEROW_BUTTON_DISPATCH_LOCK_TTL_SECONDS, alongside the builder's
dispatch cache TTL.

Adds an end to end test that an update action can target the clicked row
through get('row.id').

* test: resolve the button dispatch role rule through RBAC

The existing test only asserted the operation is listed in default_roles,
which passes even when RBAC cannot resolve the workflow action scope. Its
parent chain runs workspace, database, table, field, workflow action, and
the scope itself was deleted in phase 2b and restored for this operation,
so it is worth exercising. A viewer is refused, an editor clicks.

* feat: add the database workflow action api client

* feat: register the database workflow action types on the frontend

* test: pin the create/update/delete row action-to-service wiring

* feat: add workflow action reconciliation for the button field editor

* fix: treat unknown local ids as new actions and document the type-diff boundary

* feat: add the button field action list editor

* fix: namespace the sortable id fallback so it cannot collide with a real action id

* feat: save a button field's actions when the field form is submitted

* fix: re-sync workflow actions after save and guard the mount fetch by field type

* feat: report whether a button field has workflow actions

* feat: dispatch a button field's actions when its cell is clicked

* fix: keep a button field's actions when the field is duplicated

* chore: add changelog entry for the button field action editor

* fix: let local baserow service forms pick a table without an integration

* fix: send the service type when a new button action is first saved

A buffered action's service has no `type` until the server makes one, so
the follow-up update after the create sent a service payload the API's
polymorphic serializer could not type and answered with a 500. The table
a user picked on a brand new action was therefore never persisted, while
the same edit on an already-saved action worked because its service
carries the type the server assigned.

Take the type from the service the create just returned.

* fix: correct the upsert row form on the integration-less path

Two defects the button field's action editor exposed in the shared form.

The table loading spinner is only lowered again by the `loading` prop
going false, which the builder toggles around the save it makes when the
table changes. The button field buffers its edits instead, so nothing
ever lowered the spinner and the field mappings form, hidden behind it,
never came back. Raising it is now opt-out via `savesOnTableChange`.

The "choose a table" hint tested `values.table_id`, which this form never
populates: `allowedValues` is `['field_mappings']`. It was dead code
until the `databases` prop widened the condition, and then showed
permanently. Test the service, which actually carries the table.

* fix: render the field mapping formula inputs in the button field editor

A "create a row" action's field mappings render their formula input through
the shared InjectedFormulaInput, which resolves the component to render from
an injected formulaComponent. The builder and automation editors provide one;
nothing in the database module did, so the injection was undefined and Vue
rendered a bare comment node where the input should be.

FieldButtonSubForm now provides a DatabaseFormulaInput, plus the row data
provider a button action's arguments actually resolve against. Additive:
InViewport, FieldMappingForm and FieldMappingsForm are untouched, so the
builder, automation and dashboard callers are unaffected.

* test: cover the button dispatch operation reaching existing roles

RBAC reads a role's operations from the core_operation table, so an
instance whose table predates the dispatch operation denies the click to
every role. Only the post_migrate receivers write that row, so a test
database never shows it while a long lived one refuses until migrated
again. Pins both halves: the deny without the row, and the repair after
the sync.

* fix: discard the buffered action list when the field editor is cancelled

UpdateFieldContext keeps one sub-form per field alive across opens, so
cancelling only reset the form values and left the action buffer intact.
The discarded action was still listed on the next open, and a later save
created it for real. Rebuild the buffer from the last server response in
reset().

* fix: refresh a button field's has_workflow_actions after saving its actions

The flag is derived server side and returned by the field create/update
response, which is built before the workflow actions are saved. The store
committed that stale value, so a freshly configured button field kept
rendering the url link branch until the page was reloaded, and a field that
lost its last action kept a dispatch button that did nothing.

* fix: disable the button field dispatch until the row exists

The row create modal renders every visible field, so the dispatch button was
clickable there and posted a request without a row id, which the API rejects
with a generic error. Gate it on rowIsCreated like the AI field does.

* fix: keep the button action editor out of the field form payload

The nested action and service forms register up the form chain, so the field
create/update body carried their service config too. Return only the field's
own values from the sub-form.

* test: drive the buffered action list through the real editor

The test assigned localActions directly, so it never exercised addAction and
would still have passed if adding an action had called the API.

* test: restore the role cache after the dispatch operation test

The test deletes the operation rows and resets the handler's process wide
role cache. Without teardown a failure between the delete and the re-sync
would leave later tests in the same worker with a cache missing it.

* feat: add the open url button field workflow action

* fix: give workflow action formulas their application type context

* feat: return frontend only actions to the browser instead of dispatching them

* test: prove the open-url lock skip and the client_actions wire shape

* fix: remap field references inside an open url action on import

* feat: add the open url action type to the field editor

* test: pin the segmented control to the 36px small size

* feat: choose and change a button action type from a dropdown

* fix: type a service payload when a button action changes type

Changing an action's type into a service-backed type sent
`{ type, service: {} }` in one PATCH. The empty service carries no nested
`type`, so the polymorphic service serializer fails with an AssertionError
and the API answers 500. The type change now goes on its own and the
config follows against the recreated action, typed from the service that
PATCH returned, exactly as a create already did.

Also remount the per-row form on a type change: `create_row` and
`update_row` resolve to the same component and the row key does not
change, so Vue reused the instance and could show the old config.

* fix: type a button action's service on a plain config update too

A type round trip inside one editing session (create_row to update_row and
back) leaves the type matching the server's, so the payload carries no
top-level `type` and the deferral guard does not fire. Its service is still
brand new, because picking a type resets the config and the remounted form
re-seeds it, so it reached the API untyped and hit the same polymorphic
serializer 500.

The service fixup now lives in `withTypedService`, shared by the create
follow-up and the plain update. An empty service is dropped rather than
sent, a configured one takes its type from the action the server already
has, and an update left with nothing to say makes no call. The server
response is read with the same optional chaining the surrounding id guards
already use.

* fix: run a button's browser side actions after the dispatch response

* test: prove a button's client actions run one after another

* feat: retire the button field url attribute into an open url action

* fix: keep the merged button field migration untouched

* chore: add changelog entry for the open url button action

* fix: decide a button url's protocol with the browser's url parser

A leading C0 control character made the scheme regex read a
`javascript:` url as relative, so it passed through untouched and was
assigned to window.location, where the parser stripped the control
character and ran it. Parse with new URL() instead, which is the same
parse the browser performs.

* docs: correct adr 006 on how open_url actually reaches the browser

Section 2 still said a frontend-only action skips the dispatch endpoint
and that url_formula is still read. Both are now wrong: the client always
dispatches and the server returns the frontend-only actions under
client_actions, and url_formula is a deprecated column nothing reads.

* test: record that clicking an existing button needs the flag on

The registration comment claimed existing button fields keep working with
the flag off, but only reading does: has_workflow_actions is serialized
either way, so the cell renders an enabled button whose click the gated
dispatch endpoint refuses. State the real boundary and assert it.

* test: assert the open url formula reference the frontend actually uses

The formula lacked the field_ prefix, so it was not the reference form the
migration writes or the data provider resolves, and the assertion only
checked the id appeared somewhere in an echoed string.

* fail a button click that would write an unwritable field

ADR 006 section 5 requires a click to fail when an action would write a
field the clicker cannot write, rather than skipping it the way the
builder's upsert does. The upsert service type is shared, so the rule is
carried on the dispatch context: DatabaseDispatchContext turns on
requires_writable_fields, and only then does the upsert raise instead of
filtering. The builder, automation and dashboards inherit the default and
keep skipping.

The refusal is a PermissionDeniedDispatchException, listed in
USER_FACING_DISPATCH_EXCEPTIONS so it reaches the clicker's error toast as
ERROR_WORKFLOW_ACTION_DISPATCH_FAILED rather than a 500. It is raised
before any row is written, so nothing lands.

* remap a button action's service formulas on import

A create or update row action can map a field to a formula such as
get('row.field_25'). Only the field mapping's field_id was remapped on
import, so a duplicated table or an imported database kept a formula
naming the source table's field and silently wrote the wrong value.

Wires the formula generator that was already there to a database-side
import_formula, and gives the row data provider the import_path it needs
to remap a field reference.

* cover the button dispatch failure toast

ERROR_WORKFLOW_ACTION_DISPATCH_FAILED is the only failure surface a
clicker gets until a later phase, and nothing tested it. Adds the API side
(400, the error code, and a body naming the action that failed, with the
earlier action's row still standing) and the cell side (both branches of
the catch: a handled API error goes through notifyIf, anything else raises
the toast itself).

* correct adr 006 on the button loading state

Section 3 described broadcasting the loading state to every open view over
the row realtime channel. That was descoped to phase 4 on 2026-07-28: local
dispatch is synchronous, so the clicker gets the result in the response and
other viewers see the rows change through the normal signals. The clicking
user's own loading state does exist, so the section now describes that and
records the deferral.

* log skipped formula remapping and correct import docs

The formula importer swallowed parse and unknown-provider errors without a
trace. The swallow stays, but a genuine failure now logs a warning, and the
comment says a partial remap is possible.

Two import/export tests claimed the formula came back untouched. It is
re-rendered from its parse tree, so casing and spacing may change; the
wording now says what actually holds.

The ADR 006 sequence diagram returned results after the failure branch with
no else, contradicting section 2. Added the success branch.

* refresh the clicker's grid after a button dispatch

A dispatch changes rows server side, so the client applies nothing itself,
but the WebSocketId header still left it out of the realtime broadcast its
own request triggered. The clicker's grid stayed stale until a reload while
every other viewer saw the change.

Requests can now opt out of the header.

* offer field mappings on an unsaved button action

The upsert form derives its mappings from the service schema, which only a
saved service carries. The button editor buffers its changes, so a newly
added create or update row action had none and the form reported that the
table held no writable fields. Nothing could be mapped until the field was
saved and reopened.

The editor now fetches the target table's fields itself, which also keeps
the list right when a table other than the saved one is picked.

* keep the add button out of the action list's sortable container

The sortable directive builds the new order from every element child of the
dragged item's parent. The add button sat alongside the action rows, so its
missing sortable id arrived as undefined, the id-to-action lookup missed,
and an undefined entry landed in the list. The next render then threw on
action.id and took the whole editor down, which is why adding and deleting
stopped working after a drag as well.

The rows get a container of their own, as every other sortable list in the
codebase already does, and an unresolvable id no longer reorders anything.

* name the row provider after the row it exposes

The picker group was labelled just "Row", directly under the action's own
table picker, which reads as a row of that table. It is the clicked row, and
there is no row of the target table to reference: a delete or update action
chooses rows by id.

Also covers deleting several rows in one click, which the service's own
tests only exercised with an integration behind them.

* match the action editor to the figma

Four gaps against the design:

The actions section had no heading. The design puts "Actions" and "Add
action" on one row above the cards, under a divider; the add button sat
below the list instead, with no label and no rule.

The empty state invented copy the design does not have. It now shows the
heading and nothing else.

The drag handle was an icon glyph. The design draws two columns of three
dots, which is how the builder draws its own handles, so it is drawn the
same way here. The 10px handle plus its 10px gap keeps the 20px slot the
icon had, so the dropdown width above is unchanged.

The type dropdown searched with the generic "Search" placeholder rather
than "Search actions".

* annotate whether a button field has actions when fields are listed

has_workflow_actions is serialized for every button field, so the
property's own exists() cost one query per button on every table load.
Annotate it in enhance_field_queryset, which the bulk field fetches
already run, and keep the query as a fallback for a field fetched alone.

* refuse a dispatch whose integration has no authorized user

authorized_user is nullable, and an import nulls it when the exported
username is not in the target workspace. get_acting_user returned that
None, which reached a permission check as an anonymous user. Raise the
same exception it already raises when no actor supplies a user.

* stop a re-picked table hiding the field mappings behind a spinner

The action editor saves nothing when the table changes, but the upsert
form still raised its own tableLoading, which only the loading prop can
lower. The table dropdown is not clearable, so re-picking the selected
table re-emits the same id: table_id never changes, nothing refetches,
loading never moves and the spinner covers the mappings for good.

Opt the editor out with savesOnTableChange, and let loading raise the
spinner as well as lower it for a caller that has opted out.

* discard a field fetch overtaken by a newer one

Picking two tables in quick succession left whichever response arrived
last describing the mappings, which can be the table no longer selected.
Take a token before the fetch and drop a response whose token is stale.

Only the newest fetch lowers the spinner too, so an overtaken one cannot
uncover the previous table's mappings mid flight. Clearing the table
lowers it directly, since the fetch it supersedes no longer will.

* name the failed action by its position, not its id

The toast read "The workflow action 62 failed". That id is a primary key
the clicker never sees anywhere in the UI, so it identified the action
without telling them which one it was.

The editor shows an ordered list, so report the position instead.
Counted over the whole list, frontend-only actions included, so it
matches what the editor shows.

* add a deferred callback context for imports

Some import work can only be done once everything has been imported. This
lets an importer register that work instead of doing it, and runs it when
the entry point that opened the context exits.

* import a button field's actions once every application is in

An action can target a table, and name fields, of another database. The
field hook that imported them runs at the end of one database's import, so
a reference into another one was read as trashed: the target table came out
null and the field mappings were dropped, leaving a button that looked
configured and did nothing.

The action import is now deferred until every application has been
imported, and the formula remapping it registers waits until every action
has been imported. Every path that reaches the action import opens a
callback context.

* let the service decide how it acts, not the dispatch context

A Local Baserow service already knows how it runs: with an integration it
acts as that integration's authorized user on someone else's behalf, and
without one it acts as the person in front of the screen. Two flags were
telling it the same thing from the outside.

`requires_writable_fields` is gone; the upsert service reads
`service.integration_id` instead. `requires_integration` no longer takes a
dispatch context and is False for every Local Baserow service, so a missing
integration is refused by `get_acting_user` rather than one step earlier.
The message a dispatch source sees is unchanged.

* remap an open url through the shared formula import

The url had its own `deserialize_property` calling `replace_field_id_references`
by hand, because the `fields` data provider had no `import_path` and so the
shared importer could not remap a `get('fields.field_25')`.

The provider has one now, next to the one `row` already had, and the url is
declared as a `simple_formula_fields` entry. The deferred import pass moved
up to `DatabaseWorkflowActionType` so an action without a service reaches it
too, which is what `open_url` needed.

* let each application type say where the tables come from

The shared Local Baserow service form carried its own integration dropdown
and worked out the databases from whatever was picked. That only suits an
application type that has an integration, and a button field has none, so it
had grown a second way in through a `databases` prop.

The form now only picks a table, from the databases it is handed. Supplying
them belongs to the wrapper of the application type it is rendered in: the
builder and automation offer the dropdown, a button field passes its own
workspace. Both dropdowns are the same `LocalBaserowIntegrationPicker`.

The builder's workflow actions were relying on the shared form's dropdown
without ever asking for it, so they get `picksIntegration` and keep it.

* chore: simplify code comments (#1722)

Second pass over the comments this branch adds: cut the ones that restate
the code, and rewrite the over-compressed ones to say why rather than what.

* refactor: use the WithRegistry get_type shortcut in the action serializer (#1722)

* fix: hand relational row values to actions as ids (#1722)

A link row, select or collaborator field held a manager or a model instance,
which reached the row API as something it could not write. The field type's
internal value is used instead, and read-only fields fall back to their
computed value.

* fix: keep the target table's field names out of the dispatch error (#1722)

The message reaches the clicker, who may have no access to that table at all.
Roles are not field scoped, so the list could only ever name every mapped
field, which says nothing the table name doesn't.

* chore: clarify the is_frontend_only comment (#1722)

* fix: keep the picked integration when the builder service form emits

The form no longer emits integration_id, so rebuilding the service from the
server's copy dropped a freshly picked one and saved the action without it.

* fix: trash the imported applications when a deferred callback fails

The callbacks run once the import loop is over, so a failure there raised past
the cleanup and left a partial import visible.

* fix: give client actions the row as it was at click time

The dispatch takes its own realtime broadcast, so an earlier row action could
update the cell's row before open_url resolved its formula.

* test: assert the dispatch refusal names no fields

* test: cover the button field click path end to end

* test: cover realtime, reorder, save failure and public views end to end

* fix: keep a button's loading state when the grid swaps the cell

* test: cover unmount during dispatch, two buttons on a row and a re-picked table

* test: cover an action type change, a reorder alongside it and a self deleting row

* fix: refuse a database dispatch carrying an integration (#1722)

An integration's authorized_user outranks the dispatch actor, so a service
that carries one would run every click as that user. prepare_values already
strips integration_id on the way in; guard the dispatch too, and cover both
with regression tests.

* feat: expose the clicked row id to a button's url formula (#1722)

A url resolves through the fields provider only, which is built from the
table's fields, so the row id was unreachable from an open_url action. The
row provider carries it but is deliberately kept out of urls, since it
returns raw types. Add the id to the fields provider on both sides instead.

* fix: keep a duplicated action's target table outside the copied scope (#1722)

Duplicating a table maps only that table, so an action pointing anywhere
else found no mapping and had its target nulled. A duplicate stays in the
same workspace, so the original table is still right; an import can land
elsewhere, so that case still nulls. The button field also has to pass the
import config down, or the service type cannot tell the two apart.

* refactor: namespace the button dispatch lock setting under DATABASE_ (#1722)

Matches BUILDER_DISPATCH_ACTION_CACHE_TTL_SECONDS ten lines above it, so
the module a setting belongs to is readable from its name. Also documents
it in configuration.md, which it was missing from. Not added to
env-remap.mjs: the frontend never reads it.

* refactor: namespace the row workflow actions as local_baserow (#1722)

The create, update and delete row actions are Local Baserow specific today
but will not always be, so name them for it now rather than carry a
compat_type forever. Renames the three models, their types and the type
strings; open_url is frontend-only and keeps its name.

The builder already has models of these exact names pointing at Service,
so the abstract base sets an explicit related_name to keep the reverse
accessors apart. The migration is edited in place since it was created on
this branch.

* test: cover the button field's remaining basics end to end (#1722)

Four gaps the unit and backend tests cannot reach on their own:

- a click runs as the user who clicked, proven with two real users in two
  browsers rather than a mocked request
- a duplicated table keeps its actions pointing somewhere resolvable,
  including a target outside the copied scope, which is the case that
  emptied the form's dropdowns
- creating the field through the UI, the only coverage of the feature flag
  gating the type dropdown
- a create row action, whose new row reaches the grid by a different
  broadcast to the other action types

Removing an action joins add, reorder and retype in the editor save test.

The suite gains three columns, so the viewport widens to fit them, and
opening a field's editor now retries because the context self-hides when it
does not fit.

* chore: drop the button field changelog entries until the flag is lifted (#1722)

The button field is behind FF_BUTTON_FIELD, so a single entry when the flag
is removed says more than eight spread across the phases. The encode_uri
entry goes with them and needs folding into that final entry: those formula
functions ship ungated.

* fix: read the clicked row again as each button action starts (#1722)

The row provider held the row from click time, so an action saw what the
actions before it did only for values behind a related manager: link row,
multiple select and multiple collaborators query when they are read, and
were never part of the snapshot the rest of the row was. A sequence mixed
snapshotted and live values with nothing to say which was which.

Every field now reads at the same moment, once per action. Reading the row
after an earlier action deleted it fails that action rather than resolving
to nothing, which would have written blanks over the deleted values.

Reverses the snapshot decision in ADR 006 section 4, which leaned on the
previous-action provider for fresher values. That provider is not built
yet, and reads a named action's result rather than the row.

* fix: keep a duplicated action's field mappings for a kept table (#1722)

A duplicate keeps a target table that falls outside the copied scope, but
that table's fields are outside it too, so nothing mapped them and every
mapping was dropped. The action landed on the right table with nothing to
write to it.

An unmapped field is now kept when it still exists, which is what tells a
field outside the copied scope apart from a trashed one. Trashed fields
are still dropped, or they would come back pointing at the source table.

* fix: restore the row id input on the get row data source (#1722)

The service form stopped carrying an integration when the table picker
moved to a `databases` prop, so the guard on this block never passed again
and the data source could no longer be given a row to fetch. The upsert
form was moved off the same guard, this one was missed.

The table is what the row id depends on, so it is what the block asks for.

* fix: apply a mapping edit when the field is left, not on its timer (#1722)

A mapping formula is only applied 500ms after the last keystroke, so a save
in that window read the buffer before the edit reached it and kept the old
formula, with nothing to say the edit was dropped. The button field's
editor makes this easy to hit: clicking Save is what ends the typing.

The formula input now says when it loses focus, and a pending edit is
applied there instead of waiting. Clicking Save takes the focus, so the
edit lands first. Builder and automation stop waiting on the timer too.

* fix: refuse to read a password field into a button action (#1722)

The row provider handed back whatever the column stores, and for a password
field that is the hash. Mapping it into a text field copied the hash
somewhere readable, which every other surface prevents: the response
serializer, exports and row history all mask it.

A field type can now say its stored value must never be handed back, and
the provider refuses to read one. The editor leaves such a field out of the
data explorer, so it cannot be picked in the first place.

* fix: identify an unsaved button action by more than its place (#1722)

An action with no id yet was keyed by its position, so deleting one handed
its key, and with it the form Vue had already built, to the action below.
Two unsaved actions of the same type left the survivor showing the deleted
action's configuration.

Each action the editor makes now carries a client id, which identifies its
row until the server gives it a real one. It is stripped from what is sent
and from what is diffed, so nothing reaches the API.

* fix: wait for the saved actions before the list can be edited (#1722)

The editor started empty and filled itself when the fetch returned, so an
edit made in between was replaced by the response. Keeping the edit instead
would have been worse: the buffer would be missing the actions the user
never saw, and saving would delete them.

The list is only rendered once the fetch is in, with a spinner until then,
so neither is reachable.

* feat: tell the table when a button field's actions change (#1722)

A cell renders a working button or an inert one from `has_workflow_actions`,
and nothing told anyone else when that changed. Adding the first action, or
removing the last, left every other session showing the button the wrong way
round until a refresh.

The action signals now send the button field out again, so the flag everyone
holds matches what the field has. The field is all that is broadcast: an
action's configuration is of no use outside the editor.

* fix: keep a half saved action list open on its edits (#1722)

A save that failed part way still closed the editor and replaced the buffer
with the server's list, so whatever had not saved was gone with only a toast
to say so. Keeping the buffer as it was is not enough either: the actions the
attempt did create would be created a second time on the retry.

The buffer now takes on the ids the server handed out before it is kept, so a
retry updates what exists and creates only what does not. The server list is
refreshed either way, so the retry diffs against what is really there, and
the editor stays open on the edits rather than closing over them.

* fix: stop the field watcher discarding kept action edits (#1722)

The editor stayed open on a half saved list, then emptied itself anyway: the
field's own update reaches the `field` watcher, which rebuilds the form from
the server's list and throws the kept edits away.

The watcher now leaves the form alone while a failed save is holding edits
for a retry. Cancelling drops them, as it always did.

* fix: require update rights to read a button field's actions (#1722)

An action is serialized with the schema and select options of the table it
writes to, and reading the field was enough to be handed them. A viewer with
no access to that table could read it through a button pointed at it.

Reading the actions now asks for the same right as changing them, which is
what the rest of the editor already asks for. Clicking a button is unaffected:
the dispatch reads the actions through the handler and keeps its own checks.

* fix: hide the schema of a target table the reader cannot see (#1722)

Requiring update rights to read a button's actions narrowed who is handed the
target table's schema, but not to people who may see that table. An editor of
one table could still read the fields and select options of another through a
button pointed at it.

A service now says whether the reader may see the table it writes to, and
carries no schema when they may not. The editor says so in place of the field
mappings rather than showing an empty list. The masking is a database only
serializer, so the builder and automation are untouched.

* refactor: drop the unused formula field error helper (#1722)

`get_formula_field_error` lost its last caller and only its own tests still
reached it. Premium's `get_ai_prompt_error` does the same job for the one
field that needs it, on the same shared helpers.

Two of its tests were really covering `get_table_field_ids` caching and its
invalidation, which premium still relies on, so they now call that directly
rather than going through the helper being removed.

* test: cover removing an action, and drop the unused e2e helpers (#1722)

`deleteWorkflowAction` and `orderWorkflowActions` were never called, and
`updateWorkflowAction` only ever by this module. Reordering is already
covered by dragging in the editor, but nothing covered removing an action,
which is the path that deletes it server side on save.

That test now exists and the two unused helpers are gone, with the third no
longer exported. The suite needs every column on screen at once, so the
viewport grew with the field the new test needs.

* fix: refuse a click whose mapping points at a trashed field (#1722)

A mapping whose field had been trashed was dropped at dispatch, so the click
wrote the row without it and reported success. A create row action configured
with one mapping made an empty row.

It now fails the way an unwritable field already does, so the clicker is told
rather than left with a row that quietly lost a value. The mapping itself is
untouched, so restoring the field from trash heals it (ADR 006 section 8).
A disabled mapping writes nothing, so a trashed field behind one is ignored.

* docs: say that a button's actions are not undoable yet (#1722)

ADR 006 section 8 claimed configuration changes were undoable like other
field updates. Nothing makes them so: the service has no undoable action
type, and the only undo related code keeps clicks out of the stack.

The field update around a save is undoable, so undo leaves the label
reverted and the actions as they were saved. A test pins that half state,
so the deferral lives in code rather than only in prose, and fails when
undo is implemented and the ADR needs revisiting.

* refactor: move the service action base in with the types (#1722)

`DatabaseWorkflowServiceActionType` sat beside the registry while every type
extending it lived in `workflow_action_types.py`. The builder splits the same
two files the other way round, with only its base type and registry in
`registries.py`.

A move, no behaviour change. It also takes the API serializer import out of
the registry module, which now reaches no further than core and contrib.

* refactor: keep the button field out of the generic field form (#1722)

* chore: annotate the button field's workflow action types (#1722)

* chore: annotate the rest of the button field's new backend code (#1722)

* fix: release the button dispatch lock atomically (#1722)

* fix: create a workflow action with its config in one call (#1722)

* refactor: drop the unread integration assignments in upsert dispatch (#1722)

* refactor: return the button dispatch result as a dataclass (#1722)

* fix: keep a button field's actions when a type change is undone (#1722)

* refactor: swap a workflow action's type in place instead of recreating it (#1722)
2026-08-20 12:33:20 +02:00
Davide Silvestri 1fa388b83f chore(deps): upgrade pydantic-ai to V2 (2.28.0) (#5896)
* chore(deps): upgrade pydantic-ai to V2 (2.28.0)

Upgrades pydantic-ai-slim from 1.102.0 to 2.28.0. No user-visible behaviour
change: where V2 moved a default, the V1 behaviour is pinned rather than
silently adopted.

Production changes are five files:

  assistant/assistant.py            async for -> async with ... as events:
                                    (run_stream_events is a context manager)
  assistant/retrying_model.py       public RunContext; state/metadata/
                                    close_stream proxy delegation; Vertex AI
                                    via GoogleCloudProvider
  core/generative_ai/registries.py  output_retries=3 -> retries={"output": 3}
  assistant/model_profiles.py       normalise google-gla/google-vertex prefixes
  assistant/tools/database/agents.py  pin end_strategy="early"

The rest of the diff is test hardening, and it is the point of the change.
The assistant suite mocked pydantic-ai's streaming path instead of running it,
which hid four real breaks — one of them user-facing:

  - Agent(output_retries=3) raises TypeError on V2, breaking the premium
    generate_ai_formula endpoint. Invisible because the test patches prompt()
    wholesale and the shared fixture refuses structured output.
  - run_stream_events became a context manager; the bare async generator mock
    kept working regardless.
  - end_strategy flipped early -> graceful, letting a previously-skipped tool
    call execute and hard-fail formula generation.
  - GoogleProvider(vertexai=True) was removed entirely.

The doubles now wrap real pydantic-ai types, one test drives the genuine
streaming path, one proves cancellation unwinds through the context manager,
and test_pydantic_ai_contract.py pins the API surface (public and private) so
the next upgrade fails at import rather than mid-run in production.

Verified: assistant + core/generative_ai 343 passed, 66 skipped; full backend
suite 11962 passed, 360 skipped, 1 failed. That failure
(test_view_empty_count_aggregation_for_interesting_table, BaserowFormulaButtonType
missing empty_query) is pre-existing and unrelated — the identical failure occurs
at base commit 321c00adc, and this branch changes nothing under
backend/src/baserow/contrib/ or premium/.

Note for future upgrades: _ErrorRecoveringStream in retrying_model.py
re-exposes each StreamedResponse class attribute as a delegating property,
because class attributes shadow __getattr__. V2 added state and metadata. That
list must be revisited on every pydantic-ai upgrade — the failure mode is a
wrong value, not an error.

* fix: give Google models a usable HTTP deadline

A bare httpx.AsyncClient defaults to a 5s timeout, and GoogleProvider
forwards that to the Gemini API as an explicit deadline, which the API
rejects because its minimum is 10s. Every Google model was therefore
unusable. Build the client with pydantic-ai's own
create_async_http_client factory instead (600s read, 5s connect).

Also document GOOGLE_API_KEY alongside the other assistant provider
keys, pass it through docker-compose, and bridge it in the eval
conftest so evals can target Gemini.

* fix: resolve GOOGLE_API_KEY explicitly for Google providers

_PROVIDER_ENV had no google entry, so _resolve_credentials fell through
to the deprecated UDSPY_LM_API_KEY and handed whatever it held (e.g. a
Groq key) to Google. It only worked because pydantic-ai reads
GOOGLE_API_KEY itself when no key is passed. Map all four google
prefixes explicitly, matching the other providers' precedence.

Also raise the title-generation timeout from 10s to 15s: 10s is exactly
Gemini's minimum allowed deadline, leaving no margin.
2026-08-20 12:20:40 +02:00
Bram 0e75a6bb6d feat: Harden workspace invites with Captcha and rate limit (#5808) 2026-07-31 21:34:13 +02:00
Bram 92ce535aba feat: Report abuse in public views (#5766) 2026-07-29 13:24:21 +02:00
Tsering Paljor 429847210a feat: Add Go to node type (#5582)
* Add Go to node

* Remove goto_ prefix from destination_node_*

* Move max dispatches check into _before_node_dispatch()

* Remove translations from backend errors

* move validate_goto_destination to a static method in the node type

* Move clearing goto links to node type

* Refactor cleared_goto_links to a more generic post_move_modifications

* Remove automation concepts from integration land

* Fix flakey service test

* Remove 'node' mentions in CoreGotoServiceType

* Implement new import_references() hook to avoid overriding import_formulas()

* Fix forward-jumps

* Fix test

* Rename goto_node to just goto

* Update comment

* Clean up old references to connectors (we now use badge)

* Refactor history handler's get_destination_labels() to get the destination from node type.

* Handle max dispatch error in the dispatch_node()

* Rename output_service_id to destination_service_id

* Remove simulate check from goto node type.

* Rename post_move_modifications to move_extra_data

* Rename revert_move_in_workflow and after_move_in_workflow to revert_move and after_move respectively.

* Rename import_references to post_import

* Make _condition_is_set more consistent

* Move CoreGottoServiceForm to integrations and refactor logic/imports.

* Make node history label more generic.

* Add afterMove() hook

* Max dispatch check should happen for simulations too

* Move _before_node_dispatch() error handling into the main try/except

* Move post_import() into EasyImportExportMixin

* Add a generic getDestinations() method to node types

* Simplify setting destination_service_id

* Use existing convention to inject registry

* Set limit to 2000 for max dispatch

* Add new skipped history status

* Dedupe queries for destination labels

* Ensure destination node validation considered deleted nodes.

* Ensure destination nodes are ordered per graph

* Set max dispatches default limit to 1000

* Only allow backward jumps.

* Fix ordering bug that caused non-default router branch nodes to not appear as a destination target.

* Fix migration

* Re-add lost commit from Jeremie - rename to after_import()
2026-07-23 20:57:19 +07:00
Davide Silvestri e6f2a44e85 chore: scale OpenTelemetry sampling and preserve traffic metrics (#5726)
* feat: scale OpenTelemetry sampling and metrics

* feat: add per-user invitation metric

* fix: monitor every queue in OpenTelemetry

* docs: explain retaining every eligible trace

* feat: retain all eligible traces with -1

* fix: address feedback; trace ActionType.do and several important handlers methods
2026-07-22 11:57:11 +02:00
alamin-br 322c95bc18 feat: monitor celery beat periodic tasks with Sentry crons (#5754)
* feat: monitor celery beat periodic tasks with Sentry crons

* fix: validate sentry exclude beat task patterns and correct docs example
2026-07-21 11:09:33 +02:00