Skip to content

fix: improve Emby to 115 deletion sync - #52

Open
xudong7587 wants to merge 2 commits into
mainfrom
fix/emby-115-delete-sync-v0612
Open

fix: improve Emby to 115 deletion sync#52
xudong7587 wants to merge 2 commits into
mainfrom
fix/emby-115-delete-sync-v0612

Conversation

@xudong7587

@xudong7587 xudong7587 commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Module scope

  • Primary module: media-server
  • Changed modules: media-server, strm, cloud
  • Shared/Core changed: No
  • Cross-module reason (if applicable): Emby 删除 Webhook 通过既有 STRM 删除工作流解析精确映射,并由 115 客户端执行文件或目录回收站操作;删除范围需要在三个既有接缝间传递。

Compatibility

  • Behavior changed: Yes
  • Database changed: No(无 schema 或 migration 变化;复用既有 trash_receipt_json 持久化本次删除范围,并仅在 Emby Webhook 缺失映射时向既有 strm_entries 补记唯一、待移除映射)
  • Config or environment variables changed: No
  • API contract changed: No
  • Backward compatibility: 保留现有接口、配置、数据库结构、文件路径、Docker 和升级语义;手工删除维持精确文件级;旧的空范围删除意图继续按文件级处理。

Proof

  • Tests run:
    • tests/test_deletion_workflow.py: 42 passed
    • Deletion/P115/STRM/architecture focused suite: 100 passed, 3 subtests passed
    • Full backend suite: 662 passed, 9 subtests passed
    • python -m compileall -q backend/app: passed
    • git diff --check: passed
  • Local browser acceptance (when user-visible): Not run;这是后端 Provider 删除链路,真实验收会操作 115/NAS,本次按要求未触发任何真实外部删除。
  • Known risks or follow-ups: Emby 事件缺少可识别类型时保守为文件级;目录路径、STRM 与 115 资产相对路径不一致、跨账号/来源根目录、目录 ID 无法精确解析时均拒绝目录删除。

Summary

  • 在首次 Emby 删除事件缺少 strm_entries 时,复用当前 STRM 投影规则,从完整相对路径唯一恢复映射;同名异目录、多 Provider 歧义及已移除映射继续 fail-closed。
  • 删除范围跟随 Emby:目录路径和独占电影目录删除对应 115 非根目录,海报、NFO、字幕和子目录不再阻止目录回收;Episode 与未知类型只删除唯一媒体文件。
  • 电影位于多个 STRM 共用的平铺目录时自动降级为文件级,避免删除其他电影;目录级事件只调用一次精确目录回收,并一次完成同一事件的全部映射,不会先删文件再尝试删目录。
  • 任务日志和 Emby 通知如实区分文件级与目录级删除。

Baseline: GitHub formal Release v0.6.12 (210a1ccf938176db9f93ffcfcced2d431c266086).

No NAS operation, main merge, release, or version change was performed.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1915d5e249

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

or not re.fullmatch(r"[A-Za-z0-9_-]{1,256}", parent_id)
or not raw_path
or relative_path.is_absolute()
or len(relative_path.parts) < 2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Require proof that the parent directory belongs to the asset

When an indexed file is directly under a selected category folder, such as 电影/Movie.mkv, this depth check treats the category as a deletable media directory; after the file is trashed and no siblings remain, the workflow also moves the entire 电影 folder to the recycle bin. Path depth does not establish that the parent is an asset-owned directory, so preserve it unless ownership is explicitly recorded or separately confirmed.

AGENTS.md reference: AGENTS.md:L43-L43

Useful? React with 👍 / 👎.

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