Skip to content

fix: Normalize query params in dataset create_items_public_url#963

Merged
vdusek merged 3 commits into
masterfrom
worktree-fix-b6
Jul 21, 2026
Merged

fix: Normalize query params in dataset create_items_public_url#963
vdusek merged 3 commits into
masterfrom
worktree-fix-b6

Conversation

@vdusek

@vdusek vdusek commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

DatasetClient.create_items_public_url (and its async twin) passed _build_params output straight to urlencode, bypassing the _parse_params normalization that the real HTTP request path applies. As a result, boolean and list query params ended up as Python reprs in the signed URL — e.g. create_items_public_url(clean=True, fields=['title', 'url']) produced clean=True&fields=%5B%27title%27%2C+%27url%27%5D instead of clean=true&fields=title,url. Consumers of the shared URL then got unclean/unfiltered items or an API error.

The fix routes the params through self._http_client._parse_params(...) before urlencode, so the public URL matches exactly what an actual API request would send (bool→true/false, list→comma-joined, None dropped). Added regression tests for both the sync and async clients.

✍️ Drafted by Claude Code

@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Jul 20, 2026
@vdusek vdusek self-assigned this Jul 20, 2026
@github-actions github-actions Bot added this to the 145th sprint - Tooling team milestone Jul 20, 2026
@github-actions github-actions Bot added the tested Temporary label used only programatically for some analytics. label Jul 20, 2026
@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.62%. Comparing base (c1bffc6) to head (4439d11).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #963      +/-   ##
==========================================
- Coverage   94.64%   94.62%   -0.02%     
==========================================
  Files          58       58              
  Lines        5263     5244      -19     
==========================================
- Hits         4981     4962      -19     
  Misses        282      282              
Flag Coverage Δ
integration 92.42% <100.00%> (+0.12%) ⬆️
unit 83.88% <100.00%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@vdusek vdusek left a comment

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.

It's discutable whether http_client._parse_params should remain private. This is its only use case so far, so I'd probably keep it private as it is, but I'm open to discussing it.

@vdusek
vdusek requested a review from Pijukatel July 21, 2026 06:55
@vdusek
vdusek marked this pull request as ready for review July 21, 2026 06:55

@Pijukatel Pijukatel left a comment

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.

Isn't this just a refactoring? Extracting code used in 6 places into one function. All the new and previous tests are passing even when reverting the code changes in src.

Comment thread src/apify_client/_resource_clients/_resource_client.py

@Pijukatel Pijukatel left a comment

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.

Ok, I mssed some tests

@vdusek

vdusek commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Ok, I mssed some tests

Also, the PR description mentions it.

@vdusek
vdusek merged commit c3ecaa9 into master Jul 21, 2026
30 checks passed
@vdusek
vdusek deleted the worktree-fix-b6 branch July 21, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants