Conversation
eddiearc
left a comment
There was a problem hiding this comment.
HOLD(Fable 5.1 审合)— 等 #221 Owner 定案 + 两处改动
实现方向 1 很稳:跳过授权页,但 Bot 身份、grant_status 门禁、订阅 reconcile、写盘与同 App 绑定全保留;缺凭证 / --tenant 冲突 / 与 --from-cli-profile 互斥都有 fail-fast。集成测质量高。
合前必须:
- Owner 对齐 #221(flag vs 自动复用等)
- resolveSelectedTenant() 在 reuse 分支之前仍会弹「选择平台」——reuse 检查应挪到 prompt 前
- help 文案写明 reuse 不会重跑 registerApp / LARKIN_REGISTER_ADDONS
缺 version bump;与 #226 有 import 行冲突。
Maintainer follow-up — HOLD实现质量不错(保留 bot 身份 / grant 门禁 / reconcile / 写盘),但 先等 #221 产品定案,再合。 合前还请改:
这是 setup 便利性功能,不是本轮 runtime 修复的前置。 |
Re-running setup for an already-authorized app always required another platform authorization. --reuse-credentials reuses the selected Agent's stored bot credential instead: it skips the QR/authorization page but keeps every downstream platform check unchanged — bot identity verification, the required-scope grant_status gate, comment-subscription reconciliation and the same-App-ID binding all still run and fail closed. The flag refuses to start when no valid stored credential exists, and rejects an explicit --tenant that contradicts the stored tenant before any write. Co-Authored-By: Claude Code <noreply@anthropic.com>
13c8347 to
993a4c0
Compare
|
四条已改(head
验证: |
|
复看 head
仍 HOLD:等 #221 产品定案(要不要这个 flag / 是否默认自动复用)。代码侧就绪后即可再叫合。 |
Re-running setup for an already-authorized app always required another platform authorization. --reuse-credentials reuses the selected Agent's stored bot credential instead: it skips the QR/authorization page and does not re-run registerApp or the LARKIN_REGISTER_ADDONS grant request, but keeps every downstream platform check unchanged — bot identity verification, the required-scope grant_status gate, comment-subscription reconciliation and the same-App-ID binding all still run and fail closed. The tenant is inferred from the stored credential before any interaction (no platform prompt that a later step could silently override), flag exclusivity is checked before any interaction, an explicit --tenant that contradicts the stored tenant aborts before any write, and the public `larkin setup` entry is covered by a test. Bumps the package patch version (0.5.9 -> 0.5.10) per the Owner policy. Co-Authored-By: Claude Code <noreply@anthropic.com>
993a4c0 to
6a3807a
Compare
|
|
source-checks 失败排查(head
|
What
Re-running
larkin setupfor an already-authorized app always required another platform authorization (QR / confirmation page), even though the bot credential was already on disk. The registration entry only had three paths —--from-cli-profile+LARKIN_SETUP_APP_SECRET, the Lark/page/cliQR flow, and the Feishu authorization page — with no branch that reuses stored credentials. Filed as #221; this implements direction 1.Change
src/setup/bot-register.ts: new--reuse-credentialsbranch. It loads the selected Agent's credential throughloadValidatedBotCredential(the same validator other flows use) and feeds it into the existing post-authorization pipeline exactly as if it had just been returned by the platform. Everything downstream is unchanged:im +chat-list --as bot);GET /open-apis/application/v6/scopesand dies unlessgrant_status=1— the fail-closed semantics from [Bug] Lark setup 绿过 +chat-list 后仍缺 im:message.group_msg,群/thread 历史读取 230027,freshness gate 无法发送 #160/[Bug]: Lark setup 附加权限未生效,既有应用补授权 URL 丢失 clientID #210 are preserved, so a missing grant still blocks and points at the developer console;--tenantthat contradicts the stored tenant before any write, and refuses to combine with--from-cli-profile.src/app/setup.ts: flag passthrough plus help text.test/integration/setup/setup-reuse-credentials.test.mjs: four cases — reuse skips the authorization page and still fails closed on a denied scope (the injectedregisterAppthrows if the QR path is ever taken, and the injected QR generator writes a marker file that the test asserts is absent), a green path that completes the whole flow (bot identity, grants, visibility, bind, result file) with the authorization page never requested, a missing credential fails with a clear message before any authorization, and an explicit tenant contradiction aborts before writing.Note on the interactive runtime prompt: with
--runtimeomitted, the run still shows the existing-agent prompt (已有 Agent:claude/default。直接回车保留;输入 c 才修改), so the stored runtime is kept on Enter; pass--runtimeto skip the prompt entirely. This PR lands ahead of maintainer alignment on #221 — happy to adjust the shape, split it, or park it.Validation
bun test test/integration/setup/setup-reuse-credentials.test.mjs→ 4 pass / 0 failbun test test/unit/setup/ test/unit/app/setup-cli.test.mjs test/integration/setup/→ 79 pass / 1 skip / 1 fail. The failure (setup-single-root.test.mjs: "a clean shell build emits loadable setup-binding.mjs with the pure planning export") is environmental on this machine: it performs a full clean build inside bun's default 5 s test timeout, and a clean build measures ~11.4 s here. Unrelated to this change.bun run build✅ ·bun run typecheck✅ ·bun run licenses:check✅ ·bun run publication:check:tree✅bun run test:integration(CI pre-check on this branch) → 182 pass / 18 skip / 7 fail. All 7 failures are clean-build / build-graph / hook-timeout cases that reproduce on unmodifiedmainin this environment — a clean build measures ~11.4 s here while the affected tests budget 5 s.bun run test:unit→ 895 pass / 1 skip / 1 fail. The single failure is the pre-existing environmentalthree-Agent live acceptance is opt-in, hermetic by default, and fixture-verifiable, which also fails on unmodifiedmainhere. (An earlier run under heavy concurrent load showed extra timeout failures in process-spawning tests; each of those files passes in isolation — 37 pass / 0 fail — so they were load artifacts, not regressions.)Refs #221
🤖 Generated with Claude Code