案内ファイル(移動しました.txt)に全ファイルの URL を記載する - #28
Draft
pollenjp wants to merge 1 commit into
Draft
Conversation
Folders cannot cross domains, so the destination folder is re-created and its URL necessarily differs from the source folder's. The breadcrumb only carried that one (changed) folder link, leaving no way to follow an individual file from the old folder — even though moved files keep their ID, and therefore their URL. The breadcrumb now lists every file that was in the folder, one line each, with its URL and what happened to it: moved (URL unchanged), copy-rescued (new URL, old one shown alongside), or left behind because it is owned by someone else or failed. A short section spells out which URLs survive the migration and which do not. Two correctness fixes fall out of this: - The headline no longer claims the whole folder moved when files were skipped or failed and are still sitting there. It reports how many remain, and says so explicitly while a folder is still being processed. - Records are merged with the existing breadcrumb, and flushed before the 4.5-minute execution limit suspends a folder mid-way. Re-runs and auto-resume only process the files still present, so without merging the earlier entries would be dropped from the list. Entries are keyed by file ID, so a re-run supersedes a file's previous status instead of duplicating it. Listing is capped at 5000 files per folder as a runaway guard, with the omitted count noted in the file. Fixes #27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #27
何が問題だったか
Issue の 3 点は、根っこが 1 つでした。
フォルダの URL は必ず変わります。 ドメインをまたいでフォルダは移動できないので、移行先ではフォルダを作り直しています。作り直したフォルダは別のフォルダなので、案内ファイルに書かれた移行先フォルダのリンクが移行前と違うのは仕様どおりの挙動です(不具合ではありません)。
問題は、案内ファイルがその「変わってしまったフォルダのリンク」1 本しか持っていなかったことです。旧フォルダを開いた人は、目的のファイルへ辿り着く手段がありませんでした。
一方 ファイルの URL は変わりません。移動ではファイル ID がそのままだからです。つまり Issue のご提案どおり、全ファイルの URL を案内ファイルに書いておけば、フォルダの URL が変わる分をきれいに補えます。
変更内容
1. 全ファイルの URL を 1 行ずつ記載する
そのフォルダにあった全ファイルを、URL と「どうなったか」付きで列挙します。
open?id=形式に統一。Google ドキュメント/スプレッドシートなどのネイティブ形式でも通常ファイルでも同じ書き方で開けます2. 中身が残っているのに「全部移動した」と書かない(バグ修正)
他人所有でスキップしたファイルや失敗したファイルはそのフォルダに残りますが、見出しは常に「このフォルダの中身は移動しました」でした。実際には残っているのに移動済みと読めてしまいます。残件数を出し分けるようにしました(処理途中の場合も明示します)。
3. 再実行・自動再開で過去の記録が消えない(バグ修正)
再実行や 4.5 分制限による自動再開では「まだ残っているファイルだけ」が処理されます。素直に書き出すと、前回移動したファイルの行が一覧から消えてしまいます。
検証
pnpm typecheck通過—を含むケース、中断からの再開、再実行での上書き、見出しの出し分け、ドライラン、上限超過時の省略、ID 抽出を含みます補足
Generated by Claude Code