Skip to content

feat: agent catalog foundations and migration - #14316

Merged
erichare merged 7 commits into
release-1.12.0from
feat/agent-catalog
Jul 31, 2026
Merged

feat: agent catalog foundations and migration#14316
erichare merged 7 commits into
release-1.12.0from
feat/agent-catalog

Conversation

@erichare

@erichare erichare commented Jul 29, 2026

Copy link
Copy Markdown
Member

Summary

Establishes the persistence foundation for the approved Component / Agent Catalog epic and serves as the base of the backend PR stack.

  • add the catalog_policy_rule model for component and template catalog rules
  • encode default-allow / blocklist semantics with global and future scoped-policy fields
  • enforce NULL-safe uniqueness and scope/domain consistency at the database layer
  • add an additive, idempotent Alembic migration with defensive pre-existing-schema validation
  • add focused model and migration coverage

Validation

  • focused catalog-policy model/migration suite — 43 passed, 4 skipped locally (PostgreSQL parametrizations run when a test database URL is configured)
  • production-order SQLModel.metadata.create_all → Alembic head, zero-row, schema-drift, and downgrade/roll-forward coverage included
  • Ruff check/format, git diff --check, migration validator, and pre-commit hooks — passed

Stack

Subsequent backend-ticket PRs will be stacked on this branch, beginning with the policy service, in-process snapshot cache, and superuser CRUD API.

Summary by CodeRabbit

  • New Features

    • Added catalog governance policy support for components and templates.
    • Policies can allow or block resources globally or within specific scopes.
    • Added validation for policy values, scope/domain consistency, and duplicate rules.
    • Creator references are retained safely when associated accounts are removed.
  • Tests

    • Added coverage for policy persistence, validation, uniqueness, migrations, and rollback behavior.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a8f524a2-8eba-4054-9661-65a26f566f98

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Changes

Catalog policy rule

Layer / File(s) Summary
Policy model contract
src/backend/base/langflow/services/database/models/catalog_policy/..., src/backend/base/langflow/services/database/models/__init__.py
Defines policy enums, the CatalogPolicyRule table model, timestamps, foreign-key behavior, check constraints, partial unique indexes, and public exports.
Policy schema migration
src/backend/base/langflow/alembic/versions/d4a7c9e1b2f6_add_catalog_policy_rule.py
Creates or validates the table and indexes, probes defaults and integrity constraints, and implements idempotent upgrade and downgrade operations.
Migration validation tests
src/backend/tests/unit/alembic/test_catalog_policy_rule_migration.py
Covers repeated upgrades, downgrades, incomplete schemas, malformed constraints, and incompatible index definitions.
Model behavior tests
src/backend/tests/unit/services/database/models/catalog_policy/...
Covers defaults, timestamps, creator deletion, scoped and global uniqueness, domain separation, and invalid-row rejection.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Alembic
  participant catalog_policy_rule
  participant Savepoints
  Alembic->>catalog_policy_rule: Create or reflect schema
  Alembic->>catalog_policy_rule: Verify constraints and indexes
  Alembic->>Savepoints: Run behavior probes
  Savepoints->>catalog_policy_rule: Insert representative policy rows
  catalog_policy_rule-->>Savepoints: Apply defaults and integrity rules
  Savepoints-->>Alembic: Roll back probe data
Loading
🚥 Pre-merge checks | ✅ 8 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (8 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Test Coverage For New Implementations ✅ Passed New model and migration have substantive tests: model defaults/constraints/persistence and migration idempotency/schema validation, with proper test_*.py names.
Test Quality And Coverage ✅ Passed Tests cover model defaults, FK/null-on-delete, uniqueness and check constraints, plus migration idempotency, downgrade, and bad-schema cases using project async pytest patterns.
Test File Naming And Structure ✅ Passed New backend tests use test_*.py naming, pytest fixtures, descriptive function names, teardown, and cover positive/negative cases.
Excessive Mock Usage Warning ✅ Passed Tests use real SQLite/SQLModel/Alembic behavior; only minimal monkeypatching wires Alembic op, with no Mock/MagicMock/patch usage.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and broadly matches the main change: adding agent catalog foundations plus a database migration.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/agent-catalog

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Migration Validation Passed

All migrations follow the Expand-Contract pattern correctly.

@erichare
erichare marked this pull request as ready for review July 29, 2026 21:47
@erichare
erichare requested a review from deon-sanchez July 29, 2026 21:47
@github-actions

Copy link
Copy Markdown
Contributor

✅ Test Coverage Advisor

No source changes detected without accompanying tests. Thanks for keeping coverage up! 🎉

Advisory check only — never blocks merge.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/backend/base/langflow/alembic/versions/d4a7c9e1b2f6_add_catalog_policy_rule.py`:
- Around line 78-88: Update _matches_column_type so the "uuid" branch recognizes
PostgreSQL’s reflected UUID type in addition to sa.Uuid and the existing SQLite
CHAR(32) representation. Use a dialect-aware or PostgreSQL UUID type check
without changing the string, datetime, or fallback behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 37ed2850-7b33-4257-8608-505010ced986

📥 Commits

Reviewing files that changed from the base of the PR and between 5042a65 and fadfaac.

📒 Files selected for processing (7)
  • src/backend/base/langflow/alembic/versions/d4a7c9e1b2f6_add_catalog_policy_rule.py
  • src/backend/base/langflow/services/database/models/__init__.py
  • src/backend/base/langflow/services/database/models/catalog_policy/__init__.py
  • src/backend/base/langflow/services/database/models/catalog_policy/model.py
  • src/backend/tests/unit/alembic/test_catalog_policy_rule_migration.py
  • src/backend/tests/unit/services/database/models/catalog_policy/__init__.py
  • src/backend/tests/unit/services/database/models/catalog_policy/test_model.py

@erichare erichare changed the title feat/agent-catalog feat: agent catalog foundations and migration Jul 29, 2026
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 29, 2026
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.51730% with 85 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.23%. Comparing base (0da3204) to head (a425e92).
⚠️ Report is 6 commits behind head on release-1.12.0.

Files with missing lines Patch % Lines
src/backend/base/langflow/api/v1/flows.py 55.88% 30 Missing ⚠️
src/lfx/src/lfx/utils/flow_validation.py 65.85% 15 Missing and 13 partials ⚠️
src/lfx/src/lfx/services/manager.py 30.00% 6 Missing and 1 partial ⚠️
src/backend/base/langflow/api/v1/catalog_policy.py 89.47% 4 Missing ⚠️
...nd/base/langflow/api/v1/custom_component_policy.py 88.23% 4 Missing ⚠️
src/backend/base/langflow/api/v1/chat.py 0.00% 2 Missing ⚠️
...c/backend/base/langflow/api/v1/starter_projects.py 85.71% 2 Missing ⚠️
src/lfx/src/lfx/interface/components.py 60.00% 2 Missing ⚠️
src/lfx/src/lfx/services/deps.py 91.66% 1 Missing and 1 partial ⚠️
src/backend/base/langflow/api/v1/endpoints.py 96.42% 1 Missing ⚠️
... and 3 more
Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##           release-1.12.0   #14316      +/-   ##
==================================================
+ Coverage           62.18%   62.23%   +0.04%     
==================================================
  Files                2343     2373      +30     
  Lines              236524   240951    +4427     
  Branches            35151    33715    -1436     
==================================================
+ Hits               147088   149959    +2871     
- Misses              87616    89138    +1522     
- Partials             1820     1854      +34     
Flag Coverage Δ
backend 68.24% <86.99%> (-1.18%) ⬇️
frontend 61.10% <ø> (+0.48%) ⬆️
lfx 60.19% <80.29%> (-0.30%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/backend/base/langflow/api/router.py 97.36% <100.00%> (-2.64%) ⬇️
src/backend/base/langflow/api/v1/flows_helpers.py 62.31% <ø> (+0.20%) ⬆️
...end/base/langflow/api/v1/schemas/catalog_policy.py 100.00% <100.00%> (ø)
src/backend/base/langflow/api/v1/validate.py 78.57% <100.00%> (+3.57%) ⬆️
src/backend/base/langflow/initial_setup/load.py 88.88% <100.00%> (+1.38%) ⬆️
...w/services/database/models/catalog_policy/model.py 100.00% <100.00%> (ø)
src/backend/base/langflow/services/deps.py 95.23% <100.00%> (-3.78%) ⬇️
src/backend/base/langflow/services/factory.py 84.61% <100.00%> (+0.48%) ⬆️
src/backend/base/langflow/services/schema.py 100.00% <100.00%> (ø)
src/backend/base/langflow/services/utils.py 86.46% <100.00%> (-0.03%) ⬇️
... and 16 more

... and 266 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Frontend Unit Test Coverage Report

Coverage Summary

Lines Statements Branches Functions
Coverage: 49%
49.07% (70749/144172) 70.14% (9880/14086) 46.68% (1629/3489)

Unit Test Results

Tests Skipped Failures Errors Time
5472 0 💤 0 ❌ 0 🔥 17m 23s ⏱️

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 30, 2026
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 31, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

erichare added 3 commits July 31, 2026 14:03
* feat(catalog): add policy service and admin API

* feat(catalog): expose governance config flag (#14319)

* feat(catalog): expose governance config flag

* feat(catalog): filter component palette by policy (#14320)

* feat(catalog): filter component palette by policy

* feat(catalog): filter starter templates by policy (#14321)

* feat(catalog): filter starter templates by policy

* feat(catalog): enforce component policy at runtime (#14322)
@erichare
erichare force-pushed the feat/agent-catalog branch from f9d6b9a to 5eeb48c Compare July 31, 2026 21:14
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 31, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 31, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 31, 2026
@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Build successful! ✅
Deploying docs draft.
Deploy successful! View draft

@erichare
erichare merged commit dea1cfb into release-1.12.0 Jul 31, 2026
381 of 386 checks passed
@erichare
erichare deleted the feat/agent-catalog branch July 31, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant