TDD: JSON/YAML envelope timing field uses wrong structure — spec requires {duration_ms: N} but implementation produces {start_time, end_time, duration} #1949

Open
opened 2026-04-03 00:20:41 +00:00 by freemo · 2 comments
Owner

Metadata

  • Branch: tdd/m5-output-timing-duration-ms
  • Commit Message: test(output): add TDD issue-capture test for timing envelope structure
  • Milestone: v3.5.0
  • Parent Epic: #936

Background and Context

This is the TDD issue-capture companion to bug issue #1944. Per the project's mandatory Bug Fix Workflow, every Type/Bug issue must have a corresponding Type/Testing issue that first proves the bug exists by writing a failing test before the fix is implemented.

The bug: OutputSession.close() in src/cleveragents/cli/output/session.py produces a timing field with {start_time, end_time, duration} (epoch floats and fractional seconds), but the spec requires {"duration_ms": N} (a single integer in milliseconds).

Expected Behavior

A Behave scenario tagged @tdd_issue @tdd_issue_1944 @tdd_expected_fail must be written that:

  1. Creates an OutputSession with JSON (or YAML) format
  2. Closes the session
  3. Asserts that the output envelope's timing field contains only duration_ms as an integer
  4. The test fails while the bug exists (proving the bug), and passes after the fix is applied

Acceptance Criteria

  • A Behave scenario exists tagged with @tdd_issue, @tdd_issue_1944, and @tdd_expected_fail
  • The scenario asserts timing contains only duration_ms (integer) and does NOT contain start_time, end_time, or duration
  • The test passes CI with @tdd_expected_fail present (inverted result — bug still exists)
  • The test is placed in the appropriate feature file for output/materializer behavior

Subtasks

  • Write Behave scenario tagged @tdd_issue @tdd_issue_1944 @tdd_expected_fail asserting timing.duration_ms is an integer and no other timing keys are present
  • Implement step definitions if not already present
  • Verify the test fails without the fix (proving the bug exists)
  • Verify CI passes with @tdd_expected_fail tag in place
  • Run nox (all default sessions), 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 (test(output): add TDD issue-capture test for timing envelope structure), followed by a blank line, then additional lines providing relevant details.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly (tdd/m5-output-timing-duration-ms).
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass (with @tdd_expected_fail tag causing the new test to pass CI despite the bug).
  • Coverage >= 97%

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `tdd/m5-output-timing-duration-ms` - **Commit Message**: `test(output): add TDD issue-capture test for timing envelope structure` - **Milestone**: v3.5.0 - **Parent Epic**: #936 ## Background and Context This is the TDD issue-capture companion to bug issue #1944. Per the project's mandatory Bug Fix Workflow, every `Type/Bug` issue must have a corresponding `Type/Testing` issue that first proves the bug exists by writing a failing test before the fix is implemented. The bug: `OutputSession.close()` in `src/cleveragents/cli/output/session.py` produces a `timing` field with `{start_time, end_time, duration}` (epoch floats and fractional seconds), but the spec requires `{"duration_ms": N}` (a single integer in milliseconds). ## Expected Behavior A Behave scenario tagged `@tdd_issue @tdd_issue_1944 @tdd_expected_fail` must be written that: 1. Creates an `OutputSession` with JSON (or YAML) format 2. Closes the session 3. Asserts that the output envelope's `timing` field contains only `duration_ms` as an integer 4. The test **fails** while the bug exists (proving the bug), and **passes** after the fix is applied ## Acceptance Criteria - [ ] A Behave scenario exists tagged with `@tdd_issue`, `@tdd_issue_1944`, and `@tdd_expected_fail` - [ ] The scenario asserts `timing` contains only `duration_ms` (integer) and does NOT contain `start_time`, `end_time`, or `duration` - [ ] The test passes CI with `@tdd_expected_fail` present (inverted result — bug still exists) - [ ] The test is placed in the appropriate feature file for output/materializer behavior ## Subtasks - [ ] Write Behave scenario tagged `@tdd_issue @tdd_issue_1944 @tdd_expected_fail` asserting `timing.duration_ms` is an integer and no other timing keys are present - [ ] Implement step definitions if not already present - [ ] Verify the test fails without the fix (proving the bug exists) - [ ] Verify CI passes with `@tdd_expected_fail` tag in place - [ ] Run `nox` (all default sessions), 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 (`test(output): add TDD issue-capture test for timing envelope structure`), followed by a blank line, then additional lines providing relevant details. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly (`tdd/m5-output-timing-duration-ms`). - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass (with `@tdd_expected_fail` tag causing the new test to pass CI despite the bug). - Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.4.0 milestone 2026-04-03 00:22:06 +00:00
freemo modified the milestone from v3.4.0 to v3.5.0 2026-04-03 00:22:35 +00:00
Author
Owner

⚠️ Potential duplicate notice: This issue (#1949 TDD) describes the same bug as #1944 (UAT: JSON/YAML envelope timing field uses wrong structure). Both report that the timing field produces {start_time, end_time, duration} instead of the spec-required {duration_ms: N}.

Please review both issues and consider closing one as a duplicate. The UAT issue (#1944) may be the canonical one.


Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: ca-backlog-groomer

⚠️ **Potential duplicate notice**: This issue (#1949 TDD) describes the same bug as #1944 (UAT: JSON/YAML envelope `timing` field uses wrong structure). Both report that the `timing` field produces `{start_time, end_time, duration}` instead of the spec-required `{duration_ms: N}`. Please review both issues and consider closing one as a duplicate. The UAT issue (#1944) may be the canonical one. --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: ca-backlog-groomer
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • MoSCoW: MoSCoW/Should Have — bug or error handling improvement.

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **MoSCoW**: MoSCoW/Should Have — bug or error handling improvement. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
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.

Reference
cleveragents/cleveragents-core#1949
No description provided.