mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 00:08:25 +00:00
stop-reporting-builder-custom-code-errors
55
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5fd3296e16 |
fix: Update ADR for Workspace integrations (#6981)
* Renumber the workspace-level integrations ADR to 017 and mark it accepted * Correct ADR 017 where the endpoint list and the promotion of Local Baserow integrations differ from the code |
||
|
|
d7e2c3f635 |
chore: remove core and WAB feature flags shipping in v3 (#6903)
* chore: remove core and WAB feature flags shipping in v3 * docs: drop stale feature flag mentions from invitation link comments * docs: add missing changelogs for released core features * docs: mark identities ADR as accepted * chore: remove the identities feature flag * docs: add changelog for workspace identities * test: remove obsolete identity feature flag test * docs: remove stale identities feature flag references --------- Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com> |
||
|
|
250748c8dc |
feat: Workspace level integrations (#6547)
* Add ADR-013 for workspace level integrations * Add implementation * Improve context section and remove technical points * Move bulk replacement point to v2 * Remove workspace-level ownership on import since manual promotion should handle this. * Add a glossary section * Do Lazy creation + Celery migration * Remove demotion * Tighten the Options considered section * Add Decision describing where the integrations are managed * Update implementation plan after changes to ADR * Sync plan and adr * Rename adr and implementation * Add the shared application that owns workspace integrations * Create the shared application of every workspace * Let only workspace admins manage workspace integrations * Let applications use the integrations of their workspace. * Trash workspace integrations in their workspace. * Copy workspace integrations into exports and keep them in duplicates. * Workspace admins can share integrations with every application in the workspace. * Load the shared application of each workspace in the frontend and keep it out of application lists. * Manage workspace integrations from an Integrations page in workspace settings. * Offer workspace integrations in the integration dropdowns of every application. * Move promoted integrations to the workspace list in other open tabs. * Let admins make an app's integration available to the whole workspace from its integration settings. * Preselect a workspace integration for new nodes and data sources when the app has none of its own. * fix tests * Delete implementation file * More fixes after rebase * Fix tests * Let builders of an application see and use the workspace integrations from it. * Show the workspace integrations, read-only, in the integration settings of applications. * Keep a dashboard's integration out of promotion to the workspace. * Leave the shared applications out of the admin dashboard's application count. * Create the shared application of the workspaces made by the fill commands. * Say in the promotion modal that an integration nobody authorized will run as the promoting admin. * Say in the promotion modal that undoing it won't make the integration run as the previous person again. * Ignore integration ids in sample data when publishing copies the workspace integrations an app uses. * Let only undoing a promotion move an integration out of the workspace. * Let the shared application backfill stop itself after 5 minutes and skip workspaces another transaction has locked. * Say in the workspace integrations settings that published applications and workflows keep their own copy until they're published again. * Leave the shared application out of the assistant evals' application counts. * Refresh the workspace integrations when the Builder's data, events, users and integrations panels open. * Say that anything new using a promoted integration blocks undoing the promotion, even from its own application. * Warn when a database button sends through a workspace integration with no host or token. * Refuse roles and invitations on the shared application. * Fix tests * Show an application only the workspace integrations of types it can use. * Say in the promotion modal what builders of other applications can do as the integration. * Leave the shared application type out of the API docs for creating and updating applications. * Check who receives a workspace integration event in one permission call. * Say which workspaces have a shared application and who creates it. * Let a redone promotion record what uses the integration again. * Update docstrings * Stop template visitors from listing the integrations of the template's workspace. * Let database buttons find their own copy of a workspace integration after an import. * Say what holds the workspace row lock while a shared application is created. * Fix tests * Stop the workspace integration form component from being made reactive. * Make test runs use a new copy of the workflow after an integration it uses changes. * Hide the Members settings tab from members who can't list the workspace members. * Add changelog * Fix migration conflict * Fix migration conflict * Fix test * Update comments and ADR number * Link to the workspace integrations from the sidebar's Settings menu. * fix: refresh agent action errors when workspace integrations change * fix: move workspace integrations into workspace settings * fix: use share icon for workspace integration promotion * refactor: use explicit shared application relations * feat: centralize default integration selection * refactor: share integration change notifications * refactor: prepare integration mappings before import * refactor: collect integration references during export * refactor: prepare integration ownership changes without a new hook * test: restore registered service model after mocking * test: cover shared integration defaults in Builder * test: include Slack in Agent workspace integration choices * Fix migrations * Stop template visitors from listing the workspace integrations through an application of the template. * Only offer integrations of the user source's integration type when updating a user source. * Say the workspace integration copy means published Application Builder apps and automation workflows. * Use the same spacing under both integration settings sections and enlarge their headings. * Keep the shared application out of automatic snapshot schedules. * Fix test after rebase --------- Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com> |
||
|
|
2659033445 |
feat(agent): website widget channel (#6884)
* feat(agent): serve a website widget channel and its embed script A website widget is a public chat a website opens in a panel from a button. Its model extends the public chat's with the button's text and corner and never has a password. GET /api/agent/public-chat/<slug>/widget.js returns the button's script with the widget's settings written in, cached for five minutes. ADR 016 records the decision. * feat(agent): add website widgets in the Channels section Channel types now come from a frontend registry: "Add channel" opens a menu of them and each card shows its type's form. The website widget's form has the embed code and the button's text and corner, and shares the title, welcome text and appearance with the public chat. Embedded in the widget's panel, the chat page fills it with its background, keeps text readable on a dark one, and asks the widget to close on Escape. * fix(agent): copy only a channel type's own settings Export and import copied the public chat's appearance fields for every public chat type, so an imported widget kept a background it can't show or change. Each type now lists its appearance fields once, and copies use that list; the password follows the same rule. The widget's chat URL is built with get_embedded_share_url, so a share URL ending in / works. * test(agent): run the widget script on another website An e2e test embeds the widget on a page from another origin, with markup as the button text and title, and checks both show as text and the chat opens in the panel. * fix(agent): backend default button text, focus the channel menu, keep widget names visible A new widget gets its button text from the backend only, as one created through the API does. "Add channel" moves focus into its menu like the other menus, and a card's type label gives its space up before the name. A test covers choosing Automatic to clear a colour. * fix(agent): visible hover without an accent, no suggestions while a message is locked Without an accent colour the chat's buttons darken on hover as the member chat's do, and custom accents get the stronger hover again. The member chat hides suggested messages while the message box is read-only for a pending or failed send, since a click couldn't change it. * test(agent): serve the widget test's website on loopback CI's Chrome blocks a public page's scripts from loopback, so the routed website never loaded the widget. |
||
|
|
dcf2ce57b4 |
feat(agent): let people outside Baserow talk to an agent through a public chat (#6864)
* docs(agent): add ADR 016 on agent channels A channel is a place outside the agent's own page where people talk to it and get its replies. It is its own concept beside triggers: a trigger reacts once to an event, a channel carries a conversation that continues. * feat(agent): add channels and replies with no member behind them A conversation a channel started is shared, has no owner and holds visitor messages. Its replies run on the channel's authority and stop once the channel is off, trashed or deleted. A reply that can call tools keeps its text out of the stream, so nothing written before a tool call reaches a visitor. Members can read such a conversation, filter for it and decide its held calls, but not write in it. * feat(agent): add channel types, the visitor service and the channels API Channel types are a registry and each type keeps its own data in a subclass. Builders list, add, change and delete an agent's channels, with audit actions and trash. One service holds everything an anonymous visitor may do. * feat(agent): add the public chat channel with its visitor API A public chat is a page with its own link and an optional password. Anyone with the link talks to the agent through an anonymous API that shows a message's text only; a signed token says which conversation is theirs. * feat(agent): show visitor conversations to members A conversation a channel started reads "Started by a visitor" in the list and can be filtered. The visitor's messages sit on the right under their label, and the composer gives way to a note, since members don't write in it. * feat(agent): add the public chat page The page a visitor opens from the link: the title and welcome text, the conversation, and a password form when the chat is protected. It keeps its tokens in local storage and recovers a reply through one sync path, so it never stays on the typing dots. * feat(agent): add the Channels section to the agent configuration A builder adds a public chat, copies its link, sets a title, a welcome text and a password, switches it off or deletes it. The link and password controls match the ones shared views and dashboards have. * feat(agent): edit the public chat's welcome text with the rich text editor The card shows the text formatted while it is written and saves it as markdown. The public page shows it read-only with the same component, so the builder sees what the visitor gets. * feat(agent): give channels and visitor conversations their own icon The person icon marks a private conversation and the globe the HTTP trigger, so channels use two bubbles: a conversation with someone outside the workspace. * fix(agent): harden public chat replies, sends and exports after review - A reply that can call tools keeps no draft: when it fails, is stopped or waits for approval, the visitor sees nothing rather than text it wrote before a tool call. - One rule decides whether a channel can be used, for the visitor API and for the worker before a reply starts or resumes, licence included. - Visitor sends can be repeated safely. A lost first message is recovered only with a secret key the page generated, never with ids members can read. - Visitor conversations never become template examples, even when pinned. - Visitor responses are never cached, and passwords are taken exactly as typed when set and when checked. * fix(agent): harden the public chat page and Channels section after review - The page sends a secret key with the first message and ids with the next ones, so a resend after a lost answer runs nothing twice, and shows each message once. - It asks for a password when the chat became protected, retries a failed first load with backoff while saying so, and shows a stopped reply. - The password modals wait for the server before the switch changes. - In a workspace without Advanced or Enterprise a card only allows switching the chat off and deleting it. - The welcome text is checked against its limit before it is saved. - In a visitor's conversation the reject dialog says the visitor may see the reason, and the conversation filter is named Channels. * fix(agent): fit the Permissions section description on one line * fix(agent): open a protected public chat only once the server grants access The page took a stored token as proof of access and guessed a refused one from an empty title, so a failed info request after the password showed a blank chat. The info endpoint now says whether the request has access, and the page shows the chat only on that answer. * fix(agent): open a protected public chat without flashing the password form The server renders the page without the visitor's token, which only the browser keeps, so a saved session showed the password form until the info reloaded. The page now shows neither the form nor the chat until the browser has checked its stored token. * fix(agent): read the public chat from the primary database A replica can lag behind a chat that was just switched off or given a password, so visitors could keep using it until the replica caught up. * fix(agent): cap the length of a public chat password guess * fix(agent): back off syncing a public chat reply that waits for a member A reply can wait for approval for hours, so the visitor page now checks less often, up to once a minute, and right away when the tab is shown. * fix(agent): refuse an agent message's uuid sent again by a visitor A visitor and the agent both write without a sender, so a visitor resending an agent message's uuid and text got it back as accepted, with no reply after it, and a 500. The retry now also needs the role of the sender. * fix(agent): keep syncing a resent public chat reply that waits for approval A resend can get back a reply without a run, which opened no stream and started no sync, so the page never showed the decision. Following a reply now syncs whenever no stream follows it. * fix(agent): send a heartbeat for each run record a visitor can't see During a long tool run the visitor's stream dropped every record, so the page saw nothing, reconnected every 15 seconds and replayed the hidden records each time. * fix(agent): word the approval and workspace access instructions for visitors They told the agent that the reader approves held calls and can restore the Run as identity, which is wrong for a visitor and shares internal configuration with them. * feat(agent): copy channels switched off with a link of their own A copy of an agent now keeps its channels, so a builder doesn't have to set them up again, but none answers before a member turns it on, and each gets a new link. Only a duplicate or a snapshot restore keeps a public chat's password; file exports and templates leave it out. Copied visitor conversations stay on the copied channel. |
||
|
|
ed9eb7d3a7 |
feat: turn user templates off for a whole instance (#6842)
* feat: turn user templates off for a whole instance * Review feedback |
||
|
|
638d7236c3 |
feat(agent): let triggered runs ask a person (#6812)
* feat(agent): let triggered runs ask a person A trigger-started reply gets a built-in ask_person tool when the trigger's may_ask_person is on (default). The call is held like an ask-first call: the run pauses, counts as going for the overlap rule, and resumes with the answer of someone who may approve tool calls, or is told nobody will answer when the question is dismissed. Unattended replies are told that nobody reads them and whether they may ask; follow-ups keep the outside-data instruction. Later replies replay each decided question and its answer as plain turns in their history. * feat(agent): answer an agent's question in the conversation A held ask_person call shows as its own card with an answer field, Send answer and Dismiss, kept out of the approval card's batch actions. Only people without the approve permission see it read-only. The trigger card gets a switch to let the agent ask a person, and approval wording now covers questions too. * test(agent): cover asking a person end to end and record it in ADR 014 * refactor(agent): build the question tool like web fetch and tell it from actions The question tool is a plain Pydantic AI tool in agent/tools.py that the reply runner wraps in a FunctionToolset, like web fetch. A held call is a question only when it has no tool key, so an action saved as ask_person before the name was reserved keeps its normal approval. History prefetches only the decided questions, and the pending approvals menu links to the conversation only for a pending question. * test(agent): cover Ask first in a triggered run end to end With changes set to not ask first, a triggered run creates a database without waiting; turned back on, the same run waits for approval and finishes once approved. * test(agent): open the Triggers section in the ask-a-person spec The section was renamed on develop. * fix(agent): keep web search off next to the question tool on older Gemini Gemini before 3 refuses web search next to function tools. The question tool now counts as one, so a triggered run that may ask a person no longer sends both, gets a 400 and records a failed search on every run. * fix(agent): keep the ask-a-person switch of a license-locked trigger read-only The API refuses the change like the trigger's other locked settings, and the card makes the section inert and the switch read-only, like the overlap rule. * fix(agent): reserve the web_fetch action name An action named web_fetch on an agent with web fetch on gave two tools with the same name, so every reply failed when its toolsets were built. * refactor(agent): drop the special case for an action named ask_person Agents are behind a flag with no production users, so the name is simply reserved like the other built-in tools: a held ask_person call is always a question, on the backend and in the conversation. * fix(agent): answer a waiting question after asking is turned off ask_person now defers its call, and the resumed run gets the answer, or the dismissal note, as the call's result. Turning the trigger's switch off only stops new questions, instead of telling the agent that an answered question is no longer allowed while the card shows it as answered. * fix(agent): decide calls held with a question from the pending approvals menu The question shows as its link row to the conversation, and the other held calls stay in a card below it, so they can still be approved or rejected from the menu. |
||
|
|
16dbb0690f |
feat(agent): configure who can chat, approve and continue triggered runs (#6826)
* feat(agent): configure who can chat, approve and continue triggered runs Approving held tool calls and continuing a conversation a trigger started become their own operations. With RBAC, an agent's Permissions section sets who may chat, approve and continue: a lowest role, specific people or teams, or nobody. Without RBAC every member chats and approves, and nobody continues. The owner of a private conversation can ask others to approve its held calls, and leave it to them. * feat(agent): let everyone in a private conversation leave it and name who stopped a reply Anyone asked to approve can now remove a private conversation from their own list; only its owner deletes it for everyone. Once the owner has left, the last person to leave deletes it for good, as only an owner's trash may list a private conversation. A reply someone else stopped says who stopped it. * fix(agent): close the gaps a security review of participation found Keep a triggered conversation's opening message untrusted when a person continues it, audit changes to who can chat, approve and continue, and require being able to chat to ask others to approve. People asked to approve follow runs only while they may read the conversations, the approver picker scans at most a thousand members, and the permission object lists only the agents the person may see. A reply whose sender was deleted can still be resumed by someone asked to approve it. * docs(agent): add the participation test plan with its results Cover every participation setting, asking others to approve, leaving a private conversation and stopping replies, with the outcome of the e2e run and the findings of the security review. * fix(agent): address the review of participation permissions - Name only people's messages to the model: a trigger's opening message no longer reads as written by a deleted user. - Check the approver candidates in one pass, so the number of queries doesn't grow with the workspace. - Show the read-only note only to who can't write in a conversation. - Take a person who leaves the workspace out of the conversations they were asked into and the rules naming them, and delete the conversations nobody is left in. - Record a rule change and its audit entry in one transaction. - Refuse a custom approve rule nobody named in it could use. * docs(agent): update the participation test plan after the review |
||
|
|
1a555ad89e |
feat(agent): share conversations with everyone who reads the agent (#6793)
* feat(agent): share conversations with everyone who reads the agent A person's conversation starts private; its owner can share it for good. Everyone who may read the agent's conversations then sees it, and anyone who may send the agent messages continues it. Messages record their sender, and a reply runs for the person it answers. The conversation list filters private and shared conversations. * feat(agent): show each conversation's state, origin and age in the list * fix(agent): address conversation sharing review Name who wrote each message of a shared conversation to the model, let the person a reply answers stop it, and say in the share dialog that only people who can update the agent rename, pin or delete it afterwards. Only the owner shares a conversation. Show a failed reply live, on a resend and with the false filter, explain why you can't send in any conversation you can only read, list a conversation again when the share or update that hid it fails, and name a deleted owner in the list. * fix(agent): polish shared messages and the conversation list Show another person's message as a grey bubble with their name inside and keep its line breaks. Keep the copy button and time closer to their own message than to the next one. In the conversation list, align the icon, lock and time with the filter and the section label, put the icon on the title line, let the options button take the lock's place instead of reserving a column, and leave a small gap between rows. * fix(agent): stop a message or a name from passing for another sender |
||
|
|
19bb477c64 | fix: show apps and dashboards in signed-out template previews; user template previews run no data sources (#6841) | ||
|
|
b580793dd7 |
fix(agent): address agent builder feedback (#6781)
* fix(agent): address agent builder feedback * feat(identities): let builders bind existing identities Binding an Agent or a Local Baserow integration to an existing identity takes the new identity.bind permission, held by workspace builders and admins. Creating, editing and deleting identities stays admin-only. ADR 013 updated and trimmed of migration and deployment details. * fix(agent): show ask before changes only for the Everything preset * fix(agent): fix CI and polish the tools modal and input table Update tests for the identity bind rule and the key/value input table, keep table keys on one line, use one toggle style in the external tools modal, and apply Prettier. * fix(agent): compact the pending approvals menu Each conversation is one line: its title with an ellipsis, then Always allow, Reject and Approve. The chat keeps the full approval card. * feat(agent): make the conversation sidebar collapsible * address feedback * Added a little bit of space after the trigger --------- Co-authored-by: Bram Wiepjes <bramw@protonmail.com> |
||
|
|
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 |
||
|
|
5169076065 |
feat: introduce User-backed workspace identities (#6556)
* feat: introduce User-backed workspace identities Replaces workspace core.Agent subjects with identities stored as Django Users, so permissions, execution and attribution use the same record. - User.objects and WorkspaceUser.objects are human-only; permission and identity code opts in through objects_and_identities. is_human and is_identity classify a user at runtime. - Login, tokens, seats, notification recipients, personal views and last-admin checks stay human-only. Roles, teams and field grants work for identities unchanged. - Agent applications run as an identity, never as a person. Every shared tool rechecks the identity's authority on each call, and MCP refuses a tool that skips that boundary. - Migrations add the profile metadata and index, remove the Agent model and delete or clear legacy Agent data: trash entries, role assignments, team memberships, integration authorizations and run-as bindings. - Rename the management API, UI, events and feature flag to identity. Squashed and rebased onto develop; the previous history is kept on backup/6556-before-develop-rebase. * refactor: remove generic subject options endpoint * refactor: simplify identity selection and Agent run-as options * feat: distinguish identity notification senders * fix: restrict identity bindings to identity managers * docs: record users and identities verification * fix: restore snapshots as the person restoring A restore checked the snapshot creator's permission and used the creator to decide whether an Agent keeps its identity binding. It now checks the person restoring, passed to the import as `restored_by`. `copied_by` stays unset on restore, so credential checks keyed on it behave as on develop. Restoring a snapshot whose creator was deleted works again. The copy rule for identity bindings covers Agent run-as only; a copied Local Baserow integration keeps its authorized subject. * fix: leave settings pages the user may not open A settings route without a permitted tab rendered an empty page, as the Identities page did with its feature flag off. It now opens the first page the user may see. * fix: renumber the legacy Agent cleanup migrations Develop added agent 0016 and integrations 0043, so the migrations that clear legacy Agent run-as bindings and integration authorizations move to agent 0017 and integrations 0044. * test(agent): run the trigger self-event test as an identity The test added on develop created a `core.Agent`, which this branch removes. It now uses an identity user as the Agent's run-as subject. * perf: load user types once per batched permission check * refactor: state the stored subjects in each subject type * fix: give every user a profile * fix: keep identity attribution on rows copied in their workspace * refactor: give people and identities their own subject type UserSubjectType stays the type both are registered and stored under. It forwards what differs to HumanSubjectType and IdentitySubjectType, so get_specific_type is the only place in subject code that inspects the user type. The registry returns the specific type on request and get_by_model keeps returning the stored type, which never reads the profile. An identity's membership is checked in one query instead of two. * fix: keep the roles of identities when a database is duplicated The role import read subjects through the model's default manager, which only returns people, so duplicating or restoring a database failed when an identity held a role on it. It now resolves the subject through the subject registry. A subject that no longer exists is skipped instead of failing the whole duplicate or restore. * refactor: look up a subject type from its content type in one place * fix: reload a cached token whose profile is incomplete A token cached by the previous release has a profile without the user type, which reads as not a person, so its requests were refused until the entry expired. The token cache now treats it as a miss, with the check the user cache already used. * refactor: check the user type once where the check was repeated The MCP endpoint loader, the personal view permission manager and the identity trash type each asked the same question several times. The rule that an identity is never selected by email moves from the team handler to the identity subject type. * refactor: leave trashed workspaces out of the identity membership manager WorkspaceUser.objects_and_identities was named after objects but also returned memberships of trashed workspaces, so callers filtered them by hand. It now follows the existing pair: it leaves trashed workspaces out, and objects_and_identities_and_trash includes them, as objects_and_trash does for people. * test: state the behaviour of every user type The table fails when a user type is added and says what has to be decided first. An unknown type is checked to be denied. * refactor: refuse to say whether a stored user subject is interactive The answer differs between a person and an identity, so reading it from the stored type would be wrong for one of them. It now raises and points to the specific type. * refactor: lock the person in membership writes instead of checking the type Leaving a workspace, removing a member and adding a user lock the user through the people manager, which refuses an identity or an unknown type in the same query. Nothing adds an identity through add_user_to_workspace, so its branch for identities goes. The last admin check compares the membership with the people who are admin, which needs no type check. * test: leave no rows behind in the legacy authorization migration test The test left an integration that pointed at a user that didn't exist and a workspace, in the database the migration tests share. Tests that ran after it then failed on the foreign key or on the workspace id. It now uses a real user and empties the two tables. * docs: describe the subject types and compare the Subject table alternative ADR 013 is shorter and states that people and identities each have a specific subject type under the stored auth.User type. It compares shared User storage with a Subject table that users and identities would both point to. * chore: run the legacy run-as cleanup after the agent actions migration Develop added agent migration 0017, so the cleanup becomes 0018 and depends on it. * test: leave no rows behind in the legacy agent migration tests Like the legacy authorization test, these left a workspace in the database the migration tests share, which a later test that creates workspaces with fixed ids collides with. * fix: write and read the workspace role of an identity in one place The role assignment API wrote the role of an identity through the membership update of people, which told every member of the workspace about it and stored Builder as MEMBER, while the identities API stored BUILDER and returned the stored value. Both now write through the identity handler, which stores the role like the role of a person, and the role is read with the resolver the workspace members use. * fix: take no row lock in the membership writes of a person Leaving a workspace locked the user before the membership while removing or updating a member locks the membership first, so the two could deadlock. The user type never changes and these operations refuse an identity, so the lock protected nothing: they now only check that the user is a person. Leaving no longer locks the admin memberships and removing a member no longer checks for the last admin, as before identities. * fix: find an identity by its name only in the subject options The search also matched the email and username, which for an identity hold an internal key, so searching a part of that key returned every identity. * chore: run the identity migrations after the new ones on develop Develop added core 0138, integrations 0044 and enterprise 0073, so the identity migrations become core 0139 and 0140, integrations 0045 and enterprise 0074 and depend on them. * fix: keep the identity of a copied integration only for identity managers A duplicated application or a restored snapshot kept the identity its Local Baserow integration acts as, without checking the person who made the copy. Restoring a snapshot could so bring back a binding an admin had removed. The copy now keeps the identity only when that person may bind identities, as the Agent application already did, and is otherwise authorized as that person. * docs: follow the renumbered migrations and the copy rule in the test plan The test plan named the identity migrations and their tests by their old numbers and still said a copied integration keeps its subject. * test(agent): run the row trigger tests as an identity The row trigger tests added on develop created a `core.Agent`, which this branch removes. They now use an identity user as the Agent's run-as subject, and the e2e fixture creates it through the identities endpoint. |
||
|
|
d21801281f |
feat(agent): trigger agents when rows are created, updated or deleted (#6695)
* feat(agent): trigger agents when rows are created, updated or deleted * test(agent): find the trigger picker by the class it now has The trigger picker renders the shared service picker since the send email actions, so its menu is under .agent-service-picker. * fix(agent): check a trigger's access again before its conversation starts The task that starts a firing's conversation trusted the access check made when the event happened. A run identity removed, trashed or without access by the time the task ran still got a conversation with the event's rows. * fix(agent): apply the row trigger review fixes - A type change moves an overlap rule left at the old type's default to the new type's default. - Queued replies wait while the run identity can't read what the trigger watches. - An imported formula is kept as written when no path is remapped, through one import_formula in core. - Row events hand their listeners services holding the event's table. - Trigger form choices no longer read the workspace's views. - A first row too long for a message is cut short instead of left out. - A no-access error for a type the card no longer shows is ignored. - The dispatcher no longer clamps the batch size. * fix(agent): keep the merged trigger behaviour and UI for row triggers - Skipping stays the default overlap rule: only the row trigger types say their events can't be skipped, so HTTP and periodic triggers start as they did before. - The workspace-access note is a plain alert and the batch size field is spaced like the hosted forms, without style overrides. - The type-change and queued-firing tests are develop's again, with the row trigger tests added after them. - ADR 014 names the hooks row triggers add to the shared service type. * fix(agent): show a row trigger without workspace access as misconfigured The trigger can't run until the agent has workspace access, so its card gets the error icon with a tooltip and the database field shows the error, instead of an info note. |
||
|
|
b566941058 |
feat(agent): start runs from HTTP webhooks (#6737)
* feat(agent): start runs from HTTP webhooks * fix(agent): address HTTP trigger review feedback - Add opt-in agent trigger types that adapt a shared trigger type - HTTP: exclude GET by default and drop the workflow response settings - HTTP: raw body is the default message and the text of an unset one - A message with no text says when the trigger fired, not the payload - Forms take hiddenFormFields from their host - Trigger cards collapse and no longer resize while saving - Keep the HTTP trigger uid out of exports without sensitive data * feat(agent): make trigger and action card headers consistent - Chevron on the left of action cards, as on trigger cards - "Enabled" label above the switches, on the Expand all line - Switch tooltip says the state and what a click does - No divider under an action card's name |
||
|
|
47ef996921 |
feat: a way back for a blocked user template (#6696)
* feat: a blocked user template has a way back * Review feedback |
||
|
|
9af8a8422e |
feat(agent): rate-limit agent triggers and let a busy trigger skip or wait (#6672)
* feat(agent): rate-limit agent triggers and let a busy trigger skip or wait * feat(agent): choose a trigger's overlap rule and show skipped firings * feat(agent): let a trigger run its replies in parallel A third overlap rule, Run in parallel, starts up to BASEROW_AGENT_TRIGGER_MAX_PARALLEL_RUNS replies at once (default 5) and queues the rest up to the queue cap. Skip, Wait and Parallel now share one rule (OverlapLimits): start while there is room to go and nothing is queued ahead, queue while the queue has room, else skip. A firing held back by the workspace's run limit queues where the rule queues. The hand-off and the sweep start as many queued replies as fit. * test(agent): pin the trigger lock order a hand-off and a builder's save rely on * fix(agent): lock agent before firing its trigger * fix(agent): tighten trigger overlap counts and limit parsing - A reply in a trashed conversation no longer counts as going, so it can't block a trigger until the trash is emptied. - A message that fails to resolve fails its reply before the overlap rule, so the builder sees it instead of a skip. - The hand-off locks only the queued replies that can start. - Rate-limit pairs must be positive integers. - The API help text describes `parallel`. * fix(agent): hand a trigger's queue on in its own task - When a trigger's reply ends, a task started with the trigger's id starts its queued replies, instead of the ending reply's save doing it. With the broker down, a hand-off fails at most one reply instead of the whole queue, and the reply's save no longer loads the trigger. - The hand-off and the sweep check what a firing checks: Agents on, the trigger type available and the agent ready. A trigger that can't fire keeps its queue until it can. |
||
|
|
3911d1ae66 |
docs: add ADR 015 for encrypting stored secrets (#6713)
* docs: add ADR 015 for encrypting stored secrets Records why secrets sent to other services are encrypted with a dedicated key and one shared field. * docs: keep ADR 015 to decisions, without implementation details * docs: add a developer guide for encrypted secrets and update ADR 015 Unreadable secrets now stay stored and are never sent, and adopters need the field's usage, limits and required tests. * docs: add diagrams to the encrypted secrets guide * docs: stage key changes in the encrypted secrets guide Services not yet restarted can't read what new ones write unless the new key is a fallback first. * docs: flag expression updates, raw SQL and db defaults on encrypted fields They skip the field's encryption, so adopters must review them separately. * docs: cover rollout of released columns and damaged values in the secrets guide Old processes read ciphertext as the secret during a deploy, and damaged values now count as encrypted. |
||
|
|
09e6992a1c |
feat(agent): run agents from triggers in shared conversations (#6663)
* feat(agent): start shared conversations when a trigger fires * feat(agent): show shared conversations and let editors decide their held calls |
||
|
|
4ad9b01319 |
feat(agent): set up agent triggers in When it runs (#6693)
* refactor(core): read service results and trigger timezones through the service type * feat(agent): add named agent triggers with their API * feat(integrations): name and describe periodic trigger services for any consumer * feat(agent): configure triggers in the When it runs section * docs(adr): record agent triggers and shared conversations * fix(agent): save a trigger switch alone after a rejected save * fix(agent): audit only trigger messages that change and translate trigger actions * perf(agent): load trigger services in bulk when listing triggers * fix(agent): resolve trigger dates in the trigger's timezone, drop the duplicate schema and unnamed trash names * fix(agent): save each trigger field alone and show reverted service values in the form * fix(agent): offer to add a trigger only once the trigger list has loaded * fix(agent): stop nesting trigger service forms inside the configuration form * refactor(builder): read data source and previous action results through the service type * perf(agent): look up a trigger's type only when its service values change |
||
|
|
7121039db6 |
feat: block and unblock user templates from the admin Templates page (#6661)
* feat: block and unblock user templates from the admin Templates page * Review feedback |
||
|
|
5e6ce919b6 |
feat: share a user template with a private link (#6611)
* feat: share a user template with a private link * Review feedback |
||
|
|
2f17b58e1c |
feat: download a user template (#6477)
* feat: download a user template * Review feedback * Review feedback 2 |
||
|
|
8353d65c5f |
refactor: [1/5] Prepare for semantic search (#6470)
* Made pending search data updates reusable * Added field extension hooks * Moved embeddings and text chunking to core * Fixed feedback |
||
|
|
31552d5e97 |
feat: show who effectively has access in the share dialog (#6463)
* show who effectively has access in the share dialog * optimise the effective access query * add a loading spinner for the effective access too * fix: navigate inherited access within the sharing modal * fix: restore invitation popup and scrollable access lists * fix: return accurate team counts in scope access lists * refactor: centralize subject avatar rendering and styling * fix: keep team counts in field permissions and restore template icons --------- Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com> |
||
|
|
48e666c34c | feat(update-user-template): Update a user template's details and content (#6428) | ||
|
|
5c4828d7ae |
fix: admins should not be able to exclude themselves (#6373)
* v1 of the ADR * fix: admins can no longer be locked out of databases, tables or views * ADMIN direct role assignments take priority at their level, and at their descendants. * fix: lock inherited admins in the new share dialog and show admin explanations in full |
||
|
|
542638de5d |
docs(ADR): record background chat run architecture (#6405)
* docs: record background chat run architecture Define shared Celery execution, Redis replay, HTTP following and durable final outcomes for Kuma, agents and other features. Product adapters own endpoints and wire formats. Include context, decision factors and architecture diagram. Part of #6346 * docs: align ADR 010 with the engine implementation - Check read access when a stream opens or reconnects. An open stream keeps running after access is lost. - Pruning tries once more to preserve an interruption warning, and does not wait for it to succeed. * docs: clarify ADR 010 after review - Define the not-started timeout, the periodic sweep and the chat_run queue. - At the buffer size bound, stop publishing and mark replay unavailable. - Make the interruption warning best effort and list its loss. - Give Stop its own adapter permission check. - Use "output events" as the single term in the text and diagram. * removed reference to the Celery queue name |
||
|
|
0d332bec49 |
docs(ADR): represent agents as workspace applications (#6342)
* docs(adr): define Agent Builder application ownership * docs(adr): make each agent a workspace application * docs(adr): focus Agent decision on the final model * docs(adr): evaluate the two Agent ownership models * docs(adr): reserve 011 for Agent applications * docs(adr): clarify Agent option names and comparison Add a terms table, use one name per concept, and shorten the comparison table. Note the RBAC requirement for per-agent roles and how snapshot restore affects callers. * docs(adr): describe snapshot restore per agent |
||
|
|
0971ac4504 |
feat: data model for user templates (#6388)
* feat: data model for user templates (#6341) * docs: ADR 008 template revisions * fix: collision-aware duplicate template slug rename in 0128 |
||
|
|
ae95e512e1 |
docs(adr): add ADR 009 to authorize MCP clients with OAuth (#6317)
* docs(adr): add ADR 009 to authenticate MCP clients with OAuth * docs(adr): address second review round on ADR 009 Define terms, split decisions into subsections, and add costs, follow-up work and library choice. |
||
|
|
3e084aceb4 |
docs(adr): rewrite ADR 006 in the ADR template format (#6337)
* docs(adr): rewrite ADR 006 in the ADR template format Folds the phase amendments into the main sections and trims the record to the decisions. * docs: point ADR 006 references at the rewritten sections Drops references to points the trimmed record no longer covers. * docs(adr): drop implementation details from ADR 006 * docs(adr): state the unwritable-field rule in ADR 006 Comments cite it as section 4's stricter rule. * docs(adr): apply review suggestions to ADR 006 |
||
|
|
0af9be4ae6 |
docs: add ADR README with template (#6336)
Gives new decision records a shared structure based on ADR 006 and 008. |
||
|
|
5567ef744b | docs(adr): add ADR 008 for user templates (template marketplace) (#6223) | ||
|
|
f594e12c0f |
feat(database): button field - send email through an SMTP integration (#6208)
* feat(database): let a button email send through an SMTP integration SaaS turns instance SMTP off, which left the email action unusable there. * feat(database): flag a button email with nothing to send through An email set to an unavailable instance server or a missing integration fails on every click. * test(database): cover email actions carrying an SMTP integration through import * feat(database): pick an SMTP integration for a button email The backend now lets a button email send through an SMTP integration, so the form offers the dropdown and says when the instance cannot send. * fix(database): let a stale instance email switch to an integration With the instance choice hidden the saved true value stayed, so the integration was dropped by the backend. * docs: record that button emails can use an SMTP integration SaaS turns off instance SMTP, so the 4b revisit trigger fired. * test(e2e): the button email form offers an SMTP integration The form now matches the builder's instance/integration choice. * fix(database): refresh open button editors when an integration is updated A renamed or reconfigured integration left the editors of the buttons using it stale. * fix(database): keep a button email's integration choice from blocking a save or a click Switching to the instance failed when the old integration was trashed or unreadable. A trashed, missing or hostless integration only failed after earlier actions ran. * fix(database): refuse button emails that cannot send and keep the chosen sender A stored instance choice was lost on any save while instance SMTP was off, and a named integration was dropped where the instance only prints mail. Clicks through an integration with no From or a non-public host are refused before anything runs. * fix(database): stop the button email form from editing actions on open The shared SMTP form rewrote a stored instance choice on mount, so opening an editor during an SMTP outage changed actions, and the builder and automations saved on view. The form is back to develop's behaviour unless the button passes its new prop. * chore: drop the changelog entry for button email integrations The button field is not released yet, so its own changelog entry covers this. * fix(database): let a button email's SMTP integration be edited A database has no integrations page, so the dropdown is the only place to edit one, as with the Slack action. |
||
|
|
38f434db7b |
fix(database): fail a button click when an endpoint answers an error (#6190)
* fix(database): fail a button click when an endpoint answers an error A timeout or 4xx/5xx came back as a completed action, so the actions after it ran and the clicker saw no error. A click cannot branch on the status. * fix(database): say a button's 504 may be a timeout or an answer The HTTP service returns 504 for its own timeout and for an endpoint's 504. * docs(database): stop saying a button's error status is counted An HTTP action answered with an error status now fails the click. |
||
|
|
4a07ad00b3 |
fix(database): flag imported email buttons with no recipients (#6191)
* fix(database): flag imported email buttons with no recipients A workspace export blanks email recipients, so imported buttons looked ready and failed only when clicked. * fix(integrations): treat whitespace-only email recipients as missing Matches the backend's reconfigure check and the row id check. |
||
|
|
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. |
||
|
|
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. |
||
|
|
25335530f8 |
feat: undo for button field action configuration (#6086)
* feat: undo for button field action configuration Creating, editing, reordering and deleting a button's actions bypassed undo, so Ctrl+Z restored the field but not its actions. * fix: keep button action undo working across edits and type changes A type change dropped trashed actions and gave restored ones new ids, so redo failed. A reopened editor kept stale card values and could revert an undo on save. A concurrent delete of one action returned a 500. * test: e2e coverage for button field action undo Covers one undo reverting a whole editor save, redo, and redo after a field is changed into a button. * fix: skip the order call when a button save keeps the order Each call adds an undo step, and an undo group only reverts 20 of them. * docs: document create_instance_from_serialized parameters * fix: keep sensitive fields when undoing a button action type change A type change deleted the old service, and undo rebuilt it from logged values that leave sensitive fields out. The replaced service is now kept until the undo step is cleaned up. * fix: remove a button action's trash entry when the action is deleted A field changing away from a button deleted its trashed actions but left their entries listed in the trash. * fix: harden button action undo around secrets and field type changes Field backups logged action secrets, undo reattached integrations unchecked, and a field type round trip broke redo. Sensitive-only edits added empty undo steps, and the delete race error could never be reached. * fix: rebuild button action cards when the editor is cancelled Each card copies its values once, so a cancelled edit stayed visible and could be saved later. * fix: skip undo of a button action already restored from the trash * fix: restore a deleted button action to its old position on undo * fix: check the workflow when undo brings back a start workflow action * perf: check a kept button action service in one query * fix: name a trashed button action by its position * chore: invoke button action types through the action registry * fix: send a button save too big for one undo group ungrouped * docs: spell out what button action undo leaves unreverted |
||
|
|
6c1e3e45e8 |
feat(database): Button field: record who started a workflow run (#6068)
* feat: record who triggered an automation workflow run * feat: name the clicker on a workflow a button started * feat: carry the trigger user on the automation dispatch context * feat: expose who triggered a run on the workflow history API * feat: audit log a button field click * feat: show who started a run in the workflow history * docs: say a periodic trigger can be started and how a click is recorded * fix: give the history actor label room for a full name * fix: keep the trigger user off the dispatch context actor A Local Baserow node with no integration acts as the context actor, so a run would act as whoever clicked. * fix: audit a click only once it holds the lock * feat: record who started a test run * fix: honour is_test_run in the workflow history fixture * refactor: resolve who started a run through the workspace user store * test: drop a start workflow test whose deny patch never fires * test: e2e for who started a workflow a button or a test run began * test: e2e for picking a workflow in the button field editor * refactor: read the trigger user lazily from the run's history No per-node user join; the context exposes history.triggered_by on demand. * refactor: plain serializer for who triggered a run * test: forward history fixture kwargs and hoist imports * fix: put the run's starter on its own line in the history panel The header row is 327px wide; a name beside the title wrapped it. Name resolution reuses the collaborator mixin. * docs: say exactly when a click is audited and what a nested run records * test: share e2e job polling and AI panel suppression * fix: annotate the automation dispatch context's history as a workflow history * fix: cap the button action form so a helper sentence cannot stretch the editor * fix: keep the automation dispatch context's history required The simulation's history=None is a sample-data-only exception, not the norm. * refactor: carry the dispatch context actor through own_properties Contexts that take an actor list it like any other property; the rest keep the base None. * refactor: record who started a workflow run as a subject Stores id, type and name instead of a user foreign key, so an agent can start a run without a data migration and the name survives the user being deleted. * fix: record who started a test run that waits for its event The starter is kept on the workflow with the other test state, so the event that starts the run later can still name them. * fix: forget a test run's starter when its window closes Opening or closing the test run window through a workflow update left the earlier starter in place, so a later run could name the wrong person. * fix: keep a test run's starter when undo restores an unchanged window Undo and redo send every workflow field back, so only a real change to the test run window may replace who started it. * fix: reset a test run's starter type along with its id * fix: return None from get_subject for subject types without a table anonymous, user_source.user and builder_preview_actor have no manager, so the lookup raised AttributeError. * refactor: resolve collaborator names through a core util The history panel called a mixin method without its component, which only worked while the method ignored this. * refactor: name the history's started-by line after what it shows * docs: note that a button with no actions logs no click * refactor: drop the unused triggered_by from the automation dispatch context Left over from when the clicker was the context's actor; the history already records who started the run. |
||
|
|
0bb39e36c6 |
[1/4] feat: AI assistant eval platform on self-hosted Phoenix (#5958)
* feat: add Phoenix LLM tracing service to the dev stack (ai profile) * chore(deps): add openinference pydantic-ai instrumentation (dev) * feat: export assistant traces to Phoenix when BASEROW_ASSISTANT_PHOENIX_URL is set * fix: harden Phoenix tracing setup after review * feat: Phoenix postgres storage, ai-evals profile and auth support * docs: ADR 007 and assistant tracing/evals guides * feat: assistant eval platform core (types, registries, scenarios) * feat: eval harness with shared assistant factory * feat: phoenix dataset sync for assistant evals * feat: assistant eval experiments via phoenix client + CLI * feat: migrate core, database and docs evals to the platform Ports the 42 kuma-core/kuma-database/kuma-docs pytest evals into declarative EvalCase/EvalScenario registrations, plus structure-level tests asserting dataset counts, ids, and scenario wiring. * feat: migrate builder and automation evals to the platform Ports the 12 builder + 2 proactive + 2 user-source cases into evals/datasets/builder.py (kuma-builder, 16 cases) and the 7 automation cases into evals/datasets/automation.py (kuma-automation), following the Task 5 pattern established in core.py/database.py. Extends eval_platform/test_datasets.py with counts, id lists, a mode-per-case assertion, and pre_state snapshot checks for the two cases that need one. * fix: link traces and final counts for single-case eval runs * fix: root spans for single-case eval runs use the assistant tracer provider * feat: assistant eval runner service with run page Adds the assistant_eval_runner management command (migrate -> instrumentation -> dataset sync -> single worker thread -> wsgiref server) and its runner.py module: a stdlib WSGI app serving a plain server-rendered page (GET /, POST /run, GET /healthz) backed by a bounded in-memory run history and one background worker draining a queue.Queue via run.run_experiment_for. Wires the assistant-eval-runner compose service (ai-evals profile, own baserow_evals DB), renames phoenix-db-init to ai-evals-db-init and extends it to also create baserow_evals, and adds BASEROW_EVAL_RUNNER_PORT to both env example files and the dev docs. * fix: eval runner integration fixes assistant-eval-runner needs its own SECRET_KEY/DATABASE_*/REDIS_* env vars: dev-overlay compose services don't inherit docker-compose.yml's x-backend-variables anchor (that's file-scoped YAML), so the container was starting without a Django SECRET_KEY and without a Redis password, crashing on auth. Also links to finished experiments pointed at the container-internal BASEROW_ASSISTANT_PHOENIX_URL (http://phoenix:6006), unreachable from the developer's browser. Adds BASEROW_ASSISTANT_PHOENIX_PUBLIC_URL (defaulting to http://localhost:${BASEROW_PHOENIX_PORT:-6060}) and has runner.py build the Phoenix link from it, deep-linking straight to the finished run's experiment compare view when its dataset_id/experiment_id are known, falling back to the datasets list otherwise. * refactor: retire the pytest eval harness All 65 eval cases now live in baserow_enterprise.assistant.evals.datasets; delete the legacy pytest-based suite and its `eval` markers. * docs: rewrite assistant evals guide for the Phoenix platform * feat: docs judge, prompt sync, git stamping and UI-contributed eval examples - answer_quality LLM-as-judge evaluator for kuma-docs (BASEROW_EVAL_JUDGE_MODEL) - Kuma prompts versioned into Phoenix on sync; experiments stamped with prompt hashes, git branch/commit and judge model - sync preserves UI-added dataset examples with prompt-match adoption; eval-export emits paste-ready docs.py snippets - final-review fixes: skip-safe scoring, runner CSRF/bind hardening, doc corrections * feat: eval runner UI round — tabs, fan-out, reference answers, 64-case docs dataset - Runner page: dataset tabs with selection badges, per-dataset and global all/none, cross-dataset fan-out (one experiment per dataset), 5s auto-refresh of runs, persistent run history across restarts, per-dataset Phoenix links, in-page Help tab rendering the repo docs via /docs.json. - Reference answers for kuma-docs: EvalCase.reference_answer, judge grades against it, sync preserves UI-curated ones, eval-export round-trips them. - kuma-docs grown to 64 cases: reference answers for all, PostHog-mined frequent questions, and cannot-do guardrail cases. - Gemini (google:gemini-3.6-flash) in the eval model list. * feat: runnable UI examples, prompt overrides, eval baseline and results view - UI-added Phoenix examples now execute: docs questions get the standard docs checks + judge; tool cases declare scenario/expected_tools/ answer_contains in metadata (empty-workspace default scenario). They are tickable per dataset on the runner page and run in whole-dataset experiments too. - Prompt overrides: run any experiment with a prompt's latest Phoenix version instead of the code constant (runner checkbox panel with soft per-tab ordering, or --override-prompt). Agent singletons keep their dynamic instructions; effective hashes + override list stamped on the experiment. - Committed baseline snapshot (evals/baseline.json, 111 cases) with just b eval-baseline capture/import; the runner imports it on startup so every Phoenix instance gets a baseline experiment per dataset, idempotent by content hash and run count. - Results tab: all datasets in one view for a named experiment, with baseline deltas and a case-weighted overall row, via Phoenix experiment annotation summaries. - New evaluation guide (docs/testing/ai-assistant-eval-analysis.md) served in the Help tab; layout uses horizontal space better (single tab row, fluid case columns). * feat: time and cost in eval results, frozen into the baseline snapshot - Results tab gains time (sum of run latencies) and cost/token columns per dataset and summed overall, with lower-is-better baseline deltas. - eval-baseline capture freezes each dataset's time/cost/token totals into baseline.json; import stamps them as metadata so imported baselines (which carry no traces to price) still show time and cost. - Importing a new baseline supersedes the previously imported one instead of accumulating duplicates. - Changelog entry for the eval platform. * fix: OpenInference attributes on subset-run task root spans Bare wrapper spans rendered as kind 'unknown' with Unset status and empty input/output in Phoenix. The Task root span now carries the CHAIN kind, the case prompt as input, the run result as JSON output, and an explicit OK status. * polish; minor fixes * fix: address eval platform review feedback Apply production model settings and retries, isolate automation checks, and fix runner configuration, links, and result status. Defer GPT-5.6 compatibility and baseline comparisons to #6034. * fix: preserve model profiles in rebased eval harness Use an explicit model profile for evals and share concrete models with tools. Manage model clients through the existing lifecycle helper and preserve regression coverage from the retired harness. * fix: harden eval persistence and Phoenix access |
||
|
|
588bae1b50 |
feat[5/6] Button field: start an automation workflow (#6035)
* feat: let a button field start an automation workflow * fix: start only a workflow from the button's own workspace * fix: drop an imported workflow the button's workspace does not hold * test: cover what a click on a start workflow action does * feat: offer the start workflow action in the button field editor * test: cover the start workflow form inside the field editor * docs: say what the start workflow action does and does not do * docs: point to the start workflow action from phase 4's summary * fix: keep a snapshot's start workflow action pointing at its workflow * test: cover the create and type swap routes into the workspace guard * test: pin the start workflow icon, label and immediate dispatch error * docs: say what a click reaches through a started workflow * fix: keep an imported workflow only when the reference is this instance's Ids are one global sequence, so a file written elsewhere can name a workflow number the destination workspace happens to own. Presence in the workspace was read as identity, and the button started work nobody chose. An imported action now keeps its workflow only when this import remapped it, or when the data never left the instance, and in both cases when the workspace still matches. Field duplication and a field type change say so the way every other copy does, with an `is_duplicate` config. The same rule now also refuses a workflow whose trigger cannot be dispatched immediately, which a save with the same id already refused, and a copy asked for by a person drops a workflow that person may not read. * fix: say in the editor that the started workflow cannot be found Trashing the automation leaves the id on the action. The click fails, and the editor said nothing: the shared service type reports a workflow that is missing from the list the same way it reports one still being fetched. The database action type now says it, once the applications have actually been fetched. Every automation of the workspace carries its workflows in that same payload, so before it lands an empty store is what a load still running looks like, and nothing is said. The applications are filtered by what the reader may see, so absence answers whether this editor can see the workflow, not whether it exists. The copy says that, rather than sending someone to replace an action that works for everybody else. * fix: treat a template install as the file import it is A template is imported with `is_duplicate=True`, so the rule that keeps an imported workflow read it as a copy that never left the instance. It is the one exception to that: the file was written on another installation, where the same number meant a different workflow, which is the collision the rule exists to stop. `ImportExportConfig` now says which of the two an import is, and the start workflow action drops a workflow a template names by a number this workspace happens to own. Nothing else reads the new flag, so a template install keeps behaving as it did. Also drops the id mapping `_check_workflow` no longer receives: the import path stopped calling it, and leaving the parameter suggested the save path handles the snapshot case, which only the import path does. * test: cover a duplicated button field keeping its workflow Field duplication skips the serialization import path and builds its own import config, so nothing covered the one call site that config was added for: remove it and every duplicated button silently loses its workflow while the suite stays green. Also says in a comment that a field type change reaching the same code is a restore of what the conversion backed up, not a copy, and that the read check applies to it too. * refactor: read the workspace from the caller, not the store The action list already knows which workspace the button field is in and passes it in the context every other check reads. Taking it from the selected workspace instead said something the type had no business knowing. * fix: resolve an imported workflow reference instead of following it An export of a database without its automation names a workflow id this installation does not have. The foreign key is deferred, so the service row is written and following the reference is what fails, ending the whole import job over a reference that simply has to go. Look the workflow up and blank it when it is not here. Read the id off the service defensively too: the service type builds whatever type the file named, so a hand-edited or version skewed export can leave a start workflow action holding a service that has no workflow at all. * fix: ask the id mapping what it actually remapped `MirrorDict` answers `in` and `get` for every key, and an import installs one under this very key when a workflow is duplicated. Asked that way the guard is told this import remapped an id it never touched, and the collision check below it never runs, so the copy could keep a workflow nobody picked. The key view answers only for what was written. * test: cover a restored button keeping its action target Converting away from a button deletes the row its actions cascade off, so only the backup brings them back, and nothing covered what a restored action ends up pointing at. * refactor: trim comments on the start workflow action * fix: decide a start workflow import before the row is written The import callbacks run after the application's transaction has committed, so a workflow id this installation lacks failed on insert. Permission is now checked before the trigger, through the service. * fix: restore the serializers import develop moved out of the module |
||
|
|
5459f9ecb5 |
feat[4c/6] Button field: send a Slack message (#6005)
* feat: let a database carry integrations, and take them along in an export
* feat: let a button field post to Slack through a bot of its own database
* feat: offer the Slack action in the button field editor, with the bots of its database
* docs: record where a button's external integrations live, and what an import drops
* fix: draw the button's action list the way the design does
* fix: put a Slack message's answer where its schema says it is
* test: drive the Slack action end to end, and send for real when a bot token is given
* test: let the e2e stack answer for Slack, so a click is proven in CI
* fix: charge a click for a Slack post its API refused
The refusal is raised once the post has been made, so treating it as
'nothing left the instance' handed the outbound slot back and let one row
drive unbounded requests at Slack.
* fix: read one rule for the integration a button may carry
Saving, importing and dispatching each spelled the rule out again, and
dispatch had lost the half about the field's own database. The refusal is
one answer now: three different ones let a caller walk the ids and learn
what the installation holds.
* fix: keep the Slack action standing on an answer that is not Slack's
The endpoint is configurable now, so a refusal need not carry an error
code, and a blocked address reads like the HTTP service's. The channel is
held to its column, and a half-filled form is described rather than
thrown over.
* fix: forget a database's integrations when its application is replaced
Remembering the fetch in a module-level map outlived the object it
described, so after any refetch the bot dropdown stayed empty and the only
thing offered was creating a second bot. A failed fetch is now reported
rather than left as an unhandled rejection.
* test: point the e2e suites at the renamed label and the stub's real path
The email spec picks its action by exact label, which this branch renamed,
and the stub was mounted from a path that does not exist once the recipe
has moved to the repo root.
* test: let the API guard for an unsupported application keep a type to refuse
A database accepts integrations now, so the endpoint test that used one to
prove the guard was asserting the opposite of what ships.
* fix: hold a database to the integrations its buttons can actually carry
Opening a database to integrations opened it to every type, so a Local
Baserow one, carrying an authorized_user, could be created on it and ride
along in every duplicate and snapshot. Refusing it on the action was not
enough. The list is read from the action types themselves, so the two
cannot drift.
* fix: answer a refused address and a stranger's JSON the way the HTTP action does
An address Advocate blocked was charged to the click although nothing was
sent, an answer that is not an object raised out of the service, and the
frame holding the bot token was logged with its locals. The channel form
also refused a length the API accepts.
* fix: check the integration an action carries on every save, not just the first
An edit that resent only the channel and the message skipped the read
check, so someone who may edit the field but not read the bot could
retarget it.
* fix: check who is copying an action against the integration it carries
Duplicating a field and changing a field's type both recreate the actions
without passing through the endpoint that checks the credential, so a copy
kept a bot the person asking for it may not read. The duplication hook now
carries the acting user, and a copy it cannot account for comes back
unconfigured.
* fix: hold a Slack answer to a size and a deadline, the way an HTTP one is held
The endpoint is configurable now, so its answer is not bounded by Slack's
own limits, and the request timeout restarts on every byte. A body that
drips could outlive the lock its dispatch time sizes, letting a second
click post against the same row. The reader the HTTP service already had
now lives beside the request function both of them use.
* fix: read the clicked field once, and survive an id an export made up
The dispatch guard read the field back through every action, two cold
queries apiece inside the lock, when the context already holds it. And an
integration id from an import file is not the validated integer the
endpoint's serializer produces, so a hand-edited export failed the job
with a database error.
* test: land a second click while a Slack post is still in flight
The lock that keeps two clicks off one row had no Slack coverage, which is
what the size and deadline on the answer are there to protect. The stub
holds one channel open long enough for the second click to arrive.
* docs: say what an empty integration list means, and what an authorized user does
It read as though only the row and frontend-only actions carried nothing,
when HTTP and email carry nothing either, for reasons of their own. And an
integration's authorized user does not outrank the clicker, it replaces
them: the dispatch never compares the two.
* fix: check what a duplicating user may read on every path that copies an action
The permission check only ran where a person copies an action in place, since
that was the only path carrying an actor. Duplicating a table or a database
goes through the serialized import instead, which had nobody to check, so the
copy kept a bot its owner may not read.
`ImportExportConfig` now carries who asked for the copy. An import from a file
and a template install still carry nobody, and keep what they came with.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: refuse an imported integration the application would not accept
The endpoint refuses a Local Baserow integration on a database, because its
authorized user would replace the clicker (ADR 006 section 5). The import path
never asked, so a hand written export placed one anyway, and it rode into
every duplicate and snapshot from there.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: read an integration id out of an export before keying the mapping with it
A list or a dict is not hashable, so looking one up aborted the whole import
job with a `TypeError`. `true` hashes equal to 1 and quietly picked up
whatever integration 1 was remapped to. A numeric string missed the mapping
and then resolved the id the export was written with, which is another
database's.
Coerced before the lookup rather than after, and booleans, containers and
floats refused outright.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* perf: read the bot once however many actions of a click share it
`select_related` only saves the base row. The token lives on the subtype, and
resolving that row by row cost a query per action, inside the lock that guards
the row. Three actions sharing one bot read it three times.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: hold a Slack post to the time its lock was sized for
The timeout Requests applies is per socket operation, not for the call as a
whole, and redirects were followed, thirty of them if offered. A configured
endpoint could spend a fresh timeout on every hop and outlive the lock that
guards the row, letting a second click through.
Redirects refused, since `chat.postMessage` answers directly, and the lock
sized off the socket operations the way the email service already does.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: remove only the containers the local e2e run started
A trap replaces the one before it rather than adding to it, so the Slack stub's
had to name httpbin too. It named it whether or not this run started one: point
E2E_HTTP_STUB_URL at your own stub and the block that starts httpbin never
runs, but the exit still removed whatever was using that name.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: let a fetched integration list land on the application still on screen
The fetch mutated the object it was handed, so a `forceSetAll` in flight left
the bots on an object nobody renders while the one on screen stayed empty. And
it cleared and repopulated with no ordering guard, so a bot created while the
request was open was wiped when the answer landed, with nothing to fetch it
again.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: ask again for a bot list the editor failed to fetch
The action cards are hidden rather than unmounted, so a fetch tied to a form's
own `created` ran once for the life of the editor. After a network blip the
dropdown read as a database with no bot, and the only thing offered was
creating a second one. Every form also reported the same failure, so three
Slack actions raised three toasts for one request.
The list owns the fetch now: it knows when a card opens, so reopening one asks
again, and there is one place to report from.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: make the integration dropdown selectable, editable and reachable
Every parent binds it with `v-model`, which listens for `update:modelValue`.
Creating an integration from the footer emitted `input` instead, so the bot was
created and then not selected. The auto select of a lone integration went the
same way.
The footer was an anchor with no href, so tab skipped it and no key opened it,
which left creating a first bot unreachable without a mouse.
And the footer only ever opened the modal to create. A database has no
integration settings page of its own, so an imported bot, whose token the
export stripped, could not be repaired from anywhere.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: say when a Slack action carries a bot with no token
An export strips the credential, so an imported bot arrives named and unusable
while the action still looks configured. Every click was then an outbound
request that was never going to work, and the reason only arrived after it.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* test: cover the Slack request deadline and its refused redirects
The tests for these were written with the fix and then left out of it, so the
lock sizing and the refused redirects went in uncovered.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: report a failed integrations fetch once for the request, not once per waiter
Moving the fetch to the list left the reporting with the caller, and a list can
be asked for the same request more than once. Each caller then caught the same
rejection and raised its own toast. Reported from inside the shared request
instead, so one failure is one message however many are waiting on it.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: describe the Slack answer where the dispatch actually puts it
`generate_schema` advertised `ok`, `channel` and `ts` at the root while the
dispatch kept them under `data`, so every path the data explorer offered for a
Slack node resolved to nothing. Chaining off one has never worked.
The schema describes the wrapper now, rather than the dispatch dropping it.
That leaves every sample an earlier version stored exactly as it is, so no
migration is needed. The cost is that this service describes its answer one
level deeper than the HTTP and email ones, which unwrap theirs instead.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* feat: say who else can use a Slack bot when its token is entered
A database's integrations are shared by everyone who can build in it, and nothing said
so at the moment that matters. The warning goes where the decision is made, and is
worded around reuse rather than exposure, since the token is never shown back.
It comes out again once ownership or private integrations land.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* docs: keep the integration rule in one place, and say what the new methods take
The comment on `allowed_integration_types` listed every action type's reason, which goes
stale the first time someone adds one. It now says what an empty list means and points
at the ADR, which carries the reasoning.
The methods this branch added or changed say what they take and what they answer with.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* docs: bring ADR 006 up to what phase 4c actually built
Section 5 said databases carry integrations while later sections still read as though
external actions were unbuilt: nothing to strip, nothing to reconfigure, no integrations
on a database at all.
Now recorded: which integration types an action may carry and why the list is empty for
most of them, that the database derives what it holds from those lists rather than
keeping a second one, which copy paths carry the requesting user and which deliberately
do not, what happens to a stripped token on import, and the Slack action's own
lifecycle.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* test: prove a Slack answer reaches the paths its schema offers
Three gaps found reviewing the fixes against what was asked for.
The e2e still reopened the dropdown to pick the bot it had just created, which
was the manual step the Vue 3 event was meant to remove. The dropdown now says
so on its own, and a form test covers it, asserting the selected value rather
than the item list, which holds the name either way.
And nothing exercised an automation node reading a Slack result, which is what
the shape question was really about. The new test builds the stored result with
`dispatch_transform` and walks the paths out of `generate_schema`, so moving
either side without the other fails it.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* refactor: cut the comments back to what is not already in the code
Roughly half of what this branch added restated the line below it or explained
at paragraph length what a sentence covers. Kept the ones that say why, dropped
the rest, and fixed a stale reference to an exception this service no longer
raises.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: keep the integration dropdown reaching its parent
Declaring `update:modelValue` in `emits` was half a fix. Vue keeps a declared
event's listener out of `$attrs`, so the parent's `onUpdate:modelValue` stopped
falling through to the dropdown below, which was the only thing carrying a
list selection back. Creating a bot worked; picking an existing one silently
did nothing, for the builder's data sources and user sources as much as for a
button field.
Everything now goes through `select`, and `autoSelectFirst` reads what the
parent actually bound rather than the `value` prop nobody passes.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: do not remember a load that backed off, or share one across requests
A fetch that backed off returned the list it declined to fill, which read as
success: the caller marked the database loaded, so bots that existed before
the request never appeared and nothing asked again. It answers null now, and
only a fetch that committed marks the load.
The in-flight map was also module scope, which one server process shares
across every request it renders. Keyed by store instead.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: let an action's bot be cleared without permission to read it
`get` cannot tell a key the request never sent from one sent as null, so
clearing the integration resolved to the one already carried and was refused
to anyone who could not read it. Removing a credential takes nothing away
from anyone, so it needs no such permission. An absent key still keeps and
checks what the action carries.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: stop a failed Slack request repeating the message back in its error
`except ConnectionError` caught the builtin, which requests' own
ConnectionError does not inherit from, so that branch never ran and the
failure fell through to a clause that raised `str(e)`. Requests builds that
message out of the whole URL, and this one's query string carries the channel
and the resolved message text.
`response.json()` sat in the same block, so a proxy's HTML or a redirect body,
which `allow_redirects=False` now stops following, surfaced as an opaque parse
error. Read outside it, and reported as an answer that is not Slack's.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: let a database still turn integrations off entirely
The override answered from the action types alone, so `supports_integrations`
was dead for databases. The two tests that turn it off to exercise the guard
were passing on the allow-list instead, and would have passed with the guard
deleted. Both now name a type the allow-list accepts, so only the flag can
refuse it.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* docs: say that a bot's token can be read, because it can
The warning claimed the token stays hidden. The integrations endpoint
serializes it in the clear, as it does for every other type, and this branch
is what exposes that endpoint on databases. Reworded, and the ADR with it,
noting that masking it on read is worth doing and is not scoped here.
Also finishes the comment trim, which a script gave up on halfway through, and
sources the Slack logo from the integration type that already owns it.
Claude-Session: https://claude.ai/code/session_0125wkP6wPcyQ3MZwtbDawhr
* fix: send the Slack channel and message in the body, not the query string
Both are row data. A query string is what a proxy writes to its access log, and
this PR makes the destination host configurable, so the message travelled
further than it needed to. The error path already worked around this by
refusing to repeat `str(e)`; sending the payload as form data removes the
reason for that.
* fix: keep a bot out of a duplicate made by someone who may not read it
A duplicate is taken with `exclude_sensitive_data=False`, so the bot was cloned
into the new database with its token. The action's `ReadIntegration` check then
ran against that clone, which lives in an application the duplicator owns and
can read, so it always passed. Denying read on a bot and duplicating the
database was a way to obtain its token.
The credential is left out of the export instead, and the copied action drops it
for want of one it may carry. One `check_multiple_permissions` call for the
whole list rather than one per integration.
The existing test passed only because it denied the operation by name, which
denied the clone too. The new one denies a single object, the way a per-object
role assignment does.
* perf: stop reading the same integration row three times on every save
The check resolves the integration to check it, then hands the id on and the
service type reads the same row twice more, base and subtype. It passes the
instance it already has instead. Its own checks are looser than the ones that
have just run.
The click path resolved integrations with `specific_iterator` directly, which
skips each type's `enhance_queryset`, trading one query per action for one per
related row. It goes through `IntegrationHandler.get_integrations` now.
Also says in the comment why an edit that does not resend the id is still
checked: the channel and the message are the whole of what a bot does.
* fix: skip an integration an application will not take, rather than fail the import
The gate refused the whole job. No export this instance writes can fail it
today, but a release that stops registering an action type would turn every
snapshot holding that integration into one that cannot be restored, and a
restore is the one path a user cannot work around.
The row still does not land, which is what the gate is for. An action naming a
skipped integration imports unconfigured, the same as for any integration it may
not carry. Only the database type narrows what it accepts, so nothing else can
see the None this now returns.
* refactor: tidy what the database does with its integrations
Share one cache across the integrations it exports and imports, the way builder,
automation and dashboard already do, so a type that serializes a file writes it
once. Count them in the import progress, which reported 100% before they were
done.
Keep `supports_integration_type` out of the middle of the class attributes and
read the accepted types once per call instead of scanning the registry inside a
generator. Not cached across calls: a test can register an action type.
Drop `_read_response_within_limit`, which had become a one-line pass-through to
the util the module already imports.
* fix: do not let a delayed integrations fetch undo a change made while it ran
Only a create or a delete bumped the generation the fetch reads, so an edit or a
reorder landing mid-request was overwritten by an answer written before it. For
a bot's token that reads as a missing credential on a bot that has one.
The fetch also restored the counter to what it found after writing its answer,
which dropped a bump a create had committed in the meantime and let a second
fetch write a list without the new bot. It commits the rows directly instead:
its own writes were never a change to back off from.
* fix: say when a Slack action points at a bot that is not there
An empty list read as healthy, so a bot deleted since, or one named by an import
made elsewhere, left the action looking configured until the click failed. It
now waits for the list to have been fetched rather than for it to be non-empty,
and reports a bot it cannot find.
A fetch that failed stays quiet: the list is unknown then, not empty, and the
failure already raises its own message.
* fix: offer to edit an integration only where there is nowhere else to
The edit button went into the shared dropdown, so it appeared in the builder
data source and user source forms, automation, dashboard, the AI agent form and
the SMTP form. All of those have an integration settings page; a database does
not, which is the reason the button exists.
It is behind a prop now, and the Slack form passes it only for a database.
* fix: match the slow Slack stub on the body the request now sends
Moving the payload out of the query string left this stub matching on a
`channel` query parameter that is no longer there, so it never matched and the
catch-all answered at once. The concurrent-click test lost the delay its lock
assertion depends on, and would have passed without ever holding a lock.
* fix: ask again for an integrations list that changed, rather than dropping it
Bumping the generation on an edit or a reorder made the back-off common, and
only the button field caller reads the null it returns. The builder awaits this
inside `loadExtraData` and then marks itself loaded either way, so renaming an
integration while that fetch was open left every data source and user source
dropdown empty until a reload.
It asks again instead, up to three times, and answers null only when the list
will not settle. The tests give the retry the answer a server would have by
then.
* fix: do not call a bot missing when it may only be hidden
`get_integrations` filters the list by what the caller may list, so a bot absent
from it is either deleted or invisible to this user and there is no telling
which. Someone with no list access to a colleague's bot was told a working
action was broken, and following the message would have overwritten it.
* refactor: read the accepted integration types without building a set
One membership test does not need a frozenset of every type: the generator it
replaced short-circuited and allocated nothing. Not keeping the answer was the
right call; building the set was not.
Also `or []` for the imported integrations, since a hand-edited export can name
the key with an explicit null, and two test names and a docstring that still
described the behaviour before this branch changed it.
* test: open the Slack answer's data node before reading its fields
The schema describes the wrapper the dispatch actually writes, so `ok`,
`Channel` and `Message timestamp` sit one level in. The test still expected
them beside the action, and had been failing since the schema was corrected.
Opening the node is what a user does to reach them.
* fix: mount the Slack stub from the directory the recipe actually runs in
`just --justfile e2e-tests/justfile` runs recipes from that file's own
directory, so `$(pwd)/e2e-tests/stubs/slack` pointed a level too deep. Docker
created the missing path and mounted it empty, WireMock started with no
mappings, and every Slack call answered 404. CI was unaffected: it mounts the
stub by workspace path.
* docs: say why the application type is compared as a literal here
`integrations` must not import from `database`, and the sibling forms compare
`application.type === 'automation'` the same way.
* Revert "fix: mount the Slack stub from the directory the recipe actually runs in"
This reverts commit
|
||
|
|
0f8d63e4e4 |
feat[4b/6] Button field: send an email (#5973)
* feat: let a button field send an email
A button can now send an email when it is clicked, through the SMTP
server this installation is configured with. A button's actions carry no
integration, so the form drops the integration branch of the shared SMTP
form and the action always sends through the instance.
Without an instance SMTP server the action would fail on every click, so
it is refused when it is configured instead, and the editor shows the
reason rather than a generic error. The refusal covers creating an
action, swapping an existing one to this type, and clicking a button that
already carries one.
A failure names neither the mail host nor its port: the clicker is told
which action could not be completed and nothing more.
* fix: refuse the email action on an instance that only prints what it sends
Without SMTP configured, Baserow keeps a backend that writes the message
locally and reports that it sent, so the guard never fired on the very
installation it was written for: the action was offered, the click said it
worked, and nothing arrived. What the instance does with a message it is
given now decides, rather than EMAIL_HOST, which Django defaults to
localhost whether or not anything is listening.
The instance setting is also pinned when an action is prepared. The form
does not offer the choice, but the endpoint took whatever it was given,
and a service that sends through nothing fails on every click.
A click that may not dispatch no longer learns how this installation is
configured: the refusal now runs after the permission check, and once per
type rather than per action.
Drops the editor's own toast for a refused type. The shared error handler
already shows the reason on a 4xx, and replacing the handler with a stub
broke every caller that asks it what kind of failure it was.
Also sets the SMTP form's instance flag where the form takes its defaults,
so opening an action no longer reports a change the user never made, and
fixes the mail fixture, which read one page of a catcher the whole suite
shares.
* fix: scope the mail cleanup, and only hide the failures that name an address
Emptying the catcher in `beforeAll` runs once per worker, and the suite
runs three of them locally, so one worker could delete the message another
was waiting for. Pointed at a dev stack it also took whatever mail the
developer had captured. A test now drops the message it read, by id.
The clicker was told "the request could not be completed" for failures
that name nothing about this installation, such as a server refusing the
encryption. What is withheld is now named: the failures whose message
carries the address the request was going to. Everything else a service
raises is about the values it was handed, and is the only thing telling
the clicker what to fix.
* fix: keep the mail lookup independent of the catcher, and say when sending is off
The catcher is asked for the message by subject rather than read a page at
a time. A dev stack's is long lived and holds whatever the developer
captured, so the one being looked for can be arbitrarily far down, and the
purge that used to hide that was itself taking other workers' mail.
Whether this installation can send is now decided in one place, the SMTP
service type, so the flag the API already exposes for it is true rather
than a check the button field kept to itself. A backend the settings do
not name at all counts as unable to send: the service asks for it by name
and would fail on every click. The editor reads that flag and says so on
an action whose instance has stopped being able to send, which until now
only a click would reveal.
A sequence carrying two deactivated types names the same one every time.
Tests cover what the endpoints answer: the create, type swap and dispatch
refusals, their error code and reason, and that a refused click leaves the
rate limit alone.
* fix: say an instance cannot send email before the action is saved
An action being configured has not been saved yet, so there is no service to
ask whether this installation can send. Until now the first thing to say so
was the refusal on save. The settings the editor already loads now carry it,
and the email option in the action dropdown is disabled with the reason beside
it.
The two ways of being unable to send are told apart. Sending turned off by an
administrator and an instance with no mail server each get their own reason,
returned as a code so the editor words and translates it.
The mail backend is matched as whole path segments, so a custom backend such
as `myapp.console_relay` is not read as the console one.
The setting behind all of this is documented, including that turning it off
disables a button field's email action altogether.
* fix: pin the mail server as part of the write that creates the service
A database action carries no integration, so the service is pinned to the
instance server whatever the caller asked for. That pin was applied after the
base had already saved the service, which updated the row a second time. It
now travels in the values the base saves, so a create writes the service once.
* test: cover what an exported email action carries and what it drops
The HTTP action had import and duplication coverage, the email one had none.
These pin the field references a copy has to rewrite, that an export keeps the
action pinned to the instance server, and that an instance which cannot send
still imports the action as configured rather than dropping or repairing it.
* fix: hold a button's lock for as long as its email actions can wait
The lock's TTL read a `timeout` field off each service. An email service has
none, so a click that only sends email got the default floor however many
sends it chained, and a lock expiring mid sequence lets a second click send
the same mail again.
Services are asked now. The HTTP one answers with its timeout, the email one
with three times the SMTP timeout, which is per socket operation rather than
for the send as a whole.
* docs: say what the deactivation hooks take and give back
The hooks a type overrides to say it cannot be used here were documented
unevenly: no return described, no raise named, and the SMTP overrides took
untyped arguments.
* fix: let an unsaved email action be read by the one after it
A service has no schema until it is saved, so an email added in the editor was
missing from the next action's explorer until the field was saved and reopened.
An email answers with whether it went out and nothing else, which is known
before anything is sent, so the type offers that shape itself.
* test: prove the chained email arrived, and say where the catcher is
The chained test only showed that the action after the email ran. It now waits
for the message itself, under a subject unique to the run, and drops it in a
`finally` so a failed assertion leaves nothing behind for later runs to read.
Which mail catcher the suite reads is documented: the local runner follows the
dev stack's own MailHog port rather than assuming the default instance, and
the two mail variables are written down with when each applies.
* fix: keep the email action pinned through an edit, and size its lock for a real send
An update is not refused the way a create is, and the service type drops the
instance server while sending is off. An action edited then came out unpinned
and failed on every click once sending was back. The action type restores the
pin after the base has saved, writing only in that case.
The lock's share for an email is sized for the conversation a send really is:
the timeout applies to every socket operation, and there are a dozen or more
of them, not three.
Whether the instance can send is asked two ways now. The Application Builder
and automations keep the setting-and-host check they always had, so an
installation without a mail server behaves as before for them. The stricter
check, where a backend that only prints counts as no server, is the button
field's alone: it has no integration to fall back on. `is_deactivated` is
derived from the reason rather than computed a second time.
* refactor: let every email editor see the answer's shape, and decide deactivation once
The `{success}` shape an unsaved email answers with lived on the button field's
action type alone, so the builder and automations still showed nothing for an
unsaved email. It moves to the shared service type, which every editor reads
through.
The action type's `getErrorMessage` repeated what the base already does with
`isDeactivatedReason`, and only differed for tests that passed no workspace.
The override goes, and the tests pass the workspace the action list passes.
* test: read the dev stack's mail catcher by default
A plain `yarn run test` after the local runner has finished fell back to the
containerized stack's port, which the README says it does not. `just e2e` and
CI set the URL themselves.
* fix: line up what an email action promises with what it can do
Four follow-ups from the review of the email action.
The editor and the send now ask the same question about the instance mail
server. A mail backend with no host to give it reported the action as
available and then failed the click, because a database action has no
integration to fall back on.
What an email says no longer travels in an export that leaves the
instance. The table schema handed to formula AI is serialized that way,
and reading a formula field needs far less permission than configuring a
button, so recipients, subject and body are blanked there as an HTTP
action's headers already are. A snapshot and a duplicate keep them.
A server that answers and then refuses, over TLS or over credentials,
now counts against the rate limit. The instance had already opened the
connection, so giving the slot back made that traffic free to repeat.
And ADR 006 records that the email action sends through the instance
server rather than an SMTP integration, which is the opposite of what it
said.
|
||
|
|
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.
|
||
|
|
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) |
||
|
|
9166a46c34 |
docs: ADR for how the button field shares workflow actions across modules (#1722) (#5755)
* docs: add ADR for button field workflow actions (#1722) * docs: renumber button field ADR to 006 to avoid collision with 005 * docs: rework button field ADR to cover integrations, ownership, and import/export from review * docs: split run-as user from row history attribution in button field ADR Rewrites section 5 so permission checks keep running as the integration's authorized_user while row history records the clicking user as initiator from v1. Also removes speculation about the future Agent feature, and documents id_mapping remapping in the import section. * docs: close review gaps in button field ADR Names the initiator mechanism and the configuration permission boundary in section 5, serializes dispatch per button cell, defines row context snapshot semantics, excludes database tokens from clicking, and covers target table deletion under common operations. * docs: rework button field ADR to run actions as the clicking user Adopts the actor approach from review: permission checks, row history, and created-by all see the clicking user, with no on-behalf-of execution. The Local Baserow integration becomes an internal auto-created object, removing the v1 settings UI, credential stripping concerns, and the initiator extension. * docs: simplify button field ADR import pass per review Defers every service and formula reference on import instead of checking resolvability first, and documents why the second pass needs no dependency ordering between buttons. * docs: apply review wording fixes to button field ADR Marks the automation base-class PR as parallel rather than a dependency, softens the Option 1 con to a maintenance note, states both data providers exist on backend and frontend, and reuses the builder's action error state for reconfigure. * docs: drop the integration requirement for v1 button actions Adopts the optional-integration direction from review: database services authorize and execute as the actor with no integration attached, v1 ships no integration object or settings UI, and the nullable-FK-versus-dedicated-object choice is left to implementation. * docs: mark button field ADR accepted with final review touches Flips the status to Accepted after core-team approval, routes the failure toast through the API participant in the sequence diagram, and notes the upstream dependencies are scoped core/services changes, not a refactor. * docs: scope the no-integration decision to Local Baserow services Clarifies section 5 after review: only the Local Baserow integration is unnecessary for buttons, since it just carries a user and buttons use the clicker. External integrations like SMTP and Slack carry real configuration and stay required when external action types arrive. * docs: tighten button field ADR claims and record integration ownership plan Names the undo mechanism (perform without registering, keep the action_done signal), corrects the scope of the actor fallback work, fixes the builder-unchanged justification, defers actor auditing in the integration-present branch, fails clicks on field-level permission gaps instead of skipping fields, and records the agreed integration ownership sequence: explicit sharing warnings when external types arrive, created_by plus is_shared private-by-default later. |
||
|
|
b9d0b91d07 | chore: rename 'formula' to 'expression' in WAB & integrations (#5261) | ||
|
|
b432334fa1 | Changed repository URL to baserow/baserow [1/2] |