TEST-INFRA: [coverage-gaps] Missing branch coverage for src/cleveragents/a2a/versioning.py — ValueError guard paths uncovered #2323

Open
opened 2026-04-03 14:20:56 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: test/a2a-versioning-coverage
  • Commit Message: test(a2a): add BDD scenarios for A2aVersionNegotiator ValueError guard paths
  • Milestone: v3.8.0
  • Parent Epic: #933

Background and Context

The file src/cleveragents/a2a/versioning.py defines A2aVersionNegotiator, the component responsible for A2A protocol version negotiation (spec §Standards Alignment — A2A; ADR-047). While the happy-path and unsupported-version scenarios are already covered in features/consolidated_misc.feature, the argument-validation guard branches in two methods are not exercised by any existing BDD scenario:

  • negotiate(requested) — line 31: if not requested or not isinstance(requested, str): raise ValueError(...)
  • is_supported(version) — line 44: if not version or not isinstance(version, str): raise ValueError(...)

Each guard has two distinct falsy sub-cases (empty string and non-string type), meaning four branch paths are currently uncovered. This violates the project's ≥ 97% coverage threshold.

Current Behaviour

Running nox -s coverage_report shows src/cleveragents/a2a/versioning.py with the following uncovered branches:

  • negotiate("")ValueError (empty string guard)
  • negotiate(None)ValueError (non-string type guard)
  • is_supported("")ValueError (empty string guard)
  • is_supported(42)ValueError (non-string type guard)

The five existing scenarios cover only the success and A2aVersionMismatchError paths; no scenario exercises the ValueError raise in either method.

Expected Behaviour

BDD scenarios exist that cover all uncovered branches in A2aVersionNegotiator:

  • negotiate("") raises ValueError with message "requested version must be a non-empty string"
  • negotiate(None) (or any non-string) raises ValueError with the same message
  • is_supported("") raises ValueError with message "version must be a non-empty string"
  • is_supported(42) (or any non-string) raises ValueError with the same message

Acceptance Criteria

  • New Gherkin scenarios cover all four ValueError guard paths in A2aVersionNegotiator
  • All new scenarios are implemented with full step definitions (no placeholder steps)
  • Coverage for src/cleveragents/a2a/versioning.py reaches 100% (all lines and branches)
  • Overall project coverage remains ≥ 97%
  • All nox default sessions pass without errors

Supporting Information

  • Source file: src/cleveragents/a2a/versioning.py
  • Class under test: A2aVersionNegotiator
  • Uncovered paths:
    • negotiate(requested="")ValueError("requested version must be a non-empty string")
    • negotiate(requested=None)ValueError("requested version must be a non-empty string")
    • is_supported(version="")ValueError("version must be a non-empty string")
    • is_supported(version=42)ValueError("version must be a non-empty string")
  • Existing coverage (already passing): negotiate("1.0")"1.0", negotiate("2.0")A2aVersionMismatchError, is_supported("1.0")True, is_supported("99.0")False, get_current()"1.0"
  • Existing step definitions: features/steps/a2a_facade_steps.py (contains A2aVersionNegotiator steps — extend rather than duplicate)
  • Existing scenarios: features/consolidated_misc.feature (search for A2aVersionNegotiator section)
  • Related coverage issues: #2317 (transport.py), #2311 (models.py), #2291 (errors.py), #2280 (clients.py)
  • Parent Epic: #933 (A2A Protocol Compliance — JSON-RPC 2.0 Framing, Standard Operations, and Extension Methods)

Subtasks

  • Audit src/cleveragents/a2a/versioning.py and confirm the four uncovered branch paths
  • Review existing step definitions in features/steps/a2a_facade_steps.py for reusable A2aVersionNegotiator steps
  • Add Gherkin scenario: negotiate raises ValueError for an empty string argument
  • Add Gherkin scenario: negotiate raises ValueError for a non-string argument (e.g. None)
  • Add Gherkin scenario: is_supported raises ValueError for an empty string argument
  • Add Gherkin scenario: is_supported raises ValueError for a non-string argument (e.g. an integer)
  • Implement any missing step definitions (extend a2a_facade_steps.py or add to the appropriate steps file)
  • Run nox -s coverage_report and confirm versioning.py reaches 100%
  • Run nox (all default sessions) and confirm all pass

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(a2a): add BDD scenarios for A2aVersionNegotiator ValueError guard paths), followed by a blank line, then additional lines providing relevant implementation details.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly (test/a2a-versioning-coverage).
  • 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%.

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

## Metadata - **Branch**: `test/a2a-versioning-coverage` - **Commit Message**: `test(a2a): add BDD scenarios for A2aVersionNegotiator ValueError guard paths` - **Milestone**: v3.8.0 - **Parent Epic**: #933 ## Background and Context The file `src/cleveragents/a2a/versioning.py` defines `A2aVersionNegotiator`, the component responsible for A2A protocol version negotiation (spec §Standards Alignment — A2A; ADR-047). While the happy-path and unsupported-version scenarios are already covered in `features/consolidated_misc.feature`, the **argument-validation guard branches** in two methods are not exercised by any existing BDD scenario: - `negotiate(requested)` — line 31: `if not requested or not isinstance(requested, str): raise ValueError(...)` - `is_supported(version)` — line 44: `if not version or not isinstance(version, str): raise ValueError(...)` Each guard has two distinct falsy sub-cases (empty string and non-string type), meaning **four branch paths** are currently uncovered. This violates the project's ≥ 97% coverage threshold. ## Current Behaviour Running `nox -s coverage_report` shows `src/cleveragents/a2a/versioning.py` with the following uncovered branches: - `negotiate("")` → `ValueError` (empty string guard) - `negotiate(None)` → `ValueError` (non-string type guard) - `is_supported("")` → `ValueError` (empty string guard) - `is_supported(42)` → `ValueError` (non-string type guard) The five existing scenarios cover only the success and `A2aVersionMismatchError` paths; no scenario exercises the `ValueError` raise in either method. ## Expected Behaviour BDD scenarios exist that cover all uncovered branches in `A2aVersionNegotiator`: - `negotiate("")` raises `ValueError` with message `"requested version must be a non-empty string"` - `negotiate(None)` (or any non-string) raises `ValueError` with the same message - `is_supported("")` raises `ValueError` with message `"version must be a non-empty string"` - `is_supported(42)` (or any non-string) raises `ValueError` with the same message ## Acceptance Criteria - [ ] New Gherkin scenarios cover all four `ValueError` guard paths in `A2aVersionNegotiator` - [ ] All new scenarios are implemented with full step definitions (no placeholder steps) - [ ] Coverage for `src/cleveragents/a2a/versioning.py` reaches **100%** (all lines and branches) - [ ] Overall project coverage remains **≥ 97%** - [ ] All `nox` default sessions pass without errors ## Supporting Information - Source file: `src/cleveragents/a2a/versioning.py` - Class under test: `A2aVersionNegotiator` - Uncovered paths: - `negotiate(requested="")` → `ValueError("requested version must be a non-empty string")` - `negotiate(requested=None)` → `ValueError("requested version must be a non-empty string")` - `is_supported(version="")` → `ValueError("version must be a non-empty string")` - `is_supported(version=42)` → `ValueError("version must be a non-empty string")` - Existing coverage (already passing): `negotiate("1.0")` → `"1.0"`, `negotiate("2.0")` → `A2aVersionMismatchError`, `is_supported("1.0")` → `True`, `is_supported("99.0")` → `False`, `get_current()` → `"1.0"` - Existing step definitions: `features/steps/a2a_facade_steps.py` (contains `A2aVersionNegotiator` steps — extend rather than duplicate) - Existing scenarios: `features/consolidated_misc.feature` (search for `A2aVersionNegotiator` section) - Related coverage issues: #2317 (transport.py), #2311 (models.py), #2291 (errors.py), #2280 (clients.py) - Parent Epic: #933 (A2A Protocol Compliance — JSON-RPC 2.0 Framing, Standard Operations, and Extension Methods) ## Subtasks - [ ] Audit `src/cleveragents/a2a/versioning.py` and confirm the four uncovered branch paths - [ ] Review existing step definitions in `features/steps/a2a_facade_steps.py` for reusable `A2aVersionNegotiator` steps - [ ] Add Gherkin scenario: `negotiate` raises `ValueError` for an empty string argument - [ ] Add Gherkin scenario: `negotiate` raises `ValueError` for a non-string argument (e.g. `None`) - [ ] Add Gherkin scenario: `is_supported` raises `ValueError` for an empty string argument - [ ] Add Gherkin scenario: `is_supported` raises `ValueError` for a non-string argument (e.g. an integer) - [ ] Implement any missing step definitions (extend `a2a_facade_steps.py` or add to the appropriate steps file) - [ ] Run `nox -s coverage_report` and confirm `versioning.py` reaches 100% - [ ] Run `nox` (all default sessions) and confirm all pass ## 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(a2a): add BDD scenarios for A2aVersionNegotiator ValueError guard paths`), followed by a blank line, then additional lines providing relevant implementation details. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly (`test/a2a-versioning-coverage`). - 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%. --- **Automated by CleverAgents Bot** Supervisor: Unknown | Agent: ca-new-issue-creator
freemo added this to the v3.8.0 milestone 2026-04-03 14:21:04 +00:00
freemo removed this from the v3.8.0 milestone 2026-04-07 01:01:43 +00:00
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#2323
No description provided.