Skip to content

fix: add output schema merges to Django replay span#93

Merged
sohankshirsagar merged 1 commit intomainfrom
sohan/send-output-schema-during-replay-django
Apr 14, 2026
Merged

fix: add output schema merges to Django replay span#93
sohankshirsagar merged 1 commit intomainfrom
sohan/send-output-schema-during-replay-django

Conversation

@sohankshirsagar
Copy link
Copy Markdown
Contributor

Summary

The Django middleware's replay code path (_capture_replay_output) was missing OUTPUT_SCHEMA_MERGES on the span, causing the Tusk UI to display raw base64-encoded response bodies instead of the decoded value when viewing replay results.

This is purely a UI display bug — CLI test results are unaffected and correctly report "no deviation." The CLI comparison flow never reads outputSchema from the replay span. It decodes the recorded span's body using the recorded schema (which has encoding: BASE64), then compares it against the raw HTTP response bytes from the actual replay request. Both sides resolve to the decoded value, so the comparison passes.

This issue is Django-specific. Flask/WSGI and FastAPI correctly set schema merges during replay

Changes

  • Add OUTPUT_SCHEMA_MERGES attribute to the replay span in DriftMiddleware._capture_replay_output so the downstream schema generator correctly annotates the body field with encoding: BASE64
  • Update the method's docstring to reflect that schema merges are no longer skipped in the replay path

@sohankshirsagar sohankshirsagar added the Tusk - Pause For Current PR Pause Tusk for future commits in the current PR label Apr 14, 2026
@tusk-dev
Copy link
Copy Markdown
Contributor

tusk-dev bot commented Apr 14, 2026

Tusk is paused for this PR

View output

Tip

New to Tusk Unit Tests? Learn more here.

View check history

Commit Unit Tests Created (UTC)
6b8cf46 Tusk is paused for this PR · Output Apr 14, 2026 7:03PM

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@sohankshirsagar sohankshirsagar merged commit 229146f into main Apr 14, 2026
27 checks passed
@sohankshirsagar sohankshirsagar deleted the sohan/send-output-schema-during-replay-django branch April 14, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tusk - Pause For Current PR Pause Tusk for future commits in the current PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants