dsh-aiyayi 1.5.24 → 1.5.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/lib/feishu-logic.js +3 -0
- package/package.json +1 -1
- package/test/feishu-multiapp.test.mjs +21 -0
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,15 @@
|
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
+
## 1.5.25(2026-11-11 修复:extractFeishuErrorCode 补挖顶层 feishuCode——1.5.23 的 230001 判定真正生效)
|
|
12
|
+
|
|
13
|
+
- 环境:DSH-执行智能体(DeepSeek Harness 子会话,模型名未确证)
|
|
14
|
+
- git:本次 commit(2026-11-11,阿依娅伊)1.5.25:装版静态断言连续抓出的第二处遗漏。
|
|
15
|
+
- 现象:1.5.24 修好 import 后装版断言仍显示伪造 chatId 走 `ok:true + warning`(probe-error 分支),230001 判定没生效。
|
|
16
|
+
- 根因:`probeChatMembership` 抛错时把飞书错误码放在 **`error.feishuCode`**(`feishu-logic.js` 抛错处),而 `extractFeishuErrorCode` 的候选链只挖 `cause.response.data.code`/`cause.data.code`/`cause.code`/`data.code`/顶层 `code`——不认 `feishuCode`,返回 null,`=== 230001` 恒 false。
|
|
17
|
+
- 修法:候选链首位补 `typeof error?.feishuCode === 'number' ? error.feishuCode : undefined`(顶层 feishuCode 优先——probe 错误以它为准);`test/feishu-multiapp.test.mjs` 钉死:顶层 feishuCode 挖出、feishuCode 优先于 code、isOutOfChatError 认 feishuCode 抛错。
|
|
18
|
+
- 教训:**「函数级单测全过」≠「链路行为正确」**——extractFeishuErrorCode 的旧测试全是手工造的 SDK 形状错误,没人测 probe 自己抛的形状;两条修复(1.5.24 import、1.5.25 候选链)都是装版静态断言(mock ctx + 真实飞书 API)抓出来的。装版后断言应当作发版链路的固定环节。
|
|
19
|
+
|
|
11
20
|
## 1.5.24(2026-11-11 修复 1.5.23 遗漏 import + 禁用宿主 ask_user_question 选项组件)
|
|
12
21
|
|
|
13
22
|
- 环境:DSH-执行智能体(DeepSeek Harness 子会话,模型名未确证)
|
package/lib/feishu-logic.js
CHANGED
|
@@ -205,6 +205,9 @@ export async function probeChatMembership({ domain, appId, appSecret, chatId })
|
|
|
205
205
|
/** 从 SDK 抛出的错误里挖出飞书错误码(LarkChannelError 带 code + cause 链)。 */
|
|
206
206
|
export function extractFeishuErrorCode(error) {
|
|
207
207
|
const candidates = [
|
|
208
|
+
// probeChatMembership 抛的错把码放顶层 feishuCode(1.5.25:候选链补上它——
|
|
209
|
+
// 1.5.24 装版断言实测发现漏挖,230001 判定失效走回 probe-error)。
|
|
210
|
+
typeof error?.feishuCode === 'number' ? error.feishuCode : undefined,
|
|
208
211
|
error?.cause?.response?.data?.code,
|
|
209
212
|
error?.cause?.data?.code,
|
|
210
213
|
typeof error?.cause?.code === 'number' ? error.cause.code : undefined,
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSy
|
|
|
3
3
|
import { tmpdir } from 'node:os'
|
|
4
4
|
import { join } from 'node:path'
|
|
5
5
|
import {
|
|
6
|
+
extractFeishuErrorCode,
|
|
6
7
|
isOutOfChatError,
|
|
7
8
|
migrateConfigFile,
|
|
8
9
|
normalizeApps,
|
|
@@ -127,6 +128,26 @@ assert.equal(isOutOfChatError({ cause: { response: { data: { code: 99991663 } }
|
|
|
127
128
|
assert.equal(isOutOfChatError(null), false)
|
|
128
129
|
assert.equal(isOutOfChatError('230002-string'), false, 'bare string is not an error code object')
|
|
129
130
|
|
|
131
|
+
// ── extractFeishuErrorCode:probeChatMembership 顶层 feishuCode 候选(1.5.25 钉死)──
|
|
132
|
+
// 1.5.24 装版断言实测:probe 抛错把码放 error.feishuCode(feishu-logic.js:200),
|
|
133
|
+
// 候选链不查它 → 230001 判定失效走回 probe-error → 伪造 chat 被照绑。
|
|
134
|
+
{
|
|
135
|
+
const probeErr = new Error('成员探测失败: HTTP 400 code=230001 msg=invalid container_id')
|
|
136
|
+
probeErr.feishuCode = 230001
|
|
137
|
+
assert.equal(extractFeishuErrorCode(probeErr), 230001, '顶层 feishuCode 被挖出')
|
|
138
|
+
// 顶层 code 仍在(旧路径不回退)。
|
|
139
|
+
assert.equal(extractFeishuErrorCode({ code: 230002 }), 230002)
|
|
140
|
+
// 顶层 code 与 feishuCode 并存时 feishuCode 优先(probe 错误以它为准)。
|
|
141
|
+
const both = new Error('dual')
|
|
142
|
+
both.code = 99991663
|
|
143
|
+
both.feishuCode = 230002
|
|
144
|
+
assert.equal(extractFeishuErrorCode(both), 230002, 'feishuCode 优先于 code')
|
|
145
|
+
// isOutOfChatError 同样受益(probe 抛的 230002 也能判定)。
|
|
146
|
+
const p230002 = new Error('成员探测失败: code=230002')
|
|
147
|
+
p230002.feishuCode = 230002
|
|
148
|
+
assert.equal(isOutOfChatError(p230002), true, 'isOutOfChatError 认 feishuCode')
|
|
149
|
+
}
|
|
150
|
+
|
|
130
151
|
// ── 与旧测试共存检查:迁移后的 config 能被 normalizeApps 直接消化 ──
|
|
131
152
|
const root3 = mkdtempSync(join(tmpdir(), 'feishu-roundtrip-test-'))
|
|
132
153
|
try {
|