Interrupted bare clone (`clone_kept_releases`) leaves unborn HEAD and permanently breaks update checks (`Failed to get repo HEAD`)
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 53/100
調査の方向性
Start with src-tauri/src/git.rs, especially clone_kept_releases, ensure_repository, and the repo.head() call in get_tags_and_current_version; read the existing repository tests and trace how app.current_version is stored. Reproduce with an existing bare repo whose HEAD points to a missing branch, then check how recovery should work alongside interrupted clones. Done means the version list can load after this failure; the issue suggests atomic cloning and unborn-HEAD recovery, with tests in git.rs.
索引モデルが issue の本文から書いたものです。
説明
Summary
In PyAppify v1.2.9 (dceecfb), if clone_kept_releases is interrupted mid-way (e.g. the launched app kills the launcher via "Kill Launcher After Start" while a background re-clone is still fetching tags), data/apps/<app>/repo is left behind as a valid-looking bare repo with an unborn HEAD (ref: refs/heads/master, refs/heads/ empty).
Afterward, ensure_repository treats the repo as valid and only syncs tags, while get_tags_and_current_version fails unconditionally on repo.head(), permanently breaking version checks and updates (Failed to load app: Failed to get repo HEAD).
Root Cause (v1.2.9 / dceecfb)
- Non-atomic in-place
init_bare(src-tauri/src/git.rs):clone_kept_releases(L556) initializes directly at the finalrepopath (defaultHEAD = ref: refs/heads/master), fetches only tags, and relies oncheckout_detachedlater inensure_repository(L1499) to set a validHEAD..inspect_errcleanup (L1429–L1431) does not run when the process is terminated externally. - Race with
start_app+ launcher kill (src-tauri/src/app_service.rs):load_appemitsapp.json(installed: true) at L458 beforeupdate_app_from_disk()(L460).start_app(L1652) does not wait forensure_repository, so the app can start and kill the launcher while the re-clone is still running. - No unborn-HEAD recovery (
src-tauri/src/git.rs): Subsequentensure_repositorycalls succeed atopen_repository(L1357) and only runsync_tags, thenget_tags_and_current_versionalways fails atrepo.head()(L1264).
Launcher log excerpt (Windows, ok-nte, keep_releases: 30)
# 1. Invalid repo removed; in-place bare re-clone starts (31 tags)
2026-11-30 23:50:32.603 WARN pyappify_lib::git: Directory at ...\repo exists but is not a valid git repository (...). Removing and re-cloning.
2026-11-30 23:50:32.608 INFO [ok-nte]: Attempting to clone https://cnb.cool/BnanZ0/ok-nte-update.git into ...\repo
2026-11-30 23:50:33.071 INFO [ok-nte]: Fetching the 31 newest version(s) of 30 releases kept.
# 2. App starts 12s later and kills the launcher before clone finishes
2026-11-30 23:50:45.165 INFO pyappify_lib::app_service: Attempting to start app: ok-nte
2026-11-30 23:50:52.084 INFO [ok-nte]: ... MainWindow showEvent Kill Launcher After Start
2026-11-30 23:50:52.084 INFO [ok-nte]: ... Attempting to terminate process with PID: 14364
# 3. Subsequent CLI --get-version-list sees an "existing" bare repo, finishes fetching tags, then fails on unborn HEAD
2026-11-30 23:50:53.224 INFO [ok-nte]: Repository already exists ...\repo
2026-11-30 23:51:44.275 INFO [ok-nte]: Fetch complete.
2026-11-30 23:51:44.275 INFO [ok-nte]: Fetching all tags for repository at ...\repo
# -> App log: RuntimeError: Failed to load app: Failed to get repo HEAD
Minimal Repro & Workaround
- Repro: Set
data/apps/<app>/repo/HEADtoref: refs/heads/master(nonexistent branch) and run<app>.exe --get-version-list --number-versions 10 --release-only true --response-file out.json→{"error":"Failed to load app: Failed to get repo HEAD"}. - Workaround:
git --git-dir="data/apps/<app>/repo" update-ref --no-deref HEAD <installed-tag-commit-oid>(or deleterepoand let the launcher finish re-cloning).
Suggested Fix
- Atomic clone: Clone into a temporary sibling dir (e.g.
repo.cloning), finish fetching tags and setting initial detachedHEAD, then atomicallyrenametorepo(cleaning up leftover temp dirs on startup). - Self-heal unborn
HEAD: Inensure_repository, validaterepo.head()on existing repos; if unborn/unresolvable, detachHEADtoapp.current_version(or latest release tag / re-clone) so already-affected installs recover automatically. - (Optional) Prevent
start_appfrom launching (and killing the launcher) while a fresh/re-clone is in progress.
Happy to submit a PR with unit tests in git.rs if this direction sounds good!
- 主要言語
- Rust
- スター
- 75
- フォーク
- 13
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ok-oldking/pyappify のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
ok-oldking/pyappify#9 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 56/100
ok-oldking/pyappify#13 ·
ok-oldking/pyappify の issue をすべて見る
似ている issue
-
The new tests repeat each other and one only checks a two-line helper再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンinfra
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
storytold/wordcraft#9405 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
in-progress
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
area: ai-assistants documentation help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
BetaBots-LLC/latticegate#17 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 94/100
storytold/craft-libs#5594 ·
メンテナーはふだん 1 日以内に返信
-
available documentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Nixitov/Riptide-Native#932 ·
メンテナーはふだん 1 日以内に返信