a2aproject / a2aproject/a2a-tck
bug(tck): CARD-CACHE-003 is MAY-level but test hard-fails when header is absent
- Lingua principale
- Python
- Stelle
- 50
- Fork
- 40
- Merge medio
- 7g 1h
- PR unite (30g)
- 1
Descrizione
## 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.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- testing
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Attiva
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 75/100