feat(06-07): scheduled() cron tick wired — factory, loadGraph street memo, crons trigger (GREEN)

- webhook.ts: createExportedHandler(opts) factory (offline send capture via
  baseFetch); scheduled() wraps runGuidanceCronTick in ctx.waitUntil —
  fail-closed unconfigured gate, paginated guidance: KV list (list_complete
  respected), loadGraph awaited ONCE per tick (the shared R2 memo), per-key
  getGuidanceSession → projectTurnCards → sendPhoto to envelope.chat_id ONLY
  (T-06-02), every log a [guidance-cron] category, zero KV writes
- guidance-sessions.ts: GUIDANCE_KEY_PREFIX exported — the ONE key-scheme
  authority (list scans derive prefix + slice ids from it)
- wrangler.jsonc: triggers.crons */1 * * * * (60 s scan, cadence in code)
- guidance-cron.test.mjs GREEN completion: GC-C3/C5/C8/C9 wire the recording
  baseFetch through the factory (the header-documented seam — they defined
  the recorder but never passed it); GC-C7 uses readdirSync (require is
  undefined in ESM); GC-C1/C8/C9 drain inside the withConsole window (the
  tick's logs fire under waitUntil)
- guidance-envelope.test.mjs: GE7 allows the GUIDANCE_KEY_PREFIX named import
- 125/125 bot tests green; bot:typecheck clean
This commit is contained in:
araharah-executor
2026-10-24 19:49:00 +08:00
parent 37ffefe11c
commit ad612299ca
5 changed files with 175 additions and 56 deletions
+5
View File
@@ -28,5 +28,10 @@
// (docs/ROAD-GRAPH.md is the fork contract). The bucket name is public
// configuration, never a secret.
"r2_buckets": [{ "binding": "ROAD_GRAPH", "bucket_name": "araharah-graphs" }],
// The repo's FIRST Cron Trigger (06-07, D-11): 60 s scan; card cadence
// decided in code (CARD_CADENCE_S 180) — D-11's 60–120 s window. The tick
// is STATELESS (zero KV writes — the free-plan budget law). Local test:
// curl "http://localhost:8787/cdn-cgi/local/scheduled" against `wrangler dev`.
"triggers": { "crons": ["*/1 * * * *"] },
"kv_namespaces": [{ "binding": "chat_sessions", "id": "59f58a54bc44483e89872b20a005a5eb" }]
}