Skip to content

Add correlation ID fallback for async polling (Movable Ink)#8034

Merged
Linker44 merged 5 commits into
mainfrom
movable-ink-async-polling-fallback
May 5, 2026
Merged

Add correlation ID fallback for async polling (Movable Ink)#8034
Linker44 merged 5 commits into
mainfrom
movable-ink-async-polling-fallback

Conversation

@Linker44
Copy link
Copy Markdown
Contributor

Ticket [ENG-XXXX]

Description Of Changes

Adds a fallback mechanism for correlation ID extraction in async polling. Some APIs (e.g. Movable Ink) return an empty response body after the initial DSR request, so extracting the correlation ID from the JSON response fails. This change allows the framework to resolve the correlation ID from param_value_map when the response body is empty — for example, using privacy_request_id which is always auto-populated.

This is fully backward-compatible: connectors that return correlation IDs in their response bodies continue to work via the primary extraction path.

Companion PR: ethyca/fidesplus — Movable Ink connector config, dataset, and tests.

Code Changes

  • Added _extract_correlation_id() static method to AsyncPollingStrategy that tries the response body first, then falls back to param_value_map
  • Refactored _handle_polling_initial_request and _handle_polling_initial_erasure_request to use the new shared method
  • Added 5 unit tests covering: response body extraction, empty body fallback, non-JSON fallback, response-over-params precedence, and error case

Steps to Confirm

  1. Run existing async polling tests to verify backward compatibility: pytest tests/ops/service/async_dsr/polling/test_async_polling_strategy.py -v
  2. Verify new tests pass: pytest tests/ops/service/async_dsr/polling/test_async_polling_strategy.py -k test_extract_correlation_id -v

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Updates unreleased work already in Changelog, no new entry necessary
  • UX feedback:
    • No UX review needed
  • Followup issues:
    • No followup issues
  • Database migrations:
    • No migrations
  • Documentation:
    • No documentation updates required

Some APIs (e.g. Movable Ink) return an empty body after the initial
request, so extracting the correlation ID from the response JSON fails.
This adds a fallback that resolves the correlation ID from param_value_map
when the response body is empty or missing the expected field.
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 27, 2026

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

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
fides-plus-nightly Ignored Ignored Preview May 5, 2026 2:43pm
fides-privacy-center Ignored Ignored May 5, 2026 2:43pm

Request Review

correlation_id = pydash.get(response_data, correlation_id_path)
if correlation_id:
return str(correlation_id)
except ValueError:
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.

I agree that this is something to be reviewed/checked. I dont think we should have a blanket pass on the ValueError, since a malformed JSON wouldn't get caught.

If what we are trying to pass on is an Empty ValueError we should aim for that specifcially with another check, and keep the ValueError exception to catch errors on the JSON responses, I.E:

  response_data = None
  if response.content:                                                                                                                                                                                          
      try:                                                                                                                                                                                                      
          response_data = response.json() ## Becomes null on empty response       
      except ValueError as exc:                                                                                                                                                                                 
          raise FidesopsException(f"Invalid JSON response: {exc}")                                
    
  if response_data and correlation_id_path:                                                                                                                                                                     
      correlation_id = pydash.get(response_data, correlation_id_path)
      if correlation_id:                                                                                                                                                                                        
          return str(correlation_id)  

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.

implemented

@Linker44 Linker44 marked this pull request as ready for review April 27, 2026 14:55
@Linker44 Linker44 requested a review from a team as a code owner April 27, 2026 14:55
@Linker44 Linker44 requested review from JadeCara and Vagoasdf and removed request for a team and JadeCara April 27, 2026 14:55
@Linker44 Linker44 self-assigned this Apr 27, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

❌ Patch coverage is 85.71429% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.17%. Comparing base (f99bff4) to head (45eee2c).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...async_dsr/strategies/async_dsr_strategy_polling.py 85.71% 1 Missing and 2 partials ⚠️

❌ Your patch check has failed because the patch coverage (85.71%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8034      +/-   ##
==========================================
+ Coverage   85.14%   85.17%   +0.02%     
==========================================
  Files         637      637              
  Lines       41936    41942       +6     
  Branches     4927     4930       +3     
==========================================
+ Hits        35707    35722      +15     
+ Misses       5121     5111      -10     
- Partials     1108     1109       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@Vagoasdf Vagoasdf left a comment

Choose a reason for hiding this comment

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

There Are a few changes required around the managment of errors, but besides that. the logic looks solid and the tests are complete. 👍🏽

correlation_id = pydash.get(response_data, correlation_id_path)
if correlation_id:
return str(correlation_id)
except ValueError:
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.

I agree that this is something to be reviewed/checked. I dont think we should have a blanket pass on the ValueError, since a malformed JSON wouldn't get caught.

If what we are trying to pass on is an Empty ValueError we should aim for that specifcially with another check, and keep the ValueError exception to catch errors on the JSON responses, I.E:

  response_data = None
  if response.content:                                                                                                                                                                                          
      try:                                                                                                                                                                                                      
          response_data = response.json() ## Becomes null on empty response       
      except ValueError as exc:                                                                                                                                                                                 
          raise FidesopsException(f"Invalid JSON response: {exc}")                                
    
  if response_data and correlation_id_path:                                                                                                                                                                     
      correlation_id = pydash.get(response_data, correlation_id_path)
      if correlation_id:                                                                                                                                                                                        
          return str(correlation_id)  

Linker44 and others added 3 commits May 5, 2026 11:41
- Replace blanket except ValueError with explicit response.content check and FidesopsException on malformed JSON
- Update tests: empty body fallback test, add malformed JSON error test
@Linker44 Linker44 added this pull request to the merge queue May 5, 2026
Merged via the queue into main with commit 9ce112f May 5, 2026
67 of 69 checks passed
@Linker44 Linker44 deleted the movable-ink-async-polling-fallback branch May 5, 2026 18:19
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