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

推荐订阅源

博客园 - 司徒正美
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
美团技术团队
WordPress大学
WordPress大学
罗磊的独立博客
Last Week in AI
Last Week in AI
人人都是产品经理
人人都是产品经理
爱范儿
爱范儿
MongoDB | Blog
MongoDB | Blog
J
Java Code Geeks
H
Hackread – Cybersecurity News, Data Breaches, AI and More
H
Help Net Security
S
SegmentFault 最新的问题
C
Check Point Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
腾讯CDC
Engineering at Meta
Engineering at Meta
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
D
DataBreaches.Net
雷峰网
雷峰网
GbyAI
GbyAI
宝玉的分享
宝玉的分享

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(feishu): clean up bitable placeholder rows with empty...
openclaw-clo · 2026-04-30 · via Recent Commits to openclaw:main

@@ -0,0 +1,131 @@

1+

import type * as Lark from "@larksuiteoapi/node-sdk";

2+

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

3+

import type { OpenClawPluginApi } from "../runtime-api.js";

4+

import { createToolFactoryHarness } from "./tool-factory-test-harness.js";

5+6+

const createFeishuClientMock = vi.hoisted(() => vi.fn());

7+8+

vi.mock("./client.js", () => ({

9+

createFeishuClient: createFeishuClientMock,

10+

}));

11+12+

import { registerFeishuBitableTools } from "./bitable.js";

13+14+

type MockRecord = {

15+

record_id?: string;

16+

fields?: Record<string, unknown>;

17+

};

18+19+

function createConfig(): OpenClawPluginApi["config"] {

20+

return {

21+

channels: {

22+

feishu: {

23+

enabled: true,

24+

accounts: {

25+

default: {

26+

appId: "cli_default",

27+

appSecret: "secret_default", // pragma: allowlist secret

28+

},

29+

},

30+

},

31+

},

32+

} as OpenClawPluginApi["config"];

33+

}

34+35+

function createBitableClient(records: MockRecord[]) {

36+

const batchDelete = vi.fn(async () => ({ code: 0 }));

37+

const client = {

38+

bitable: {

39+

app: {

40+

create: vi.fn(async () => ({

41+

code: 0,

42+

data: {

43+

app: {

44+

app_token: "app_token",

45+

name: "Project Tracker",

46+

url: "https://example.feishu.cn/base/app_token",

47+

},

48+

},

49+

})),

50+

},

51+

appTable: {

52+

list: vi.fn(async () => ({

53+

code: 0,

54+

data: { items: [{ table_id: "tbl_main", name: "Table 1" }] },

55+

})),

56+

},

57+

appTableField: {

58+

list: vi.fn(async () => ({ code: 0, data: { items: [] } })),

59+

update: vi.fn(async () => ({ code: 0 })),

60+

delete: vi.fn(async () => ({ code: 0 })),

61+

},

62+

appTableRecord: {

63+

list: vi.fn(async () => ({ code: 0, data: { items: records } })),

64+

batchDelete,

65+

delete: vi.fn(async () => ({ code: 0 })),

66+

},

67+

},

68+

} as unknown as Lark.Client;

69+70+

return { batchDelete, client };

71+

}

72+73+

describe("feishu bitable create app cleanup", () => {

74+

beforeEach(() => {

75+

createFeishuClientMock.mockReset();

76+

});

77+78+

it("deletes placeholder rows whose fields contain only default empty values", async () => {

79+

const { batchDelete, client } = createBitableClient([

80+

{ record_id: "rec_missing_fields" },

81+

{ record_id: "rec_empty_fields", fields: {} },

82+

{

83+

record_id: "rec_empty_defaults",

84+

fields: {

85+

Name: "",

86+

Status: [],

87+

Attachments: [],

88+

Started: null,

89+

EmptyObject: {},

90+

},

91+

},

92+

{

93+

record_id: "rec_empty_rich_text",

94+

fields: { Notes: [{ type: "text", text: "" }] },

95+

},

96+

{

97+

record_id: "rec_empty_nested",

98+

fields: { Notes: { value: "", segments: [{ type: "text", text: "" }] } },

99+

},

100+

{ record_id: "rec_text", fields: { Name: "Milestone" } },

101+

{ record_id: "rec_number", fields: { Estimate: 0 } },

102+

{ record_id: "rec_boolean", fields: { Done: false } },

103+

{ record_id: "rec_link", fields: { Link: { text: "", link: "https://example.com" } } },

104+

{ record_id: "rec_attachment", fields: { Attachments: [{ file_token: "boxcn_token" }] } },

105+

{ record_id: "rec_user", fields: { Assignee: [{ id: "ou_1", name: "" }] } },

106+

{ record_id: "rec_location", fields: { Location: { name: "", location: "116,39" } } },

107+

]);

108+

createFeishuClientMock.mockReturnValue(client);

109+110+

const { api, resolveTool } = createToolFactoryHarness(createConfig());

111+

registerFeishuBitableTools(api);

112+113+

const result = await resolveTool("feishu_bitable_create_app").execute("call", {

114+

name: "Project Tracker",

115+

});

116+117+

expect(result.details.cleaned_placeholder_rows).toBe(5);

118+

expect(batchDelete).toHaveBeenCalledWith({

119+

path: { app_token: "app_token", table_id: "tbl_main" },

120+

data: {

121+

records: [

122+

"rec_missing_fields",

123+

"rec_empty_fields",

124+

"rec_empty_defaults",

125+

"rec_empty_rich_text",

126+

"rec_empty_nested",

127+

],

128+

},

129+

});

130+

});

131+

});