fix(api): scrub server-owned flags from workflow query filters#4827
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Railway Preview Environment
Updated at 2026-06-24T19:23:28.826Z |
) #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
Symptom
run-api-tests (acceptance)failed on #4791 once the build was fixed and the suite stopped being skipped:test_query_workflows_by_flagsgotcount == 0instead of1.Root cause (real backend bug)
The write path scrubs the server-owned
is_platformflag before persisting (_scrub_server_owned_flags), so stored flags never contain that key. The query path did not scrub, so a/workflows/querycarryingis_platform(the test re-posts a workflow's own echoed-back flags, which includeis_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_flagsto 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), sois_platformmust never gate a DB containment query.Verification
ruff format/ruff check: clean.test_flag_ownership.pyunit suite: 13 passed.https://claude.ai/code/session_01DEZYALzKjh9ocjkscaBWRT