diff --git a/.github/scripts/sync-upstream.sh b/.github/scripts/sync-upstream.sh deleted file mode 100644 index fc1424f86..000000000 --- a/.github/scripts/sync-upstream.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail -report="$RUNNER_TEMP/upstream-sync-report.md" -printf '# 上游同步清单\n\n' > "$report" -git config user.name 'github-actions[bot]' -git config user.email '41898282+github-actions[bot]@users.noreply.github.com' -git fetch --no-tags https://github.com/jxxghp/MoviePilot.git v3 -upstream=$(git rev-parse FETCH_HEAD) -base=$(git merge-base HEAD "$upstream") -echo "上游提交:$upstream" >> "$report" -git log --format='- %h %s' HEAD.."$upstream" >> "$report" -if git merge-base --is-ancestor "$upstream" HEAD; then - echo '没有上游更新。' >> "$report" - echo 'changed=false' >> "$GITHUB_OUTPUT" - exit 0 -fi -# 双方修改同一文件时交给人工处理,避免自动合并悄悄改变定制行为 -git diff --name-only "$base" HEAD | sort > "$RUNNER_TEMP/fork-paths" -git diff --name-only "$base" "$upstream" | sort > "$RUNNER_TEMP/upstream-paths" -comm -12 "$RUNNER_TEMP/fork-paths" "$RUNNER_TEMP/upstream-paths" > "$RUNNER_TEMP/overlap" -if [ -s "$RUNNER_TEMP/overlap" ]; then - echo '需要人工审阅:上游与 fork 同时修改以下文件,未推送:' >> "$report" - cat "$RUNNER_TEMP/overlap" >> "$report" - exit 1 -fi -if ! git merge --no-ff --no-edit "$upstream"; then - echo '合并冲突,未推送:' >> "$report" - git diff --name-only --diff-filter=U >> "$report" - git merge --abort - exit 1 -fi -git diff --check HEAD^ HEAD -echo 'changed=true' >> "$GITHUB_OUTPUT" -echo '合并完成,等待验证。' >> "$report" diff --git a/.github/workflows/fork-upstream-sync.yml b/.github/workflows/fork-upstream-sync.yml deleted file mode 100644 index 347e68c99..000000000 --- a/.github/workflows/fork-upstream-sync.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Fork upstream sync -on: - schedule: - - cron: '0 15 * * *' - workflow_dispatch: -permissions: - contents: write - issues: write -concurrency: - group: fork-upstream-sync - cancel-in-progress: false -jobs: - sync: - if: github.repository == 'ranzhigg/MoviePilot' - runs-on: ubuntu-latest - timeout-minutes: 60 - steps: - - uses: actions/checkout@v7 - with: - ref: v3 - fetch-depth: 0 - - name: Merge upstream conservatively - id: merge - run: bash .github/scripts/sync-upstream.sh - - name: Set up uv - if: steps.merge.outputs.changed == 'true' - uses: astral-sh/setup-uv@v10.0.1 - with: - python-version: '3.14' - - name: Verify merged MoviePilot - if: steps.merge.outputs.changed == 'true' - run: | - uv sync --locked - uv run --locked --no-sync python tests/run.py - - name: Push verified merge - if: steps.merge.outputs.changed == 'true' - run: | - git push origin HEAD:v3 - echo '验证通过,已推送;没有更新本地 MP,也没有自动发布插件安装包。' >> "$RUNNER_TEMP/upstream-sync-report.md" - - name: Record failure - if: failure() - run: | - echo '同步失败:请查看失败步骤。主分支不会收到未通过验证的合并。' >> "$RUNNER_TEMP/upstream-sync-report.md" - - name: Publish run summary - if: always() - run: | - test -f "$RUNNER_TEMP/upstream-sync-report.md" || echo '工作流未完成初始化,请查看日志。' > "$RUNNER_TEMP/upstream-sync-report.md" - cat "$RUNNER_TEMP/upstream-sync-report.md" >> "$GITHUB_STEP_SUMMARY" - - name: Save report - if: always() - uses: actions/upload-artifact@v7 - with: - name: upstream-sync-report - path: ${{ runner.temp }}/upstream-sync-report.md - retention-days: 30 - - name: Report failure as issue - if: failure() - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - run: | - printf '\n运行日志:%s\n' "$RUN_URL" >> "$RUNNER_TEMP/upstream-sync-report.md" - issue=$(gh issue list --state open --search '"上游同步失败" in:title' --json number --jq '.[0].number // empty') - if [ -n "$issue" ]; then - gh issue comment "$issue" --body-file "$RUNNER_TEMP/upstream-sync-report.md" - else - gh issue create --title '上游同步失败:需要检查' --body-file "$RUNNER_TEMP/upstream-sync-report.md" - fi diff --git a/app/api/endpoints/transfer.py b/app/api/endpoints/transfer.py index 9843c9d37..2af051d74 100644 --- a/app/api/endpoints/transfer.py +++ b/app/api/endpoints/transfer.py @@ -11,7 +11,11 @@ from app.api.endpoints.transferhistory import ( restore_manual_transfer_history_batch, restore_manual_transfer_history_metadata, ) -from app.api.response import CompatibleCountParam, CompatiblePageParam, ResponseAPIRouter +from app.api.response import ( + CompatibleCountParam, + CompatiblePageParam, + ResponseAPIRouter, +) from app.application.configuration import get_api_runtime_config_snapshot from app.application.directory import DirectoryHelper from app.application.history import TransferHistoryLookupService diff --git a/docs/development-setup.md b/docs/development-setup.md index a6ed55af6..db73f9fa6 100644 --- a/docs/development-setup.md +++ b/docs/development-setup.md @@ -255,10 +255,6 @@ CI 上传 `complexity-report` 工件,门禁失败时也保留已生成的指 - [MoviePilot-Resources](https://github.com/jxxghp/MoviePilot-Resources) - [MoviePilot-Plugins](https://github.com/jxxghp/MoviePilot-Plugins) -## 个人 fork 同步 - -定时合并和失败通知见 [Fork 上游同步](fork-upstream-sync.md)。 - ### Agent 历史消息索引验证 独立消息库位于 Agent 运行目录,不参与主库 Alembic。使用临时运行目录运行 `tests/test_agent_recall_persistence.py`,不得用真实用户的 `state.db` 做索引破坏或重建测试。CJK tokenizer 保留 Hermes 原版源码及许可证于 `native/fts5_cjk/`;Docker 构建与 CLI 依赖安装使用该目录的 `install.py`,按本机架构编译并用目标解释器实际验证两字中文查询,安装到 `/lib/moviepilot/libfts5_cjk.so`。旧配置目录内的手工扩展作为加载回退;编译器要求和补装/检查命令见该目录 README。测试有本地 C 编译器时在临时目录构建,无编译器时只跳过原生扩展用例,不能宣称该分词路径已验证。常规 FTS5 与 trigram、短中文回退无需该扩展,扩展缺失或失效时索引状态会明确降级。独立 schema 版本不等于产品版本;后续新增主库升级脚本从 3.1.0 命名。 diff --git a/docs/fork-upstream-sync.md b/docs/fork-upstream-sync.md deleted file mode 100644 index 7ab76aa0e..000000000 --- a/docs/fork-upstream-sync.md +++ /dev/null @@ -1,13 +0,0 @@ -# Fork 上游同步 - -每天北京时间 23:00(UTC 15:00)由 GitHub Actions 检查上游;GitHub 定时任务可能延迟。也可在 Actions → Fork upstream sync 手动运行。 - -使用普通合并,保留 fork 提交;双方改动同一文件时暂停人工审阅,不采用 ours/theirs 或强制覆盖。合并、校验或推送失败时工作流失败,生成日志、30 天报告附件,并创建或更新失败 Issue。每次运行的 Summary 展示上游提交清单及结果。失败不自动回滚已有提交,不修改本地 MP。 - -推送使用 GITHUB_TOKEN,合并推送不会自动触发其他 push 工作流或插件发布;插件发布及本地安装需要另行执行。验证仅覆盖工作流列出的检查,不保证所有外部服务或第三方插件兼容。 - -## GitHub 自带失败邮件 - -仓库代码无法修改账号的邮件通知偏好。在 GitHub Settings → Notifications → System → Actions,启用 Email 并选择仅失败通知;确保该仓库通知路由使用已验证的 `ranzhigg@gmail.com`。首次用自己的账号手动运行本工作流,并检查失败邮件偏好。未开启账号通知前,工作流无法保证邮件送达,也不能从仓库设置强制收件人。 - -不需要 SMTP 密钥。失败 Issue 和 Actions 日志始终作为反馈入口,修复后可手动重跑;失败 Issue 由人工确认后关闭。 diff --git a/tests/test_architecture_ci.py b/tests/test_architecture_ci.py index 805d6b6bf..c41c3f6d5 100644 --- a/tests/test_architecture_ci.py +++ b/tests/test_architecture_ci.py @@ -256,7 +256,6 @@ def test_upload_artifact_actions_share_node24_major(): assert actions_by_workflow == { "architecture-observe.yml": ["actions/upload-artifact@v7"], - "fork-upstream-sync.yml": ["actions/upload-artifact@v7"], "native-dependency-update.yml": ["actions/upload-artifact@v7"], "pylint.yml": ["actions/upload-artifact@v7"], "site-adapter-collector.yml": ["actions/upload-artifact@v7"],