Lc Feishu Selection Sync
Use ./selectionctl sync-feishu --job-id <job> or --watch.
Single-writer rules
- Other Skills and stage workers must never call Feishu write APIs directly.
- Reuse the configured Feishu master Base. Create one
01 任务入口record per submission and keep all parent products in the same02 商品决策table; never create a daily table or erase historical rows unless the user explicitly asks. - Consume SQLite
outboxin batches of 10 or every 30 seconds. - Keep attachments in their own queue and preserve product-level confirmation.
- Upsert
02by offer ID,04by product + site + ASIN, and05by product + country + landing URL. - Upsert
08 渠道输出批次by output batch code. Attach its manifest, input workbook, generated upload workbook, and validation report without duplicating filenames. - Read user choices from
02:本次生成渠道,目标品牌,Amazon目标站点, and确认生成表格. Validate them against系统主建议; do not create a batch from08edits or require manual copying. - Retry transient EOF, timeout, rate-limit, and write conflicts with bounded backoff. Do not silently change user/bot identity.
Batch organization
- Link every
02product to the current01record through关联任务. - Write
批次内序号as the stable 1-based source order within that task; never use the global Base row number. - Treat
导入日期as a read-only system creation date. - Set
重复铺货状态to未检查,非重复,重复-跳过, or重复-保留来源. Keep a minimal source row for skipped duplicates so the task remains auditable. - When a new task starts, update only the
当前任务view filter to the new01record ID. - Keep the first
全部商品view grouped by关联任务as the in-place collapsible historical view. Do not create a separate按任务批次view or daily product tables. - Map
RETRYABLE_ERROR/BLOCKED_LOGINto数据完整性=抓取失败, andAMAZON_DATA_INCOMPLETEto数据完整性=缺失with channel recommendation未判断. Keep these records in the automatic retry/data-incomplete view; do not convert them toMANUAL_REVIEWafter Feishu read-back. - Reserve
人工复核for completed evidence that still has material risk or same-product ambiguity. - Write user-facing review routing to
02.待复核渠道with valuesAmazon FBA,Amazon FBM,Walmart自发货, andWalmart WFS; one product may hold multiple values. Write the Google/channel reason to02.待复核信息and keep Google website, evidence URL, screenshot, and decision reason visible in every review view. - Preserve four channel review views:
亚马逊 FBA 待复核,亚马逊 FBM 待复核,沃尔玛自发货待复核, and沃尔玛 WFS 待复核. Filter out records whose人工审核结论is通过or淘汰. Do not group these user-facing views by Google status. - Existing rows with blank new fields remain valid. Do not delete and recreate them; fill missing values only when their original task is resumed or reconciled.
- Keep the user-facing Base root limited to
01 任务入口,02 商品决策, and08 渠道输出批次. Keep03through07inside后台数据(系统使用); moving them must not change their table IDs. - Preserve four compact action views in
02: Amazon FBA, Amazon FBM, Walmart WFS, and Walmart self-fulfilled. Channel batch status and files remain in08and link back through02.输出批次.
Success gate
After all prior Outbox items are sent, read back the remote product and evidence records. Confirm:
02business key and decision fields;- correct
关联任务,批次内序号, and重复铺货状态for newly imported products; - required
04/05records; - every required image attachment is visible remotely;
- data completeness and channel recommendations are present.
Only then finish FEISHU, pass through FEISHU_SYNCED, and assign a ready route. Local crawl completion without this verification is only “本地完成,待回写”.
Progress and repair safeguards
- Treat import-time
02upsert plus main-image upload asIMPORT_FEISHU_CHECKPOINTbehavior in Outbox/remote refs, not as finalFEISHU=DONE. Do not introduce a new product state; final FEISHU state remains governed by the Success gate above. - Before marking
FEISHU=DONE, verify stage contiguity: Google must be terminal; risk-stopped products need no Amazon stage, while all other products require terminal Amazon completeness status and the appropriate decision record. - Status counters must report final read-back confirmation separately from import checkpoint confirmation.
pending_writeback_productsmust be derived from eligible terminal products and can never be hidden by an early import sync. - If a successful retry supersedes a Google/Amazon error, keep the historical evidence row but mark it resolved and omit it from active errors, current screenshots, and failure totals.
- A sent Outbox row without the expected stage/checkpoint marker is a reconciliation item. Recover the marker by remote read-back; do not resend or duplicate the Feishu record.