Deduplicate _StubActorService test helper across actor registry step files #10832

Open
opened 2026-04-23 04:03:17 +00:00 by hurui200320 · 0 comments
Member

Metadata

  • Milestone: v3.5.0
  • Parent Epic: (Testing Infrastructure)
  • Branch: refactor/m6-dedup-stub-actor-service
  • Commit Message: refactor(tests): deduplicate _StubActorService into features/mocks/

Description

Three slightly divergent copies of _StubActorService exist across:

  • features/steps/actor_registry_steps.py
  • features/steps/actor_registry_persistence_steps.py
  • features/steps/actor_registry_spec_yaml_steps.py

Each copy has minor differences (e.g., set_default parameter handling, config_blob handling for Actor.compute_hash()). These divergences create maintenance risk — a fix applied to one copy may be missed in the others.

This was identified during code review of PR #10796 (review item Q2 by @CoreRasurae).

Subtasks

  • Create a single _StubActorService class in features/mocks/ that covers all parameter variations
  • Update all three step files to import the shared stub
  • Verify all existing actor registry test scenarios still pass

Definition of Done

  • A single _StubActorService exists in features/mocks/
  • All three step files import from the shared location
  • No duplicate class definitions remain
  • All quality gates pass (nox -e lint, nox -e typecheck, nox -e unit_tests, nox -e integration_tests, nox -e coverage_report >= 97%)
## Metadata - **Milestone**: v3.5.0 - **Parent Epic**: *(Testing Infrastructure)* - **Branch**: `refactor/m6-dedup-stub-actor-service` - **Commit Message**: `refactor(tests): deduplicate _StubActorService into features/mocks/` ## Description Three slightly divergent copies of `_StubActorService` exist across: - `features/steps/actor_registry_steps.py` - `features/steps/actor_registry_persistence_steps.py` - `features/steps/actor_registry_spec_yaml_steps.py` Each copy has minor differences (e.g., `set_default` parameter handling, `config_blob` handling for `Actor.compute_hash()`). These divergences create maintenance risk — a fix applied to one copy may be missed in the others. This was identified during code review of PR #10796 (review item Q2 by @CoreRasurae). ## Subtasks - [ ] Create a single `_StubActorService` class in `features/mocks/` that covers all parameter variations - [ ] Update all three step files to import the shared stub - [ ] Verify all existing actor registry test scenarios still pass ## Definition of Done - A single `_StubActorService` exists in `features/mocks/` - All three step files import from the shared location - No duplicate class definitions remain - All quality gates pass (`nox -e lint`, `nox -e typecheck`, `nox -e unit_tests`, `nox -e integration_tests`, `nox -e coverage_report` >= 97%)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#10832
No description provided.