Commit Graph
23 Commits
Author SHA1 Message Date
alamin-br 94e374dbac fix: don't open a linked row after its cell or modal is closed (#6992)
The linked row modal can be unmounted while it fetches the row, which
left its modal ref null and threw on show.
2026-12-02 13:50:20 +01:00
Davide Silvestri 23f328cb19 feat(database): assign identities to rows and mention them in comments (#6619)
* feat(database): assign and mention identities behind a field option

- Collaborator fields get `include_identities` and long text fields
  `long_text_include_identities`, both off by default.
- With the option on, active identities of the workspace can be assigned
  or suggested as mentions; they are shown with their icon and renamed
  in realtime, and they never receive notifications.
- Turning the collaborator option off backs up the column, deletes the
  identity assignments and strips identities from the view defaults, so
  the update can be undone.
- Identities can author row comments and be mentioned in them.
- Exports write an identity as `Name <identity>`.

* refactor: hide internal emails in collaborator exports through one check

* fix: import a personal view only for a person, without a query per owner

* fix: show collaborator identities with the icon of the user subject type

* refactor: drop a redundant local import of the core handler

* fix: unify identity icons and space field options

* fix: keep identity field menus and saved mentions readable

* fix: limit identity mention suggestions to row comments

* perf: prefetch available collaborators once per workspace

* fix: use workspace members as authors of generated rows

* fix: resolve linked collaborator values by member email

* fix: use workspace collaborators for field pickers and paste

* refactor: move identity avatar styles to the avatar stylesheet

* fix: address review feedback on identity collaborators
2026-11-18 22:53:44 +01:00
Davide Silvestri 42803f23ca feat: record and show the identity kind in history and pickers (#6620)
* feat: record and show the identity kind in history and pickers

- Snapshot the user type of the actor on row history, workflow history
  and audit log entries, and return it from their APIs.
- Show the identity icon in row and workflow history, list identities in
  their own section of the audit log actor filter and count them per role
  in inherited access.
- Load every identity in the team and access pickers through the
  paginated subjects endpoint, which now returns the workspace role.
- Give identities premium features from the workspace or instance
  licence instead of a seat.

* feat: record identity management in the audit log

Creating, updating and deleting an identity go through registered
actions, so the audit log shows who did it, with the identity's name and
role before and after an update. The actions are not undoable.

* fix: export an identity by its name in created by and last modified by

* fix: record the values an identity update replaced from the locked row

* fix: check the owner of an imported personal view without a query

* fix: show an identity with the avatar and icon of its subject type

* fix: audit an identity update by what it changed

* feat: include the actor's user type in the audit log export and tool

* test: cover a row history actor of an unregistered type

* test: name the history migration test after what it checks
2026-11-18 14:39:43 +01:00
Przemyslaw Kukulski 308919f3d4 fix: keep input made before the page finished loading (#6627) 2026-11-06 13:50:48 +01:00
Jérémie Pardou 93eeb19dcb feat: run Local Baserow integrations as Agents (#6064)
* Run Local Baserow integrations as Agents

* fix tests

* feat(core): add reusable subject options endpoint

* Add beta badge

* fix(audit-log): require actor type with actor id

* fix(audit-log): avoid duplicate actor export columns

* fix(audit-log): guard deprecated actor fields

* Restore the feature flag

* fix tab alignement

* fix(integrations): reject trashed authorized agents

* Fix migration conflict

* fix(audit-log): assert structured validation error

* fix(database): support agent row deletion trash entries

* fix(database): support agent row notifications

* fix(core): enforce subject option permissions

* chore: fix formatting after rebase

* fix(core): include agents in member totals

* fix(database): batch row history actor migration

* fix(integrations): handle trashed authorized agents

* fix(core): remove untranslated subject labels

* chore: move nodes around

* test: mock integration registry in AI agent service tests

* fix: resolve database migration conflict

* Add changelog entry

* feat: use typed subjects for local Baserow integrations

* fix: make audit actor migration retry-safe

* fix: retain historical audit actors

* Please linting

* fix: use canonical local integration subjects

* fix: order listed workspaces

* fix: validate current user integration authorization

* fix: preserve integration authorization on update

* docs: clarify migration deployment compatibility

* fix: paginate local baserow agent selection

* fix: validate selectable subject options

* fix: preserve integration authorization on update

* fix: show saved integration user in subject dropdown

* fix(enterprise): protect team subject options

* fix(builder): redispatch data sources for trashed agents

* fix(database): split row history actor backfill

* fix(enterprise): require audit log actor type

* fix(enterprise): use audit log actor options

* fix(core): prevent blank agent names

* fix(integrations): resolve migration conflict

* fix(integrations): pass SMTP preparation context

* docs: clarify migration rollout guidance

* fix: handle trashed integration subjects

* fix: reuse local integration authorization column

* fix: allow unconfigured local integrations

* fix: only update changed integration values

* fix: cache local integration subjects

* fix: sort field permission subjects by name

* fix: include historical audit log actors

* fix: center grow tab labels

* chore: remove unused AI providers flag

* fix: support agent file uploads

* Please linter

* fix: initialize integration edit values

* fix: preserve integration authorization updates

* fix: bound audit log actor pagination

* fix: support legacy local integration fixtures
2026-10-19 10:38:57 +02:00
Davide Silvestri ca2f3e1115 fix: keep public and restricted views in sync when linked-table changes move rows (#6339) (#6378)
* fix: keep public and restricted views in sync when linked-table changes move rows (#6339)

- Dependency cascades now send rows_deleted / rows_created to publicly shared
  and restricted views when a row leaves or enters their filters. The decision
  is made inside the transaction, from a before snapshot read under the row lock.
- Only tables with such a view filtering on a field the cascade changes pay for
  this. The check is an EXISTS inside the existing snapshot read, so other tables
  run the same queries as before and take no extra lock.
- Snapshot reads match ids read from the link tables with id = ANY(ARRAY(...)),
  which avoids a full primary key walk. A row the cascade updated before
  snapshotting it never gets an enter/leave decision.
- Fields a cascade changes without an UPDATE (link values) are tracked across
  the transaction. Views filtering on them are skipped, and those values are
  left out of rows_deleted. This replaces the cell_values_come_from_other_tables
  field type flag.
- Cascades over the realtime limit also refresh publicly shared and restricted
  views (force_view_rows_refresh), not only workspace members.
- On realtime deletes, the client removes rows it already holds by id. When the
  payload lacks a value it needs to place an unheld row, it leaves counts as
  they are.
- Creating a linked row from a link cell no longer sends a redundant PATCH,
  which failed in restricted views.

* test: keep only the essential #6339 tests and trim docstrings

Merge overlapping tests into shared builders and parametrized cases. Keep one
test per behaviour, and keep the exact security assertions. Cut new docstrings
and comments down to the non-obvious why.

* fix: keep a link created from the link-cell modal in the cell (#6339)

Skipping the redundant PATCH also skipped the only local write of the
new link, so a later pick or remove PATCHed a stale list and unlinked
the created row. The link is now applied locally through the same store
path realtime uses; only the PATCH is skipped.

* fix: let a cascade decide only rows nothing else wrote in the transaction (#6339)

A broadcast decided enter and leave from its first snapshot of a row
and cached the result, so another write in the same transaction made
it send rows or values a public or restricted view never showed: a
direct edit after the cascade, a row created or edited before it, the
other rows after close() split the broadcast, or a cascade inside a
savepoint.

The transaction's writes are now tracked per table. At commit, a
broadcast drops every row something else wrote: rows written directly
keep develop's direct-path events, and rows of a savepoint split or of
a bulk write get none. close() is gone.

Also pins the no-lock gate's filters_disabled and changed-link cases.

* chore: shorten the #6339 changelog entry
2026-10-19 09:39:10 +02:00
Davide Silvestri 89184e9b27 fix: stop editing rows hidden by restricted view filters (#6217)
* fix: stop editing rows hidden by restricted view filters

Cancel edits still queued for a row that the backend reported as hidden,
including pasted values, in grid, gallery, timeline, kanban and calendar,
so they are neither sent nor put back on screen. Close the row modal when
its row gets hidden in a restricted view; other views keep it open.

* test: cover builders and ignore broadcast order in restricted view tests

* test: add e2e tests for restricted view row visibility

Cover creating, editing, pasting and dragging rows in a restricted view
while the HTTP response is held after the server commits, the row modal
closing only in restricted views, and view default values.

* fix: hide rows created with the grid's floating add button when filtered out

createNewRowConfirmed used the single-row endpoint, which doesn't return
hidden_row_ids, so a restricted editor kept a row the view's filters
exclude. Create it through the batch endpoint and report hidden rows like
the other create paths.

* test: expect the batch endpoint for the grid's floating add button

* fix: cancel queued kanban edits when a drag hides the card
2026-10-08 09:23:06 +02:00
Davide Silvestri fc6bfb299b feat(database): format AI field text output as rich text (#6221)
* feat(database): format AI field text output as rich text

AI fields with text output can store rich text, reusing the rich long
text editor without mentions or images. New AI fields default to it in
the create form; existing fields, API clients and old imports stay
plain. Rich fields add a one-line formatting instruction to the prompt.

Also:
- forward row-modal edits of AI fields, which were never saved
- keep image markdown as literal text when images are off, instead of
  reducing it to its alt text and losing the URL on save
- escape user file image references as `![alt]\[name]` so a reference
  nested in another's alt text can't stay live
- return 400 instead of 500 when a PATCH would make a primary field
  rich text

Closes #6220

* fix: preserve reference image URLs in rich text

Defined Markdown image tokens carry their destination and title separately
from the raw reference marker. Keep that data as self-contained literal
inline text when image nodes are disabled, and align the preview behavior.

Add parser, AI row persistence, and browser regressions while preserving
internal file references and the existing inline-image path.

* fix: handle AI field changes during generation
2026-10-05 09:17:09 +02:00
alamin-br aedbdfcfd3 fix(database): guard grid against missing and stale cell values (#6207)
* fix(database): guard grid against missing and stale cell values

Grouped rows now get newly created fields, sorts treat a missing or null cell
as empty, and rich text cells tolerate a value of the previous field type.
Rows in collapsed groups resolve their group from the section key.

* fix(database): address review findings on grid cell guards

Key an undefined group value like null so pathFromKey can parse it, remove
deleted rows from collapsed groups, and sort present-but-undefined cells and
empty multiple select or collaborator formulas as empty.

* refactor(database): drop empty value for formula types that cannot be sorted

Multiple select and collaborator formulas cannot be sorted or grouped by, so a missing cell never reaches their sort.

* fix(database): sort zero in array formulas as a value

The element check treated 0 as missing, so [0] tied with [] and with other numbers.

* fix(database): keep grouped row caches shared and sort null cells as empty

addField now reuses one copy per row, so an edit reaches both sectionRows and
absoluteRows. The sort wrapper also replaces null cells.
2026-09-30 15:16:52 +02:00
dimmur-brw 5d0bef8f7a feat: enable image embedding in rich text fields (#5775) 2026-09-28 13:57:41 +02:00
alamin-br 2dd4defb3b feat(database): run a button click with external actions as a job (#6164)
* fix: keep every button action card in place after a save

A retyped action can keep its id, and an action created by an earlier
save still carries its client id, so the refetched list must keep the
client id of every buffered action rather than only the created ones.

* feat(jobs): let a job type choose its Celery queue

* test: assert the job enqueue through apply_async

* refactor(database): expose the button click pre-checks on the service

* refactor(database): share the button click payload and outcome mapping

* feat(database): run a button click with external actions as a job

* fix(database): map click races on the job and assert the audit entry

* feat(database): answer a click with external actions with a job

The request returns 202 and the job runs the sequence, so a slow endpoint
holds a Celery worker instead of a WSGI one.

* fix(database): give a capped click its slots back and cover the denied job

* refactor(database): raise a plain exception for a denied click job

* chore: consume the button_dispatch queue on the default worker

* chore: add the button_dispatch queue to the Zed worker launch config

* feat(database): wait on the job of an accepted button click

* fix(database): stop waiting on a button click job after a deadline

* test(e2e): a slow endpoint no longer blocks the grid during a click

* test(e2e): name the second-button test for what a single worker can prove

* test: assert the airtable import job enqueue through apply_async

* chore: changelog for the button dispatch job

* fix(database): keep the clicker's IP and session on a button click job

The audit log and analytics read both from the user, which the job only restores through these mixins.

* fix(database): fail a button click job whose field or table was trashed

* fix(database): serialize the busy check of a click with its job creation

Two racing requests could both see the cell free and each start a job, so a single worker sent every request twice.

Also drops the budget bookkeeping from the inline path, which no longer reaches outside Baserow.

* test: assert a refused dispatch check records no audit entry

* docs: say a button click job shares the default worker with realtime updates

Also adds the automation_workflow and button_dispatch queues to the example supervisor config.

* fix(database): check a button click job once more at the deadline

The job store stops polling before the deadline, so a job that finished unseen was reported as still running.

* test: cover an accepted click in the row modal and on a card

* refactor(database): ask the service whether a cell has a click in flight

The view queried the job table itself; the check belongs beside the
other dispatch rules in the service.

* fix(database): run only the action list a click was accepted with

The request checks and charges one list; the job re-read the field's
current one, so an action added while the job waited ran unchecked and
an added external one sent without a rate-limit slot.

* fix(database): keep queued button clicks sane across crashes, retypes and trash

A dead worker's job no longer blocks its cell until cleanup, a retype no longer deletes a queued job, and a trashed database refuses the click.
Core permission refusals use the API's wording. The cell lock is shared and the unused refund plumbing is gone.

* fix(database): stop a queued button click from sending twice or unchecked

A late or replica-blind click no longer repeats its requests, a retype to external is caught, and a quota refusal answers in the request.
Slots come back when no job row was written, and the stored answer is safe for jsonb.

* fix: keep polling a button click job after one failed poll

A click waits on the job store, which stopped for good after a single failed poll. A settled click's job is dropped so the store stops polling it.

* fix(database): stop a cancelled button click between actions

The owner can cancel a running job, and later actions still ran. The last job check at the deadline is bounded too, so a hung request cannot keep the button spinning.

* test: cover a job's answer reaching Open URL and a click edited while queued

* fix(database): let a click job finish when its button is retyped mid-run

The worker's save wrote the old field id back and failed. Timeouts and unmapped failures no longer name the job type, and a job that is already final leaves the store.

* fix(database): run button click jobs on the export queue

Review feedback: the celery queue is for fast tasks, and a new queue needs every self-hosted worker changed.
Also strips lone surrogates from the stored answer, moves the enqueue rules into the service and drops the unused websocket id.

* fix(database): drop a waiting button click on logout or table switch

A job can end minutes after the click, when its toast or Open URL no longer belongs to the page.

* chore: drop the changelog entry for #6134

The button field has not shipped yet, so there is no fix to announce.

* fix(database): point a click job at the base field

A retype deletes the button row, so a job pointing at it had to be
nulled first, and a click landing meanwhile failed the retype.

* fix(database): keep a button spinning for its job after a reload

The spinner only knew about clicks made in this page, so a reload
dropped it while the job ran and a second click got the 409 toast.

* fix(database): ignore a late job_started for a settled button click

On a single worker the broadcast reaches the clicking tab after the job
ended, and its started copy spun the button again until the next poll.

* docs(database): correct the dispatch signal and e2e comments

The signal's first send for a job click happens before the enqueue lock.
2026-09-28 11:13:42 +02:00
alamin-br b8caade86a fix(database): open new-tab URL buttons in Safari (#6171)
* fix(database): open new-tab URL buttons in Safari

Safari blocks window.open once the dispatch request has returned, so the
button opens the tab on click and the Open URL action navigates it.

* fix(database): take opens_new_tab from the field after saving actions

The action list is stale when refreshing it fails.

* test(database): match button flags by label, not list order

* fix(database): leave no empty tab for mailto and tel button URLs

Such URLs hand off to another app, so they navigate the current page and
the placeholder tab is closed. Covers opens_new_tab in the broadcast test.
2026-09-25 17:54:39 +02:00
alamin-br 9b4fbdff7e fix: button field follow-ups from the #6086 review (#6135)
* fix: keep a button action card open when its save finishes

A created action is keyed by its new id once the list is refetched, which closed the card while the context was still on screen.

* fix: give the button action error a line height

* fix: outline the selected button field cell

* fix: name the button actions that ran before one failed

Completed actions are not rolled back, and the old message left the clicker to assume nothing had happened.

* fix: disable a button field for users who may not click it

The dispatch operation is now scoped to the field, which is the only id a cell has to ask with. Roles attach no lower than the table, so one check on the field answers the same as one per action.

* fix: refetch permissions when a field is created or restored

A role on the table or database lists the fields it covers, so a field
added after the page loaded was refused by every field scoped check
until a reload.

* test: cover the disabled button in the row modal and on a card

* fix: keep a button action card in place while its save finishes

The refetched list keyed a created or retyped action by its new id, so
its card remounted and the editor scrolled to the top mid-save.
2026-09-23 16:00:14 +02:00
alamin-br 8d389cd0e8 fix(database): Show when a button field needs reconfiguring (#6114)
* feat: report when a button's row action points at the trash

* fix: keep a row action's mapping on a trashed field across edits

* fix: update buttons in other tables when their target is trashed

* feat: disable a button cell that needs reconfiguring

* feat: flag a row action that writes to a trashed field

* docs: describe the button reconfigure state in ADR 006

* test: cover a button healing when its mapped field is restored

* test: keep failing-click tests clickable under the reconfigure state

Give "Broken" and "BrokenChain" a table-targeting action that fails at
dispatch instead of one with no table, so requires_reconfiguration
stays false and the original click/toast assertions still run.

* perf: look up a button's own services in the reconfigure check

The uncorrelated subqueries scanned every upsert row service in the
instance, which the builder and automations share.

* perf: load mapped fields in one query when saving and serializing mappings

Update responses and realtime payloads read each mapping's field for
`trashed`, and saving looked each field up separately.

* fix: let undo restore the values of a mapping on a trashed field

The kept mapping was skipped, so replaying the exported mappings left its
current value and enabled flag in place.

* perf: skip the button lookup when no service depends on a trashed item

Every table and application created, and every field trashed, joined all
button fields and their actions even when no service pointed at it.

* fix: only offer restoring the field to heal a trashed field mapping

A permanent delete is cleaned up later without a broadcast, so an open
page never learns the action works again.

* fix: show the full label of a grid button that needs reconfiguring

The tooltip span shrink-wrapped the button, so its 90% max width
resolved against the span and cut the label short.

* fix: put a button using a trashed integration in the reconfigure state

The dispatch refuses a service whose integration is in the trash, so the
button now says so up front and open grids update on trash and restore.

* fix: update open grids when emptying the trash heals a button

Permanently deleting a trashed field or integration ends the reconfigure
state without any broadcast, so the cell stayed disabled until a reload.

* docs: note trashed integrations and permanent deletion in ADR 006

* fix: count a missing integration a button action needs

Deleting a trashed Slack bot left the action with none and re-enabled a
button that still fails. Also skips integrations outside a database, keeps
service lookups as subqueries, and stops a failed deletion leaking state.

* docs: note a missing required integration in ADR 006

* test: wait for a button field save to finish before moving on

The save sends the field update and each action call in sequence. A test
that navigated right after clicking Save could cancel the order call, so the
Stale button kept its old order and never navigated.

* fix: replace a row action's mappings with exactly what the payload sends

Keeping trashed mappings the payload left out stopped undo from removing them
and made undo raise on a mapping it had removed. The editor now sends them back.

* fix: leave the reconfigure flag out when the field refresh after a save fails

The mount-time value was written over whatever a broadcast had set since.

* fix: update buttons mapping a link field to a table that is trashed

Trashing a table trashes the link fields to it in other tables without a field_deleted signal.

* perf: send the buttons of a table in one message with their flags annotated

Every field_updated refreshes the grid, and an unannotated button cost queries of its own.

* fix: put a button whose target table is in a trashed workspace in the reconfigure state

An action can target a table in another workspace, and the dispatch refuses one whose workspace is trashed.

* fix: leave the buttons of a new table or database out of its broadcast

Duplication, template installs and imports send the created signals too, and nobody has the copy open.

* perf: pair each button service lookup only with the actions it backs

Also stop the early check deduplicating its UNION, and test that permanently deleting a builder integration never looks up buttons.

* fix: name each action that needs reconfiguring in the button editor

The field flag is now whether any action has the per-action flag, so the
editor can point at a trashed table, database or integration too.

* fix: keep the button flags out of the cached table model

They depend on other tables, so a model cached for the button's table served
them stale. They are now annotated only where fields are fetched to serialize.

* test: make the shared grid view private again after the public view test

A public view hides a field created in it until its editor closes, so the
retry test that runs later never saw its column.

* fix: update buttons mapping a link field to a table deleted from the trash

Deleting the table deletes the link fields to it and their mappings, with no signal of their own.

* fix: send a restored workspace's dependent buttons once and leave its own out

The once-per-restore check now keys the waiting on-commit callback by workspace id instead of relying on a shared Workspace instance.

* perf: leave a button's action state out of a service's table schema

The grouped aggregate rebuilds that schema uncached per property, and each
flag now cost a query per button. Nothing reads them from the schema.

* refactor: read an action's reconfigure flag straight from its definition

* fix: update buttons mapping a link field whose related field is purged

Emptying the trash for a link field also deletes its related field and that
field's mappings, which left buttons mapping it disabled until reload.

* fix: drop a mapping whose field was deleted from the trash on save

An open editor or an undo still sends the purged field's id, so every save
failed until reload. Fields that still exist elsewhere are still refused.

* fix: match no button for a lookup with no action model

An empty model list left the action filter empty, which matched every action
and would have sent every button in the instance.

* test: describe mappings replaced by the payload after a table change

The table change test sent no mappings, so it did not show a new table's
mapping replacing the old table's trashed one.

* fix: name a button action's trashed table instead of its fields

Trashing a table marks all its fields trashed, so the editor asked to restore a
field that only restoring the table brings back. The 404 from the fields fetch
now marks the table missing, and the action says so rather than a toast.

* fix: drop a mapping on another workspace's field instead of refusing it

Refusing it told the editor that the field exists.

* perf: send a button's state on its own realtime message

A `field_updated` makes the client refetch the whole grid, which for a flag
that says nothing about the rows throws away what someone is typing. The
signal also gives the enterprise restricted views a place to mirror from.

* fix: update buttons when a workspace is purged without being trashed

`delete_expired_users` and the admin panel delete a workspace outright, so
the `workspace_deleted` that would have flagged the buttons pointing into it
never goes out. A snapshot's application expires the same way.

* fix: flag an update row action that names no row

Every click on it is refused, so to the person clicking it is no different
to a target in the trash, but the button stayed enabled.

* fix: clear the server's reconfigure verdict when an action is edited

It describes the action as it was read, so the warning stayed up after a fix
until the save landed. Changing the type already dropped it by rebuilding.

* docs: name every cause of the button reconfigure state

The field and action descriptions each left one out, so they disagreed with
ADR 006 and with each other.

* test: expect the rowless button to render disabled

The server now flags an update row action with no row id, so the click the test made never lands.

* perf: serialize button fields once for all restricted views

Each serialization runs the reconfigure and action queries, which repeated for every view.

* perf: skip purged buttons and merge purge broadcasts

Buttons deleted with their container were collected for nothing, and a workspace purge
also purges its tables, so one button could be sent twice.

* fix: bump the global cache version

The button field schema dropped its action state, and cached schemas would keep the old shape.

* fix: keep the reconfigure verdict while the integration is unchanged

A trashed integration is missing from the list, so the verdict is the only warning.
2026-09-21 14:29:18 +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
Davide Silvestri 64639afc29 fix: validate required duration form fields while editing (#5974)
* fix: validate required duration while editing

Validate the parsed duration copy while the editor is active instead of the stale parent value, which is only updated on blur. This lets valid required values save while preserving untouched-required and invalid-format errors.

* chore: add changelog entry for #5741
2026-09-02 15:51:49 +02:00
alamin-br 821a3d4991 feat[3/6]: Chain a button action's result into the ones after it (#1722) (#5951)
* feat: chain a button action's result into the actions after it

A click runs its whole sequence in one request, so each action's result is
kept on the dispatch context and read back by a new `previous_action` data
provider. The builder needs a cache keyed by a dispatch id because its
browser dispatches one action at a time, and automation reads results from
workflow history; neither applies here.

The store lives in the context's cache rather than on the context itself.
`clone()` rebuilds the context through `__init__` and only copies the cache
dict, so a plain attribute would give every clone its own empty one.
`start_action` deliberately leaves it alone: the row is re-read per action,
results are what the rest of the sequence chains from.

* feat: remap a previous action reference on import

A chained reference names an action by id, so duplicating a field, a table or
an application has to point it at the imported copy. The action id is remapped
through the import mapping and the rest of the path handed to that action's
service, the way the builder and automation already do.

A reference to an action outside the import is left as it is rather than
raising, so a partial import stays loadable.

* feat: reference an earlier action's result from the button editor

The data explorer offers an action what the actions before it return, and
`open_url` can build a URL from one. An action is only ever offered what
precedes it in the list, so a reference always points backwards.

An action that has never been saved carries no service schema, so its output
is derived from the target table's fields, which the action forms now report
up to the sub-form. It is referenced by its client id until the save, and the
creates go out in list order rewriting those ids to the real ones as they are
handed out, so no client id ever reaches the API.

A dispatch result is keyed by field name, and the browser has no way to map a
`field_<id>` onto a table that is not the clicked row's, so each result now
carries the names of the fields it returned.

* fix: let a button's URL reference an earlier action

The form names its own data providers, which overrides what the sub-form
injects, so the URL field never offered `previous_action` and the chained
URL could not be configured at all. The unit tests covered the provider and
the click path but never the form, which is what let it through.

Naming the fields of a result costs a table model per action, so it is only
done when there is a client action to read them.

* feat: mark a button action the click would fail on

Chaining multiplies the ways a configuration can be wrong, and until now
nothing said so until the button was clicked. An action with no table, a URL
action with no URL, and one referencing an action that no longer runs before
it are each marked, with a warning on the list.

A stale reference is marked rather than cleared, following ADR 006 section 8:
moving the action back makes it valid again, and clearing would throw away a
formula the user wrote.

It stays a warning rather than a validation gate, since a half configured
action is a normal state while editing and the field already saves either way.

* chore: drop the button field's url_formula column

Phase 2e stopped reading and writing it and backfilled every value into an
`open_url` action. Nothing has read the attribute since, so the column goes.

Safe to drop now rather than a release later: no released version has it.
2.3.3 carries no button field at all, and phases 1 to 3 go out together, so
there is no older process still writing the column during a rolling deploy.

The backfill helper stays where it is, since migration 0216 imports it and
has to keep running from scratch. Its test goes: it wrote to the column with
raw SQL, which there is now no column for.

* docs: record the phase 3 decisions in ADR 006

Section 2 gains why the frontend-last execution split is safe under chaining:
the explorer is scoped by list position, so an action can only ever name one
that has already run.

Section 4 gains where results live and why it differs from the other two
modules, and the field name mapping the response carries for a frontend-only
action that references a table it has no fields for.

Section 2's url_formula paragraph now says the column is gone rather than
pending, with the reason it could go a release early.

* test: cover context chaining end to end

Nine cases on the existing button field suite, chosen for spanning something
no unit test reaches: a URL built from a row a server action just created, the
data explorer through the whole provide chain, two brand new actions chained
in one save, a saved action pointed at one created beside it, a forward
reference marked and healed, and a failing action refusing to navigate.

Two backend cases go with them, both from shapes the suite seeds: a reference
to an action whose service has no table, and one pointing forwards.

Dragging an action is verified rather than assumed. How far the pointer has to
travel depends on how tall the target's form is, so the helper drops once,
checks the order really changed, and tries a different landing point if not.

The derived schema now names the row id "Id" like the backend's does, instead
of "Row ID", so the node stops renaming itself the first time an action is
saved.

* test: cover a three deep chain and a duplicated one

The third action reads the first, skipping the one between, which an
off-by-one in the position scoping still satisfies with only two actions.

The duplication test gains the chained case rather than duplicating this wide
table a second time: the copy's URL action has to name the copy's create row
action, and the copy has to still be clickable, which remapping alone does not
prove.

The test that saves a built chain gets a button field of its own, so it no
longer shares one with the test that builds a chain and throws it away.

* test: match a table name whole when picking one

"Tickets" also matched the "Tickets 2" that the duplication test leaves behind,
so the dropdown resolved to two items and Playwright refused to click either.
It only showed up in a full run, since duplication happens earlier in the file
than the test that picks a table.

* test: a write only field is not offered out of a created row

The derived schema filters them, but nothing asserted it. Verified alongside
the dispatch result masking a password to a boolean rather than the hash,
which is what the decision to document rather than rebuild the exposure
machinery rests on.

* fix: fail a chained read of a field that no longer exists

Reading a deleted field resolved to nothing and the click carried on, writing
a blank over whatever the target row held. The provider raised when the
referenced action was missing but not when the field was, so the two halves
disagreed, and the row provider already raises in the same situation.

A key absent from the result means the field is gone and now raises. A key
present holding null is a legitimately empty cell and still resolves to null.
Reading any path out of an action that produced no row at all, a delete for
instance, raises for the same reason.

Found working through the phase 3 verification checklist, item R12.

* test: cover explorer scoping for reorder, deletion and open_url

Four cases the desktop browser cannot show, because the field editor's popup
runs past the bottom of the viewport whatever the window size: the third action
seeing the first two, reordering changing what each is offered with no save,
a deleted middle action leaving the tree, and a URL action between two others
contributing nothing.

* test: cover reordering unsaved actions, and drain rows between tests

An action added, pointed at another added beside it, then dragged in front of
both, so the creates go out in an order the list no longer matches. The saved
formula has to name the middle action rather than the one dragged past it.

`resetRows` deleted a single page. `listRows` caps at 200, so once the shared
table grew past that, resets left a backlog and later lookups returned old rows
instead of the ones a test had just created. It drains in pages now. That is
what the intermittent failures in the chained tests were, not contention.

The viewport widens again for the two fields this adds; the grid renders only
the columns that fit, so a column past the edge never appears at all.

* fix: keep a button's buffered actions when a reference cannot be resolved

An unresolved reference threw a bare error. `notifyIf` presents an error only
when it carries a handler and rethrows anything else, so the throw escaped
before the caller could flag the failure. The editor then closed and reset,
discarding every buffered action edit, with no toast to say why. The guard that
exists to keep those edits on screen never ran.

The error now carries a handler that raises a toast, so a save that cannot
resolve a reference fails the way any other failed save does and the user keeps
what they were editing.

Adopting the ids handed out before a failure now rewrites the references to
them as well. Without that a retry met a client id whose action was no longer
being created, so nothing mapped it and the save could never succeed.

* fix: refuse a broken chained reference in the browser too

The backend raises for a reference to an action that did not run or a field
missing from its result. The browser resolved the same reference to nothing,
and a URL built from it opened with a hole in it, which is the failure this
phase exists to avoid. It now refuses them the way the backend does, so the
click reports an unusable URL instead of navigating.

Only a real click carries results. The editor resolves formulas for its own
preview before anything has run, so that path still resolves to nothing.

Naming a result's fields is skipped for an action that returned no row, a
delete for instance. It cost a table model per click to build a mapping the
browser could never resolve anything against.

* fix: describe the table an action points at now, not the one it was saved with

The editor buffers a table change without clearing the schema the API returned,
so the explorer kept offering the previous table's fields. Picking one wrote a
field reference that no longer existed anywhere, and the click then failed. The
fetched fields describe the table selected right now, so they win; the saved
schema is only a fallback for an action whose form has not fetched anything.

A reference was matched anywhere the words appeared, string literals included,
so a URL ending `/docs/previous_action.html` captured `html`, failed the check
that a reference resolves to a number, and left the field impossible to save
behind a toast about an action order that was never the problem. A path opens
straight after its quote, so requiring one keeps the match off ordinary text.

The list-returning branch of the provider indexed into its result before
checking it was one. No action type reaches it yet, and the guard is a line.

* refactor: type an unsaved action's fields, and match the base argument order

Every field of an action that had never been saved was typed as a string, so a
file or link row field showed as a leaf with nothing under it and then changed
shape the moment the real schema arrived. Only the types that decide whether a
node can have children are worth deriving, and they are taken from a schema the
backend generated rather than guessed: a number field really is a string there,
because the API returns it as one.

`getDataSchema` took its arguments the other way round from the base class and
from the builder's types. It has one caller, so nothing was wrong today, but
anything reaching for it through the base signature would have read a schema
off the wrong object and quietly returned nothing.

* fix: mark a reference to an action that no longer returns a result

Changing an earlier action to Open URL or Delete row kept its id and its
place, so nothing warned, yet the dispatch fails the whole click on a
read of it.

* fix: fail a previous action read outside a click, rather than crash

Both database providers share a registry, so an AI prompt formula could
reach this one through a context that carries no cache.

* perf: name a table's fields once per click

Every dispatched action rebuilt the table model to name the same fields,
which on a wide table is the expensive part of the response.

* fix: only offer a client action what really ran before it

Client actions run last whatever their place, so the response carried
every server result and the browser resolved references the dispatch
would have refused. The result now says where its action sat.

* perf: check each action's configuration once per render

Every rendered row asked for its error twice, and the warning banner once
more per action, each walking the whole config.

* test: say so when rows cannot be drained between tests

Falling through at the pass cap left behind the very rows the loop
exists to remove, so a suite failed later on a stale lookup.

* feat: collapse a button field's actions, one card at a time

The list showed every action's form at once, so a button with three of them
did not fit the editor and the data explorer opened over the list rather
than under the input it belongs to. Cards now open one at a time, the way
the builder's event list does.

The form is hidden rather than unmounted: it registers into this form's
chain and emits its defaults on mount, so tearing it down on collapse would
change what a save sends. A misconfigured action's message stays outside the
collapsible part, so it can be found without opening every card.

* fix: read an action reference only where a formula asks for one

A quoted literal that begins with the same word, such as the second argument
of concat('https://example.com/', 'previous_action.tmp.id'), was counted as a
reference to an action named tmp, which has no id and so blocked the save.
The pattern now anchors on the get( the reference must sit inside.

The walk also no longer descends into schema, context_data and
context_data_schema. Those formulas describe the selected table rather than
anything the user typed.

* fix: hold back a new action's error until the form is touched

An action is invalid the moment its type is picked, since it is configured
afterwards, so the warning appeared while the user was still filling it in.
The rest of the form only reports errors once touched, and this now follows:
Save, Create, or adding another action reveals them.

What the editor loaded is marked on sight, because an error there describes
config that is already saved.

* fix: keep a field's editor open when its actions fail to save

The field is created before its workflow actions can be, so a failure there left a field behind and closed the editor on the configuration. The editor now stays open on the edits and a retry saves them against the field that was made.

* test: cover retrying a new field whose actions failed to save

* fix: refuse a previous action reference that names no action

get('previous_action') has nothing to read. The API now rejects it while validating the formula, and the provider fails as a formula error rather than crashing on an empty path, so one saved earlier reports a dispatch failure instead of a 500.

* fix: fail a reference to a field the previous action no longer has

A path names a field as field_<id>, and the service turns that into the field's name. A field the reference outlived is left as it is, so a field named literally field_<id> answered for it and the click wrote the wrong value.

* test: cover a click that references a field the chain no longer has

* fix: tell two actions sharing an order apart by where they ran

Concurrent creates can hand two actions the same order, which execution then breaks by id. A client action compared orders to decide which results it may read, so it dropped one it was entitled to. The dispatch now returns the position each action ran at, on both the results and the client actions.

* docs: describe an action's dispatch position in the API schema

* fix: stop a click's client actions once one could not run

Open URL reported an unusable URL with a toast and returned, so the action after it still ran and could navigate away, taking the message with it. It now says whether it ran, and the loop stops when it did not.

* fix: open the card that is blocking a save, and reach it by keyboard

A collapsed action blocked the save with nothing on screen, since an invalid formula renders no error element to scroll to. Submitting now opens the first card whose form refuses what it holds. The collapse control and the drag handle also take focus, and the handle reorders with the arrow keys, which was mouse only.

* test: name a provider that really is unknown, and cover the url_formula upgrade

The duplication test used previous_action, which this branch registers, so duplication remapped the id and the test failed on its own. It now names a provider nothing registers. The helper level migration tests are replaced by one that runs 0215 to 0217 and proves every url_formula shape becomes an Open URL action before the column is dropped.

* test: expect the open url action to report that it did not run

* test: cover the lazy warning for a newly chosen row action

* test: cover a chained reference through a mapping and through a first save

A field mapping's value is a formula the service does not remap itself, and a reference between two never saved actions is rewritten from the ids the server hands out. Both were only covered end to end.

* perf: stop every formula input rebuilding its explorer on each keystroke

The action form copied the context it was given, which read the parent's getters and made the actions list a dependency of the provided object, so the object changed identity on every edit. It now delegates to the parent instead. The function nodes, which come from the registry rather than from anything being edited, are also built once per input rather than on every rebuild.

* fix: describe a composite field down to its children in the explorer

* refactor: drop a field name cache the table model already provides

* refactor: let the service type name its own missing table

* fix: fail a click that reads a result no action was recorded for

* fix: wrap an action's error instead of cutting the sentence short

* fix: point an imported path's tail at the action its head was remapped to

The remapped id was written straight over action_id, so when the lookup that
follows found no such action the path came back naming the imported copy with
the field id of the original. That field does not exist in the copy, and every
click on it failed.

* fix: report the field a retry patched, not the one it started from

A successful retry hid the editor without clearing createdField, so onHidden
ran as though the retry had been abandoned: it reset the form a second time
and handed the parent the copy taken when the field was first made, before the
retry patched its name, label and type.

* fix: keep two actions the server forgot from sharing one id

An action deleted by someone else is created again, and came from the server
with no client id. Both were keyed by that same undefined, so the second
create overwrote the first and every clientId-less action then adopted the one
id left, which the next save reconciled as two updates to one action.

* fix: forget a table whose fields could not be fetched

A failed fetch left the table unregistered, so the explorer fell back to the
schema of the last save, which describes whichever table the action pointed at
before. It went on offering those fields for as long as the fetch kept
failing, and a formula built from one fails the click.

* perf: read an action's references without copying it

Checking a reference ran the action through _.omit, which copies what it keeps
all the way down, so every keystroke cloned the saved schema of every action on
the field. The walk only reads, so it now visits the same keys where they are.

* test: cover a re-run of the url_formula move, and a reversed empty one

Two cases the helper level tests had were lost when they were replaced. The
column stores its keys in either order depending on whether it was written
from a string or a dict, and a re-applied migration must not stack a second
action on a field it already moved.

* fix: let a service that cannot name its fields answer for its own path

Only a table service defines get_table_field_objects. Any other kind reaching
this check raised an AttributeError, which is not a formula error, so the click
would have 500ed rather than reporting itself. Guarded the way the sibling that
makes the same call already is.

* docs: say that a dispatch position can be absent

Both sides of the response take their position from a dict that is empty when
the click ran no sequence, so both can be null. The schema promised an integer,
and a generated client reads null as a type error.

* fix: raise for any segment a previous action's result does not carry

The frontend provider only raised for a `field_` segment, so any other one
resolved to nothing, left a hole in the URL and opened it anyway. The backend
raises for whatever the result does not carry, and the explorer shows field
names, so a formula naming one was easy to write and silently wrong.

* fix: refuse a composite value in an open url formula

A previous action's result comes back raw, so a single select, link row or file
resolved to an object. `concat` turned it into JSON, and the URL parser read the
result as a relative path, so the click opened a URL built out of a field's
internal shape.

* test: cover a path that reaches inside a composite value

Only the leaf reaches the URL, so a deeper path is not itself a composite and
must keep resolving.

* fix: stop a cancelled edit hiding a saved action's error

The list stays mounted between opens and its pristine flag is keyed by a saved
action's id, so retyping an action and then cancelling brought it back as it was
stored with its own error still suppressed.

* fix: mark a table whose fields could not be fetched

Registering an empty list said two other things by accident: that the table has
no fields, and that whatever another action had fetched for the same table was
gone. A marker keeps those apart, and a failed fetch no longer overwrites a list
that arrived fine.

* fix: read a previous action reference from the parse tree

A regex cannot tell a reference from a string that reads like one, and it only
matched a lowercase get. An uppercase GET was a working reference the editor
never saw, so a stale one went unmarked and a client id reached the API. The
tree says which get() calls are real, and the ids are spliced by offset so the
rest of the formula is untouched.

An unparseable formula falls back to the regex for the save guard only, which
errs towards refusing the save rather than letting a client id through.

* fix: finish a retried field creation the way the first attempt would

Three things the retry path did differently from the create it continues. The
patch went out under no undo group, so undoing the create trashed the field and
left the patch nothing to undo. The field was committed straight away instead of
through a callback, so the parent never refreshed its rows, which shows when the
retry also changes the type. And dismissing the popup mid save reported the
field a second time.

* fix: address review findings on the button field editor

A close that lands while a save is running is now held and reported once
the save settles. Before, `@hidden` was dropped and never fired again, so
a failed save left the field with no owner and the context still holding
it: the next create patched that field instead of making a new one.

An action the server has forgotten keeps the id it had while it is created
again, so the actions naming it follow it to its new id rather than
pointing at nothing. The card the user has open follows the same way, so a
save that stops part way no longer closes it.

The previous action provider now refuses a write-only field the way the
row provider does, and says a context runs no sequence rather than
reporting the reference as one that has not run yet.
2026-08-28 18:16:42 +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 3a4a57246d fix: use the official TipTap Markdown extension and fix newlines disappearing (#5721)
* fix: use TipTap Markdown for rich text fields

* fix: escape markdown at line starts only and skip saves without edits

* perf: skip the preview markdown round-trip when no empty paragraphs are possible

* fix: address feedback; add docs

* fix: copilot feedback

* fix: copy one cell, paste in edit mode in another one
2026-07-22 12:02:53 +02:00
dimmur-brw 384aeac0aa fix: prevent link row modal from unlinking newly created rows (#5736) 2026-07-20 12:59:26 +02:00
alamin-br 633f1c4b7d feat: remember last-opened row sidebar tab (comments/history) (#5687)
* feat: add helper to persist row edit modal sidebar tab

* test: spy on real localStorage so error-path tests exercise the catch

* feat: remember last-opened row edit modal sidebar tab (#2532)

* fix: persist the genuinely last-opened row sidebar tab

* chore: add changelog for remembered row sidebar tab

* refactor: tidy sidebar tab snapshot and assert no write on default mount

* refactor: address PR review — explicit no-op catch, shared localStorage test mock

* refactor: harden localStorage test mock with null-prototype store

* fix: keep sidebar tab preference when props deactivate it on a reused instance

* refactor: simplify sidebar tab persistence to a single reactive property
2026-07-09 15:56:41 +02:00
alamin-br 636691c4d5 fix(web-frontend): correct link row "Add new" create modal behavior (#5481)
* fix(web-frontend): correct link row "Add new" create modal behavior

* chore: add changelog entry for link row create modal fix and simplify logic

* refactor(web-frontend): make null case explicit in URL formula toHumanReadableString

Replace scattered optional chaining with an explicit early return for
null/undefined values, per review feedback on #5481.
2026-06-15 12:57:11 +02:00
alamin-br 7872562e53 fix(web-frontend): Show unnamed row label in row history instead of (#5467)
empty boxes
2026-06-05 12:54:50 +02:00