Skip to content

refactor: Use ensure_context decorator in Actor class#822

Open
vdusek wants to merge 1 commit intomasterfrom
add-ensure-context
Open

refactor: Use ensure_context decorator in Actor class#822
vdusek wants to merge 1 commit intomasterfrom
add-ensure-context

Conversation

@vdusek
Copy link
Contributor

@vdusek vdusek commented Mar 2, 2026

Summary

  • Replace manual _raise_if_not_initialized() calls with the @ensure_context decorator from Crawlee, matching the pattern already used in ChargingManager
  • Add active attribute to _ActorType (replaces _is_initialized) for compatibility with ensure_context
  • Remove the now-unused _raise_if_not_initialized method

Reopens #400

Test plan

  • CI passes

🤖 Generated with Claude Code

Replace manual `_raise_if_not_initialized()` calls with the `ensure_context`
decorator from Crawlee, matching the pattern already used in ChargingManager.

- Add `active` attribute to `_ActorType` (replaces `_is_initialized`)
- Decorate all public methods with `@ensure_context` instead of calling
  `_raise_if_not_initialized()` at the start of each method
- Remove the now-unused `_raise_if_not_initialized` method
- Update all test references from `_is_initialized` to `active`

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vdusek vdusek added this to the 135th sprint - Tooling team milestone Mar 2, 2026
@github-actions github-actions bot added t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics. labels Mar 2, 2026
@codecov
Copy link

codecov bot commented Mar 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.92%. Comparing base (69b8af9) to head (6bb0618).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #822      +/-   ##
==========================================
- Coverage   85.92%   85.92%   -0.01%     
==========================================
  Files          46       46              
  Lines        2778     2777       -1     
==========================================
- Hits         2387     2386       -1     
  Misses        391      391              
Flag Coverage Δ
e2e 37.88% <83.33%> (+0.80%) ⬆️
integration 59.30% <96.66%> (+0.66%) ⬆️
unit 73.42% <100.00%> (-0.01%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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 added the adhoc Ad-hoc unplanned task added during the sprint. label Mar 2, 2026
@vdusek vdusek marked this pull request as ready for review March 2, 2026 13:52
@vdusek vdusek requested a review from Pijukatel March 2, 2026 13:52
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.

1 participant