Skip to content

fix(mypy): narrow compressed feature_states to bytes in dynamodb mapper test#7916

Merged
gagantrivedi merged 1 commit into
mainfrom
fix/dynamodb-mapper-test-typing
Jun 30, 2026
Merged

fix(mypy): narrow compressed feature_states to bytes in dynamodb mapper test#7916
gagantrivedi merged 1 commit into
mainfrom
fix/dynamodb-mapper-test-typing

Conversation

@gagantrivedi

Copy link
Copy Markdown
Member

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Follow-up to #7915. The new test test_map_environment_to_compressed_environment_document__mv_option_with_key__key_preserved passed result.document["feature_states"] — a DocumentValue union — directly to gzip.decompress, which mypy rejects:

error: Argument 1 to "decompress" has incompatible type
"dict[str, DocumentValue] | list[DocumentValue] | str | bytes | bool | Decimal | None"; expected "Buffer"  [arg-type]

Narrow the value to bytes with an isinstance assert before decompressing, matching the sibling *_returns_compressed_fields tests.

How did you test this code?

  • mypy tests/unit/util/mappers/test_unit_mappers_dynamodb.pySuccess: no issues found.
  • test_map_environment_to_compressed_environment_document__mv_option_with_key__key_preserved still passes.

The new dynamodb mapper test passed result.document["feature_states"]
(a DocumentValue union) straight to gzip.decompress, which mypy rejects.
Narrow it with an isinstance assert, matching the sibling tests.
@gagantrivedi gagantrivedi requested a review from a team as a code owner June 30, 2026 10:22
@gagantrivedi gagantrivedi requested review from khvn26 and removed request for a team June 30, 2026 10:22
@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

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

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Jun 30, 2026 10:22am
flagsmith-frontend-preview Ignored Ignored Jun 30, 2026 10:22am
flagsmith-frontend-staging Ignored Ignored Jun 30, 2026 10:22am

Request Review

@github-actions github-actions Bot added the api Issue related to the REST API label Jun 30, 2026
@github-actions github-actions Bot added the fix label Jun 30, 2026
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-7916 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-7916 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-7916 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api:pr-7916 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7916 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7916 Finished ✅ Results

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.62%. Comparing base (fe840c5) to head (3003671).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7916      +/-   ##
==========================================
+ Coverage   98.56%   98.62%   +0.06%     
==========================================
  Files        1488     1488              
  Lines       58561    58590      +29     
==========================================
+ Hits        57720    57784      +64     
+ Misses        841      806      -35     

☔ View full report in Codecov by Harness.
📢 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.

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  4 passed

Details

stats  4 tests across 3 suites
duration  37.3 seconds
commit  3003671
info  🔄 Run: #17961 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  5 passed

Details

stats  5 tests across 3 suites
duration  12.3 seconds
commit  3003671
info  🔄 Run: #17961 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  4 passed

Details

stats  4 tests across 3 suites
duration  39 seconds
commit  3003671
info  🔄 Run: #17961 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  5 passed

Details

stats  5 tests across 3 suites
duration  12.4 seconds
commit  3003671
info  🔄 Run: #17961 (attempt 1)

@github-actions

Copy link
Copy Markdown
Contributor

Visual Regression

17 screenshots compared. See report for details.
View full report

@gagantrivedi gagantrivedi merged commit ee9f182 into main Jun 30, 2026
33 checks passed
@gagantrivedi gagantrivedi deleted the fix/dynamodb-mapper-test-typing branch June 30, 2026 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants