BUG-HUNT: [type-safety] Missing arguments in constructor calls in decision_persistence_bench.py #3790

Open
opened 2026-04-06 06:21:17 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/decision-persistence-bench/type-safety-constructor-args
  • Commit Message: fix(benchmarks): add missing constructor arguments in decision_persistence_bench
  • Milestone: None (Backlog)
  • Parent Epic: #394

Background and Context

Pyright has detected two instances of missing required arguments in constructor calls within the _make_db function in benchmarks/decision_persistence_bench.py. These omissions violate the type contracts of the Action and Plan domain classes, causing static type-checking failures. While these are in benchmark files, they indicate a deviation from the domain model's contracts, which could lead to unexpected behavior or runtime errors if similar patterns are used elsewhere.

Current Behavior

The _make_db function in benchmarks/decision_persistence_bench.py calls the Action and Plan constructors without all required arguments:

  1. Issue 1 (Line 70): The Action constructor is called without the required long_description, reusable, read_only, and created_by arguments.
# benchmarks/decision_persistence_bench.py:70
    action = Action(
        namespaced_name=NamespacedName.parse("local/bench-decision-action"),
        description="Benchmark action",
        definition_of_done="Done",
        strategy_actor="local/s",
        execution_actor="local/e",
        state=ActionState.AVAILABLE,
        created_at=datetime(2026, 1, 1, tzinfo=UTC),
        updated_at=datetime(2026, 1, 1, tzinfo=UTC),
    )
  1. Issue 2 (Line 88): The Plan constructor is called without the required decision_root_id argument.
# benchmarks/decision_persistence_bench.py:88
    plan = Plan(
        identity=PlanIdentity(plan_id=_PLAN_ID, attempt=1),
        namespaced_name=NamespacedName(namespace="local", name="bench-plan"),
        action_name="local/bench-decision-action",
        description="Benchmark plan",
        definition_of_done="Done",
        phase=PlanPhase.STRATEGIZE,
        processing_state=ProcessingState.PROCESSING,
        strategy_actor="local/s",
        execution_actor="local/e",
        timestamps=PlanTimestamps(created_at=now, updated_at=now),
        created_by="bench",
        tags=[],
        reusable=True,
        read_only=False,
    )

Expected Behavior

All constructor calls should provide all required arguments as defined by the Action and Plan class definitions. The benchmark setup code should be fully type-correct and pass nox -e typecheck without errors.

Acceptance Criteria

  • Action constructor call at line 70 includes all required arguments (long_description, reusable, read_only, created_by)
  • Plan constructor call at line 88 includes the required decision_root_id argument
  • nox -e typecheck passes with zero errors related to decision_persistence_bench.py
  • Benchmark still runs correctly and produces valid results

Supporting Information

  • File: benchmarks/decision_persistence_bench.py
  • Function: _make_db
  • Lines: 70 and 88
  • Severity: Medium — type contract violations in benchmark setup code
  • Category: type-safety
  • Detected by: Pyright static analysis

Subtasks

  • Inspect Action class definition to identify all required constructor arguments
  • Inspect Plan class definition to identify all required constructor arguments
  • Add missing long_description, reusable, read_only, and created_by arguments to Action constructor call (line 70)
  • Add missing decision_root_id argument to Plan constructor call (line 88)
  • Run nox -e typecheck to verify no remaining type errors in the file
  • Run nox (all default sessions) and fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly (fix(benchmarks): add missing constructor arguments in decision_persistence_bench), followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly (fix/decision-persistence-bench/type-safety-constructor-args).
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass
  • Coverage >= 97%

Backlog note: This issue was discovered during autonomous operation
on milestone v3.7.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


Automated by CleverAgents Bot
Supervisor: Bug Hunting | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/decision-persistence-bench/type-safety-constructor-args` - **Commit Message**: `fix(benchmarks): add missing constructor arguments in decision_persistence_bench` - **Milestone**: None (Backlog) - **Parent Epic**: #394 ## Background and Context Pyright has detected two instances of missing required arguments in constructor calls within the `_make_db` function in `benchmarks/decision_persistence_bench.py`. These omissions violate the type contracts of the `Action` and `Plan` domain classes, causing static type-checking failures. While these are in benchmark files, they indicate a deviation from the domain model's contracts, which could lead to unexpected behavior or runtime errors if similar patterns are used elsewhere. ## Current Behavior The `_make_db` function in `benchmarks/decision_persistence_bench.py` calls the `Action` and `Plan` constructors without all required arguments: 1. **Issue 1 (Line 70)**: The `Action` constructor is called without the required `long_description`, `reusable`, `read_only`, and `created_by` arguments. ```python # benchmarks/decision_persistence_bench.py:70 action = Action( namespaced_name=NamespacedName.parse("local/bench-decision-action"), description="Benchmark action", definition_of_done="Done", strategy_actor="local/s", execution_actor="local/e", state=ActionState.AVAILABLE, created_at=datetime(2026, 1, 1, tzinfo=UTC), updated_at=datetime(2026, 1, 1, tzinfo=UTC), ) ``` 2. **Issue 2 (Line 88)**: The `Plan` constructor is called without the required `decision_root_id` argument. ```python # benchmarks/decision_persistence_bench.py:88 plan = Plan( identity=PlanIdentity(plan_id=_PLAN_ID, attempt=1), namespaced_name=NamespacedName(namespace="local", name="bench-plan"), action_name="local/bench-decision-action", description="Benchmark plan", definition_of_done="Done", phase=PlanPhase.STRATEGIZE, processing_state=ProcessingState.PROCESSING, strategy_actor="local/s", execution_actor="local/e", timestamps=PlanTimestamps(created_at=now, updated_at=now), created_by="bench", tags=[], reusable=True, read_only=False, ) ``` ## Expected Behavior All constructor calls should provide all required arguments as defined by the `Action` and `Plan` class definitions. The benchmark setup code should be fully type-correct and pass `nox -e typecheck` without errors. ## Acceptance Criteria - [ ] `Action` constructor call at line 70 includes all required arguments (`long_description`, `reusable`, `read_only`, `created_by`) - [ ] `Plan` constructor call at line 88 includes the required `decision_root_id` argument - [ ] `nox -e typecheck` passes with zero errors related to `decision_persistence_bench.py` - [ ] Benchmark still runs correctly and produces valid results ## Supporting Information - **File**: `benchmarks/decision_persistence_bench.py` - **Function**: `_make_db` - **Lines**: 70 and 88 - **Severity**: Medium — type contract violations in benchmark setup code - **Category**: type-safety - **Detected by**: Pyright static analysis ## Subtasks - [ ] Inspect `Action` class definition to identify all required constructor arguments - [ ] Inspect `Plan` class definition to identify all required constructor arguments - [ ] Add missing `long_description`, `reusable`, `read_only`, and `created_by` arguments to `Action` constructor call (line 70) - [ ] Add missing `decision_root_id` argument to `Plan` constructor call (line 88) - [ ] Run `nox -e typecheck` to verify no remaining type errors in the file - [ ] Run `nox` (all default sessions) and fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly (`fix(benchmarks): add missing constructor arguments in decision_persistence_bench`), followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly (`fix/decision-persistence-bench/type-safety-constructor-args`). - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass - Coverage >= 97% > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.7.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: Bug Hunting | Agent: ca-new-issue-creator
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.

Blocks
#394 Epic: Decision Framework
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3790
No description provided.