Skip to content

fix(coprocessor): context keys/values not deleted across stages#8679

Merged
rohan-b99 merged 14 commits intodevfrom
rohan-b99/coprocessor-context-keys-not-deleted
Nov 28, 2025
Merged

fix(coprocessor): context keys/values not deleted across stages#8679
rohan-b99 merged 14 commits intodevfrom
rohan-b99/coprocessor-context-keys-not-deleted

Conversation

@rohan-b99
Copy link
Copy Markdown
Contributor

@rohan-b99 rohan-b99 commented Nov 26, 2025

Ensure that coprocessor keys that are deleted in a previous stage do not re-appear in later stages


Checklist

Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.

  • PR description explains the motivation for the change and relevant context for reviewing
  • PR description links appropriate GitHub/Jira tickets (creating when necessary)
  • Changeset is included for user-facing changes
  • Changes are compatible1
  • Documentation2 completed
  • Performance impact assessed and acceptable
  • Metrics and logs are added3 and documented
  • Tests added and passing4
    • Unit tests
    • Integration tests
    • Manual tests, as necessary

Exceptions

Note any exceptions here

Notes

Footnotes

  1. It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this.

  2. Configuration is an important part of many changes. Where applicable please try to document configuration examples.

  3. A lot of (if not most) features benefit from built-in observability and debug-level logs. Please read this guidance on metrics best-practices.

  4. Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

@rohan-b99 rohan-b99 requested a review from a team November 26, 2025 13:15
@apollo-librarian
Copy link
Copy Markdown
Contributor

apollo-librarian bot commented Nov 26, 2025

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: 6b9e759f67251cf00738c79f
Build Logs: View logs

@github-actions

This comment has been minimized.

pub(crate) fn extract_context_keys_sent(
target_context: &Context,
context_config: &ContextConf,
) -> HashSet<String> {
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.

out of curiosity, I'm wondering if we could potentially avoid allocations here and then not cloning keys but instead returning HashSet<&'str> ? Maybe it's not easy, I just want to know if it could be a quick win

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This seemed pretty hard to do due to the way dashmap works, but I reworked the code so that we don't need to extract/store them separately anyway

Comment thread apollo-router/src/plugins/coprocessor/mod.rs Outdated
Comment thread apollo-router/src/plugins/coprocessor/mod.rs Outdated
@rohan-b99 rohan-b99 requested a review from a team as a code owner November 26, 2025 17:15
@rohan-b99 rohan-b99 requested a review from bnjjj November 27, 2025 09:54
Copy link
Copy Markdown
Contributor

@bnjjj bnjjj left a comment

Choose a reason for hiding this comment

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

Just a small comment, otherwise LGTM

);
}

#[test]
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.

Why did you remove this test ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think this was the "remove key if value set to null" test - that functionality was mistakenly added in this PR in the first place, I think it would have been a breaking change as it didn't happen before

Comment thread apollo-router/tests/integration/coprocessor.rs Outdated
@rohan-b99 rohan-b99 merged commit 9882d82 into dev Nov 28, 2025
15 checks passed
@rohan-b99 rohan-b99 deleted the rohan-b99/coprocessor-context-keys-not-deleted branch November 28, 2025 11:26
@abernix abernix mentioned this pull request Dec 12, 2025
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