mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-08-29 12:06:51 +08:00
refactor(architecture): 修复模块依赖违规并强化架构守护
- 字幕编排上移 DownloadChain.download_site_subtitles,SubtitleModule 仅保留站点链接解析 - TransferChain.recommend_name 上移 TV episodes_info 获取,filemanager 模块不再导入 TmdbChain - endpoint 穿透修复:WXBizMsgCrypt3 迁至 adapters/external/wechat_crypt.py; music/tmdb 缓存管理、listenbrainz 常量、TMDbException、WechatClawBot 辅助统一经 chain 包装 - RuleParser 与 builtin_rules 合并为 application/filter_rules.py; fsproxy/fsworker 迁至 adapters/system/ - chain/__init__.py 删除 qbittorrentapi/transmission_rpc 导入,消除后端协议类型泄漏 - 架构守护测试新增三项检查:模块间隔离、入口层穿透、下载器 SDK 泄漏 - 文档同步:05-architecture.md 记录 DB/Oper 聚合例外与迁移文件位置,AGENTS.md 更新所有权表
This commit is contained in:
@@ -211,7 +211,10 @@ depend on this established runtime root.
|
||||
SQLAlchemy models stay under `app/db/models/`; the data access classes live in
|
||||
`app/db/oper/` and mirror them one-for-one (`models/subscribe.py` ↔
|
||||
`oper/subscribe.py`), so a filename carries only the entity and the package name
|
||||
carries the role. Chains, modules, application services and endpoints use Oper
|
||||
carries the role. Two verified aggregation exceptions exist: the site family
|
||||
(`Passkey`, `SiteIcon`, `SiteStatistic`, `SiteUserData`) is consolidated in
|
||||
`oper/site.py`, and `AgentTaskRun` lives in `oper/agenttask.py`. Chains, modules,
|
||||
application services and endpoints use Oper
|
||||
classes instead of issuing SQLAlchemy queries directly. Every schema change
|
||||
requires an Alembic migration under `database/versions/`.
|
||||
|
||||
@@ -292,6 +295,9 @@ policy. `app/db` therefore has no dependency on `app/domain`.
|
||||
| `app/runtime/cache.py` | Cache contracts, memory backend, decorators and proxies |
|
||||
| `app/adapters/cache/backends.py` | Redis and filesystem cache adapters |
|
||||
| `app/adapters/system/resource.py` | Runtime resource detection/download/installation |
|
||||
| `app/adapters/system/fsproxy.py` | Timeout-guarded local filesystem operations in a killable subprocess (with colocated `fsworker.py`) |
|
||||
| `app/adapters/external/wechat_crypt.py` | WeChat enterprise-message XML encryption/decryption protocol |
|
||||
| `app/application/filter_rules.py` | Built-in torrent filter rule set and rule parser |
|
||||
| `app/adapters/external/market.py` | Plugin repository discovery and installation |
|
||||
| `app/application/security/url.py` | URL/path validation, SSRF protection and signed image policy |
|
||||
| `app/application/mediaserver.py` | Configured media-server discovery and identity matching |
|
||||
@@ -300,7 +306,10 @@ policy. `app/db` therefore has no dependency on `app/domain`.
|
||||
|
||||
Run `tests/test_architecture_dependencies.py` after every ownership or import
|
||||
change. It rejects physical legacy or retired canonical sources, forbidden
|
||||
upward dependencies, SDK/compat backreferences and any strongly connected
|
||||
component containing a migrated module.
|
||||
upward dependencies, SDK/compat backreferences, any strongly connected
|
||||
component containing a migrated module, module-to-module or module-to-chain
|
||||
imports, entrypoint (`api`/`agent`/`monitor`/`workflow`/`doctor`) imports of
|
||||
`app.modules` internals, and downloader SDK (`qbittorrentapi`,
|
||||
`transmission_rpc`) imports inside `app/chain`.
|
||||
|
||||
*Last Updated: 2026-08-14*
|
||||
*Last Updated: 2026-08-15*
|
||||
|
||||
Reference in New Issue
Block a user