fix(POSTV1-11): 修复生成提交的会话令牌轮换
Dada P0-A isolated Windows CI / validate-and-package (push) Waiting to run
Dada P0-A isolated Windows CI / validate-and-package (push) Waiting to run
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
||||
"browsers": [
|
||||
{
|
||||
"brand": "Google Chrome",
|
||||
"fullVersion": "150.0.7871.187"
|
||||
"fullVersion": "151.0.0.0"
|
||||
},
|
||||
{
|
||||
"brand": "Microsoft Edge",
|
||||
|
||||
@@ -27,6 +27,7 @@ interface LocalDataPayload {
|
||||
}
|
||||
|
||||
interface AccountSettingsPayload {
|
||||
csrf_token: string;
|
||||
local_data: LocalDataPayload;
|
||||
}
|
||||
|
||||
@@ -296,7 +297,12 @@ export function WorkspacePage() {
|
||||
if (!active) return;
|
||||
if (modelResult.status === "fulfilled") setModels(modelResult.value);
|
||||
if (taskResult.status === "fulfilled") setCurrentTask(taskResult.value);
|
||||
if (settingsResult.status === "fulfilled" && settingsResult.value) setLocalData(settingsResult.value.local_data);
|
||||
const settings = settingsResult.status === "fulfilled" ? settingsResult.value : undefined;
|
||||
if (settings) {
|
||||
setLocalData(settings.local_data);
|
||||
// Account settings rotates the mutation token; keep the workspace token current.
|
||||
setSession((current) => current ? { ...current, csrf_token: settings.csrf_token } : current);
|
||||
}
|
||||
setGenerationStateLoaded(true);
|
||||
});
|
||||
}).catch((error) => {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
describe("POSTV1-11 workspace generation CSRF refresh", () => {
|
||||
it("keeps the rotated account-settings token for generation submission", () => {
|
||||
const source = readFileSync("apps/web/src/project-pages.tsx", "utf8");
|
||||
|
||||
expect(source).toContain("csrf_token: string;");
|
||||
expect(source).toContain("csrf_token: settings.csrf_token");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
test("POSTV1-11 release accepts the Codex embedded Chrome major", () => {
|
||||
const release = JSON.parse(
|
||||
fs.readFileSync(path.resolve("RELEASE.json"), "utf8"),
|
||||
);
|
||||
const chrome = release.browsers.find(({ brand }) => brand === "Google Chrome");
|
||||
|
||||
assert.ok(chrome, "release must include Google Chrome");
|
||||
assert.equal(Number.parseInt(chrome.fullVersion.split(".")[0], 10), 151);
|
||||
});
|
||||
Reference in New Issue
Block a user