Commit Graph
55 Commits
Author SHA1 Message Date
Davide Silvestri aacb878968 fix(database): run realtime refresh callbacks when no view is selected (#6944)
* fix(database): run realtime refresh callbacks when no view is selected

Fixes #6943

* fix(database): add created and restored fields when no view is selected

view/getSelected is {} without a selected view, so the field_created and
field_restored handlers looked up an undefined view type and threw. Use
view/hasSelected instead, and cover both events on a table page without views.
2026-12-01 13:38:24 +01:00
Davide Silvestri ca2f3e1115 fix: keep public and restricted views in sync when linked-table changes move rows (#6339) (#6378)
* fix: keep public and restricted views in sync when linked-table changes move rows (#6339)

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

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

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

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

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

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

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

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

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

* chore: shorten the #6339 changelog entry
2026-10-19 09:39:10 +02:00
alamin-br b8caade86a fix(database): open new-tab URL buttons in Safari (#6171)
* fix(database): open new-tab URL buttons in Safari

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

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

The action list is stale when refreshing it fails.

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

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

Such URLs hand off to another app, so they navigate the current page and
the placeholder tab is closed. Covers opens_new_tab in the broadcast test.
2026-09-25 17:54:39 +02:00
Davide Silvestri 64c9fff85e feat [6/8]: prepare AI provider management for rollout (#6070)
* feat: retire AI provider flag and add rollout audit

* test: remove obsolete AI provider flag setup and docs

* chore: clean up AI provider configuration and tests

* feat: deprecate legacy AI provider environment configuration

* docs: explain AI provider migration sizing and timing

* docs: mark AI provider migration audit for removal

* docs: explain AI provider migration audit usage

* fix: log AI provider env deprecations after logging setup

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

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

* fix: reuse environment AI settings in generation workers

* feat: import legacy AI provider settings on upgrade

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

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

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

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

* chore: remove the temporary AI provider audit command

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

* docs: reduce AI provider docs to lasting behaviour

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

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

* docs: shorten the AI provider changelog entries

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

* docs: clarify where imported AI credentials are stored

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

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

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

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

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

* feat: remove the legacy workspace generative AI settings endpoint

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

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

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

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

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

* fix: skip malformed Ollama URLs during AI provider migration

* fix: preserve skipped legacy AI provider connections

* test: cover independent legacy AI workspace connections

* fix: skip malformed legacy AI provider settings

* fix: move legacy AI import after current core migrations

The linear rebase omitted the migration renumbering from the previous merge commit, while develop advanced through core 0124. Rename the existing AI import to 0125, depend on 0124, and update its historical migration test so core has a single leaf.
2026-09-25 17:05:10 +02:00
alamin-br 8d389cd0e8 fix(database): Show when a button field needs reconfiguring (#6114)
* feat: report when a button's row action points at the trash

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

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

* feat: disable a button cell that needs reconfiguring

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

* docs: describe the button reconfigure state in ADR 006

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* fix: count a missing integration a button action needs

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

* docs: note a missing required integration in ADR 006

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Refusing it told the editor that the field exists.

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

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

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

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

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

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

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

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

* docs: name every cause of the button reconfigure state

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

* test: expect the rowless button to render disabled

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

* perf: serialize button fields once for all restricted views

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

* perf: skip purged buttons and merge purge broadcasts

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

* fix: bump the global cache version

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

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

A trashed integration is missing from the list, so the verdict is the only warning.
2026-09-21 14:29:18 +02:00
Davide Silvestri ab45c2346a feat [4/8]: per-feature AI model settings (#5796)
* feat: per-feature and workspace-level AI model settings

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

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

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

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

* fix: address AI provider settings review feedback
2026-09-04 10:53:53 +02:00
Bram e69a5188b3 feat: Copy view configuration (#5959) 2026-09-02 16:27:04 +02:00
Przemyslaw Kukulski 80f55a4a59 fix: serialize only updated fields in WebSocket row update events (#5928) 2026-08-21 14:43:00 +02:00
Davide Silvestri f27bb387fe feat [3/8]: add workspace AI provider management and complete AI Field resolution (#5785)
* feat: add workspace AI providers for AI fields

* fix: address workspace AI provider review feedback

* fix: address remaining AI provider review feedback

* fix: resolve core migration conflict

* fix: stabilize premium AI provider tests

* address feedback for local imports
2026-08-20 10:49:57 +02:00
Davide Silvestri c3706658a2 feat [1/8]: add instance AI provider management behind a feature flag (#5740)
* 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
2026-07-27 14:12:37 +00:00
Bram 057f5a1cb0 feat: Add drag and drop ordering of sortings and group bys (#5332) 2026-05-21 18:37:47 +02:00
Bram c264f91085 feat (View level permissions): Default view values (#5058) 2026-04-03 12:15:26 +02:00
Davide Silvestri df68bd9339 fix (grid view): group by flickering at every change (#5043)
* revert: undo unnecessary frontend changes from f6a7d302f

Revert all frontend changes introduced in "fix: bug in public view with
hidden group by" (f6a7d302f). The backend changes from that commit are
kept as they are the actual fix for the public view bug.

The reverted frontend changes caused a regression where group bys would
flicker (disappear and reappear) when changing the group by order,
because activeGroupBys was being cleared at the start of every refresh.

* fix: public view crash when group by is added or removed

Add ViewType.forceViewRefresh() method that handles updating the view,
fields, and (for grid views) activeGroupBys atomically during a
force_view_refresh realtime event. This prevents components from
accessing fields that have been removed or haven't been added yet.

Also fix LinkRowFieldType.isEqual crashing with null/undefined values
when rows have no linked items.

* fix: inconsistency in counting hidden fields in grid view

* fix issue deleting/restoring group bys
2026-03-31 14:42:43 +02:00
Cezary Statkiewicz 6cb54ec32f Date dependency between rows #3735 2025-09-29 16:34:19 +02:00
Cezary Statkiewicz 37ddb0f7d5 Date dependency #3735 2025-09-12 15:11:29 +02:00
Bram Wiepjes d01dccd0e1 [2/2] AI improvements: AI field choice output type 2024-11-12 16:29:42 +00:00
Cezary Statkiewicz aed83446bd 1911 ical feed 2024-07-23 14:19:26 +00:00
Bram Wiepjes 1298aa7eec AI field 2024-04-02 19:50:44 +00:00
Davide Silvestri b4eb488147 🔍 4️⃣ : Advanced filters for public views 2023-10-21 12:20:01 +00:00
Davide Silvestri 71724f9a4f 🔍 3️⃣ - Realtime signals and undo/redo for advanced filtering 2023-10-20 15:35:18 +00:00
Petr Stribny a8940f2887 Resolve "Real-time support for row change history" 2023-10-16 08:01:49 +00:00
Nigel Gott 5e8121fac9 1️⃣🪣 Final Group By metadata MR 2023-09-21 14:03:57 +00:00
Petr Stribny 0892857ab5 Resolve "Calendar view" 2023-03-28 14:10:35 +00:00
Bram Wiepjes 1364d96e10 Improve before inserting and moving performance 2023-03-06 08:23:05 +00:00
Petr Stribny 5c7e654678 Resolve "Personal views" 2023-01-27 15:45:11 +00:00
Alexander Haller 581ee16c76 Resolve "Prevent websockets from leaking information about resources in Baserow" 2023-01-11 19:03:32 +00:00
Bram Wiepjes c40bf6f973 Fix bug where the metadata was not updated when receiving a realtime event 2022-11-01 08:50:54 +00:00
Davide Silvestri d29843ef8b Resolve "Run Template imports as async tasks in celery" 2022-10-10 10:03:12 +00:00
Petr Stribny 1dc464461f Add Multiple Collaborators field 2022-09-06 15:32:12 +00:00
Alexander Haller e1e55a2593 Resolve "View and Fields get out of sync on realtime update" 2022-08-03 09:06:37 +00:00
Alexander Haller 81dde0acce Resolve "Publicly shared Gallery View" 2022-07-27 11:19:29 +00:00
Bram Wiepjes d55f8ca427 Fixed two small bugs 2022-07-24 13:28:47 +00:00
Alexander Haller aae90f477f Remove primary from table 2022-07-20 18:07:00 +00:00
Petr Stribny f75ed23f4d Batch webhooks 2022-07-19 21:00:07 +00:00
Jrmi bd9c2670d6 📄1️⃣ Async file import v1 - Add async job manager for file import 2022-06-28 07:58:05 +00:00
Petr Stribny 3c0c36d0b3 Resolve "Add API support for batch delete rows" 2022-05-03 12:15:59 +00:00
Petr Stribny be99eb606c Implement batch create rows 2022-04-28 13:52:49 +00:00
Bram Wiepjes fa75fbbd0d Resolve "Show related row by clicking on a link row relationship" 2022-04-26 13:06:33 +00:00
Jrmi bc8956b7cc 🌈 2️⃣ - Row coloring v2 - Add backend storage 2022-04-26 09:37:37 +00:00
Petr Stribny 65c5754985 Implement batch row update api 2022-04-19 10:50:08 +00:00
Petr Stribny b96371a7ad Resolve "Make it possible to search in the gallery view" 2022-02-21 18:33:27 +00:00
Nigel Gott 60eb85da4f Realtime Public View Sharing 2022-01-11 20:13:08 +00:00
Bram Wiepjes fd246a3e74 Resolve "Kanban view" 2021-11-23 16:48:51 +00:00
Nigel Gott 7df4e258be Deprecate field_by_id special baserow formula function to greatly simplify... 2021-10-22 08:37:52 +00:00
Nigel Gott a943716dde Final formula MR 2021-10-05 11:31:44 +00:00
Sascha Jullmann 4696b98ac4 Resolve "Last modified field" 2021-08-11 07:39:58 +00:00
Nigel Gott 679d2b2169 Add a realtime comment count display on every row with comments. 2021-08-06 12:12:03 +00:00
Bram Wiepjes 53ffd8f9c0 Resolve "Form view" 2021-07-11 18:02:37 +00:00
Nigel Gott 6e5ce3846a Resolve "Trash (never delete anything)" 2021-07-09 08:29:08 +00:00
Bram Wiepjes a0d6926d46 Resolve "Make the tables orderable" 2021-05-18 11:14:18 +00:00