a2aproject / a2aproject/a2a-tck

bug(tck): CARD-CACHE-003 is MAY-level but test hard-fails when header is absent

Offen Anfängerfreundlich
#236 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
50
Forks
40
Ø Merge
7 T. 1 Std.
Gemergte PRs (30 T.)
1

Beschreibung

## Problem

`CARD-CACHE-003` (Last-Modified header) is registered as `RequirementLevel.MAY` in [`tck/requirements/agent_card.py:218`](https://github.com/a2aproject/a2a-tck/blob/main/tck/requirements/agent_card.py#L218) and decorated `@may` in the test class, but `test_last_modified_present` hard-`assert`s on the header's presence:

```python
last_modified = response.headers.get("last-modified")
valid = last_modified is not None
# ...
assert valid, _fail_msg(req, errors[0])
```

Per RFC 2119, MAY means the item is truly optional. A conformant implementation that omits the header is exercising a legitimate choice — the TCK shouldn't count that as a failure.

## Impact

- The compatibility report shows `CARD-CACHE-003` as `FAIL` for any SUT that doesn't emit `Last-Modified`, even though it's not required.
- A reference SUT that ships the header to silence the test masks this classification bug rather than surfacing it.

## Expected behavior

A `MAY`-level requirement that the SUT doesn't satisfy should be reported as `NOT TESTED` or `SKIPPED`, not `FAIL`. The `@may` marker should prevent a hard assertion failure — either:
1. The test should use `pytest.skip()` or `pytest.xfail()` when the header is absent, or
2. The reporting layer should downgrade MAY-level assertion failures to a non-FAIL status.

## Related

Discovered while working on #234 / #235. The SUT PR intentionally does **not** emit `Last-Modified` to avoid masking this.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

The issue is in the test file `tck/requirements/agent_card.py` around line 218. Look at the `test_last_modified_present` method and the `@may` decorator. Understand how the test currently asserts the header's presence. Check how other `@may` tests are handled. The fix likely involves modifying the assertion logic to skip or not fail when the header is absent, and ensuring the reporting reflects a MAY-level requirement correctly.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
testing
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Aktiv
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
75/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.