惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
B
Blog
P
Proofpoint News Feed
美团技术团队
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
A
About on SuperTechFans
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Vercel News
Vercel News
有赞技术团队
有赞技术团队
小众软件
小众软件
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
H
Help Net Security
罗磊的独立博客
L
LangChain Blog
GbyAI
GbyAI
腾讯CDC
T
The Blog of Author Tim Ferriss
Microsoft Security Blog
Microsoft Security Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(qa): measure chunked credential payload bytes · openc...
vincentkoc · 2026-06-20 · via Recent Commits to openclaw:main

@@ -4,7 +4,7 @@ import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "no

44

import { readFile } from "node:fs/promises";

55

import { tmpdir } from "node:os";

66

import path, { win32 } from "node:path";

7-

import { afterEach, describe, expect, it } from "vitest";

7+

import { afterEach, describe, expect, it, vi } from "vitest";

88

import { fetchJsonWithTimeout, runCommand } from "../../scripts/e2e/telegram-user-credential-io.ts";

99

import {

1010

expandHome,

@@ -75,6 +75,8 @@ async function waitForExit(

7575

}

76767777

afterEach(() => {

78+

vi.restoreAllMocks();

79+

vi.unstubAllGlobals();

7880

for (const dir of tempDirs.splice(0)) {

7981

rmSync(dir, { force: true, recursive: true });

8082

}

@@ -178,6 +180,64 @@ describe("telegram user credential IO", () => {

178180

).toThrow("Chunked payload marker exceeds 67108864 bytes.");

179181

});

180182183+

it("hydrates chunked lease payloads using utf8 byte lengths", async () => {

184+

const credentialModule = (await import(

185+

`${new URL("../../scripts/e2e/telegram-user-credential.ts", import.meta.url).href}?case=utf8-chunk-${Date.now()}`

186+

)) as {

187+

hydratePayloadFromLease(params: {

188+

acquired: Record<string, unknown>;

189+

ownerId: string;

190+

siteUrl: string;

191+

token: string;

192+

}): Promise<Record<string, unknown>>;

193+

};

194+

const sha256 = "a".repeat(64);

195+

const serialized = JSON.stringify({

196+

groupId: "-100123",

197+

sutToken: "sut-token",

198+

testerUserId: "8709353529",

199+

testerUsername: "OpenClawTestUser",

200+

telegramApiId: "123456",

201+

telegramApiHash: "api-hash-\u00e9",

202+

tdlibDatabaseEncryptionKey: "db-key",

203+

tdlibArchiveBase64: "tdlib-archive",

204+

tdlibArchiveSha256: sha256,

205+

desktopTdataArchiveBase64: "desktop-archive",

206+

desktopTdataArchiveSha256: sha256,

207+

});

208+

const fetchMock = vi.fn<typeof fetch>(

209+

async () =>

210+

new Response(JSON.stringify({ status: "ok", data: serialized }), {

211+

status: 200,

212+

headers: { "content-type": "application/json" },

213+

}),

214+

);

215+

vi.stubGlobal("fetch", fetchMock);

216+217+

const payload = await credentialModule.hydratePayloadFromLease({

218+

acquired: {

219+

credentialId: "cred-utf8",

220+

leaseToken: "lease-utf8",

221+

payload: {

222+

[CHUNKED_PAYLOAD_MARKER]: true,

223+

byteLength: Buffer.byteLength(serialized, "utf8"),

224+

chunkCount: 1,

225+

},

226+

},

227+

ownerId: "owner-utf8",

228+

siteUrl: "https://qa.example.invalid",

229+

token: "ci-secret",

230+

});

231+232+

expect(payload.telegramApiHash).toBe("api-hash-\u00e9");

233+

expect(fetchMock).toHaveBeenCalledWith(

234+

"https://qa.example.invalid/qa-credentials/v1/payload-chunk",

235+

expect.objectContaining({

236+

body: expect.stringContaining('"credentialId":"cred-utf8"'),

237+

}),

238+

);

239+

});

240+181241

it("rejects loose numeric credential limits instead of parsing prefixes", async () => {

182242

const credentialModule = (await import(

183243

`${new URL("../../scripts/e2e/telegram-user-credential.ts", import.meta.url).href}?case=limits-${Date.now()}`