Skip to content

Commit 115abf8

Browse files
authored
Fix canonical Bay redirect smoke (#1183)
* Fix canonical Bay redirect smoke * Correct Bay redirect proof wording
1 parent 68a6dfc commit 115abf8

3 files changed

Lines changed: 30 additions & 6 deletions

File tree

‎docs/proof/openclaw-bay/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,5 @@ private payloads.
136136

137137
This is deterministic interaction proof, not a claim that synthetic state is
138138
live operational evidence. The separate deployment smoke covers the canonical
139-
`/bay` route, the query-preserving legacy redirect, response headers, shared
139+
`/bay` route, the query-stripping legacy redirect, response headers, shared
140140
schema, and static assets.

‎scripts/dashboard-smoke.mjs‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,8 @@ async function main() {
107107
const legacyBay = await fetch(`${baseUrl}/bay-demo?repo=openclaw%2Fopenclaw&q=proof`, {
108108
redirect: "manual",
109109
});
110-
if (
111-
legacyBay.status !== 308 ||
112-
legacyBay.headers.get("location") !== `${baseUrl}/bay?repo=openclaw%2Fopenclaw&q=proof`
113-
) {
114-
throw new Error("legacy Bay route did not preserve its query in a permanent redirect");
110+
if (!isCanonicalLegacyBayRedirect(legacyBay, baseUrl)) {
111+
throw new Error("legacy Bay route did not strip its query in a permanent redirect");
115112
}
116113

117114
const bayAssets = {};
@@ -216,6 +213,10 @@ export function containsDirectGitHubApiUrl(html) {
216213
return /(?:^|[^a-z0-9.-])api\.github\.com\.?(?=$|[^a-z0-9.-])/iu.test(html);
217214
}
218215

216+
export function isCanonicalLegacyBayRedirect(response, baseUrl) {
217+
return response.status === 308 && response.headers.get("location") === `${baseUrl}/bay`;
218+
}
219+
219220
function positiveInteger(value, fallback) {
220221
const number = Number(value);
221222
return Number.isInteger(number) && number > 0 ? number : fallback;

‎test/dashboard-smoke.test.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import test from "node:test";
44

55
import {
66
containsDirectGitHubApiUrl,
7+
isCanonicalLegacyBayRedirect,
78
waitForDashboardDeployment,
89
} from "../scripts/dashboard-smoke.mjs";
910

@@ -48,6 +49,28 @@ test("dashboard smoke requires Bay's public indexability and overview navigation
4849
assert.doesNotMatch(source, /unlisted: true/);
4950
});
5051

52+
test("dashboard smoke requires the legacy Bay redirect to strip query data", () => {
53+
const baseUrl = "https://clawsweeper.example";
54+
55+
assert.equal(
56+
isCanonicalLegacyBayRedirect(
57+
new Response(null, { status: 308, headers: { location: `${baseUrl}/bay` } }),
58+
baseUrl,
59+
),
60+
true,
61+
);
62+
assert.equal(
63+
isCanonicalLegacyBayRedirect(
64+
new Response(null, {
65+
status: 308,
66+
headers: { location: `${baseUrl}/bay?repo=public%2Frepository&q=proof` },
67+
}),
68+
baseUrl,
69+
),
70+
false,
71+
);
72+
});
73+
5174
test("dashboard smoke waits for the exact deployed revision", async () => {
5275
const observed = ["old-sha", "expected-sha"];
5376
let sleeps = 0;

0 commit comments

Comments
 (0)