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

推荐订阅源

aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
云风的 BLOG
云风的 BLOG
Microsoft Azure Blog
Microsoft Azure Blog
腾讯CDC
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
小众软件
小众软件
美团技术团队
Martin Fowler
Martin Fowler
爱范儿
爱范儿
有赞技术团队
有赞技术团队
博客园 - 【当耐特】
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
J
Java Code Geeks
B
Blog
V
V2EX
Stack Overflow Blog
Stack Overflow Blog
B
Blog RSS Feed
博客园 - Franky

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
refactor(infra): drop unused apns store wrappers · opencl...
vincentkoc · 2026-06-19 · via Recent Commits to openclaw:main

@@ -4,12 +4,10 @@ import path from "node:path";

44

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

55

import { createTrackedTempDirs } from "../test-utils/tracked-temp-dirs.js";

66

import {

7-

clearApnsRegistration,

87

clearApnsRegistrationIfCurrent,

98

loadApnsRegistration,

109

loadApnsRegistrations,

1110

registerApnsRegistration,

12-

registerApnsToken,

1311

} from "./push-apns.js";

14121513

const tempDirs = createTrackedTempDirs();

@@ -18,14 +16,27 @@ async function makeTempDir(): Promise<string> {

1816

return await tempDirs.make("openclaw-push-apns-store-test-");

1917

}

201819+

async function registerDirectApnsRegistration(params: {

20+

nodeId: string;

21+

token: string;

22+

topic: string;

23+

environment?: unknown;

24+

baseDir?: string;

25+

}) {

26+

return await registerApnsRegistration({

27+

...params,

28+

transport: "direct",

29+

});

30+

}

31+2132

afterEach(async () => {

2233

await tempDirs.cleanup();

2334

});

24352536

describe("push APNs registration store", () => {

2637

it("stores and reloads direct APNs registrations", async () => {

2738

const baseDir = await makeTempDir();

28-

const saved = await registerApnsToken({

39+

const saved = await registerDirectApnsRegistration({

2940

nodeId: "ios-node-1",

3041

token: "ABCD1234ABCD1234ABCD1234ABCD1234",

3142

topic: "ai.openclaw.ios",

@@ -120,7 +131,7 @@ describe("push APNs registration store", () => {

120131121132

it("loads multiple APNs registrations from one store snapshot", async () => {

122133

const baseDir = await makeTempDir();

123-

const first = await registerApnsToken({

134+

const first = await registerDirectApnsRegistration({

124135

nodeId: "ios-node-1",

125136

token: "ABCD1234ABCD1234ABCD1234ABCD1234",

126137

topic: "ai.openclaw.ios",

@@ -155,40 +166,38 @@ describe("push APNs registration store", () => {

155166156167

await expect(loadApnsRegistration("ios-node-missing", baseDir)).resolves.toBeNull();

157168

await expect(loadApnsRegistration(" ", baseDir)).resolves.toBeNull();

158-

await expect(clearApnsRegistration(" ", baseDir)).resolves.toBe(false);

159-

await expect(clearApnsRegistration("ios-node-missing", baseDir)).resolves.toBe(false);

160169

});

161170162171

it("rejects invalid direct and relay registration inputs", async () => {

163172

const baseDir = await makeTempDir();

164173

const oversized = "x".repeat(257);

165174166175

await expect(

167-

registerApnsToken({

176+

registerDirectApnsRegistration({

168177

nodeId: "ios-node-1",

169178

token: "not-a-token",

170179

topic: "ai.openclaw.ios",

171180

baseDir,

172181

}),

173182

).rejects.toThrow("invalid APNs token");

174183

await expect(

175-

registerApnsToken({

184+

registerDirectApnsRegistration({

176185

nodeId: "n".repeat(257),

177186

token: "ABCD1234ABCD1234ABCD1234ABCD1234",

178187

topic: "ai.openclaw.ios",

179188

baseDir,

180189

}),

181190

).rejects.toThrow("nodeId required");

182191

await expect(

183-

registerApnsToken({

192+

registerDirectApnsRegistration({

184193

nodeId: "ios-node-1",

185194

token: "A".repeat(513),

186195

topic: "ai.openclaw.ios",

187196

baseDir,

188197

}),

189198

).rejects.toThrow("invalid APNs token");

190199

await expect(

191-

registerApnsToken({

200+

registerDirectApnsRegistration({

192201

nodeId: "ios-node-1",

193202

token: "ABCD1234ABCD1234ABCD1234ABCD1234",

194203

topic: "a".repeat(256),

@@ -262,9 +271,9 @@ describe("push APNs registration store", () => {

262271

).rejects.toThrow("sendGrant too long");

263272

});

264273265-

it("persists with a trailing newline and clears registrations", async () => {

274+

it("persists with a trailing newline and clears current registrations", async () => {

266275

const baseDir = await makeTempDir();

267-

await registerApnsToken({

276+

const registration = await registerDirectApnsRegistration({

268277

nodeId: "ios-node-1",

269278

token: "ABCD1234ABCD1234ABCD1234ABCD1234",

270279

topic: "ai.openclaw.ios",

@@ -273,7 +282,13 @@ describe("push APNs registration store", () => {

273282274283

const statePath = path.join(baseDir, "push", "apns-registrations.json");

275284

await expect(fs.readFile(statePath, "utf8")).resolves.toMatch(/\n$/);

276-

await expect(clearApnsRegistration("ios-node-1", baseDir)).resolves.toBe(true);

285+

await expect(

286+

clearApnsRegistrationIfCurrent({

287+

nodeId: "ios-node-1",

288+

registration,

289+

baseDir,

290+

}),

291+

).resolves.toBe(true);

277292

await expect(loadApnsRegistration("ios-node-1", baseDir)).resolves.toBeNull();

278293

});

279294

@@ -282,7 +297,7 @@ describe("push APNs registration store", () => {

282297

try {

283298

const baseDir = await makeTempDir();

284299

vi.setSystemTime(new Date("2026-03-11T00:00:00Z"));

285-

const stale = await registerApnsToken({

300+

const stale = await registerDirectApnsRegistration({

286301

nodeId: "ios-node-1",

287302

token: "ABCD1234ABCD1234ABCD1234ABCD1234",

288303

topic: "ai.openclaw.ios",

@@ -291,7 +306,7 @@ describe("push APNs registration store", () => {

291306

});

292307293308

vi.setSystemTime(new Date("2026-03-11T00:00:01Z"));

294-

const fresh = await registerApnsToken({

309+

const fresh = await registerDirectApnsRegistration({

295310

nodeId: "ios-node-1",

296311

token: "ABCD1234ABCD1234ABCD1234ABCD1234",

297312

topic: "ai.openclaw.ios",