Add BDD coverage for ServerConnectionConfig in src/cleveragents/a2a/server_config.py #2314

Open
opened 2026-04-03 13:59:43 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: test/a2a-server-config-coverage
  • Commit Message: test(a2a): add BDD scenarios for ServerConnectionConfig validation
  • Milestone: v3.4.0
  • Parent Epic: #933

Background and Context

src/cleveragents/a2a/server_config.py defines ServerConnectionConfig, a frozen Pydantic model that validates server connection parameters (server_url, namespace, auth_token_ref, tls_verify) used by the CLI connect command and info output.

The module currently has no dedicated BDD test coverage. The two @field_validator methods — _validate_server_url and _validate_namespace — contain non-trivial validation logic (URL scheme enforcement, empty-string rejection, whitespace stripping) that is entirely untested. This gap risks silent regressions and prevents the project from meeting the ≥97% coverage threshold required by CI.

Expected Behavior

A dedicated Behave feature file (features/server_config.feature) and its step definitions (features/steps/server_config_steps.py) must cover all public behaviour of ServerConnectionConfig:

  • Valid construction with all combinations of optional fields
  • server_url validator: rejects empty/whitespace-only strings, rejects non-HTTP(S) schemes, accepts http:// and https:// prefixes, strips leading/trailing whitespace
  • namespace validator: rejects empty/whitespace-only strings, strips leading/trailing whitespace, defaults to "default"
  • auth_token_ref field: accepts None and non-empty string values
  • tls_verify field: defaults to True, accepts False
  • Frozen model: mutation raises ValidationError

Acceptance Criteria

  • features/server_config.feature exists with Gherkin scenarios covering all validation paths listed above
  • features/steps/server_config_steps.py exists with all step definitions fully implemented (no placeholder steps)
  • nox -s unit_tests passes with all new scenarios green
  • nox -s coverage_report reports ≥97% coverage and server_config.py is fully covered
  • nox (all default sessions) passes with no errors

Subtasks

  • Create features/server_config.feature with scenarios for valid construction, URL validation, namespace validation, optional fields, and frozen-model mutation guard
  • Create features/steps/server_config_steps.py with all step definitions implemented
  • Verify no existing step file already covers this behaviour (check features/steps/ before creating a new file)
  • Run nox -s unit_tests and confirm all new scenarios pass
  • Run nox -s coverage_report and confirm server_config.py reaches 100% line coverage
  • 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 (test(a2a): add BDD scenarios for ServerConnectionConfig validation), followed by a blank line, then additional lines providing relevant implementation details.
  • The commit is pushed to the remote on the branch test/a2a-server-config-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-server-config-coverage` - **Commit Message**: `test(a2a): add BDD scenarios for ServerConnectionConfig validation` - **Milestone**: v3.4.0 - **Parent Epic**: #933 ## Background and Context `src/cleveragents/a2a/server_config.py` defines `ServerConnectionConfig`, a frozen Pydantic model that validates server connection parameters (`server_url`, `namespace`, `auth_token_ref`, `tls_verify`) used by the CLI `connect` command and `info` output. The module currently has **no dedicated BDD test coverage**. The two `@field_validator` methods — `_validate_server_url` and `_validate_namespace` — contain non-trivial validation logic (URL scheme enforcement, empty-string rejection, whitespace stripping) that is entirely untested. This gap risks silent regressions and prevents the project from meeting the ≥97% coverage threshold required by CI. ## Expected Behavior A dedicated Behave feature file (`features/server_config.feature`) and its step definitions (`features/steps/server_config_steps.py`) must cover all public behaviour of `ServerConnectionConfig`: - Valid construction with all combinations of optional fields - `server_url` validator: rejects empty/whitespace-only strings, rejects non-HTTP(S) schemes, accepts `http://` and `https://` prefixes, strips leading/trailing whitespace - `namespace` validator: rejects empty/whitespace-only strings, strips leading/trailing whitespace, defaults to `"default"` - `auth_token_ref` field: accepts `None` and non-empty string values - `tls_verify` field: defaults to `True`, accepts `False` - Frozen model: mutation raises `ValidationError` ## Acceptance Criteria - [ ] `features/server_config.feature` exists with Gherkin scenarios covering all validation paths listed above - [ ] `features/steps/server_config_steps.py` exists with all step definitions fully implemented (no placeholder steps) - [ ] `nox -s unit_tests` passes with all new scenarios green - [ ] `nox -s coverage_report` reports ≥97% coverage and `server_config.py` is fully covered - [ ] `nox` (all default sessions) passes with no errors ## Subtasks - [ ] Create `features/server_config.feature` with scenarios for valid construction, URL validation, namespace validation, optional fields, and frozen-model mutation guard - [ ] Create `features/steps/server_config_steps.py` with all step definitions implemented - [ ] Verify no existing step file already covers this behaviour (check `features/steps/` before creating a new file) - [ ] Run `nox -s unit_tests` and confirm all new scenarios pass - [ ] Run `nox -s coverage_report` and confirm `server_config.py` reaches 100% line coverage - [ ] 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 (`test(a2a): add BDD scenarios for ServerConnectionConfig validation`), followed by a blank line, then additional lines providing relevant implementation details. - The commit is pushed to the remote on the branch `test/a2a-server-config-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.4.0 milestone 2026-04-03 14:01:44 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Medium (confirmed)
  • Milestone: v3.4.0 (already assigned in metadata — though this is a test coverage issue, the milestone assignment is acceptable)
  • MoSCoW: Could Have — Coverage gap for server config validation. Not blocking current milestones.
  • Parent Epic: #933 (confirmed correct)

Note: The issue body says milestone v3.4.0 but no milestone was set on the issue. Assigning to v3.4.0 as specified.


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

Issue triaged by project owner: - **State**: Verified - **Priority**: Medium (confirmed) - **Milestone**: v3.4.0 (already assigned in metadata — though this is a test coverage issue, the milestone assignment is acceptable) - **MoSCoW**: Could Have — Coverage gap for server config validation. Not blocking current milestones. - **Parent Epic**: #933 (confirmed correct) Note: The issue body says milestone v3.4.0 but no milestone was set on the issue. Assigning to v3.4.0 as specified. --- **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#2314
No description provided.