Skip to content

Testing: nothing enforces header and status parity between cache MISS and HIT #570

Description

@Depo-dev

The response cache stores only the body, and until recently replayed it with a hardcoded Content-Type.

Context

Fixed in the follow-up to #221 — this issue tracks the invariant, which nothing currently enforces.

middleware/cache.go now persists status, headers, and body together, so a HIT reproduces what the MISS returned. But there is no test asserting that a newly cached route keeps that property, and the failure is silent: a handler sets Cache-Control, the first caller sees it, every subsequent caller does not, and no test fails.

Scope

  • A table-driven test over every ResponseCache-wrapped route asserting header and status parity between MISS and HIT.
  • Make it fail closed: adding a route to the cache without adding it to the table should break the build, so the check cannot rot.

Done when

  • Header/status parity is asserted for every cached route, and adding a cached route without covering it fails CI.

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

    apiGo REST API + Rust gRPC APItestingTests and test coverage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions