Skip to content

feat(quota-v2): retro compat#147

Open
klaidliadon wants to merge 9 commits intomasterfrom
quota-v2/retro-compat
Open

feat(quota-v2): retro compat#147
klaidliadon wants to merge 9 commits intomasterfrom
quota-v2/retro-compat

Conversation

@klaidliadon
Copy link
Copy Markdown
Contributor

@klaidliadon klaidliadon commented Mar 26, 2026

Retro compatibility test suite

Adds a standalone server/client test harness that verifies wire compatibility across quotacontrol versions — ensuring older clients can still talk to the latest server.

What it does:

  • mock.NewServer now accepts optional *Options (external Redis, custom logger) — nil-safe, backward compatible
  • Adds HandleSetLimit HTTP endpoint so test clients can set per-service limits without direct store access
  • Standalone server binary (tests/server/) using real Redis
  • Latest client binary (tests/client/latest/) that tests:
    • Legacy middleware chain: FetchKeyQuotaSpendUsage → usage sync
    • V2 fetch paths: FetchProjectInfo, FetchServiceLimit, FetchAccessKey
    • Usage accounting: send N requests, stop client, verify server-side usage == N
  • CI workflow (.github/workflows/retro.yml): starts server → runs client → stops server
  • Shared test helpers in tests/common/

Adding older client versions:
Create tests/client/v0.XX/ with its own go.mod pinned to an older release. The Makefile client-run target can be parameterized with VERSION=v0.XX.

Supersedes #138.


Stack: quota-v2

  1. refactor(quota-v2): type renames #144
  2. feat(quota-v2): server plumbing #145
  3. feat(quota-v2): cache middleware #146
  4. feat(quota-v2): retro compat #147 ◀ this PR

This stack is managed with sdf.

@klaidliadon klaidliadon force-pushed the quota-v2/cache-middleware branch from 608d4ce to 9a7b545 Compare April 3, 2026 13:39
@klaidliadon klaidliadon force-pushed the quota-v2/retro-compat branch from 4fb8b99 to 9444733 Compare April 3, 2026 13:39
@klaidliadon klaidliadon force-pushed the quota-v2/cache-middleware branch from 9a7b545 to 49dfa6a Compare April 3, 2026 13:48
@klaidliadon klaidliadon force-pushed the quota-v2/retro-compat branch from 9444733 to 89f0b6b Compare April 3, 2026 13:48
Base automatically changed from quota-v2/cache-middleware to master April 3, 2026 16:18
Adds HandleSetLimit HTTP handler for setting per-service limits
without direct store access, enabling standalone test server usage.
Standalone server and client binaries that test wire compatibility.
The latest client verifies both legacy middleware chain (usage sync)
and V2 fetch paths (FetchProjectInfo, FetchServiceLimit, FetchAccessKey).

Includes CI workflow, helper scripts, and shared test config.
Tests that a client built against the last released version (v0.23.3)
can still talk to the current server. Both clients now measure usage
delta instead of absolute to support sequential runs.
@klaidliadon klaidliadon force-pushed the quota-v2/retro-compat branch from 89f0b6b to ef06778 Compare April 3, 2026 16:19
@klaidliadon klaidliadon force-pushed the quota-v2/retro-compat branch from 136ebb2 to fa61b47 Compare April 3, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants