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>
This commit is contained in:
@@ -387,6 +387,64 @@ listEntries 加 `source` filter 即可,表結構一個欄位都不動。
|
||||
|
||||
---
|
||||
|
||||
## 19. 薄殼打的端點 server 不一定存在——死端點假綠(2026-06-27,issue #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-27,issue #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)
|
||||
|
||||
Reference in New Issue
Block a user