Skip to content

fix: Preserve decorated symbol types in docs_group and docs_name#964

Open
vdusek wants to merge 1 commit into
masterfrom
fix/docs-decorators-type-erasure
Open

fix: Preserve decorated symbol types in docs_group and docs_name#964
vdusek wants to merge 1 commit into
masterfrom
fix/docs-decorators-type-erasure

Conversation

@vdusek

@vdusek vdusek commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

The docs_group and docs_name decorators in apify._utils were typed Callable -> Callable, which erased the types of every decorated public API symbol — Configuration, ProxyConfiguration, Webhook, the charging classes, event models, and ApifyRequestList all revealed as Unknown/Any to users' type checkers (Actor survived only thanks to an explicit cast). Both decorators are now identity-typed as Callable[[T], T], reusing the module's existing bound TypeVar and matching how Crawlee fixed the same bug.

Also adds a regression test: a runtime identity check plus a type-level guard that relies on the unused-ignore-comment = "error" ty rule — if the decorators ever erase types again, the guard's suppressions become unused and uv run poe type-check fails.

@vdusek vdusek self-assigned this Jun 11, 2026
@vdusek vdusek added t-tooling Issues with this label are in the ownership of the tooling team. adhoc Ad-hoc unplanned task added during the sprint. labels Jun 11, 2026
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.82%. Comparing base (a87e8d1) to head (33a9159).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #964      +/-   ##
==========================================
- Coverage   90.00%   89.82%   -0.19%     
==========================================
  Files          49       49              
  Lines        3053     3085      +32     
==========================================
+ Hits         2748     2771      +23     
- Misses        305      314       +9     
Flag Coverage Δ
e2e 35.98% <100.00%> (+0.31%) ⬆️
integration 56.95% <100.00%> (+0.09%) ⬆️
unit 78.63% <100.00%> (-0.08%) ⬇️

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 requested a review from Pijukatel June 11, 2026 13:05
@vdusek vdusek marked this pull request as ready for review June 11, 2026 13:05
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants