Skip to content

feat: reject duplicate crawler IDs and add standalone use_state - #2572

Draft
Pijukatel wants to merge 2 commits into
masterfrom
claude/serene-cerf-gzrvig
Draft

Pijukatel wants to merge 2 commits into
masterfrom
claude/serene-cerf-gzrvig

Conversation

@Pijukatel

@Pijukatel Pijukatel commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Creating a BasicCrawler with an explicit id that another crawler already uses now raises ValueError, since the two would overwrite each other's state (JS issue: apify/crawlee#4516).
To share state between crawlers, use the new standalone crawlee.storages.use_state(key) with an explicit key, mirroring JS useState().

https://claude.ai/code/session_017ocuAHmkSj1CsSHvZFwiuZ


Generated by Claude Code

Two crawlers with the same explicit `id` silently overwrite each other's
state, so the second one now raises `ValueError` during construction. The
id is registered only after the constructor succeeds, so a failed
construction can be retried with the same id.

Aligned with apify/crawlee#4516.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ocuAHmkSj1CsSHvZFwiuZ
@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Dec 3, 2026
@codecov

codecov Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.21%. Comparing base (b33898b) to head (63dd3cd).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2572      +/-   ##
==========================================
- Coverage   94.31%   94.21%   -0.10%     
==========================================
  Files         184      185       +1     
  Lines       13787    13802      +15     
==========================================
+ Hits        13003    13004       +1     
- Misses        784      798      +14     
Flag Coverage Δ
integration 76.61% <70.58%> (-0.02%) ⬇️
unit 85.82% <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.

`crawlee.storages.use_state` returns an auto-saved dictionary under an
explicit key of a key-value store, so several crawlers can share state
without reusing a crawler `id`. Mirrors `useState()` from the JS version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ocuAHmkSj1CsSHvZFwiuZ
@Pijukatel Pijukatel changed the title fix: reject duplicate crawler IDs feat: reject duplicate crawler IDs and add standalone use_state Dec 3, 2026

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

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