fix(km-wiki-ingest): code 節點 post 前剝除 envelope 的 _estSubrequests(graph strict schema)
leo21c 實 ingest 發現:graph /triplets/ingest 為 strict schema,會以 422
unrecognized_keys 拒絕 planEnvelopes 掛在 envelope 上的診斷鍵 _estSubrequests。
修:parse_card 內聯碼在 return 前把每個 envelope 的所有 _-前綴鍵剝除,使
post_one_envelope 的 body_json={{envelope}} 為 ingest-candidate 契約乾淨 payload
(source/extractor/nodes/triplets)。已驗:剝除後 entry/nodes/triplets 與原
planCard 逐欄一致。實 ingest(直接驅動同資料流)已用此剝除成功寫入 15 triplets。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HJiLCRUU2o3aSpPEzVCt2o
This commit is contained in:
@@ -388,7 +388,17 @@ config:
|
||||
return { entry: parsed.entry, envelopes, meta: parsed.meta, nodeCount: parsed.nodes.length, tripletCount: parsed.triplets.length };
|
||||
}
|
||||
|
||||
return planCard(input.md, input.relPath, input.repo, input.opts || {});
|
||||
// graph /triplets/ingest 是 strict schema,拒絕未知鍵。planEnvelopes 於 envelope 上掛的
|
||||
// 診斷鍵 _estSubrequests 不在 ingest-candidate 契約內 → post 前剝除所有 _-前綴鍵,
|
||||
// 讓 post_one_envelope 的 body_json={{envelope}} 為契約乾淨 payload。
|
||||
// (leo21c 實測:不剝除會回 422 unrecognized_keys "_estSubrequests"。)
|
||||
const __plan = planCard(input.md, input.relPath, input.repo, input.opts || {});
|
||||
__plan.envelopes = __plan.envelopes.map(function (e) {
|
||||
const clean = {};
|
||||
for (const k in e) { if (k.charAt(0) !== '_') clean[k] = e[k]; }
|
||||
return clean;
|
||||
});
|
||||
return __plan;
|
||||
|
||||
input:
|
||||
md: "{{fetch_card.data.body}}"
|
||||
|
||||
Reference in New Issue
Block a user