Commit Graph
2 Commits
Author SHA1 Message Date
Peter EvansandJeremie Pardou b70bc968db chore: (1/2) implement the graph system in the builder backend (#4706)
Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
2026-06-25 10:09:24 +01:00
Davide SilvestriandClaude Opus 4.6 7bce809cbc feat(assistant) 2/3: add application builder tools for pages, elements, data sources, and actions (#4954)
* feat(assistant): add application builder tools module

Add 19 tool functions for creating/managing pages, elements, data sources,
and workflow actions in Baserow builder apps. Includes permission-checked
CRUD helpers, formula generation context, element type models with dispatch
tables, and routing rules for all builder operations.

* feat(assistant): add theme catalog, apply_theme, and theme templates

Add THEME_CATALOG with 20 theme definitions, ThemeName type, apply_theme()
helper, and auto-theme application on builder creation. Includes JSON and
ZIP template files for all themes.

* feat(assistant): register BuilderToolType and wire up imports

Register BuilderToolType in apps.py, consolidate ToolInputError in
builder.helpers, remove try/except guard on builder import in toolset,
and minor formatting fixes.

* feat(assistant): add builder page navigation and UI context

Add builder-page navigation handler in AssistantPanel, page name display
in AssistantUiContext, builder page context extraction in store, and
undo/redo scope dispatch for builder pages.

* test(assistant): add builder tools and eval tests

Add 55 unit tests for builder tools (pages, elements, data sources,
workflow actions, styles, themes), 4 element move tests, restore 3 theme
tests in core tools, and 11 LLM eval tests for builder scenarios.

* lint

* refactor(assistant): extract theme code for separate PR

Remove theme catalog, apply_theme, set_theme, and 20 new template files
to be re-added on pydantic-ai-pr3 as a focused theme PR.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(assistant): add missing application_type_registry import in core types

* fix(assistant): add prerequisite hint to create_display_elements and update builder evals

* feat(assistant): add view_id to data source create and update

Allow data sources to reference a database table view for filtering.
Instead of reimplementing the full filter model, this leverages existing
create_views + create_view_filters tools to set up filters on a view,
then links it via view_id.

* feat(assistant): add user source setup, role visibility, and login page

- Add setup_user_source tool: creates users table with fields and
  example rows, configures Local Baserow user source with password auth,
  creates login page with auth_form element, and sets builder.login_page
- Add update_builder core tool for application-level settings
  (login_page_id) and register it in all mode-aware toolsets
- Add role_type and roles fields to PageCreate, PageUpdate, PageItem,
  ElementItemCreate, and ElementUpdate for role-based visibility
- Add auth_form element type with user_source_id and login_button_label
- Enrich list_pages response with user_sources, available_roles, and
  login_page_id so the LLM knows what auth is configured
- Add 3 unit tests and 2 eval scenarios for user source setup

* fix(assistant): address copilot feedback

- Guard `update_single_element_formulas` against KeyError from
  `get_first_ancestor_of_type` (shared page elements), matching the
  existing guard in `update_element_formulas`
- Enforce XOR validation on UserSourceSetup for table_id/database_id
- Use `literal_or_placeholder` in notification/open_page workflow action
  kwargs so plain strings are properly quoted as formula literals
- Raise ToolInputError when table lookup via .first() returns None in
  data source and workflow action types
- Reorder page.js selectById to validate pageId before setting undo/redo
  scope

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(assistant): fix view type bugs in ViewItemCreate and from_django_orm

- Default `public` to False instead of requiring it
- Read grid `row_height` from ORM instead of hardcoding "small"
- Use `is None` check for required fields to accept valid falsy values

* fix(assistant): prevent shared header misuse and fix collection element formulas

Strengthen guidance so the AI doesn't place page-specific content in
shared headers/footers and correctly uses current_record instead of
data_source.<id>.0 for formulas inside table/repeat elements.

* fix: add pytest.skip to flaky test test_async_start_workflow_rate_limited_runs_eventually_disable_workflow

* fix: address feedback

* Revert "fix: add pytest.skip to flaky test test_async_start_workflow_rate_limited_runs_eventually_disable_workflow"

This reverts commit 39ca93eebf.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 15:55:53 +00:00