Files
baserow/docs/testing/ai-field-test-plan.md
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

5.9 KiB

AI Field Test Plan

Prerequisites

1. Instance-level configuration

As instance staff, configure a provider and working model under Admin → AI providers, make the model available to AI fields, and run Test model.

Verify: the model appears in the AI field creation form. For compatibility coverage, also test an installation without database providers using the deprecated environment variables documented in Generative AI configuration.

2. Workspace-level configuration

  1. Go to workspace Settings → AI providers
  2. Add a complete provider connection and models available to AI fields
  3. Verify: the workspace-level models appear in the AI field form for that workspace
  4. Verify: a workspace model overrides the same instance model identifier and uses the workspace connection. Other instance models remain inherited and use the instance connection. Disabling a workspace model suppresses that identifier; disabling its provider reveals the inherited instance layer again
  5. Verify: a provider configured only at instance level (no workspace override) still appears and works

3. Licensing

The AI field requires a Premium license. Verify:

  • Without Premium: AI field type is not available in the field creation dropdown
  • Without Premium: the generate button shows a Premium upgrade modal
  • With Premium: field creation and generation work normally
  • If a user who enabled auto-update loses Premium, auto-update stops for their fields

Field creation

4. Basic creation

  1. Create a table with a Name (text) column and a few rows
  2. Add an AI field — the form should show:
    • AI provider + model selector (only configured providers)
    • Temperature input
    • File field selector (only if the selected provider supports files)
    • Output type selector (Text / Choice)
    • Auto-update checkbox
    • Prompt input (formula-enabled, can reference other fields)
  3. Set provider, model, and prompt (e.g. Summarize: {Name})
  4. Save → field is created, cells are empty

5. Output types

Text output:

  • Create an AI field with output type Text
  • Generate values → cells contain free-form text

Choice output:

  • Create an AI field with output type Choice
  • Configure select options (e.g. Positive, Negative, Neutral)
  • Generate values → each cell contains one of the defined options
  • Verify: the AI response is fuzzy-matched to the closest option (e.g. model returns "positive" → maps to "Positive")

6. File field support

  1. Create a File field and upload a mix of images (.png, .jpg) and documents (.pdf, .csv, .docx)
  2. Create an AI field using OpenAI as the provider
  3. Verify: the file field selector is visible and lists file fields
  4. Select the file field and set a prompt (e.g. Describe the contents of the file)
  5. Generate → the model processes the file content
  6. Switch the provider to Anthropic or Mistral → verify the file field selector disappears (these providers don't support files)
  7. Verify: saving an AI field with a file field and a non-file-supporting provider is rejected

File type constraints (OpenAI):

  • Images (embedded): .gif, .jpg, .jpeg, .png, .webp (max ~45 MB total)
  • Documents (uploaded): .csv, .doc, .docx, .html, .json, .md, .pdf, .pptx, .txt, .tex, .xlsx, .xls (max 512 MB, configurable via BASEROW_OPENAI_UPLOADED_FILE_SIZE_LIMIT_MB)

Value generation

7. Single cell generation

  1. Click an empty AI field cell → a Generate button appears
  2. Click Generate → value is produced for that row only
  3. On a populated cell, click to edit → a Regenerate button appears
  4. Click Regenerate → value is replaced

8. Bulk generation

  1. Right-click the AI field header → Generate values
  2. In the dialog:
    • Scope: choose "Entire table" or a specific view (filters apply)
    • Skip populated: checkbox to only fill empty cells
  3. Submit → an async job starts (HTTP 202)
  4. Verify: progress indicator appears; values populate as the job runs
  5. Verify with a filtered view: only rows matching the view's filters are generated

9. Regeneration

  • Single cell: click the cell → Regenerate button (visible when cell is not empty)
  • Bulk: use "Generate values" dialog without "Skip populated" → all cells are regenerated
  • Verify: regeneration replaces existing values, not appends

Auto-update

10. Auto-update behavior

  1. Create an AI field with a prompt referencing another field (e.g. Categorize: {Status})
  2. Enable Auto-update and save
  3. Change the value of the referenced field in a row
  4. Wait ~3 seconds (debounce: BASEROW_AI_FIELD_AUTO_UPDATE_DEBOUNCE_TIME, default 3s)
  5. Verify: the AI field value for that row is automatically regenerated
  6. Rapidly change the referenced field multiple times → verify only one generation runs after the debounce settles
  7. Disable auto-update → changes to referenced fields no longer trigger regeneration

Error handling

11. Configuration errors

  • Set an invalid API key at workspace level → generate → should show a clear error (not a stack trace)
  • Select a model that doesn't exist for the provider → generation fails gracefully
  • Use a file field with a provider that doesn't support files → rejected at save time

12. Generation errors

  • If the AI model returns an unparseable response for a choice field → the cell remains empty, no crash
  • Network timeout or provider outage → error shown, other rows continue generating

Concurrency limits

13. Job limits

  • Start a bulk generation on a field → try starting another on the same field → should be rejected (1 job per field)
  • Start 3 generation jobs (different fields) → try a 4th → should be rejected (max 3 concurrent per user)
  • Single-cell (row-specific) generation bypasses the per-field limit