Skip to content

API: turn away apps below the minimum compatibility level - #27

Merged
lakaniemi merged 2 commits into
mainfrom
feat/api-compat-middleware
Nov 9, 2026
Merged

lakaniemi merged 2 commits into
mainfrom
feat/api-compat-middleware

Conversation

@lakaniemi

Copy link
Copy Markdown
Owner

What and why

The API half of the API compatibility level, App baseline slice, item 4 in the roadmap (specs/README.md). Requests declaring an App-Compat-Level below minAppCompatLevel get 400 app_outdated, and a header that isn't an integer gets 400 invalid_compat_level. Requests without the header pass, so nothing changes for the current app. The level is added to the request log. This also settles the open decision on the status: 400, following AIP-193.

The app's header and "Update required" screen follow in the next PR.

Size

About 47 logic lines (compat.go 43, plus 2 one-line edits).

How to review

Start with api/internal/server/compat.go. The wiring is one line in server.go and one log field in middleware.go. The docs only record the 400 decision.

Testing

make fmt lint test passes. compat_test.go covers no header, the minimum, above it, below it, negative and non-integer.

🤖 Generated with Claude Code

lakaniemi and others added 2 commits November 9, 2026 20:04
Requests declaring an App-Compat-Level below the API's minimum get 400
app_outdated, and a header that isn't an integer gets 400
invalid_compat_level. Requests without the header pass. The level is
added to the request log, to show which levels are still in use.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Follows Google's AIP-193, which maps FAILED_PRECONDITION to 400. 426 is
meant for protocol upgrades, and the app acts on the error code anyway.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Caution

No coverage for base commit d9d94a8 was found, so this report compares against its ancestor 5c15d2f (2 commits earlier)

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
internal/server 95.32% (+0.14%) 👍
Coverage details

Compared to commit 5c15d2f (run #39268062149)

Changed File Coverage Δ Total Covered Missed 🤖
internal/server/compat.go 100.00% (+100.00%) 14 (+14) 14 (+14) 0 🌟
internal/server/middleware.go 92.21% (ø) 77 71 6
internal/server/server.go 100.00% (ø) 3 3 0

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files:

  • internal/server/compat_test.go

@lakaniemi
lakaniemi merged commit 2c8e7cd into main Nov 9, 2026
3 checks passed
@lakaniemi
lakaniemi deleted the feat/api-compat-middleware branch November 9, 2026 18:18
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.

1 participant