Skip to content

feat(agent-bff): validate relation filters against the foreign collection - #1801

Open
Tonours wants to merge 2 commits into
mainfrom
feature/prd-677-wire-filter-validation-into-relation-list-and-count
Open

feat(agent-bff): validate relation filters against the foreign collection#1801
Tonours wants to merge 2 commits into
mainfrom
feature/prd-677-wire-filter-validation-into-relation-list-and-count

Conversation

@Tonours

@Tonours Tonours commented Aug 4, 2026

Copy link
Copy Markdown
Member

fixes PRD-677

Problem

Relation list and count requests were forwarded without validating filters, projections, and sorts against the capabilities of the foreign collection.

Fix

  • Validate relation list filters, projections, and sorts against the foreign collection.
  • Validate relation count filters against the foreign collection.
  • Re-check the parent collection, relation target, and foreign collection after capability reads.
  • Return a local 404 when a foreign collection disappears during a failed capability read.
  • Preserve the filter_too_deep error type and maxDepth details for deeply nested filters.
  • Add regression coverage for list/count validation, schema refreshes, stale targets, and error contracts.

Scope and safety

  • Changes are limited to packages/agent-bff.
  • No change to agent, agent-client, or MCP packages.
  • Requests without constrained inputs still skip the capabilities fetch.
  • The agent remains the authority for access control.

How to test

yarn workspace @forestadmin/agent-bff test
yarn workspace @forestadmin/agent-bff build
yarn workspace @forestadmin/agent-bff lint

Verified: 733 tests passing across 54 suites.

Definition of Done

General

  • Write an explicit title for the Pull Request, following Conventional Commits specification
  • Test manually the implemented changes
  • Validate the code quality (indentation, syntax, style, simplicity, readability)

Security

  • Consider the security impact of the changes made

@linear-code

linear-code Bot commented Aug 4, 2026

Copy link
Copy Markdown

PRD-677

@qltysh

qltysh Bot commented Aug 4, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

This PR will not change total coverage.

Modified Files with Diff Coverage (3)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
packages/agent-bff/src/data/agent-query.ts100.0%
Coverage rating: A Coverage rating: A
packages/agent-bff/src/validation/capabilities-validator.ts100.0%
Coverage rating: A Coverage rating: A
packages/agent-bff/src/data/data-routes-middleware.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

Comment thread packages/agent-bff/src/data/data-routes-middleware.ts Outdated
@Tonours
Tonours force-pushed the feature/prd-677-wire-filter-validation-into-relation-list-and-count branch 2 times, most recently from 078a9cf to c4a9891 Compare August 5, 2026 10:18
@Tonours
Tonours force-pushed the feature/prd-677-wire-filter-validation-into-relation-list-and-count branch from c4a9891 to 905a722 Compare August 6, 2026 13:34
@Tonours
Tonours force-pushed the feature/prd-677-wire-filter-validation-into-relation-list-and-count branch from 905a722 to f858855 Compare August 6, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant