Skip to content

训记回写链:fetch/backfill(范围口径+三列幂等键+exercise_log 写入路径) #608

Closed

Description

@FeatherHunter

Part of #593

目标

实现训记模块的回写链:fetch+backfill 两条对外命令,让「拉训记实绩」那条唤醒词有执行层——拉到本仓(训记 App 的实绩落到 exercise_log)。

逻辑口径(严格模仿老实现 xunji_bridge/backfill.py/adapters/xunji_adapter.py,代码新写)

  • 范围:老实现只能「结束日 + 往前 N 天」(__main__.py:101、backfill.py:190-193);backfill_range 签名 days=1 与 docstring「默认 2」矛盾(backfill.py:165-170)——照签名,不照文档。
  • 幂等键=三列:xunji_localid + exercise_type + set_index(xunji_adapter.py:98-101)。文档写两列的处(backfill.py:7/原 t350:15)是错的,本票在回执里点名更正。
  • UPDATE 覆盖 7 列但保留 note/date(xunji_adapter.py:105-114)。
  • 新仓落库目标:exercise_log 已有 xunji_localid/xunji_title 列与索引,但没有写入路径(src/schema.ts:44,122,243 vs src/exercise/exerciseStore.ts:167,193、src/workout/fieldLabels.ts:14)——本票把写入路径补上。
  • 缺陷不照抄:老实现「写库失败仍退 0」(backfill.py:139,147 vs __main__.py:108-111)必须修掉;失败要能分清「拉到了没写进」与「没拉到」。

验收命令

  • node --test packages/skill-calorie/test/*.test.mjs(绿;新增用例用挡板:三列幂等——同一条拉两次不增行;note/date 被保留;写库失败非 0 退出)
  • node node_modules/typescript/bin/tsc -b packages/skill-calorie
  • 「改坏必红/还原必绿」两行机器读数

不许动的东西

  • 不许打真实训记接口(测试一律挡板)。
  • 不改 exercise_log 的既有列语义(只补写入路径与标签)。
  • 不改老技能目录。

交付物路径

  • packages/skill-calorie/src/xunji/**、packages/skill-calorie/test/**
  • 证据件:docs/skills/skill-calorie/t593-S3-回写链-证据.md(含「幂等键三列」更正说明)

遗留出口

  • 真机联调另开票;附带发现另开票。

进度:100%

下一步:无(验收通过,关闭)。

fetch/backfill 已交付:范围照签名默认 1 天([结束日-N+1, 结束日],新在前);幂等三列(更正文档两列错);UPDATE 7 列保留 note/date;写库失败退 3 分清两失败(修老退 0)。四门全绿(tsc 0/定向 49/49/gen:check 129 键 10 能力/告警线 91/91),全量 72 红与基线同集,变异红绿成对,零真网。过渡债务 R2(exercise 写出口门形状,#610/#614 前认领)已立项;P2 两项(常量零引用文案、set_index null 观察)记收口。提交 5abf5b8(已 push)。对抗审查 93/100 放行。

Activity

  1. FeatherHunter commented on Sep 17, 2026

    @FeatherHunter
    OwnerAuthor

    #608 训记回写链:已交付,关闭。

    • fetch/backfill 真跑:范围「结束日+往前 N 天」默认 1 天(照签名,不照文档 2);幂等键三列 xunji_localid+exercise_type+set_index(点名更正文档两列错);UPDATE 覆盖 7 列但保留 note/date;exercise_log 写入路径补上(既有列语义不动)。
    • 失败口径:写库失败退 3,分清「拉到了没写进」与「没拉到」(修老写库失败仍退 0);行级 errors 不中断。
    • 四门:tsc 0/定向 49/49(本票 19 全绿)/gen:check(129 键/10 能力)/告警线 91/91;全量 72 红与基线同集(逐名 diff 空);变异两轮红→绿。
    • 零真 KEY、零真网(全注入挡板);本票无 HTML,视觉验收墙不触发。
    • 过渡债务 R2:exercise 写出口门形状(训记密钥与编排:key/run-sync/overlay-plan(两处老缺陷必修) #610/同步到训记/拉训记实绩两条薄命令+五条路由转 exec+墙随动 #614 前认领,证据件§九);P2 常量零引用文案与 set_index null 观察记收口。

    提交 5abf5b8(已 push)。对抗审查 93/100 放行。真机联调另开票。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

wayfinder:task

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions