test(cli): TDD failing tests for actor list database update (bug #797) #1148

Merged
aditya merged 1 commit from tdd/m3-actor-list-no-db-update into master 2026-03-26 07:00:41 +00:00
Member

Summary

Add TDD tests that prove bug #797 exists: the read-only agents actor list command triggers database writes via ActorRegistry.list_actors()ensure_built_in_actors()upsert_actor() and set_default_actor().

This is the TDD test-writing phase per the mandatory Bug Fix Workflow (CONTRIBUTING.md). The tests are tagged @tdd_expected_fail @tdd_bug @tdd_bug_797 so they pass CI via the inversion mechanism while the bug remains unfixed. When bug #797 is resolved, the @tdd_expected_fail tag will be removed.

Closes #841

Changes

Behave BDD Tests

  • features/tdd_actor_list_no_db_update.feature — Two scenarios proving the bug:
    1. upsert_actor is called during actor list (should not be)
    2. set_default_actor is called during actor list (should not be)
  • features/steps/tdd_actor_list_no_db_update_steps.py — Step definitions using FakeProviderInfo + make_registry() from features/mocks/fake_provider.py, patching _get_services

Robot Framework Integration Tests

  • robot/tdd_actor_list_no_db_update.robot — Two integration smoke tests with matching assertions
  • robot/helper_tdd_actor_list_no_db_update.py — Python helper script following the established dispatcher pattern

Root Cause

ActorRegistry.list_actors() unconditionally calls ensure_built_in_actors(), which:

  1. Iterates all configured providers and calls _actor_service.upsert_actor(...) for each — a database WRITE
  2. May call _actor_service.set_default_actor(...) if no default exists — another WRITE

A read-only list command should never trigger writes.

Test Results

Gate Result
nox -e lint Pass
nox -e typecheck Pass
nox -e unit_tests Pass (new tests pass via @tdd_expected_fail inversion)
nox -e integration_tests Pass (new tests pass via tdd_expected_fail_listener)
nox -e coverage_report 98.22% (> 97% threshold)
ruff check Pass
ruff format Pass

Dependency

This TDD test issue blocks bug fix #797. This PR must be merged first so the @tdd_expected_fail tests exist before the fix is implemented.

## Summary Add TDD tests that prove bug #797 exists: the read-only `agents actor list` command triggers database writes via `ActorRegistry.list_actors()` → `ensure_built_in_actors()` → `upsert_actor()` and `set_default_actor()`. This is the TDD test-writing phase per the mandatory Bug Fix Workflow (CONTRIBUTING.md). The tests are tagged `@tdd_expected_fail @tdd_bug @tdd_bug_797` so they pass CI via the inversion mechanism while the bug remains unfixed. When bug #797 is resolved, the `@tdd_expected_fail` tag will be removed. Closes #841 ## Changes ### Behave BDD Tests - `features/tdd_actor_list_no_db_update.feature` — Two scenarios proving the bug: 1. `upsert_actor` is called during `actor list` (should not be) 2. `set_default_actor` is called during `actor list` (should not be) - `features/steps/tdd_actor_list_no_db_update_steps.py` — Step definitions using `FakeProviderInfo` + `make_registry()` from `features/mocks/fake_provider.py`, patching `_get_services` ### Robot Framework Integration Tests - `robot/tdd_actor_list_no_db_update.robot` — Two integration smoke tests with matching assertions - `robot/helper_tdd_actor_list_no_db_update.py` — Python helper script following the established dispatcher pattern ## Root Cause `ActorRegistry.list_actors()` unconditionally calls `ensure_built_in_actors()`, which: 1. Iterates all configured providers and calls `_actor_service.upsert_actor(...)` for each — a database WRITE 2. May call `_actor_service.set_default_actor(...)` if no default exists — another WRITE A read-only list command should never trigger writes. ## Test Results | Gate | Result | |------|--------| | `nox -e lint` | Pass | | `nox -e typecheck` | Pass | | `nox -e unit_tests` | Pass (new tests pass via @tdd_expected_fail inversion) | | `nox -e integration_tests` | Pass (new tests pass via tdd_expected_fail_listener) | | `nox -e coverage_report` | 98.22% (> 97% threshold) | | `ruff check` | Pass | | `ruff format` | Pass | ## Dependency This TDD test issue blocks bug fix #797. This PR must be merged first so the `@tdd_expected_fail` tests exist before the fix is implemented.
aditya added this to the v3.2.0 milestone 2026-03-24 10:56:05 +00:00
freemo approved these changes 2026-03-24 15:27:54 +00:00
Dismissed
freemo left a comment

Review: APPROVED

Clean TDD bug-capture test. Tags correct (@tdd_expected_fail @tdd_bug @tdd_bug_797). Behave scenarios and Robot tests both present. Step definitions fully implemented with real assertions using unittest.mock.patch to verify upsert_actor/set_default_actor are not called during actor list. Small, focused — 4 files, no unrelated changes.

## Review: APPROVED Clean TDD bug-capture test. Tags correct (`@tdd_expected_fail @tdd_bug @tdd_bug_797`). Behave scenarios and Robot tests both present. Step definitions fully implemented with real assertions using `unittest.mock.patch` to verify `upsert_actor`/`set_default_actor` are not called during `actor list`. Small, focused — 4 files, no unrelated changes.
brent.edwards force-pushed tdd/m3-actor-list-no-db-update from 00e37f9b6c
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 22s
CI / lint (pull_request) Successful in 3m18s
CI / quality (pull_request) Successful in 3m40s
CI / typecheck (pull_request) Successful in 3m54s
CI / security (pull_request) Successful in 4m1s
CI / unit_tests (pull_request) Successful in 7m3s
CI / integration_tests (pull_request) Successful in 7m11s
CI / docker (pull_request) Successful in 1m3s
CI / e2e_tests (pull_request) Successful in 8m37s
CI / coverage (pull_request) Successful in 11m0s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Successful in 57m17s
to 23df639e64
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 17s
CI / quality (pull_request) Successful in 3m41s
CI / lint (pull_request) Successful in 3m45s
CI / typecheck (pull_request) Successful in 4m15s
CI / security (pull_request) Successful in 4m25s
CI / unit_tests (pull_request) Successful in 5m50s
CI / integration_tests (pull_request) Successful in 6m5s
CI / docker (pull_request) Successful in 1m13s
CI / e2e_tests (pull_request) Successful in 8m14s
CI / coverage (pull_request) Successful in 10m0s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Failing after 49m21s
2026-03-24 15:55:55 +00:00
Compare
brent.edwards dismissed freemo's review 2026-03-24 15:55:55 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

aditya force-pushed tdd/m3-actor-list-no-db-update from 23df639e64
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 17s
CI / quality (pull_request) Successful in 3m41s
CI / lint (pull_request) Successful in 3m45s
CI / typecheck (pull_request) Successful in 4m15s
CI / security (pull_request) Successful in 4m25s
CI / unit_tests (pull_request) Successful in 5m50s
CI / integration_tests (pull_request) Successful in 6m5s
CI / docker (pull_request) Successful in 1m13s
CI / e2e_tests (pull_request) Successful in 8m14s
CI / coverage (pull_request) Successful in 10m0s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Failing after 49m21s
to 968f33c17d
All checks were successful
CI / build (pull_request) Successful in 17s
CI / lint (pull_request) Successful in 3m20s
CI / quality (pull_request) Successful in 3m41s
CI / typecheck (pull_request) Successful in 3m57s
CI / security (pull_request) Successful in 4m3s
CI / integration_tests (pull_request) Successful in 7m30s
CI / unit_tests (pull_request) Successful in 8m26s
CI / docker (pull_request) Successful in 1m7s
CI / e2e_tests (pull_request) Successful in 9m52s
CI / coverage (pull_request) Successful in 11m26s
CI / status-check (pull_request) Successful in 3s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 1h2m29s
2026-03-26 06:45:14 +00:00
Compare
aditya scheduled this pull request to auto merge when all checks succeed 2026-03-26 06:46:29 +00:00
aditya merged commit 336a79b681 into master 2026-03-26 07:00:41 +00:00
aditya deleted branch tdd/m3-actor-list-no-db-update 2026-03-26 07:00:46 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
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!1148
No description provided.