Skip to content

fix: plan replacement publications with the real staged media type - #348

Merged
redtidev1918 merged 2 commits into
mainfrom
codex/fix-planner-local-kind
Oct 24, 2026
Merged

redtidev1918 merged 2 commits into
mainfrom
codex/fix-planner-local-kind

Conversation

@redtidev1918

Copy link
Copy Markdown
Owner

根因(review #208 事故第二层,业务根因)

#206(多页插画,4 个 kind:image 资产)重抓替换为 #208(ugoira 动画)后,chain-206 的资产登记仍是旧作品的。发布链路出现两个确定性缺陷:

  1. 类型降维:plan_review_media 的 assets 分支把所有非 document 媒体硬编码为 MediaKind.PHOTO,无视已 staged 的 type: animation → sendPhoto(animation_file_id) → Telegram 确定性拒绝 Can't use file of type animation as photo。
  2. 内容污染:未配对的旧资产作为 asset-only remote 条目进入发布计划 → 会把已废弃作品的页面与新作品媒体一起发布。

2.84.2 曾把该 BadRequest 误分类为响应丢失(BadRequest ⊂ NetworkError),触发无关转发反查与谎报回滚——#346(2.84.3)已修复该放大层;本 PR 修复业务根因层。2.84.3 部署后的恢复尝试已实际验证:同一拒绝被正确分类为确定失败,零重试零删除。

修复

  • indexed local item 的显式类型(type/kind,来自 Telegram staging 事实)对 animation/video/audio 同样权威;asset 声明只补位,不覆盖。
  • plan_review_media(..., work_id=):pixiv:<wid>: 前缀资产若可证明属于其它作品则丢弃;同作品资产(novel cover/插图)、非 pixiv 资产(聊天上传)、空 work_id 保持旧行为。
  • publish_from_file_ids 传入 work_id(pid)。

边界

  • 不改数据库、不重抓、不动审核 CAS 与发布账本;仅影响计划构建。
  • Telegram 媒体组约束复用现有 family_of(animation/audio 本就是 standalone singleton family,绝不进相册)。
  • 重抓替换稿不带资产清单时旧资产残留的契约层问题(producer 侧)在 deploy 仓文档记录为 KNOWN_DEBT。

测试

  • 新增回归:image→animation(fix(bot): preserve command menu and miniapp entry #208 场景:类型保留 + 旧资产全滤)、animation→image 反向、同作品/非 pixiv 资产保留、无 work_id 旧行为、video/audio 类型保留。
  • 本地全量:1566 passed, 1 skipped(类型修复轮);本 PR 全量见 CI。

A refetch replacement stages its media with the real Telegram type
(e.g. animation) while the chain's media_asset_refs may still describe
the superseded work as kind=image. plan_review_media hard-coded every
non-document entry to photo, so publishing sent an animation file_id
via sendPhoto — a certain Telegram BadRequest. On 2.84.2 that reject
was then misclassified as a lost response (BadRequest subclasses
NetworkError), which triggered the unrelated-forward rollback that
broke review 208 publication.

The indexed local item is already documented as authoritative for
presentation; this makes the code honor its explicit type for
animation/video/audio too. Asset-only entries keep the photo default.
A refetch replacement whose submission carries no asset manifest
leaves the SUPERSEDED work's media_asset_refs on the chain. Beside
the type downgrade fixed in the previous commit, those stale refs
also entered the plan as asset-only remote entries — publishing
would have shipped the old work's pages together with the new work's
media (review 208: 4 illustration pages around one ugoira animation).

plan_review_media now takes work_id and drops refs whose pixiv asset
id provably belongs to another work. Same-work refs (novel covers,
illustrations), non-pixv refs (chat uploads) and empty work_id keep
the legacy behavior, so ordinary submissions are unchanged.
@redtidev1918
redtidev1918 merged commit 59f0af9 into main Oct 24, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant