Skip to content

fix: allow request_header selector in exists conditions for response-stage coprocessor and events#8964

Merged
OriginLeon merged 8 commits intodevfrom
marcelo/ROUTER-960
Mar 16, 2026
Merged

fix: allow request_header selector in exists conditions for response-stage coprocessor and events#8964
OriginLeon merged 8 commits intodevfrom
marcelo/ROUTER-960

Conversation

@OriginLeon
Copy link
Copy Markdown
Contributor

Fixes a bug where using exists: { request_header: <name> } as a condition on response-stage coprocessor configurations would cause the router to reject the config at startup with a validation error.

The validator was incorrectly rejecting request-stage selectors in Exists conditions for response-stage configs. The fix allows this combination since evaluate_request() always pre-resolves these conditions before they reach the response stage.

The same fix also corrects the equivalent behavior in telemetry event conditions.

The Exists condition validation was rejecting request_header selectors
used in response-stage event conditions (supergraph.response,
router.response, subgraph.response) because RequestHeader is not active
at Stage::Response. However, at runtime these conditions are correctly
pre-resolved by evaluate_request() before any response-time evaluation,
so the validation was overly strict.

Fix: allow selectors active at Stage::Request in Exists conditions even
when the restricted_stage is a response stage. This unblocks the
common pattern of 'exists: { request_header: x }' as a condition for
response events.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@OriginLeon OriginLeon requested a review from a team as a code owner March 4, 2026 18:11
@github-actions

This comment has been minimized.

@OriginLeon OriginLeon enabled auto-merge (squash) March 4, 2026 18:32
@OriginLeon OriginLeon requested a review from BrynCooke March 4, 2026 18:39
@apollo-librarian
Copy link
Copy Markdown
Contributor

apollo-librarian bot commented Mar 11, 2026

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: 481e8043957caafbfa5502ff
Build Logs: View logs


✅ AI Style Review — No Changes Detected

No MDX files were changed in this pull request.

Review Log: View detailed log

This review is AI-generated. Please use common sense when accepting these suggestions, as they may not always be accurate or appropriate for your specific context.

Copy link
Copy Markdown
Contributor

@carodewig carodewig left a comment

Choose a reason for hiding this comment

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

Is the intent behind this to allow request selectors on all stages or only on response stages? There are other stages (ie Stage::Drop, Stage::Error) that this will currently apply to

@OriginLeon
Copy link
Copy Markdown
Contributor Author

@carodewig The fix was related to allow request selectors specific on response stages, but that was already a behavior that was expected. Would you say it been available on those other stages as something we don't want to allow or possibly problematic?

@carodewig
Copy link
Copy Markdown
Contributor

I think it's fine if that's how it's intended to work, just wanted to make sure.

@OriginLeon OriginLeon merged commit 8e30979 into dev Mar 16, 2026
15 checks passed
@OriginLeon OriginLeon deleted the marcelo/ROUTER-960 branch March 16, 2026 14:28
smyrick pushed a commit that referenced this pull request Mar 17, 2026
…stage coprocessor and events (#8964)

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
smyrick pushed a commit that referenced this pull request Mar 20, 2026
…stage coprocessor and events (#8964)

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@abernix abernix mentioned this pull request Mar 31, 2026
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.

2 participants