Skip to content

[CI] regression test monkeypatches for _state_file_path break when run_id kwarg added — 29 pre-existing failures #1107

@akaszubski

Description

@akaszubski

Problem

29 regression tests fail because their monkeypatches for `_state_file_path` use a single-argument signature `_patched(s)`, but the current `pipeline_completion_state.py` calls `_state_file_path(session_id, run_id=run_id)`. This mismatch causes:

TypeError: session_id.<locals>._patched() got an unexpected keyword argument 'run_id'

The root cause: `_state_file_path` received `run_id: Optional[str] = None` as a keyword-only argument (added in a prior session for issue #1041 scoping), but the monkeypatches in the regression tests for #849, #852, #853, and #906 were not updated to accept the new signature.

Affected test files (all in `tests/regression/`):

  • `test_issue_849_pipeline_mode_from_state.py` — 4 failures, fixture at line 41 patches with `_patched(s)`
  • `test_issue_852_doc_verdict_completion.py` — 3 failures, same pattern
  • `test_issue_853_batch_research_skip.py` — 6 failures
  • `test_issue_906_background_doc_master.py` — 3 failures

Total: 29 failures pre-existing before this batch — none were introduced by the batch commit (909e573).

Reproduction:

python3 -m pytest tests/regression/test_issue_849_pipeline_mode_from_state.py -x 2>&1 | tail -5

Evidence

Batch commit HEAD (909e573) did NOT modify these 4 test files. The `run_id` kwarg was already present at HEAD~2 in `pipeline_completion_state.py`:

# plugins/autonomous-dev/lib/pipeline_completion_state.py line 226
def _state_file_path(session_id: str, *, run_id: Optional[str] = None) -> Path:

Monkeypatches in the tests stub it as:

def _patched(s):  # missing **kwargs or run_id=None
    ...
monkeypatch.setattr(pcs, "_state_file_path", _patched)

Suggested Fix

Update all four fixtures to accept the `run_id` kwarg:

def _patched(s, *, run_id=None):
    ...

Or use `unittest.mock.Mock(side_effect=lambda s, **kw: ...)` for forward-compatibility. The fix is mechanical — 4 fixture functions across 4 test files.

Plugin Version: 3.50.0 (f6f264c)


Filed automatically by continuous-improvement-analyst

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-improvementContinuous improvement analyst findings

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions