Add missing src/cleveragents/a2a/asgi.py and BDD coverage for ASGI health-probe application #2261

Open
opened 2026-04-03 11:51:53 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: test/a2a-asgi-coverage
  • Commit Message: test(a2a): add asgi.py source module and BDD coverage for ASGI health-probe app
  • Milestone: v3.4.0
  • Parent Epic: #933

Background and Context

src/cleveragents/a2a/asgi.py is absent from the current working tree even though a compiled
bytecode artefact (src/cleveragents/a2a/__pycache__/asgi.cpython-313.pyc) is present,
confirming the module was previously built but the source file was never committed to this
branch.

The module provides the minimal, dependency-free ASGI application that is the concrete import
target for the server-mode entry point:

python -m cleveragents server serve --app cleveragents.a2a.asgi:app

It exposes health-probe routes (/live, /ready, /health, /) required by Kubernetes
liveness and readiness probes, handles lifespan startup/shutdown, rejects WebSocket connections
with code 1008, and returns RFC 9110-compliant 405 responses for non-GET methods on known
paths.

Without the source file the module cannot be imported, the server entry point is broken, and
coverage tooling cannot measure the module at all — making it impossible to satisfy the
project-wide ≥ 97 % coverage gate.

Current Behaviour

  • src/cleveragents/a2a/asgi.py does not exist on the current branch.
  • from cleveragents.a2a.asgi import app raises ModuleNotFoundError at runtime.
  • The BDD feature file (features/asgi_app.feature) and its step definitions
    (features/steps/asgi_app_steps.py) are also absent from this branch, so the ASGI
    scenarios cannot be executed.
  • Coverage for cleveragents.a2a.asgi is 0 % — the module is entirely untracked.

Expected Behaviour

  • src/cleveragents/a2a/asgi.py exists and is importable.
  • All ASGI protocol paths are exercised by BDD scenarios in features/asgi_app.feature.
  • nox -s unit_tests passes with all ASGI scenarios green.
  • nox -s coverage_report reports ≥ 97 % for cleveragents.a2a.asgi.

Acceptance Criteria

  • src/cleveragents/a2a/asgi.py is present and importable with no runtime errors.
  • The module exposes an app callable conforming to the ASGI 3.0 interface.
  • GET /live → 200 {"status":"alive"}.
  • GET /ready → 200 {"status":"ready"}.
  • GET /health → 200 {"status":"ok"}.
  • GET / → 200 {"service":"cleveragents"}.
  • GET /missing → 404 {"error":"not found"}.
  • POST to any known path → 405 with Allow: GET header.
  • All HTTP responses include x-content-type-options: nosniff and cache-control: no-store.
  • Lifespan startup and shutdown complete cleanly.
  • Unrecognised lifespan message types are logged as warnings and the cycle continues.
  • WebSocket scopes are closed with code 1008 (Policy Violation).
  • Unsupported ASGI scope types raise RuntimeError.
  • features/asgi_app.feature and features/steps/asgi_app_steps.py are present and all scenarios pass.
  • All nox default sessions pass.
  • Coverage for cleveragents.a2a.asgi ≥ 97 %.

Supporting Information

  • The canonical implementation exists in commit b51df2ee on branches that have merged
    feat(server): add Kubernetes Helm chart for server deployment (#1085). The source can be
    cherry-picked or ported from that commit.
  • Relevant spec section: §Architecture — A2A Protocol, §Server Mode.
  • Parent Epic: #933 (A2A Protocol Compliance).

Subtasks

  • Restore src/cleveragents/a2a/asgi.py (cherry-pick from b51df2ee or re-implement per spec)
  • Restore features/asgi_app.feature with all 13 ASGI protocol scenarios
  • Restore features/steps/asgi_app_steps.py with all step definitions
  • Run nox -s unit_tests and confirm all ASGI scenarios pass
  • Run nox -s coverage_report and confirm cleveragents.a2a.asgi ≥ 97 %
  • Run nox (all default sessions) and fix any errors
  • Update CHANGELOG with entry for this fix

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, 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.
  • 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-asgi-coverage` - **Commit Message**: `test(a2a): add asgi.py source module and BDD coverage for ASGI health-probe app` - **Milestone**: v3.4.0 - **Parent Epic**: #933 ## Background and Context `src/cleveragents/a2a/asgi.py` is absent from the current working tree even though a compiled bytecode artefact (`src/cleveragents/a2a/__pycache__/asgi.cpython-313.pyc`) is present, confirming the module was previously built but the source file was never committed to this branch. The module provides the minimal, dependency-free ASGI application that is the concrete import target for the server-mode entry point: ``` python -m cleveragents server serve --app cleveragents.a2a.asgi:app ``` It exposes health-probe routes (`/live`, `/ready`, `/health`, `/`) required by Kubernetes liveness and readiness probes, handles lifespan startup/shutdown, rejects WebSocket connections with code 1008, and returns RFC 9110-compliant 405 responses for non-GET methods on known paths. Without the source file the module cannot be imported, the server entry point is broken, and coverage tooling cannot measure the module at all — making it impossible to satisfy the project-wide ≥ 97 % coverage gate. ## Current Behaviour - `src/cleveragents/a2a/asgi.py` does not exist on the current branch. - `from cleveragents.a2a.asgi import app` raises `ModuleNotFoundError` at runtime. - The BDD feature file (`features/asgi_app.feature`) and its step definitions (`features/steps/asgi_app_steps.py`) are also absent from this branch, so the ASGI scenarios cannot be executed. - Coverage for `cleveragents.a2a.asgi` is 0 % — the module is entirely untracked. ## Expected Behaviour - `src/cleveragents/a2a/asgi.py` exists and is importable. - All ASGI protocol paths are exercised by BDD scenarios in `features/asgi_app.feature`. - `nox -s unit_tests` passes with all ASGI scenarios green. - `nox -s coverage_report` reports ≥ 97 % for `cleveragents.a2a.asgi`. ## Acceptance Criteria - [ ] `src/cleveragents/a2a/asgi.py` is present and importable with no runtime errors. - [ ] The module exposes an `app` callable conforming to the ASGI 3.0 interface. - [ ] `GET /live` → 200 `{"status":"alive"}`. - [ ] `GET /ready` → 200 `{"status":"ready"}`. - [ ] `GET /health` → 200 `{"status":"ok"}`. - [ ] `GET /` → 200 `{"service":"cleveragents"}`. - [ ] `GET /missing` → 404 `{"error":"not found"}`. - [ ] `POST` to any known path → 405 with `Allow: GET` header. - [ ] All HTTP responses include `x-content-type-options: nosniff` and `cache-control: no-store`. - [ ] Lifespan startup and shutdown complete cleanly. - [ ] Unrecognised lifespan message types are logged as warnings and the cycle continues. - [ ] WebSocket scopes are closed with code 1008 (Policy Violation). - [ ] Unsupported ASGI scope types raise `RuntimeError`. - [ ] `features/asgi_app.feature` and `features/steps/asgi_app_steps.py` are present and all scenarios pass. - [ ] All `nox` default sessions pass. - [ ] Coverage for `cleveragents.a2a.asgi` ≥ 97 %. ## Supporting Information - The canonical implementation exists in commit `b51df2ee` on branches that have merged `feat(server): add Kubernetes Helm chart for server deployment (#1085)`. The source can be cherry-picked or ported from that commit. - Relevant spec section: §Architecture — A2A Protocol, §Server Mode. - Parent Epic: #933 (A2A Protocol Compliance). ## Subtasks - [ ] Restore `src/cleveragents/a2a/asgi.py` (cherry-pick from `b51df2ee` or re-implement per spec) - [ ] Restore `features/asgi_app.feature` with all 13 ASGI protocol scenarios - [ ] Restore `features/steps/asgi_app_steps.py` with all step definitions - [ ] Run `nox -s unit_tests` and confirm all ASGI scenarios pass - [ ] Run `nox -s coverage_report` and confirm `cleveragents.a2a.asgi` ≥ 97 % - [ ] Run `nox` (all default sessions) and fix any errors - [ ] Update `CHANGELOG` with entry for this fix ## 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, 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. - 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 12:00:11 +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#2261
No description provided.