Skip to content

interim-not-cached (kind: required) asserts nothing #168

Closed

Description

@mnot

Problem

interim-not-cached is declared kind: 'required' but asserts nothing.

https://github.com/http-tests/cache-tests/blob/main/tests/interim.mjs#L58-L87

The cache-hit (second) request sets expected_interim_responses: []. The checker iterates that array:

https://github.com/http-tests/cache-tests/blob/main/test-engine/client/test.mjs#L199-L226

if ('expected_interim_responses' in reqConfig) {
  const isSetup = setupCheck(reqConfig, 'expected_interim_responses')
  reqConfig.expected_interim_responses.forEach(...)  // empty array => zero assertions
}

An empty array runs zero forEach iterations, so a cache that wrongly stored and replayed the 103 interim on the cache hit would still pass this required test.

Root cause

The framework only ever verifies that expected interim responses are present. There is no "assert no unexpected interim was received" path, so expected_interim_responses: [] cannot express the negative the test name requires.

Suggested fix

Add a negative check: when expected_interim_responses is present, also assert that no interim responses were received beyond those expected (i.e. interimResponses.length === reqConfig.expected_interim_responses.length). That makes the empty-array case meaningful and enforces interim-not-cached.


Filed from an AI-assisted (Claude Code) review of the tests, with each finding verified by hand and reviewed by a human before filing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions