Skip to content

fix(api): scrub server-owned flags from workflow query filters#4827

Merged
mmabrouk merged 1 commit into
big-agentsfrom
fix/workflows-query-scrub-platform-flag
Jun 24, 2026
Merged

fix(api): scrub server-owned flags from workflow query filters#4827
mmabrouk merged 1 commit into
big-agentsfrom
fix/workflows-query-scrub-platform-flag

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

Symptom

run-api-tests (acceptance) failed on #4791 once the build was fixed and the suite stopped being skipped: test_query_workflows_by_flags got count == 0 instead of 1.

Root cause (real backend bug)

The write path scrubs the server-owned is_platform flag before persisting (_scrub_server_owned_flags), so stored flags never contain that key. The query path did not scrub, so a /workflows/query carrying is_platform (the test re-posts a workflow's own echoed-back flags, which include is_platform: false) built a JSONB @> containment filter for a key that is never stored — matching zero rows.

This affects any client that round-trips an echoed workflow's flags into a query, not just the test.

Fix

Apply _scrub_server_owned_flags to the dumped flags on both the artifact and revision query builders, symmetric with the write path. Platform-catalogue workflows are served from the code catalog (not the DB), so is_platform must never gate a DB containment query.

Verification

  • ruff format/ruff check: clean.
  • test_flag_ownership.py unit suite: 13 passed.
  • Acceptance test validated by CI on this PR (needs Postgres).

https://claude.ai/code/session_01DEZYALzKjh9ocjkscaBWRT

The store path strips the server-owned is_platform flag before persisting
(_scrub_server_owned_flags), but the query path did not, so any
/workflows/query carrying is_platform (e.g. a client re-posting a
workflow's own echoed flags) built a JSONB containment filter for a key
that is never stored, matching zero rows.

Scrub server-owned flags on both the artifact and revision query builders,
symmetric with the write path. Platform-catalogue workflows are served
from the code catalog, not the DB, so is_platform must never gate a DB
containment query.

Fixes the skipped-then-surfaced acceptance test
test_query_workflows_by_flags (count 0 -> 1).

Claude-Session: https://claude.ai/code/session_01DEZYALzKjh9ocjkscaBWRT
@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jun 24, 2026 6:43pm

Request Review

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. Backend bug Something isn't working labels Jun 24, 2026
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 795405ac-9ef4-4b24-b216-77db54bb907e

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/workflows-query-scrub-platform-flag

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

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Status Destroyed (PR closed)

Updated at 2026-06-24T19:23:28.826Z

@mmabrouk mmabrouk merged commit 86f89c2 into big-agents Jun 24, 2026
45 of 54 checks passed
@mmabrouk mmabrouk deleted the fix/workflows-query-scrub-platform-flag branch June 24, 2026 19:23
mmabrouk added a commit that referenced this pull request Jun 24, 2026
)

#4827 scrubbed the server-owned is_platform flag from query filters
unconditionally, which broke test_query_with_explicit_is_platform_filters_on_it:
an explicit is_platform=True is a deliberate platform-catalogue filter and
must be preserved.

Use a query-specific scrub that drops a server-owned flag only when its
value is False (the echoed default that would otherwise match nothing,
since the key is scrubbed on write). An explicit True is kept. The write
path keeps the unconditional scrub.

Claude-Session: https://claude.ai/code/session_01DEZYALzKjh9ocjkscaBWRT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant