7 Commits

Author SHA1 Message Date
uncle6me-web 90777e3877 fix(auth-recipe): 回灌 telegram/line_notify/kbdb 種子,補 AuthInjectSpec.path(修 source/live 漂移)
issue #13 升級:根因不只 acr parts 殘留,是 auth-recipe-seeds.ts source 漏了 3 個 static_key
auth recipe(telegram/line_notify/kbdb),但 prod KV 手動 seed 過 → 任何全新 self-hosted
`POST /init/seed` 只 seed 23 個、漏 telegram → self-host(leo21c/mira)telegram_send 的
auth_service:'telegram' resolve 不到 → {{auth.bot_token}} 注入空 → telegram 發訊壞掉。

實測 smoking gun(2026-06-29):
- prod cypher.arcrun.dev/auth-recipes = 27 個(含 telegram)
- self-host arcrun-cypher-executor.leo21c.workers.dev = 23 個(無 telegram/line_notify/kbdb)

修法(資料/型別,非業務邏輯,守 mindset §1 不建 component):
- auth-recipe-seeds.ts 補 telegram(inject.path bot_token)/line_notify(header Bearer)/kbdb(header Bearer)
- recipes.ts AuthInjectSpec 補 path?(WASM auth_static_key + SDD §六早有此欄、source 介面漏 → tsc 擋)
- google_user(oauth2)暫不回灌:內嵌 client_secret 不可進 git + 介面無 oauth2 欄 → 留 Phase D

形態取自 prod GET /auth-recipes/{service};設計權威 auth-recipe.md §六(telegram path)/§七(kbdb 共用)。
telegram 自此與 notion(header)/gsheets(service_account) 同一條 recipe+auth-recipe 鏈,一致。
tsc 全綠;local 模擬 token-in-path 注入 PASS。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 12:37:19 +08:00
uncle6me-web 764f657201 merge: issue #13 步驟2 清 parts.ts 降級零件殘留
telegram/gmail/sheets/line 改走 recipe canonical_id、移除已刪 ai_transform。
TS tsc 過、gmail 讀取留 TODO 不硬塞。自動派工第 2 件共用框架 PR。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28 16:06:54 +08:00
uncle6me-web 225aa9f9e7 清 parts.ts 降級零件殘留:telegram/gmail/sheets/line 改走 recipe、移除已刪的 ai_transform(issue #13 步驟2)
telegram/gmail/google_sheets/line_notify 已於 2026-05-29 Phase 2 降級為 recipe,
但 acr parts 仍列舊 component: 形態誤導 CC。參照 notion 樣板改成「走 recipe」描述 +
canonical_id 對齊 api-recipe-seeds.ts(telegram_send/gmail_send/google_sheets_append/line_notify_send)。
ai_transform_compile/run 已刪除(mindset §2),整段移除。
canonical_id 均已核實存在於 cypher-executor/src/lib/api-recipe-seeds.ts。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28 16:05:39 +08:00
uncle6me-web caa8e103ff merge: issue #13 步驟1 telegram 示例改 recipe(gmail 留 TODO)
PR review 抓出 gmail_send 假綠已擋下,只併對的 telegram 三處。
自動派工首次共用框架 PR 閉環:subagent 診斷→改→獨立 review→拆併。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28 15:47:01 +08:00
uncle6me-web a234201235 修正示例 yaml:telegram 改用 recipe canonical_id;gmail 讀取留 TODO(issue #13 步驟1)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28 15:45:50 +08:00
uncle6me-web f21906ca6a chore(wiki): 本 session capture(薄殼防複發/歷史債卡 + mistakes #19-21 + status)
兩次 /wiki-capture 累積的知識落盤:
- cards/decisions/ 新卡:薄殼防複發-能力對照表加smoke、薄殼規則晚於實作-MCP漂移是歷史債
  (+ 00-INDEX 編入,決策桶現 15 張)
- mistakes #19 死端點假綠(grep route/smoke 驗端點存在)
- mistakes #20 gitignored 檔無 git 史(時間靠檔內註記)
- mistakes #21 wrangler.toml services=[...] inline 在 [vars] 後被吸成 vars.services(issue #12)
- decisions-summary:薄殼防複發機制、workflow description 由操盤 CC 據實生成
- status:本 session #8/#11/#12 進度 + merge 結果

純記憶/文檔,無 code。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28 01:43:26 +08:00
uncle6me-web 222a382d49 fix(#12): MCP service binding 用 [[services]] array-of-tables(修 self-hosted CYPHER_EXECUTOR 缺失)
根因(非總管原假設的 strip 誤清):mcp/wrangler.toml 用 inline `services = [...]` 且在
[vars] table 之後 → TOML 把它吸成 `vars.services`(普通 env var 陣列)而非頂層 service
bindings → wrangler 看不到 CYPHER_EXECUTOR/KBDB/COMPONENT_REGISTRY binding。
self-hosted 部署 injectMultiTenant 往 [vars] 注入 MULTI_TENANT 後此問題暴露
(MCP 報 "CYPHER_EXECUTOR service binding not configured")。

修法:inline → [[services]] array-of-tables(獨立頂層 table,不受 [vars] 影響,
對齊官方 cypher-executor/wrangler.toml 慣例)。

本地驗證(wrangler deploy --dry-run,模擬 self-hosted 注入 MULTI_TENANT):
- 修法後:env.CYPHER_EXECUTOR/COMPONENT_REGISTRY/KBDB 三 binding 都在 
- 對照舊 inline:binding 全消失、變成 env.services(一個 JSON env var) 坐實根因

⚠️ 端到端待 leo21c acr update 重部 MCP(CC 跑不了 leo21c 部署)。修好後
MCP validate/recipe_search 不再報 binding not configured;連帶解鎖 #11 self-hosted
u6u_list/search_workflows + mira #6 門鈴 + acr push 端到端。#12 留 open 待端到端。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-27 23:32:16 +08:00
13 changed files with 297 additions and 74 deletions
+37 -61
View File
@@ -174,27 +174,9 @@ const BUILTIN_COMPONENTS: ComponentDef[] = [
type: string
format: email`,
},
// ── AI 類 ──────────────────────────────────────────────────────────────────
{
canonical_id: 'ai_transform_compile',
display_name: 'AI Transform Compile',
category: 'ai',
description: '將自然語言規則編譯成可執行轉換程式',
config_example:
` compile_node:
component: ai_transform_compile
rule: "把 name 轉成大寫,並在前面加上 Hello "`,
},
{
canonical_id: 'ai_transform_run',
display_name: 'AI Transform Run',
category: 'ai',
description: '執行 ai_transform_compile 產生的轉換程式',
config_example:
` run_node:
component: ai_transform_run
program: "{{compiled_program}}"`,
},
// ── AI 類:已移除 ──────────────────────────────────────────────────────────
// ai_transform_compile / ai_transform_run 於 2026-05-29 刪除(mindset §2arcrun 是
// AI 呼叫的工具,不是工具回頭呼叫 LLM)。需要 AI 判斷/轉換由操盤的 CC 自己做。
// ── API 整合類(Recipe 型,不需 deploy Worker) ────────────────────────────
{
canonical_id: 'http_request',
@@ -212,63 +194,57 @@ const BUILTIN_COMPONENTS: ComponentDef[] = [
key: "{{value}}"`,
},
{
canonical_id: 'gmail',
display_name: 'Gmail',
canonical_id: 'gmail_send',
display_name: 'Gmail Send',
category: 'api',
description: '寄送 Gmail需要 gmail_token credential',
description: '透過 recipe 寄送 Gmailrecipe gmail_sendauth: google service_account)。注意:Gmail 讀取尚無對應 recipe(待 seed 補 gmail_list)。',
config_example:
` mail_node:
component: gmail
to: "recipient@example.com"
subject: "來自 arcrun 的通知"
body: "{{message}}"`,
credentials_required: [
{ key: 'gmail_token', type: 'OAuth2 access token', inject_as: 'access_token' },
],
` # 寄信用內建 recipe gmail_sendbody 帶 rawbase64url MIME
mail_node:
component: gmail_send
method: POST
body:
raw: "{{mime_base64url}}"`,
},
{
canonical_id: 'google_sheets',
display_name: 'Google Sheets',
canonical_id: 'google_sheets_append',
display_name: 'Google Sheets Append',
category: 'api',
description: 'Google Sheets 讀寫(需要 google_oauth credential',
description: '透過 recipe 追加一列到 Sheetsrecipe google_sheets_append;讀取用 google_sheets_read。auth: google service_account',
config_example:
` sheet_node:
component: google_sheets
spreadsheet_id: "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgVE2upms"
range: "Sheet1!A:B"
operation: append
values:
- ["{{name}}", "{{email}}"]`,
credentials_required: [
{ key: 'google_oauth', type: 'OAuth2 access token', inject_as: 'access_token' },
],
` # 追加用內建 recipe google_sheets_append(讀取改用 google_sheets_read
sheet_node:
component: google_sheets_append
method: POST
_path: "/v4/spreadsheets/{{spreadsheet_id}}/values/Sheet1!A:B:append?valueInputOption=RAW"
body:
values:
- ["{{name}}", "{{email}}"]`,
},
{
canonical_id: 'telegram',
display_name: 'Telegram',
canonical_id: 'telegram_send',
display_name: 'Telegram Send',
category: 'api',
description: '發送 Telegram 訊息(需要 telegram_bot_token credential',
description: '透過 recipe 發送 Telegram 訊息(recipe telegram_sendauth: static_keytoken 注入 URL path',
config_example:
` tg_node:
component: telegram
` # 內建 recipe telegram_sendtoken 由 auth 注入 URL,不寫在這)
tg_node:
component: telegram_send
chat_id: "123456789"
text: "{{message}}"`,
credentials_required: [
{ key: 'telegram_bot_token', type: 'Bot token', inject_as: 'bot_token' },
],
},
{
canonical_id: 'line_notify',
canonical_id: 'line_notify_send',
display_name: 'LINE Notify',
category: 'api',
description: '發送 LINE Notify 通知(需要 line_token credential',
description: '透過 recipe 發送 LINE Notify 通知(recipe line_notify_sendauth: static_key Bearer',
config_example:
` line_node:
component: line_notify
message: "{{notification}}"`,
credentials_required: [
{ key: 'line_token', type: 'LINE Notify token', inject_as: 'token' },
],
` # 內建 recipe line_notify_sendPOST notifybody form-urlencoded
line_node:
component: line_notify_send
method: POST
body:
message: "{{notification}}"`,
},
{
canonical_id: 'notion',
@@ -11,6 +11,13 @@ import type { AuthRecipeDefinition } from '../routes/recipes';
const now = Date.now();
// ⚠️ 已知 source/live drift2026-06-29 盤點,未在此檔修):
// prod RECIPES KV 另有 `auth_recipe:google_user`primitive: oauth2)。**故意不回灌 source**,原因:
// (1) 它內嵌 client_secretGOCSPX-...= 機密,不可進 gitwiki-secret-scan / 一般安全);
// (2) 本檔的 AuthRecipeDefinition 介面尚無 oauth2 欄位(client_id/secret/token_endpoint/scopes),
// 回灌前需先擴 schema + 把 secret 改成部署期注入(wrangler secret / env),屬獨立工作。
// → google_user 留待 oauth2 seed 機制(含 secret 注入)獨立處理;本次只修無機密的 static_key 漂移。
export const AUTH_RECIPE_SEEDS: AuthRecipeDefinition[] = [
// ── Static Key 類 ──────────────────────────────────────────────────────────
@@ -556,6 +563,94 @@ export const AUTH_RECIPE_SEEDS: AuthRecipeDefinition[] = [
updated_at: now,
},
// ── 訊息 / URL-path 注入類(static_key)────────────────────────────────────
//
// 2026-06-29 補:以下三個 static_key auth recipe 一直存在於 prod RECIPES KV(手動 seed 過),
// 但**從未進 source seed**auth-recipe-seeds.ts)→ 任何全新 self-hosted `POST /init/seed`
// 只會 seed 23 個、漏掉 telegram/line_notify/kbdb → self-hostmira/leo21c)的 telegram 發訊
// 走不通(telegram_send 的 auth_service:'telegram' 找不到 auth recipe → {{auth.bot_token}} 注入空)。
// 這正是「source vs live drift = 假綠」(總管反覆踩的同一類)。把 prod 現役定義回灌 source
// 讓 official 與 self-host 共用同一份種子。形態取自 prod GET /auth-recipes/{service}2026-06-29)。
// 設計權威:auth-recipe.md §六(line 70-71, telegram path 注入) + §七(line 150-151, kbdb 共用)。
{
kind: 'auth_recipe',
service: 'telegram',
version: 1,
primitive: 'static_key',
base_url: 'https://api.telegram.org',
display_name: 'Telegram Bot',
description: 'Telegram Bot API — sendMessage 等(bot token 注入 URL path /bot{token}/',
required_secrets: [
{
key: 'telegram_bot_token',
label: 'Bot Token(從 @BotFather 取得)',
help: '在 Telegram 對 @BotFather 送 /newbot 建立 bot,取得格式為 123456:ABC... 的 token',
help_url: 'https://core.telegram.org/bots/features#botfather',
},
],
// path 注入:recipe:telegram_send 的 endpoint 用 {{auth.bot_token}} 從 _auth_path 取值
// auth_static_key WASM 解密後輸出 auth_path → auth-dispatcher 帶進 _auth_path
// → makeRecipeRunner interpolate)。token 不落 header/query/body,符合 Telegram 的 URL-path 慣例。
inject: {
path: {
bot_token: '{{secret.telegram_bot_token}}',
},
},
created_at: now,
updated_at: now,
},
{
kind: 'auth_recipe',
service: 'line_notify',
version: 1,
primitive: 'static_key',
base_url: 'https://notify-api.line.me',
display_name: 'LINE Notify',
description: 'LINE Notify — 推播訊息(static_key Bearer',
required_secrets: [
{
key: 'line_token',
label: 'LINE Notify Token',
help: '至 https://notify-bot.line.me/my/ 發行個人存取權杖',
help_url: 'https://notify-bot.line.me/my/',
},
],
inject: {
header: {
Authorization: 'Bearer {{secret.line_token}}',
},
},
created_at: now,
updated_at: now,
},
{
kind: 'auth_recipe',
service: 'kbdb',
version: 1,
primitive: 'static_key',
base_url: 'https://kbdb.finally.click',
display_name: 'KBDB',
description: 'KBDB partner API — block 讀寫(static_key Bearer)。kbdb_* recipe 共用此把 auth。',
required_secrets: [
{
key: 'kbdb_api_key',
label: 'KBDB API Key(至 arcrun 取統一 API Key 當 credential',
help: 'KBDB 採 Supabase 模式:要用 → 去 arcrun 取統一 API Key 當此 credential',
help_url: 'https://arcrun.dev',
},
],
inject: {
header: {
Authorization: 'Bearer {{secret.kbdb_api_key}}',
},
},
created_at: now,
updated_at: now,
},
// ── Service Account 類(Google 家族,共用同一份 service_account_json)────────
{
+5
View File
@@ -460,6 +460,11 @@ export interface AuthInjectSpec {
header?: Record<string, string>; // e.g. { Authorization: "Bearer {{secret.token}}" }
query?: Record<string, string>;
body?: Record<string, string>;
// path:注入 endpoint URL path 的 secretauth-recipe.md §六,2026-05-29 加)。
// 解 telegram 類「token 在 URL path」(/bot{token}/)—— header/query/body 都不適用。
// key = 模板變數名(recipe endpoint 用 {{auth.K}} 引用),value = {{secret.X}} 模板。
// auth_static_key WASM 解密後輸出為 auth_path → auth-dispatcher 帶進 _auth_path → makeRecipeRunner interpolate。
path?: Record<string, string>;
}
export interface AuthRecipeDefinition {
+17 -9
View File
@@ -13,15 +13,23 @@ workers_dev = true # 對齊 arcrun 部署慣例(rule 05):deploy 掃描
# SDD: sdk-and-website/mcp-account-source.md §5.5HANDOFF §3b。
[vars]
# Service Bindings
# 2026-05-07COMPONENT_REGISTRY 從 inkstone-component-registry 改為 arcrun-registry
# 原因:舊的 inkstone-component-registry 期望不同 query 參數名,MCP search 失敗
# 新的 arcrun-registryregistry.arcrun.dev)才是現役
services = [
{ binding = "COMPONENT_REGISTRY", service = "arcrun-registry" },
{ binding = "CYPHER_EXECUTOR", service = "arcrun-cypher-executor" },
{ binding = "KBDB", service = "arcrun-kbdb" }
]
# Service Bindingsissue #12:用 [[services]] array-of-tables,不用 services=[...] inline
# ⚠️ 為何不能用 inline `services = [...]`:它在 [vars] table 之後 → TOML 會把它吸成
# `vars.services`(普通 var 陣列)而非頂層 service bindings → wrangler 看不到 binding
# self-hosted 部署注入 MULTI_TENANT 進 [vars] 後此問題暴露(MCP 報 CYPHER_EXECUTOR not configured
# array-of-tables `[[services]]` 是獨立頂層 table,不受 [vars] 影響(對齊官方 cypher-executor/wrangler.toml)。
# 2026-05-07COMPONENT_REGISTRY 從 inkstone-component-registry 改為 arcrun-registry(現役)。
[[services]]
binding = "COMPONENT_REGISTRY"
service = "arcrun-registry"
[[services]]
binding = "CYPHER_EXECUTOR"
service = "arcrun-cypher-executor"
[[services]]
binding = "KBDB"
service = "arcrun-kbdb"
# Route — MCP 搬進 arcrun 主庫後改用 arcrun.dev zone(與其他 worker 一致)。
# 舊的 studio.finally.click 是 inkstone 平台 zonearcrun 帳號沒有該 zone → 部署 route 失敗。
+1 -1
View File
@@ -54,7 +54,7 @@ config:
格式:markdown bullets,每條 < 30 字,標明來源。
push_digest:
component: telegram
component: telegram_send
chat_id: "{{secret.LEO_TELEGRAM_CHAT_ID}}"
text: |
☀️ 早安 {{_today}}
@@ -12,6 +12,7 @@ config:
cron_expr: "0 8 * * *" # 每天 08:00 UTC(依需求調時區)
fetch_unread:
# TODO(#13): gmail 讀取尚無對應 recipe,待 seed 補 gmail_list 後再映射;gmail_send 是送信端點,不可用於 action:list
component: gmail
action: "list"
query: "is:unread newer_than:1d"
@@ -35,7 +36,7 @@ config:
{{fetch_unread.messages}}
push_to_telegram:
component: telegram
component: telegram_send
chat_id: "{{secret.LEO_TELEGRAM_CHAT_ID}}"
text: |
📬 今日 email 摘要
+1 -1
View File
@@ -35,7 +35,7 @@ config:
# 純記錄成功,下游若需要可繼續鏈
final_fail_notify:
component: telegram
component: telegram_send
chat_id: "{{secret.LEO_TELEGRAM_CHAT_ID}}"
text: |
⚠️ workflow {{input.workflow_name}} 兩次重試都失敗
@@ -10,6 +10,7 @@
- [[自力救濟階梯-缺能力怎麼補]] — 自家API缺→補API/第三方→workflow補丁/純計算→code-node
- [[薄殼原則-能力長在API]] — CLI/MCP/lib 只暴露,齊的單位是「能力」不是「端點」
- [[薄殼規則晚於實作-MCP漂移是歷史債]] — 為何 MCP/CLI 不一致:紀律 2026-06-07 才補、補前漂移
- [[薄殼防複發-能力對照表加smoke]] — 防死端點假綠:對照清單 + 本機 smoke(非 CI),自驗能攔
## 串接 / 部署
@@ -34,4 +34,5 @@ MCP 和 CLI 不一致的根因不是「MCP 更早開發所以舊」,而是**
- 薄殼原則 >> 修正 >> MCP 漂移
### 卡片關係
- [[薄殼規則晚於實作-MCP漂移是歷史債]] >> 補充歷史成因於 >> [[薄殼原則-能力長在API]]
- [[薄殼規則晚於實作-MCP漂移是歷史債]] >> 被治理於 >> [[薄殼防複發-能力對照表加smoke]]
- (相關 memory`mcp-self-hosted-bug-fixed``thin-shell-capability-in-api` — MCP 後端接線與薄殼鐵律)
@@ -0,0 +1,37 @@
---
tags: [薄殼, 平台原則, 架構決策, 機制說明]
gloss: 防 CLI/MCP 薄殼漂移(死端點假綠)的雙層機制——靜態能力對照清單 + 本機 smoke test 對真端點斷言非 404。
---
# 薄殼防複發 — 能力對照表 + 本機 smoke
← [[decisions/00-INDEX]]
**來源**`system-dev/docs/3-specs/thin-shell-alignment/design.md §5`issue #11)、`docs/4-guides/cli-mcp-capability-matrix.md``scripts/thin-shell-smoke.sh`
**最後更新**2026-06-27
## 摘要
治「薄殼打了不存在的 server 端點」(死端點假綠)用雙層:靜態能力對照清單(review 防線)+ 本機 smoke test(對真端點斷言非 404,死端點當場現形)。本機手動跑,非 CI。
## 重點
- **根因是假綠**:MCP deploy 在宣稱「一致性落地」的同一 commit 裡打了不存在的 `/workflows/deploy`(必 404),從未端到端跑過。光靠「宣稱對齊」會再犯。
- **層 1 能力對照清單**`docs/4-guides/cli-mcp-capability-matrix.md`):表「能力 × CLI 端點 × MCP 端點 × route 存在? × 同源?」,新薄殼能力必填一行,填前 grep 確認 route 存在。
- **層 2 本機 smoke**`scripts/thin-shell-smoke.sh`):對每能力打真端點斷言非 404。**本機手動跑非 CI/cron/輪詢**(守 flag 紅線,對齊「執行鏈路不依賴 CI」鐵律)。
- **機制自驗**:注入故意死端點 → smoke 當場攔下、exit 1(已驗證能攔)。
- **smoke 區分「code 有 route」vs「prod 真部署」**:首跑就揭 #8 search/backfill 在 prod 仍 404code 已 commit 但未部署)——這正是它要揭的假綠。
- **不用 CI 高頻打真端點**(違 flag 紅線);smoke 是「宣布完成前手動跑一次」的閘。
## 實體
- **能力對照清單**cli-mcp-capability-matrix)— 靜態表列每能力的 CLI/MCP 端點與 route 存在性,review 防線。
- **本機 smoke test**thin-shell-smoke.sh)— 對真端點打、斷言非 404 的腳本,死端點現形,本機手動跑。
- **死端點假綠**dead endpoint)— 薄殼打了 server 不存在的 route(404),卻被宣稱成完成。
- **機制自驗**(注入死端點測試)— 故意加不存在端點驗 smoke 能攔,證明機制有效。
## 關聯
### 內文知識關係
- 死端點假綠 >> 被攔於 >> 本機 smoke test
- 能力對照清單 >> 互補於 >> 本機 smoke test
- 機制自驗 >> 證明 >> 本機 smoke test
- 本機 smoke test >> 區分 >> 死端點假綠
### 卡片關係
- [[薄殼防複發-能力對照表加smoke]] >> 治理 >> [[薄殼規則晚於實作-MCP漂移是歷史債]]
- [[薄殼防複發-能力對照表加smoke]] >> 落實 >> [[薄殼原則-能力長在API]]
+35
View File
@@ -327,6 +327,41 @@ code-node 規則已定、零件實作屬 wishlist C1 另案。**詳見**DECIS
---
## 薄殼防複發機制=對照清單 + 本機 smoke2026-06-27issue #11
**Q:CLI/MCP 薄殼漂移(死端點假綠)怎麼防複發?**
**決策**:雙層,非 CI。
- **層 1 能力對照清單** `docs/4-guides/cli-mcp-capability-matrix.md`:一張表「能力 × CLI 端點 × MCP 端點 × route 存在? × 同源?」,新增薄殼能力**必填一行**,PR review 對照。
- **層 2 本機 smoke test** `scripts/thin-shell-smoke.sh`:對每能力打真端點、**斷言非 404**(死端點當場現形)。**本機手動跑非 CI/cron/輪詢**(守 flag 紅線,對齊「執行鏈路不依賴 CI」)。
- **機制自驗**:注入故意死端點 → smoke 當場攔(已驗證能攔,exit 1)。
**為什麼**:根因是**假綠**——宣稱「一致性落地」但端點不存在,光靠宣稱會再犯。smoke 區分「code 有 route」vs「prod 真部署」(首跑就揭 #8 search/backfill 在 prod 仍 404=未部署)。
**避坑**:不用 CI 高頻打真端點(違 flag 紅線);smoke 是「宣布完成前手動跑一次」的閘。
**詳見**thin-shell-alignment SDD §5、[[薄殼規則晚於實作-MCP漂移是歷史債]] 卡、mistakes #19
---
## workflow description 由操盤 CC 據實生成、用戶可改(2026-06-27issue #8
**Q:強制 workflow 填 description,但 low-code 用戶不知道要填,怎麼辦?**
**決策**:強制非空落 API(不變);**空時由操盤的 CC 據實寫一句「能做什麼」,用戶可改**——非逼用戶手填、非介面層機械塞佔位。
**調和關鍵(分清兩種「生成」)**
-**操盤 CC 據實生成**CC 剛建這 workflow、最懂它做什麼 → 寫真描述(leo 例「呼叫可 Upsert Google Sheets」)。**真描述非假裝**,不違 mindset §7。
-**介面層機械塞佔位**(從 name 複製、`workflow_xxx`)=假描述,仍禁。
**為什麼**low-code 用戶不知道要填 description(逼填違北極星「不增負擔」);但自動機械填=假裝有(違誠實)。北極星「執行力外包給 AI」=AI 據實幫他寫好、他可改。
**避坑**description 是一句「能做什麼」供語意搜尋,**非寫文章**。
**詳見**workflow-discovery SDD §3.2。
---
## 快速決策樹
```
+61
View File
@@ -387,6 +387,64 @@ listEntries 加 `source` filter 即可,表結構一個欄位都不動。
---
## 19. 薄殼打的端點 server 不一定存在——死端點假綠(2026-06-27issue #8/#11
**錯誤模式**:以為「tsc 綠 + 介面有這個工具」=能力通了。實際 MCP `u6u_deploy_workflow`
`/workflows/deploy`、CLI `run.ts``/webhooks/<name>`——**兩個端點 cypher 根本沒有,必 404**
且當初 commit message 還宣稱「部署一致性落地」。**從未端到端跑過**。
**症狀**:宣稱對齊/完成,但薄殼打的 route 在 server 不存在;tsc 綠掩蓋了端點不存在。
**正確做法**
1. 宣稱對齊/完成前,**grep server route 清單確認端點存在**
`grep -rE "Router\.(post|get)\('/xxx'" cypher-executor/src/routes/`)。
2. 或跑 `scripts/thin-shell-smoke.sh`(對真端點打、斷言非 404,死端點當場現形)。
3. **tsc 綠 ≠ 端點存在 ≠ 端到端通**。三者分開驗(mindset §7 完成=客觀證據)。
**通用教訓**:薄殼漂移(CLI/MCP 各長各的)的根因常是「規則晚於實作 + 假綠」。
防複發見 [[薄殼防複發-能力對照表加smoke]] 卡 + `docs/4-guides/cli-mcp-capability-matrix.md`。日期:2026-06-27。
---
## 20. gitignored 檔查不到 git 史——別用 git log 推斷時間/狀態(2026-06-27
**錯誤模式**:想用 `git log` 查 rule 07 / SDD / wiki 的建立時間 → 全空白,卡住。
**症狀**`git log -- .claude/rules/07-thin-shell.md` 等回空,誤以為檔案有問題或 follow 寫錯。
**正確做法**:先 `git check-ignore <path>` 確認。`.claude/``docs/`、部分 `system-dev/docs/`
**全 gitignored** → git 無這些檔的歷史。查它們的時序只能靠**檔內日期註記**,且要誠實標
「估計非 git 鐵證」。**注**`system-dev/wiki/` **不是** gitignored(可 commit),只有 `docs/` + `.claude/hooks/` 是。
**通用教訓**:查歷史前先確認檔在不在 git 追蹤範圍;gitignored 的東西「精確時間」不可考,別假裝有鐵證。日期:2026-06-27。
---
## 21. wrangler.toml 的 `services = [...]` inline 放在 `[vars]` 後 → binding 消失(2026-06-27issue #12
**錯誤模式**:以為「toml 裡有 `services = [{ binding="CYPHER_EXECUTOR", ... }]`」= binding 就會生效。
實際 self-hosted MCP 報 `CYPHER_EXECUTOR service binding not configured`binding 像憑空消失。
**根因(TOML 語法坑)**`services = [...]`**inline array 形式**,且位置在 `[vars]` table **之後**
TOML 規則:`[vars]` header 後的所有 key(含 `services`)都歸 `vars` table → `services` 被解析成
**`vars.services`(一個普通 env var 陣列)而非頂層 service bindings** → wrangler 看不到任何 binding。
self-hosted 部署 `injectMultiTenant``[vars]` 注入 `MULTI_TENANT` 後此問題暴露(官方不注入故沒早爆,
且 whoami 不需 binding)。
**正確做法**service binding 一律用 **`[[services]]` array-of-tables**(每個 binding 獨立頂層 table
不受 `[vars]` 影響),**不要用 inline `services = [...]`**——尤其檔案有 `[vars]` 時。對齊官方
`cypher-executor/wrangler.toml` 慣例(它用 `[[services]]` 故不中招)。
**驗法(決定性)**`wrangler deploy --dry-run --outdir /tmp/x` 列 bindings
- 正確 → `env.CYPHER_EXECUTOR (arcrun-cypher-executor) Worker`
- 中招 → `env.services ([{"binding":...}]) Environment Variable`binding 變成一個叫 services 的 env var)。
**通用教訓**TOML 頂層 key 必須在任何 `[table]` header 之前;要在 table 後宣告的集合用
array-of-tables`[[x]]`)不用 inline array。改 toml 後用 `wrangler --dry-run` 驗 binding 真的在
(別只看「檔裡有寫」)。連帶:這跟 mistakes #17「注入順序」、#11「死端點假綠」同類——**配置寫了 ≠ 生效**,要驗。日期:2026-06-27。
---
## 快速檢查清單(做新功能前)
- [ ] 這是工作流還是零件?問「有必要嗎?」
@@ -400,3 +458,6 @@ listEntries 加 `source` filter 即可,表結構一個欄位都不動。
- [ ] 碰 KBDB?確認打基本盤現存 route/entries /templates /records /entries/search),別假設 v3 /blocks /search 還在
- [ ] KBDB 要新可查欄位?用 json_extract 查 metadata_json,別加真欄(表不變鐵律,#18
- [ ] 改 deploy.ts toml 注入順序?想「後面還有沒有 pass(如 strip)會動同一段」(#17
- [ ] 新增/改薄殼工具?grep 確認它打的 server route 真的存在,別假綠(#19);宣稱對齊前跑 thin-shell-smoke.sh
- [ ] 想用 git log 查某檔歷史?先 git check-ignore——gitignored 檔無 git 史,時間靠檔內註記(#20
- [ ] 改 wrangler.toml service binding?用 [[services]] 不用 inline services=[...][vars] 後會被吸走);改完 wrangler --dry-run 驗 binding 真在(#21
+4 -1
View File
@@ -21,7 +21,10 @@ metadata:
> - ✅ **已實作 tsc 全綠**1.1 `/webhooks/named` 強制 description2.2+Q4 KBDB base 通用 entry_type filter(改4處:searchEntries/semanticSearch/route/proxy)|2.1 部署雙寫 embeddable entry(注意 KBDB 用 metadata_json 字串)|3.1 cypher `/workflows/search`3.2 MCP `u6u_search_workflows`4.1 `/workflows/backfill-search-entries`1.3b `GET /webhooks/named` 補 description/created_at 欄位。
> - ⏸ **卡待總管定**Phase 1.2/1.3MCP deploy 改打 /webhooks/named)卡在 ①-a/b/c——實作期發現 /webhooks/named 吃 graph 非 YAMLYAML→graph 編排寫在 CLI push.ts 介面層,MCP 複製=違 rule 07。①-c(先通債另開 issue)我推薦,待總管定。
> - **完成標準**:tsc 綠≠完成,框架級待 leo21c 端到端實證(強制填擋空/搜尋命中/租戶隔離/降級 hint/MCP 不再 404)。issue open。
> - **未 commit**(待 leo 明示;wiki 骨架與 #8 SDD/code 建議分兩 commit)。署名鐵律:跨 repo comment 開頭 `[arcrun CC]`#12)。
> - **已 merge 進 main**fast-forward3 commit934b926 #4/5/7/8 功能 / 558e80b wiki-init / 5d38b59 #11 薄殼對齊)+ push origin main。repo Actions `enabled:false`leo 關),merge **未觸發部署**。**merge≠部署**#5/#7/#8/#11 端到端待 leo21c wrangler 直推(Mira 線)。
> - **issue #11 全做**P0 run 死端點/P1 list 同源/R4 防複發機制:對照清單+smoke+自驗能攔);P2 validate 依賴 #10、tag resource_id 語意債待方向①。
> - **issue #12self-hosted MCP 缺 CYPHER_EXECUTOR binding)✅ 修+merge maincommit 222a382**:根因非總管假設的 strip 誤清,是 **TOML 坑——mcp toml `services=[...]` inline 在 [vars] 後被吸成 vars.services**binding 消失);修法 inline→`[[services]]` array-of-tables(對齊官方 cypher)。wrangler --dry-run 雙向驗(修法後 binding 在/舊版變 env.services)。**端到端待 leo21c acr update 重部 MCP**;連帶解鎖 #11 self-hosted MCP + mira #6 門鈴 + acr push。見 mistakes #21。
> - 署名鐵律:跨 repo comment 開頭 `[arcrun CC]`#12 issue 慣例,非本次 bug)。
>
> **2026-06-26 上個 sessionissue #4/#5/#6/#7 一批)**
> - **#6**base `PATCH /records/:id`):✅ updateRecord + route,三表 append-only 不破。tsc 綠,端到端待 leo21c。issue open。