TDD: Write failing test for #1141 — session create does not persist for subsequent list #1179

Closed
opened 2026-03-28 21:26:10 +00:00 by freemo · 1 comment
Owner

Metadata

  • Commit Message: test: add TDD bug-capture test for #1141 — session create persistence
  • Branch: tdd/m3-session-create-persist

Background and Context

This is the TDD counterpart to bug #1141. Per the project's Test-Driven Development
workflow for bugs (see CONTRIBUTING.md > Bug Fix Workflow), the first step in fixing any
bug is to write a test that captures the buggy behavior. The test is tagged with
@tdd_bug, @tdd_bug_1141, and @tdd_expected_fail so that it passes CI while
the bug is still unfixed. Once the fix is implemented in #1141, the
@tdd_expected_fail tag will be removed and the test will run normally.

See #1141 for full bug details.

Expected Behavior

A new test exists that:

  1. Captures the exact failure described in #1141 — session create followed by session list returns 0 sessions.
  2. Is tagged with @tdd_bug, @tdd_bug_1141, and @tdd_expected_fail.
  3. Passes CI via the expected-failure mechanism (the underlying assertion fails, confirming
    the bug exists, but the tag inversion causes the test to pass).
  4. Would fail CI if the bug were fixed without removing the @tdd_expected_fail tag.

Acceptance Criteria

  • A test is written that captures the bug behavior described in #1141.
  • The test is tagged with @tdd_bug, @tdd_bug_1141, and @tdd_expected_fail.
  • The @tdd_expected_fail tag causes the test to pass CI (the underlying assertion
    fails as expected, proving the bug exists).
  • The test is specific enough that it will pass normally (without the tag) only when the
    bug is genuinely fixed.
  • Tag validation rules pass: @tdd_bug_1141 has corresponding @tdd_bug, and
    @tdd_expected_fail has both.
  • A pull request is opened from tdd/m3-session-create-persist to master, CI passes,
    and the PR is merged through the normal merge process.

Definition of Done

This issue is complete when:

  • All subtasks below 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, followed by a blank line, then additional
    lines providing relevant details about the test and what bug behavior it captures.
  • The commit is pushed to the remote on the branch matching the Branch in
    Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, CI passes,
    and the PR is merged before this issue is marked done.

Subtasks

  • Code: Analyze bug #1141 to identify the exact failure condition — session create succeeds but session list returns empty, suggesting persistence or commit issue.
  • Code: Determine the appropriate test type (Behave unit test, Robot integration test, or both) and file location for the reproducing test.
  • Tests (Behave): Write a Behave scenario in features/ that captures the bug. Tag the scenario with @tdd_bug, @tdd_bug_1141, and @tdd_expected_fail. The scenario must exercise the specific code path that triggers the bug (session create followed by session list) and assert the correct expected behavior (session appears in list).
  • Tests (Robot): Add a Robot test in robot/ with equivalent tags that captures the failure at the integration level — create a session via CLI, then list and verify the session appears.
  • Docs: Add a comment in the test file explaining that this test was written to capture bug #1141 and uses the @tdd_expected_fail tag until the fix is merged.
  • Quality: Verify CI passes with the tagged test. Confirm the underlying assertion fails for the correct reason (the bug itself, not a test setup error).
  • Quality: Verify tag validation rules pass (@tdd_bug_1141 has @tdd_bug, and @tdd_expected_fail has both).
  • Quality: Verify coverage >=97% via nox -s coverage_report. If coverage is less than 97% then review the current unit test coverage report at build/coverage.xml and use it to write new Behave based unit tests to improve code coverage.
  • Quality: Run nox (all default sessions, including benchmark), fix any errors if needed ensuring nox passes across entire code base.
## Metadata - **Commit Message**: `test: add TDD bug-capture test for #1141 — session create persistence` - **Branch**: `tdd/m3-session-create-persist` ## Background and Context This is the TDD counterpart to bug #1141. Per the project's Test-Driven Development workflow for bugs (see `CONTRIBUTING.md` > Bug Fix Workflow), the first step in fixing any bug is to write a test that captures the buggy behavior. The test is tagged with `@tdd_bug`, `@tdd_bug_1141`, and `@tdd_expected_fail` so that it passes CI while the bug is still unfixed. Once the fix is implemented in #1141, the `@tdd_expected_fail` tag will be removed and the test will run normally. See #1141 for full bug details. ## Expected Behavior A new test exists that: 1. Captures the exact failure described in #1141 — session create followed by session list returns 0 sessions. 2. Is tagged with `@tdd_bug`, `@tdd_bug_1141`, and `@tdd_expected_fail`. 3. Passes CI via the expected-failure mechanism (the underlying assertion fails, confirming the bug exists, but the tag inversion causes the test to pass). 4. Would fail CI if the bug were fixed without removing the `@tdd_expected_fail` tag. ## Acceptance Criteria - [ ] A test is written that captures the bug behavior described in #1141. - [ ] The test is tagged with `@tdd_bug`, `@tdd_bug_1141`, and `@tdd_expected_fail`. - [ ] The `@tdd_expected_fail` tag causes the test to pass CI (the underlying assertion fails as expected, proving the bug exists). - [ ] The test is specific enough that it will pass normally (without the tag) only when the bug is genuinely fixed. - [ ] Tag validation rules pass: `@tdd_bug_1141` has corresponding `@tdd_bug`, and `@tdd_expected_fail` has both. - [ ] A pull request is opened from `tdd/m3-session-create-persist` to `master`, CI passes, and the PR is merged through the normal merge process. ## Definition of Done This issue is complete when: - All subtasks below 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, followed by a blank line, then additional lines providing relevant details about the test and what bug behavior it captures. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, CI passes, and the PR is **merged** before this issue is marked done. ## Subtasks - [ ] Code: Analyze bug #1141 to identify the exact failure condition — session create succeeds but session list returns empty, suggesting persistence or commit issue. - [ ] Code: Determine the appropriate test type (Behave unit test, Robot integration test, or both) and file location for the reproducing test. - [ ] Tests (Behave): Write a Behave scenario in `features/` that captures the bug. Tag the scenario with `@tdd_bug`, `@tdd_bug_1141`, and `@tdd_expected_fail`. The scenario must exercise the specific code path that triggers the bug (session create followed by session list) and assert the correct expected behavior (session appears in list). - [ ] Tests (Robot): Add a Robot test in `robot/` with equivalent tags that captures the failure at the integration level — create a session via CLI, then list and verify the session appears. - [ ] Docs: Add a comment in the test file explaining that this test was written to capture bug #1141 and uses the `@tdd_expected_fail` tag until the fix is merged. - [ ] Quality: Verify CI passes with the tagged test. Confirm the underlying assertion fails for the correct reason (the bug itself, not a test setup error). - [ ] Quality: Verify tag validation rules pass (`@tdd_bug_1141` has `@tdd_bug`, and `@tdd_expected_fail` has both). - [ ] Quality: Verify coverage >=97% via `nox -s coverage_report`. If coverage is less than 97% then review the current unit test coverage report at `build/coverage.xml` and use it to write new Behave based unit tests to improve code coverage. - [ ] Quality: Run `nox` (all default sessions, including benchmark), fix any errors if needed ensuring nox passes across **entire** code base.
freemo added this to the v3.2.0 milestone 2026-03-28 21:26:21 +00:00
Author
Owner

Closing as duplicate — TDD counterpart #1142 already exists for bug #1141 and is completed (closed). The dependency link is already in place. This issue was created before discovering #1142 existed.

Closing as duplicate — TDD counterpart #1142 already exists for bug #1141 and is completed (closed). The dependency link is already in place. This issue was created before discovering #1142 existed.
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#1179
No description provided.