Skip to content

Conversation

@Almaju
Copy link
Contributor

@Almaju Almaju commented Feb 10, 2026

Remove cycle_context_id() API and modify cache to ignore context_id field in request bodies when generating cache keys. This prevents unnecessary cache invalidation when context_id rotates automatically.

  • Remove cycle_context_id() public API (breaking change)
  • Strip context_id from request body before hashing for cache key
  • Add tests for context_id-agnostic caching behavior
  • Update documentation to remove cycle_context_id() method

Pull Request checklist

  • Breaking changes: This PR follows our breaking change policy
    • This PR follows the breaking change policy:
      • This PR has no breaking API changes, or
      • There are corresponding PRs for our consumer applications that resolve the breaking changes and have been approved
  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGELOG.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due diligence applied in selecting them.

Remove cycle_context_id() API and modify cache to ignore context_id
field in request bodies when generating cache keys. This prevents
unnecessary cache invalidation when context_id rotates automatically.

- Remove cycle_context_id() public API (breaking change)
- Strip context_id from request body before hashing for cache key
- Add tests for context_id-agnostic caching behavior
- Update documentation to remove cycle_context_id() method
@Almaju Almaju requested a review from luc-lisi February 10, 2026 22:05
@Almaju
Copy link
Contributor Author

Almaju commented Feb 11, 2026

@luc-lisi An idea for a not so complicated refactor instead of the quick & dirty fix:
HttpCache could become HttpCache<T> where T: Into<Request> & T: Into<RequestHash>
This way for our use-case we could have HttpCache<AdRequest> and then implement the hash trait on AdRequest directly so that we don't pollute HttpCache with our specific requirement of ignoring context-id.

@Almaju Almaju marked this pull request as draft February 11, 2026 18:14
@Almaju Almaju marked this pull request as ready for review February 11, 2026 18:23
@Almaju Almaju marked this pull request as draft February 11, 2026 18:35
@Almaju Almaju marked this pull request as ready for review February 11, 2026 18:37
@Almaju Almaju added this pull request to the merge queue Feb 11, 2026
Merged via the queue into mozilla:main with commit fec6486 Feb 11, 2026
13 checks passed
@Almaju Almaju deleted the ads-client-ignore-context-id-in-cache branch February 11, 2026 19:18
alexcottner pushed a commit to alexcottner/application-services that referenced this pull request Feb 11, 2026
…illa#7214)

Remove cycle_context_id() API and modify cache to ignore context_id
field in request bodies when generating cache keys. This prevents
unnecessary cache invalidation when context_id rotates automatically.

- Remove cycle_context_id() public API (breaking change)
- Strip context_id from request body before hashing for cache key
- Add tests for context_id-agnostic caching behavior
- Update documentation to remove cycle_context_id() method
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