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

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
Google DeepMind News
Google DeepMind News
云风的 BLOG
云风的 BLOG
WordPress大学
WordPress大学
Vercel News
Vercel News
Apple Machine Learning Research
Apple Machine Learning Research
T
Tailwind CSS Blog
I
InfoQ
小众软件
小众软件
Recent Announcements
Recent Announcements
博客园 - 【当耐特】
The GitHub Blog
The GitHub Blog
大猫的无限游戏
大猫的无限游戏
美团技术团队
T
The Blog of Author Tim Ferriss
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
MongoDB | Blog
MongoDB | Blog
V
V2EX
J
Java Code Geeks
有赞技术团队
有赞技术团队
博客园 - 聂微东
B
Blog RSS Feed
博客园 - 司徒正美

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
test: tighten exec approvals policy assertions · openclaw...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -23,6 +23,15 @@ import {

2323

requiresExecApproval,

2424

} from "./exec-approvals.js";

252526+

function expectFields(value: unknown, expected: Record<string, unknown>): void {

27+

expect(value).toBeTypeOf("object");

28+

expect(value).not.toBeNull();

29+

const record = value as Record<string, unknown>;

30+

for (const [key, expectedValue] of Object.entries(expected)) {

31+

expect(record[key], key).toEqual(expectedValue);

32+

}

33+

}

34+2635

function expectMalformedAgentAskUsesDefaults(agentAsk: unknown): void {

2736

const approvals = {

2837

version: 1,

@@ -45,7 +54,7 @@ function expectMalformedAgentAskUsesDefaults(agentAsk: unknown): void {

4554

agentId: "runner",

4655

});

475648-

expect(summary.ask).toMatchObject({

57+

expectFields(summary.ask, {

4958

requested: "off",

5059

host: "always",

5160

hostSource: "~/.openclaw/exec-approvals.json defaults.ask",

@@ -241,10 +250,9 @@ describe("exec approvals policy helpers", () => {

241250

});

242251243252

expect(result.allowlistSatisfied).toBe(false);

244-

expect(result.segmentAllowlistEntries).toEqual([

245-

expect.objectContaining({ pattern: "/usr/bin/echo" }),

246-

null,

247-

]);

253+

expect(result.segmentAllowlistEntries).toHaveLength(2);

254+

expectFields(result.segmentAllowlistEntries[0], { pattern: "/usr/bin/echo" });

255+

expect(result.segmentAllowlistEntries[1]).toBeNull();

248256

expect(

249257

hasDurableExecApproval({

250258

analysisOk: true,

@@ -272,14 +280,14 @@ describe("exec approvals policy helpers", () => {

272280

scopeLabel: "tools.exec",

273281

});

274282275-

expect(summary.security).toMatchObject({

283+

expectFields(summary.security, {

276284

requested: "full",

277285

host: "allowlist",

278286

effective: "allowlist",

279287

hostSource: "~/.openclaw/exec-approvals.json defaults.security",

280288

note: "stricter host security wins",

281289

});

282-

expect(summary.ask).toMatchObject({

290+

expectFields(summary.ask, {

283291

requested: "off",

284292

host: "always",

285293

effective: "always",

@@ -334,7 +342,7 @@ describe("exec approvals policy helpers", () => {

334342

scopeLabel: "tools.exec",

335343

});

336344337-

expect(summary.ask).toMatchObject({

345+

expectFields(summary.ask, {

338346

requested: "always",

339347

host: "off",

340348

effective: "always",

@@ -404,11 +412,11 @@ describe("exec approvals policy helpers", () => {

404412

agentId: "runner",

405413

});

406414407-

expect(summary.security).toMatchObject({

415+

expectFields(summary.security, {

408416

host: "allowlist",

409417

hostSource: "~/.openclaw/exec-approvals.json agents.*.security",

410418

});

411-

expect(summary.ask).toMatchObject({

419+

expectFields(summary.ask, {

412420

host: "always",

413421

hostSource: "~/.openclaw/exec-approvals.json agents.*.ask",

414422

});

@@ -438,13 +446,13 @@ describe("exec approvals policy helpers", () => {

438446

agentId: "runner",

439447

});

440448441-

expect(summary.security).toMatchObject({

449+

expectFields(summary.security, {

442450

requested: "full",

443451

requestedSource: "tools.exec.security",

444452

host: "allowlist",

445453

effective: "allowlist",

446454

});

447-

expect(summary.ask).toMatchObject({

455+

expectFields(summary.ask, {

448456

requested: "off",

449457

requestedSource: "tools.exec.ask",

450458

host: "always",

@@ -499,13 +507,13 @@ describe("exec approvals policy helpers", () => {

499507

"agent:batch",

500508

"agent:runner",

501509

]);

502-

expect(snapshots[1]?.ask).toMatchObject({

510+

expectFields(snapshots[1]?.ask, {

503511

requested: "off",

504512

requestedSource: "tools.exec.ask",

505513

host: "always",

506514

effective: "always",

507515

});

508-

expect(snapshots[2]?.security).toMatchObject({

516+

expectFields(snapshots[2]?.security, {

509517

requested: "full",

510518

requestedSource: "tools.exec.security",

511519

host: "allowlist",

@@ -535,11 +543,11 @@ describe("exec approvals policy helpers", () => {

535543

});

536544537545

expect(snapshots.map((snapshot) => snapshot.scopeLabel)).toEqual(["tools.exec"]);

538-

expect(snapshots[0]?.security).toMatchObject({

546+

expectFields(snapshots[0]?.security, {

539547

host: "allowlist",

540548

hostSource: "~/.openclaw/exec-approvals.json agents.main.security",

541549

});

542-

expect(snapshots[0]?.ask).toMatchObject({

550+

expectFields(snapshots[0]?.ask, {

543551

host: "always",

544552

hostSource: "~/.openclaw/exec-approvals.json agents.main.ask",

545553

});

@@ -573,7 +581,7 @@ describe("exec approvals policy helpers", () => {

573581

});

574582575583

expect(snapshots.map((snapshot) => snapshot.scopeLabel)).toEqual(["tools.exec", "agent:main"]);

576-

expect(snapshots[1]?.ask).toMatchObject({

584+

expectFields(snapshots[1]?.ask, {

577585

requested: "always",

578586

requestedSource: "agents.list.main.tools.exec.ask",

579587

});