* feat: list every invitation link of a workspace in the workspace settings modal
* fix: show the table of view invite links, keep the list steady while searching and wrap its header
* 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>
* 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.
* feat(agent): show tool activity in conversations
* refactor(agent): centralize tool step statuses
* fix(agent): keep tool-step diagnostics free of private data
* fix(agent): retain Sentry details for tool errors
* feat(agent): show tool inputs and failed read attempts
* fix(agent): show individual tool outcomes in activity groups
* feat(agent): explain tool failures in translated tooltips
* feat(agent): name known targets in failed tool calls
* fix(agent): use shared tool errors after rebase
* fix(agent): show interrupted changes, announce tool steps and clear pre-tool text
* refactor(agent): move input previews and failed-call targets out of tool steps
* refactor(agent): log tool-step failures without the Sentry helper
* fix(agent): classify tool errors once and drop partial-failure steps
Calls to tools a reply never offered no longer get a step.
* refactor(agent): key tool presenters by tool name and drop unused step data
Drops presentation_type, the unused card icon, copy-time step cleanup and Kuma-visible chat CSS changes, and defers steps when loading reply history.
* test(agent): cover Stop during a change and merge overlapping step tests
* docs(agent): trim tool presentation guide to the step contract
* fix(agent): keep step facts JSON-safe and polish stopped cards
Restores the JSON check on step facts, keeps a stopped change's title readable at narrow widths, raises its warning contrast, and stops reopening a running reply from re-announcing its old steps.
* fix(agent): cap the Agent chat column at 900px
* fix(agent): name the executing tool call and keep step cards stable while text streams
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(agent): name reused tables and views instead of showing zero created
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(agent): tell the model which changes an interrupted reply started
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(agent): continue a retried tool call on the step of its invalid attempt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(agent): report views skipped by name collisions
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* 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>
* feat(jobs): Opt-in lock so a job type can refuse a cancel after its commit
* feat(create-user-template): Create a user template and list it in "Your templates"
* fix(create-user-template): Address review feedback
- Only the owner can open a user template; the slug endpoint returns 404
otherwise and includes `type`.
- List templates through `/api/templates/?view=flat` instead of `/own/`.
- Rename the job's copy to `template_workspace`, renumber the migration to
0132 after develop's core migrations, guard it like 0128, and move
revision fields and metadata to the update PR.
- Clear references outside the selection instead of failing the import,
lock the owner row against a concurrent delete, and keep leftovers
tracked until they're deleted.
- Load workspace permissions only for the wizard, handle instances without
categories, restore a running job before a failed one, and open the
default template again in the template modal.
- Reuse existing export, cancel and serializer code, keep one icon list,
remove overlapping tests, and give template fixtures a unique slug.
* feat(core): add Redis-backed background chat runs
Run AI work once in Celery and follow bounded Redis Streams over HTTP. Keep
lifecycle, Stop, leases and final outcomes in Postgres without per-token writes.
Include the shared frontend follower, adapter registry, recovery API, migration,
queue/deployment wiring and adapter guide. No product uses it yet.
Part of #6346
* Remove unused chat run response header exposure
* Extract shared async streaming HTTP router
* Simplify chat run follower and group engine constants
- Check read access once when a stream opens; read run state from Postgres
only after 5 s without output or on run.finished.
- Split follow_run into small steps around _OutputReader.
- Turn event kinds, error codes and stop reasons into StrEnums; the
Kuma-only model_unavailable code moves to Kuma.
- Document ChatRunType hooks with param, return and raises fields.
- Add BASEROW_ASGI_HTTP_MAX_CONCURRENT_STREAMS and size the follower Redis
pool by it.
- Give handler publish/recover calls their own event loop, so cleanup
cannot close pools shared by HTTP followers.
- Update ADR 010 and the background chat runs docs.
* Clean up chat run interfaces and test setup
* Prune chat runs once after 7 days and skip overdue claims
- Delete each expired page with one statement. Incomplete runs get one more
ensure_interruption_warning call first, and are deleted even if it fails,
so run metadata never accumulates. The hook now returns None.
- Keep runs for 7 days instead of 30.
- Never claim a queued run older than NOT_STARTED_AFTER; the sweeper ends it.
* Retry brief Redis failures in chat run followers
- A connection error, or a buffer that does not exist yet, is retried with
the same cursor, sending heartbeats meanwhile.
- run.replay_unavailable is only sent once the follower stops reading, so
the browser can treat it as final.
* Let finished chat run output expire with the active TTL
Nothing reads a buffer once its run has finished: followers return the saved
outcome first and recovery only reads running runs. Drop finish() and the
24 h TTL, so a finished buffer expires an hour after its last append.
_publish_terminal now reuses _publish.
* Run the chat run scale tests on fakeredis
Build the buffer's real read and write pools on fakeredis connections, so
these tests always run and backend CI needs no Redis service. The Kuma e2e
tests cover a real Redis.
* Address the remaining chat run review comments
- Serialize the saved outcome after the transaction, so only a failed save
is logged as one.
- Make the primary-pin test transactional; inside the test transaction the
router always used the primary, so it could not fail.
- Cover the race past the per-user lock, a lost run after Stop and an old
writer appending to a recreated buffer.
- End the admission test's request with a disconnect, so a regression fails
instead of looping.
- Document that one worker process runs AI replies one at a time.
* Move the chat run migration after develop's core 0130
* Log only the class of an outcome serialization error
* Test that the run deadline asks a run to stop
* Keep a run's status when a resumed follower rebuilds its output
* Note that slow DNS lookups turn off a run's live output
* Implementing the new invite-to-scope design and functionality.
* Simplifying the invitation acceptance, we don't need the redirect.
* Fix the action type description
* Addressing my own review feedback, and making sure the workspace invitation form behaves like the scoped one.
* Further tweaks after testing edge cases manually
* Lint fix
* Taking a DRYer approach to validating the subject chips.
* Lint fix
* Addressing feedback
* fix: block invitation batches containing invalid emails
Malformed addresses could be silently cleared after a partial batch send.
Keep them visible and block submission until corrected or removed.
* fix: respect workspace invitation permission in scope sharing
Scoped Admins could attempt email invites denied by workspace permissions.
Gate new-email invitations while keeping existing subjects assignable.
* feat: unify workspace and scoped access lists
Workspace and scope lists duplicated markup and lacked consistent controls.
Share rows, add workspace edit/cancel actions, and cap lists at six rows.
* fix: reconcile invitation branch with develop
Develop enables agents and adds an Enterprise migration at the same number.
Align invitation subjects and renumber the branch migration after develop.
* refactor: resolve workspace user roles in the backend
The frontend duplicated the backend mapping from basic roles to RBAC roles.
Expose role_uid in user payloads and reuse it for inherited access counts.
* fix: validate invitation emails before submission
The permissive database validator let malformed invitation addresses reach the API.
Use the existing strict validator for email suggestions, chips, and batch submission.
* fix: align invitation input focus styling
The invite input used a gray border tied to whether suggestions were open.
Use the standard blue border with focus-within so Escape preserves the focus highlight.
* feat: limit email invitation batches
Large invitation batches can exhaust the sending allowance partway through.
Default to five new emails per batch, configurable, with a message before submission.
* feat: let roles declare the invitation default
RBAC invitations should default to Viewer without Enterprise-specific logic in core.
Let role types declare the default: Member for basic workspaces and Viewer for RBAC.
* refactor: keep invitation role semantics in their owning modules
Core invitation UI should not interpret Enterprise role IDs or depend on Database roles.
Move basic roles to core and let Enterprise supply invitation subtitles through role metadata.
---------
Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
* Add markdown to HTML renderer for runtime formulas
* Add markdown_to_html formula function
* Add markdownToHtml renderer for runtime formulas
* Add markdown_to_html runtime formula to the frontend
* Add changelog
* Enable advanced mode for smtp service's body input
* feat(core): add Z.ai AI provider
Z.ai can be added as an instance or workspace AI provider with an API key.
It uses pydantic-ai's ZaiModel with a profile limited to the request fields
Z.ai documents: automatic tool choice, max_tokens, no strict tool definitions
and no file parts. AI fields send JPG/PNG images and small text files; the
temperature is capped at 1.
Part of #5753.
* fix(core): limit Z.ai thinking on short capped requests
Z.ai reasons at maximum effort by default, so a 250-token Kuma title or a
256-token model test could spend its whole budget reasoning and return
nothing. Requests capped at 1024 tokens or less now disable thinking, or
ask always-thinking models such as glm-5.3 for low effort, unless the
caller chose a level.
Admins can add xAI as an instance or workspace AI provider with an API key.
It uses xAI's OpenAI-compatible Chat Completions API at https://api.x.ai/v1
through pydantic-ai's OpenAIChatModel and Grok profile, so no new dependency
is needed. Only the stored key is used: the provider never falls back to
XAI_API_KEY or OPENAI_* variables, and it clears the organization and project
headers the OpenAI SDK would otherwise fill from the environment.
AI fields embed JPEG and PNG images within a 20 MiB budget and inline small
text files. Chat Completions has no document input, so other files are
skipped.
* feat(core): add Amazon Bedrock AI provider
Admins can add Amazon Bedrock as an instance or workspace AI provider with
an IAM access key or a Bedrock API key plus a region. The client only uses
the stored credentials: it forces its signature version so botocore never
prefers AWS_BEARER_TOKEN_BEDROCK, and ignores configured endpoint URLs so
the Helm chart's MinIO AWS_ENDPOINT_URL cannot redirect Bedrock traffic.
AI fields send images and documents as native Converse blocks within
Bedrock's per-kind limits, via a new EmbedKindLimit hook on FileHandler.
* fix(core): allow AI provider API keys up to 4096 characters
Short-term Amazon Bedrock API keys are presigned URLs of about 2,500
characters, so the 512-character limit rejected valid keys. The column only
widens (varchar(512) to varchar(4096)), which needs no table rewrite and
stays compatible with the previous app version.
* fix(core): do not send HTML files to Bedrock as documents
Uploads store HTML as application/octet-stream to neutralise active
content, which Bedrock Converse cannot map to a document block, so one
large HTML file failed the whole AI field cell. Large HTML files are now
skipped; small ones are still inlined as text like for every provider.
* test(core): pin Bedrock API key mode and newline key rejection
Assert that an API key client never resolves the default AWS credential
chain, and that the embedded-newline test fails on the api_key error
rather than on an unsupported provider type.
* feat: per-feature and workspace-level AI model settings
Baserow could only point every AI feature at one instance-wide model. An
administrator can now register provider models, declare which AI features each
model may serve, and pick the default model per feature; a workspace admin can
inherit that choice, override it, or disable the feature locally.
The assistant resolves its model once per logical request and threads that
snapshot through its nested agents and tools, so a single run can no longer
re-read settings repeatedly or pick a model other than the one it validated.
The scoped provider state is memoized for the duration of a request, keeping
workspace serialization from loading it once per workspace.
Also:
- add Google and Groq provider types, and keep these database-only providers
out of the legacy workspace settings they cannot round-trip through;
- prune orphaned feature selections so an unloaded feature type's RESTRICT FK
no longer blocks provider and model deletion;
- record whether a configured model answers text and tool-calling probes, and
invalidate that result when its credentials or identifier change;
- broadcast provider and availability changes over the existing realtime
channel so open clients update without reloading;
- read the assistant model from the shared configmap, so frontend pods no
longer miss it on Helm installs.
Manual test instructions live in docs/testing/kuma-model-settings-test-plan.md.
* fix: address AI provider settings review feedback
* refactor: move formula field-reference visitors from premium to core
* feat: add ButtonField model and fixture (#1722)
* feat: add read-only button field type backend (#1722)
* feat: resolve database formulas client-side for the button field (#1722)
* feat: add button field type frontend (#1722)
* chore: add changelog entry for button field (#1722)
* fix: disable button field cells when the url formula is broken (#1722)
* fix: encode whitespace in resolved button field urls (#1722)
* fix: rename button field visitor tests to avoid pytest module collision
* test: add button field to expected premium export outputs
* test: add button field to remaining interesting-table test expectations
Registering the button field in construct_all_possible_field_kwargs
changed the interesting test table used by several golden-output
tests. Update the affected expectations (serialized row value, CSV
export column, and generated schema entry) to match actual behavior.
* feat: put the button field behind the button-field feature flag
* fix: address button field review nits
* fix: renumber button field migration after develop merge
* docs: describe the button field as an action field in API docs
* fix: handle raw formulas and missing field references in button fields
* fix(review): remap binary-op field refs, cache parse trees, extend button field tests
- visit both operands in BaserowFormulaReplaceFieldReferences.visitBinaryOp so
get() references inside binary expressions are remapped on import/duplication
- cache client-side formula parse trees so large grids do not re-parse the same
button formula for every row
- add tests for the urlInvalid submission block, the field-store fallback in
functional grid cells, and duplication with broken field references
* fix: keep button field type registered when the feature flag is off
Gating registration behind the flag meant that disabling it after button
fields existed made every registry lookup for those fields raise, breaking
all row, field and export endpoints for the affected tables.
The type is now always registered on both backend and frontend, matching
how other gated field types work. Creating a button field (or converting
a field to one) is rejected with ERROR_FEATURE_DISABLED while the flag is
off, and the field type dropdown hides the type entirely via the new
isVisibleInDropdown hook. Existing button fields keep rendering and their
tables keep working.
* fix: keep brackets when remapping field references in formulas
* fix: keep the button url formula mode when remapping field references
Assigning the remapped formula string to `url_formula` made the patched
`save()` re-wrap it through `to_python` as `simple` mode, undoing the
raw-mode guard in `replace_field_id_references`. A raw literal URL then
became an unparseable formula, so duplicating a table left the button
broken. Assign the whole formula object so mode and version survive.
* fix(review): share the formula field id cache and cover the flag-off cases
Move `get_table_field_ids` and its `table_schema_changed` invalidation into
core next to the visitors, so validating a button field's url formula no
longer costs a query per field on every field response. The AI prompt
validation now reads the same cache instead of its own copy.
Also list the edited field's own type in the field form dropdown even when
hidden, otherwise an existing button field renders with a blank type once
the feature flag is turned back off, and drop the always-null cell backup
on type conversion.
* chore(review): tidy the button field export branch and flag docs spacing
* test: cover the formula parse tree cache
The cache is shared by every resolveFormula caller, including the builder,
so record what it guarantees: one parse per distinct formula, raw formulas
never parsed, failures not cached, and oldest-first eviction at the cap.
Also state the read-only invariant the reuse depends on.
* fix: guard and cache the formula field reference helpers (#1722)
`get()` and `get('fields')` both parse and both pass the create API, so
remapping them raised an uncaught IndexError that aborted the whole
duplication or import job. Guard every index instead.
`extract_field_id_dependencies` also parsed raw formulas, unlike its two
sibling helpers, and re-parsed on every call. It now short-circuits raw
mode and caches the extracted ids per formula string.
* fix: keep the AI prompt's mode when remapping field references (#1722)
Moving the reference visitors to core added a raw short-circuit that
returns a bare string. `AIFieldType.after_import_serialized` re-saved
that string, so `to_python` re-wrapped a raw natural language prompt as
`simple` mode and every row's generation then failed on parsing the
prose.
Assign the whole formula object instead, the same way the button field
already does, and cover a raw prompt surviving an export/import.
* feat: add the encode_uri and encode_uri_component formula functions (#1722)
A button field's URL is built by concatenating row values, so a value
holding a reserved character corrupts it: `shoes#7` truncates to a
fragment and `a&b=1` injects a parameter. Encoding every value
automatically is not an option, because a value can legitimately be the
whole URL.
These mirror the two functions that already exist in the database
formula language and let a formula escape the parts that need it. The
backend and the browser encode identically, since button URLs resolve
client-side and everything else resolves on the server.
* fix: address review on the button field backend (#1722)
The field no longer creates a database column. It held nothing but an
always-null boolean, and that boolean leaked into the API docs and the
Local Baserow schema. `get_model_field` returns None and a
`NoDatabaseColumnField` is contributed to the generated model instead,
which Django treats as non concrete. A `ButtonFieldConverter` handles
conversion in both directions, since the lenient schema editor cannot
alter into or out of a column-less field, and the serializer is now
always-null while staying writable so the read-only validator still
rejects a write.
Also from review: only creation is gated by the feature flag, so an
existing button field stays editable with the flag off; dependencies are
read off the cached table model rather than two queries per field; and
the client is only told to re-fetch when a referenced field appears or
disappears, not when one is renamed or retyped.
* fix: address review on the button field frontend (#1722)
Without a label the button showed the percent-encoded URL. The URL is
now resolved once as the user built it and only the href is encoded, so
the label reads `https://example.com/Red Button` while the link points
at `Red%20Button`. With no label and no URL it reads "Click me".
Also from review: a read-only field the search cannot match no longer
disables optimistic row updates for every edit in a searched view, which
a valueless field like this one did; the parse tree cache evicts the
least recently used entry rather than the oldest inserted one; and the
field type reports its icon class statically and no longer claims its
cells are booleans in the API docs.
* fix: hide button fields from public views and require a label (#1722)
Button fields are no longer handed to visitors of a publicly shared view.
A new `FieldType.can_be_in_public_view` flag drives the exclusion, applied
to the public view info endpoint, the public rows queryset and the two
public websocket signal paths, so a visible field option isn't enough to
expose the label and the URL formula.
The label is now mandatory. It's the only text a button shows, so it must
be set when the field is created or converted into a button, and it can't
be emptied afterwards. The client-side fallbacks to the resolved URL and
to a default label are gone with it.
* feat: add instance AI provider management
* fix: simplify AI provider testing
* fix: remove extra model list spacing
* fix: show AI provider form errors inline
* fix: use icons for AI provider row actions
* fix: place model errors before help text
* chore: polish code
* fix: address feedback
* fix: address remaining frontend CI failures
* Add from_json() and to_json() expressions.
* Fix rebase mistake
* Refactor from/to json runtime formula types to re-use existing json ensurer.
* Add frontend counterpart for ensure json
* Rename regex var
* Simplify formula check.
* Improve formula function detection when JSON load fails
* Refactor to_duration() to accept an optional format arg.
* Add tests for duration utils
* Add tests for new DurationFormation* arg type
* Expand tests for RuntimeToDuration
* Add duration_format()
* Add tests for RuntimeDurationFormat
* Add a Utility formula category, and recategorize some functions
* Allow formula validation visitor allows validating deferred args.
* Improve test coverage
* Add changelog
* Fix frontend test failure
* Remove changes around deferred arg validation
* Clean up stale logic
* Fix docstring
* Ensure tokenize_duration_format/tokenizeDurationFormat supports fractional seconds.
* Use rounding instead of truncating for fractional precision to match the existing format_duration_value()
* Add missing test coverage for duration field formatting.
* Add support to tokenizer to escape tokens.
* format_duration_value/formatDurationFalue is now just a shim that wraps a call to the unified formatValueWithDurationFormat.
* Fix to_duration() example.
* Add new skill for creating/updating runtime formulas.
* Add abs() formula function
* Add getErrorMessage() to arg type to return a human-readable error message.
* Update skill to ensure getErrorMessage() is overridden when appropriate.
* Add null() runtime formula.
* Add number_format() runtime formula.
* Fix tests
* Add changelog entry
* Add date_interval() runtime formula.
* Fix test
* Add runtime formula: to_datetime()
* Update changelog
* Fix backend test
* Fix frontend test
* Add new ensure_date_interval() ensurer.
* Update descriptions and examples.
* Remove references to Moment.js
* Refactor validate_type_of_args() to return the index of the invalid arg.
* Refactor to_datetime() to use ensure_datetime()
* Use ensure_date_interval ensurer for IntervalStringBaserowRuntimeFormulaArgumentType
* Update skill with sections on ensurers.
* Add optional strict arg to ensure_datetime()
* Fix tests
* Simplify the ensure_string() to return total seconds for timedelta.
* ensure_date_interval() should also try to convert numbers to a timedelta.
* Fix test
* Use ensure_integer() in ensure_date_interval()
* Rename DateInterval to Duration
* Return an array of all possible errors.
* Use database duration parser for consistency
* Remove contrib references in core.
* Add additional test coverage
* Rename duration to to_duration
* Attempt to fix CI
* Reverting some changes
* Ensure empty string '' isn't accepted as a datetime format.
---------
Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
* Add replace()
* Add length()
* Add contains()
* Add reverse()
* Add join()
* Add split()
* Add is_empty()
* Add strip()
* Add sum()
* Add avg()
* Add at()
* Add changelog
* Small fixes
* Add tests for ensure_array()
* Improve error handling for RuntimeLength
* RuntimeContains should return None/null for the default case
* Improve array/object/int check for RuntimeIsEmpty
* Fix logic to only work on strings for RuntimeStrip
* Lint fix
* RuntimeSum backend validation shouldn't allow non-numbers.
* RuntimeAvg backend validation shouldn't allow non-numbers.
* Handle ValueError in literal array string
* Lint fix backend
* Fix frontend tests
* Add more test cases
* Refactor backend tests
* Remove allowLiteralArray/allow_literal_array
* Add new RuntimeToArray function and refactor existing functions that use Any type to avoid using ensurer. Update examples with usage of to_array.
* Refactor frontend tests
* Add RuntimeToArray in the backend + tests
* Refactor backend functions/tests to avoid using ensurer
* Improve frontend validation and tests
* Fix examples
* simplify
* Remove local debugging code
* Allow > to compare any type
* Allow < to compare any type
* Allow >= to compare any type
* Allow <= to compare any type
* lint fix
* is_empty should raise an error for unsupported types.
* Change arg type to text for strip
* split() should return a list with the same arg if the string has no spaces and no delimited is provided.
* Update avg() helper to allow a strict param
* Fix toArray description
* is_empty() should return false by default, and handle supported args correctly.
* Refactor at() to bubble up error
* Let join() bubble up errors
* Allow reverse() to bubble up errors
* Allow contains() to bubble up errors
* Allow length() to bubble up errors
* Update examples for comparison operators to include date examples
* Allow lexicographical comparisons for >, <, >=, and <= operators.
* Improve/correct examples
* Ensure arithmetic operators can accept 2 or more args. Ensure frontend/backend formula functions are implemented similarly.
* Add and formula types.
* Fix bug reported by Frederik: concat should use Text arg type
* Update examples and small fixes.
* Lint fix
* Update and/or examples to use symbols. Add useStrict option to ensureBoolean().
* For operators, specify 2 args, since operators already reduce
* Replace manual checking of arg len
* Ensure backend implementation matches frontend
* Add castToInt option and make 2nd arg to round() an optional int
* Lint fix
* Implement datetime_format and update examples.
* Implement the moment to python datetime format converter
* Add tests for moment.js to Python datetime formatter.
* Refactor to support timezone in the user data provider.
* Use the new Timezone argument type and validate the timezone name
* Formula should be considered invalid if it can't be resolved.
* Add boolean argument type
* Improve formula validation
* Improve validators.
* Lint fix
* Add changelog
* Clean up import
* Changes to allow testing literal formula in table field mappings
* Add formula function: upper()
* Use ensure*() in the test/parse methods. Add more functions.
* Add operators, description, and examples.
* Add addable and subtractable types
* Add random generator functions
* Add tests.
* Working formula input
* Simplify
* Further simplify
* Still working - simplified further
* Lint
* Undo changes in FieldMappingForm
* Use advanced mode, not raw
* Temp fix to align the checkbox and button
* Lint fix backend
* Lint fix frontend
* Lint fix
* Add translations
* Add advanced formulas to application builder
---------
Co-authored-by: Tsering Paljor <tsering@baserow.io>
Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>