Files
Arcrun/registry/examples/km-wiki-ingest/drainer/wrangler.toml
T
kbdb-cc c6bd0d7899 fix(drainer): 同帳號 worker-to-worker 改走 Service Bindings(修 CF 1042)
Production bug(本地 miniflare 未抓到、真端點才爆):部署後 drainer 對同帳號
arcrun-code/arcrun-kbdb/kbdb-graph-plugin 做 fetch("https://*.leo21c.workers.dev")
→ CF 1042(同帳號 worker 互打限制),被 error handler 包成 "not valid JSON"。

修法=比照 cypher-executor(wrangler.toml [[services]] 綁零件):
- wrangler.toml 加 [[services]] SVC_CODE→arcrun-code / SVC_KBDB→arcrun-kbdb /
  SVC_GRAPH→kbdb-graph-plugin;移除 CODE_WORKER_URL/KBDB_URL/GRAPH_URL vars。
- index.ts:所有 code/kbdb/graph 呼叫改 env.SVC_X.fetch()(svc() 輔助);Gitea
  (git.uncle6.me,非 CF)維持 plain fetch。

驗收(強制對部署後真端點、禁 miniflare):POST /drain?batch=2 回真 JSON、notes 3 卡
冪等全 skip、無 1042;游標前進+回捲;加測試卡→真端點 /webhook 只寫該 delta(entry
create 進 live KBDB)→三模式 curl 命中(含 Arcrun#11 修後語意 owner+type 過濾生效)→
測試卡清除。deploy version 95562b3e。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HJiLCRUU2o3aSpPEzVCt2o
2026-07-06 10:51:42 +00:00

30 lines
925 B
TOML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name = "arcrun-km-wiki-drainer"
main = "src/index.ts"
compatibility_date = "2025-02-19"
workers_dev = true
# ⚠️ 維持「非-auto」:預設不註冊 cron trigger(不自走排程)。drain 走 POST /drain(與 scheduled 同核心)。
# 要開自走 Phase 0 backfillleo 過閘後取消下面兩行註解再 deployscheduled handler 已在 code)。
# [triggers]
# crons = ["*/5 * * * *"]
# ── Service Bindings(同帳號 worker-to-worker 正解;直接 fetch(*.leo21c.workers.dev) 會撞 CF 1042)──
[[services]]
binding = "SVC_CODE"
service = "arcrun-code"
[[services]]
binding = "SVC_KBDB"
service = "arcrun-kbdb"
[[services]]
binding = "SVC_GRAPH"
service = "kbdb-graph-plugin"
[vars]
REPO = "Leo/notes"
REF = "main"
OWNER = "leo"
CARDS_ROOT = "system-dev/wiki/cards"
GRAPH_KEY = "leo"
BATCH_SIZE = "2"
# secretwrangler secret put):GITEA_TOKEN(必),GITEA_WEBHOOK_SECRET(選)