Skip to content

Commit 08a98d5

Browse files
authored
Merge pull request #29 from fells-code/fix/sync-bundled-manifest
fix: sync the bundled adapter manifest with API 0.21.1 and check it in CI
2 parents a84cd63 + a49babb commit 08a98d5

4 files changed

Lines changed: 91 additions & 1 deletion

File tree

‎.github/workflows/manifest.yml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: manifest
2+
3+
# The bundled adapter manifest must match the one seamless-auth-api main
4+
# publishes. The schedule catches API route changes that land between PRs here.
5+
on:
6+
push:
7+
branches: [main]
8+
pull_request:
9+
schedule:
10+
- cron: '17 6 * * *'
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
drift:
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 5
20+
steps:
21+
- uses: actions/checkout@v4
22+
- run: scripts/check-manifest.sh

‎AGENTS.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Tooling is [uv](https://docs.astral.sh/uv/). Development runs on Python 3.11, th
5555
| Types | `uv run mypy` (strict) |
5656
| Tests | `uv run pytest` |
5757
| Conformance | see README, "Conformance" (both reference apps) |
58+
| Manifest | `scripts/check-manifest.sh` (fix with `scripts/sync-manifest.sh`) |
5859

5960
CI runs the checks on Python 3.11 to 3.14. 3.11 resolves Django 5.2 LTS and later versions the
6061
current Django, so both are covered. Do not use language or standard library features newer than
@@ -106,5 +107,8 @@ bump the version, edit the changelog, or tag by hand:
106107
`release-please-config.json`), or `uv sync --locked` fails on main after every release.
107108
- If a publish fails after the release is tagged, fix the cause on main, then publish that tag by
108109
hand: `gh workflow run release.yml -f tag=vX.Y.Z`. It checks the tag matches `pyproject.toml`.
110+
- The bundled manifest must match the one seamless-auth-api main publishes. The `manifest`
111+
workflow checks it on every PR, on `main` and daily. Update it with `scripts/sync-manifest.sh`
112+
in a `fix:` commit so the new routes ship in a patch release.
109113

110114
Pre-1.0: a breaking change is a minor bump, and 1.0 is a deliberate decision, not a side effect.

‎scripts/check-manifest.sh‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env sh
2+
# Fails when the bundled adapter manifest differs from the one the auth API
3+
# publishes. The bundled copy is what the adapter serves whenever the live fetch
4+
# fails, so a route missing from it answers 404 in that case. apiVersion is
5+
# ignored: it changes on every API release, routes do not.
6+
#
7+
# scripts/check-manifest.sh [source]
8+
#
9+
# source defaults to seamless-auth-api main. Fix a failure with
10+
# scripts/sync-manifest.sh.
11+
set -eu
12+
13+
source="${1:-https://raw.githubusercontent.com/fells-code/seamless-auth-api/main/adapter-manifest.json}"
14+
bundled="$(dirname "$0")/../src/seamless_auth/manifest.json"
15+
16+
dir="$(mktemp -d)"
17+
trap 'rm -rf "$dir"' EXIT
18+
19+
case "$source" in
20+
http://*|https://*) curl -fsSL "$source" -o "$dir/upstream.json" ;;
21+
*) cp "$source" "$dir/upstream.json" ;;
22+
esac
23+
24+
normalize() { jq -S 'del(.apiVersion) | .routes |= sort_by(.path, .method)' "$1"; }
25+
normalize "$bundled" > "$dir/bundled.norm"
26+
normalize "$dir/upstream.json" > "$dir/upstream.norm"
27+
28+
if cmp -s "$dir/bundled.norm" "$dir/upstream.norm"; then
29+
echo "Bundled manifest matches $source"
30+
exit 0
31+
fi
32+
33+
routes() { jq -r '.routes[] | "\(.method) \(.path)"' "$1" | sort; }
34+
routes "$bundled" > "$dir/bundled.routes"
35+
routes "$dir/upstream.json" > "$dir/upstream.routes"
36+
37+
echo "Bundled manifest (src/seamless_auth/manifest.json) differs from $source" >&2
38+
echo "Missing from the bundled copy:" >&2
39+
comm -13 "$dir/bundled.routes" "$dir/upstream.routes" | sed 's/^/ /' >&2
40+
echo "Only in the bundled copy:" >&2
41+
comm -23 "$dir/bundled.routes" "$dir/upstream.routes" | sed 's/^/ /' >&2
42+
echo "Full difference:" >&2
43+
diff -u "$dir/bundled.norm" "$dir/upstream.norm" >&2 || true
44+
echo "Run scripts/sync-manifest.sh to update it." >&2
45+
exit 1

‎src/seamless_auth/manifest.json‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"schemaVersion": 1,
3-
"apiVersion": "0.19.4",
3+
"apiVersion": "0.21.1",
44
"session": {
55
"subject": "sub",
66
"token": "token",
@@ -9,6 +9,15 @@
99
"refreshTtl": "refreshTtl"
1010
},
1111
"routes": [
12+
{ "method": "GET", "path": "/admin/applications", "credential": "access" },
13+
{ "method": "POST", "path": "/admin/applications", "credential": "access" },
14+
{ "method": "DELETE", "path": "/admin/applications/{id}", "credential": "access" },
15+
{ "method": "GET", "path": "/admin/applications/{id}", "credential": "access" },
16+
{ "method": "PATCH", "path": "/admin/applications/{id}", "credential": "access" },
17+
{ "method": "PUT", "path": "/admin/applications/{id}/keys", "credential": "access" },
18+
{ "method": "GET", "path": "/admin/applications/{id}/resources", "credential": "access" },
19+
{ "method": "PUT", "path": "/admin/applications/{id}/resources", "credential": "access" },
20+
{ "method": "POST", "path": "/admin/applications/{id}/secret", "credential": "access" },
1221
{ "method": "GET", "path": "/admin/auth-events", "credential": "access" },
1322
{ "method": "GET", "path": "/admin/auth-events/export", "credential": "access" },
1423
{ "method": "GET", "path": "/admin/auth-events/integrity", "credential": "access" },
@@ -51,6 +60,11 @@
5160
"credential": "access"
5261
},
5362
{ "method": "GET", "path": "/admin/reports/authentication-coverage", "credential": "access" },
63+
{ "method": "GET", "path": "/admin/resources", "credential": "access" },
64+
{ "method": "POST", "path": "/admin/resources", "credential": "access" },
65+
{ "method": "DELETE", "path": "/admin/resources/{id}", "credential": "access" },
66+
{ "method": "GET", "path": "/admin/resources/{id}", "credential": "access" },
67+
{ "method": "PATCH", "path": "/admin/resources/{id}", "credential": "access" },
5468
{ "method": "GET", "path": "/admin/review-accounts", "credential": "access" },
5569
{ "method": "GET", "path": "/admin/sessions", "credential": "access" },
5670
{ "method": "GET", "path": "/admin/sessions/{userId}", "credential": "access" },
@@ -219,6 +233,11 @@
219233
{ "method": "POST", "path": "/system-config/oauth-providers", "credential": "access" },
220234
{ "method": "DELETE", "path": "/system-config/oauth-providers/{id}", "credential": "access" },
221235
{ "method": "PATCH", "path": "/system-config/oauth-providers/{id}", "credential": "access" },
236+
{
237+
"method": "POST",
238+
"path": "/system-config/oauth-providers/{id}/discovery",
239+
"credential": "access"
240+
},
222241
{ "method": "GET", "path": "/system-config/policy", "credential": "access" },
223242
{ "method": "DELETE", "path": "/system-config/policy/draft", "credential": "access" },
224243
{ "method": "PUT", "path": "/system-config/policy/draft", "credential": "access" },

0 commit comments

Comments
 (0)