Skip to content

feat(typesafe): Handle inline images - #8164

Open
alexander-alderman-webb wants to merge 1 commit into
masterfrom
webb/typesafe/widen-type
Open

alexander-alderman-webb wants to merge 1 commit into
masterfrom
webb/typesafe/widen-type

Conversation

@alexander-alderman-webb

@alexander-alderman-webb alexander-alderman-webb commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Content was widened to a type that's JSON compatible or contains unserializable Image instances.
See typesafe-ai/typesafe-sdk-python@f36e685.

The change is to add a

def _json_default(value: object) -> str:
    """
    Render an inline typesafe `Image` as its reference, mirroring the SDK's handling.
    """
    if isinstance(value, Image):
        return str(value)

    return "<unserializable>"

and pass it as json.dumps(..., default=_json_default).

Issues

Closes #8167

Reminders

@alexander-alderman-webb
alexander-alderman-webb force-pushed the webb/typesafe/widen-type branch 4 times, most recently from 0f50489 to 3580bfd Compare October 30, 2026 10:08
@alexander-alderman-webb
alexander-alderman-webb marked this pull request as ready for review October 30, 2026 10:19
@alexander-alderman-webb
alexander-alderman-webb requested a review from a team as a code owner October 30, 2026 10:19
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Results 📊

✅ 135876 passed | ❌ 2 failed | ⏭️ 7456 skipped | Total: 143334 | Pass Rate: 94.8% | Execution Time: 455m 36s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -978
Passed Tests 📉 -980
Failed Tests 📈 +2
Skipped Tests —

➕ New Tests (2)

View new tests
  • test_cache_spans_item_size[True]
    • File: tests.integrations.django.test_cache_module
    • Status: ❌ Failing
  • test_cache_spans_item_size[True]
    • File: tests.integrations.django.test_cache_module
    • Status: ❌ Failing

❌ Failed Tests

test_cache_spans_item_size[True]

File: tests.integrations.django.test_cache_module
Suite: py3.14-django-v6.1.2
Error: tests/integrations/django/test_cache_module.py:763: in test_cache_spans_item_size assert not spans[0]["attributes"]["cache.hit"] E assert not True

Stack Trace
tests/integrations/django/test_cache_module.py:763: in test_cache_spans_item_size
    assert not spans[0]["attributes"]["cache.hit"]
E   assert not True

test_cache_spans_item_size[True]

File: tests.integrations.django.test_cache_module
Suite: py3.14t-django-v5.2.18
Error: tests/integrations/django/test_cache_module.py:763: in test_cache_spans_item_size assert not spans[0]["attributes"]["cache.hit"] E assert not True

Stack Trace
tests/integrations/django/test_cache_module.py:763: in test_cache_spans_item_size
    assert not spans[0]["attributes"]["cache.hit"]
E   assert not True

❌ Patch coverage is 75.00% (9 of 12 changed executable lines covered; target 80%).
Project statement coverage is 90.30% (down 0.03 percentage points from base (7ad4e1a) to head (76e8c03)).

Changed files with executable lines (1)
File Patch coverage Changed executable lines
sentry_sdk/integrations/typesafe.py 75.00% 9/12 covered; missed: 86, 87, 109; partial branches: 106
Coverage diff
@@            Coverage Diff             @@
##        master     #8164       +/-##
==========================================
- Coverage    90.33%    90.30%    -0.03%
==========================================
  Files          203       203         —
  Tracked lines     26872     26880        +8
  Branches     10044     10046        +2
==========================================
  Hits         24272     24272         —
- Misses        2600      2608        +8
+ Partials      1520      1517        -3

Generated by Coverage Action

This branch has not been deployed

No deployments
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.

Handle TypeSafe images

1 participant