[AUTO-INF-3] Share domain test factories for Actor-based Behave/Robot suites #8262

Open
opened 2026-04-13 06:54:15 +00:00 by HAL9000 · 0 comments
Owner

Summary

  • features/steps/actor_cli_steps.py (lines 24-47) and robot/helper_actor_cli_show.py (lines 16-36) both define _make_actor; grep def _make_actor across the repo returns 19 separate copies inside Behave, Robot, and benchmark suites.
  • The duplicated builders diverge in default payloads (e.g., config blobs vs. provider/model defaults), making it easy for test coverage to drift when the Actor schema changes.

Problem

  • Each suite reimplements the same actor factory logic, so schema updates or bug fixes (see bug #3870) must be manually applied everywhere, increasing the chance of inconsistent mocks and broken assertions.
  • The duplicated builders inflate maintenance overhead and make it harder to introduce new metadata (flags, timestamps) because tests silently diverge.

Proposal

  1. Introduce a shared tests/support/factories/actors.py (or equivalent) that provides typed helpers for constructing Actor instances with the common variants (safe, unsafe, built-in, default).
  2. Update Behave steps, Robot helpers, and benchmark helpers to import the shared builders instead of defining local _make_actor helpers.
  3. Document the factories in CONTRIBUTING.md's test guidance and provide a shim to avoid circular imports from application code.

Acceptance Criteria

  • Shared factory module covers existing defaults (including config hashes and optional graph descriptors) and is reused by Behave, Robot, and benchmark test modules.
  • No Behave or Robot step file contains a local _make_actor definition; benchmark helpers also rely on the shared factory.
  • Test and benchmark suites pass with coverage ≥ 97% after the refactor.

Duplicate Check

  • Open issues (q=make_actor): #3870 targets missing constructor arguments in benchmarks/actor_registry_bench.py, not shared test factories.
  • Open issues (q=factory): top hits (#8212, #8213) focus on application service factories and type annotations, not test data builders.
  • Cross-area (q=[AUTO-INF-): #8168 covers nox parallelization; unrelated to factory sharing.
  • Closed issues (q=make_actor): no results.
  • Closed issues (q=factory): only status reports; no overlapping work.

Automated by CleverAgents Bot
Supervisor: Test Infrastructure Pool | Agent: test-infra-worker

### Summary - `features/steps/actor_cli_steps.py` (lines 24-47) and `robot/helper_actor_cli_show.py` (lines 16-36) both define `_make_actor`; `grep def _make_actor` across the repo returns 19 separate copies inside Behave, Robot, and benchmark suites. - The duplicated builders diverge in default payloads (e.g., config blobs vs. provider/model defaults), making it easy for test coverage to drift when the Actor schema changes. ### Problem - Each suite reimplements the same actor factory logic, so schema updates or bug fixes (see bug #3870) must be manually applied everywhere, increasing the chance of inconsistent mocks and broken assertions. - The duplicated builders inflate maintenance overhead and make it harder to introduce new metadata (flags, timestamps) because tests silently diverge. ### Proposal 1. Introduce a shared `tests/support/factories/actors.py` (or equivalent) that provides typed helpers for constructing `Actor` instances with the common variants (safe, unsafe, built-in, default). 2. Update Behave steps, Robot helpers, and benchmark helpers to import the shared builders instead of defining local `_make_actor` helpers. 3. Document the factories in `CONTRIBUTING.md`'s test guidance and provide a shim to avoid circular imports from application code. ### Acceptance Criteria - Shared factory module covers existing defaults (including config hashes and optional graph descriptors) and is reused by Behave, Robot, and benchmark test modules. - No Behave or Robot step file contains a local `_make_actor` definition; benchmark helpers also rely on the shared factory. - Test and benchmark suites pass with coverage ≥ 97% after the refactor. ### Duplicate Check - Open issues (`q=make_actor`): #3870 targets missing constructor arguments in `benchmarks/actor_registry_bench.py`, not shared test factories. - Open issues (`q=factory`): top hits (#8212, #8213) focus on application service factories and type annotations, not test data builders. - Cross-area (`q=[AUTO-INF-`): #8168 covers nox parallelization; unrelated to factory sharing. - Closed issues (`q=make_actor`): no results. - Closed issues (`q=factory`): only status reports; no overlapping work. --- **Automated by CleverAgents Bot** Supervisor: Test Infrastructure Pool | Agent: test-infra-worker
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#8262
No description provided.