Skip to content

Commit 29c9a74

Browse files
committed
fix(ci): the RC smoke asserts the declared 401 refusal for an anonymous get-session
The packed-tarball release-candidate smoke asserted that an anonymous `GET /api/v1/auth/get-session` answers 200. Since #17881 the platform deliberately answers 401 with the ADR-0112 envelope (`code: UNAUTHENTICATED`), ruled by the director seat in decision batch #117 item 4 on card #17238: better-auth's `200` + literal JSON `null` is a value no `SessionResponse` can express, so `auth.me()` resolved outside its own declared type; the code moved and the published schema did not. The smoke was therefore asserting a contract the product deliberately stopped serving. This re-pins the probe to what the code declares — the same move #14000 made for `SELF_REGISTRATION_CLOSED` — and pairs the status with the envelope `code`, so a 401 from an origin check, a rate limiter or a later guard cannot keep the probe green while measuring nothing. The signed-in `get-session` probe is untouched and still asserts 200: the refusal seam converts only a 200 whose body is exactly `null`. Claude-Session: https://claude.ai/code/session_012GKcPZbMoGq7WPzKLfRBTU Co-authored-by: Claude <noreply@anthropic.com>
1 parent a90a9f2 commit 29c9a74

1 file changed

Lines changed: 32 additions & 2 deletions

File tree

‎scripts/publish-smoke.sh‎

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
#
2929
# Both modes then boot `objectstack dev --fresh` and assert the DECLARED
3030
# first-run contract (see "the first run this asserts" below):
31-
# - GET /api/v1/auth/get-session → 200 (anonymous)
31+
# - GET /api/v1/auth/get-session → 401 (anonymous) with the
32+
# ADR-0112 envelope code
33+
# UNAUTHENTICATED — see the probe
3234
# - GET /api/v1/auth/config → 200, and in `pack` mode the
3335
# advertised audience posture
3436
# IS the declared `invite_only`
@@ -1007,7 +1009,35 @@ assert_body() {
10071009
}
10081010

10091011
log "Auth probes (the #3091 failure surface)"
1010-
probe "GET /auth/get-session (anonymous)" 200 "$BASE_URL/api/v1/auth/get-session"
1012+
# ── the anonymous session read is a REFUSAL, not an empty 200 (#17881 / #17238) ─
1013+
# better-auth answers an anonymous `/get-session` with `200` and the literal
1014+
# JSON `null`, and this probe asserted that 200 until #17881 changed it. `null`
1015+
# is a value no `SessionResponse` can express, so `ObjectStackClient.auth.me()`
1016+
# — which declares `Promise<SessionResponse>` — resolved OUTSIDE its own declared
1017+
# type on the most ordinary call a logged-out caller makes. Ruled by the
1018+
# director seat, decision batch #117 item 4 (「17238 B」): the server answers the
1019+
# platform's standard ADR-0112 failure envelope with 401 and
1020+
# `SessionResponseSchema` is UNTOUCHED. The seam is
1021+
# `plugin-auth/src/anonymous-session-refusal.ts`, whose module header carries
1022+
# the ruling and the three narrowings; it converts ONLY a 200 whose body is
1023+
# exactly `null`, on ONLY the `/get-session` path, which is why the signed-in
1024+
# probe further down is still 200 and byte-identical to before.
1025+
#
1026+
# ⚠ 401 here is the DECLARED contract — NOT a regression and NOT a relaxation.
1027+
# This is the #14000 move again: re-pin the smoke to what the code declares and
1028+
# ⛔ do not touch the auth surface. ⛔ Do not "fix" this back to 200; that would
1029+
# re-assert a shape the platform deliberately stopped serving, and it is the
1030+
# relaxation the header above forbids.
1031+
probe "GET /auth/get-session (anonymous — must be REFUSED)" 401 "$BASE_URL/api/v1/auth/get-session"
1032+
# The status alone is NOT the assertion (the same discipline the sign-up refusal
1033+
# below is written under): a 401 also comes out of an origin check, a rate
1034+
# limiter, a proxy in front of the dev server, or any guard added later — each
1035+
# would keep this probe green while saying nothing about the anonymous-session
1036+
# contract. The envelope `code` is the part that pins it, and `UNAUTHENTICATED`
1037+
# is a code this repo owns and publishes (`StandardErrorCode`, ADR-0112's
1038+
# derived-code map `401 -> UNAUTHENTICATED`), ⛔ never a vendor-internal symbol.
1039+
assert_body '.error.code == "UNAUTHENTICATED"' \
1040+
"the anonymous session read was refused, but NOT by the declared ADR-0112 envelope — a 401 whose .error.code is not UNAUTHENTICATED means some other guard answered, and this probe has stopped measuring the anonymous-session contract"
10111041

10121042
# ── which contract THIS artifact declares ───────────────────────────────────
10131043
# `GET /auth/config` is public and unauthenticated, and since #11739 it

0 commit comments

Comments
 (0)