Skip to content

fix: route move_context_files renames through the fault-injection choke point - #592

Merged
t0k0sh1 merged 1 commit into
mainfrom
586-persistence-choke-point-gap
Aug 12, 2026
Merged

fix: route move_context_files renames through the fault-injection choke point#592
t0k0sh1 merged 1 commit into
mainfrom
586-persistence-choke-point-gap

Conversation

@t0k0sh1

@t0k0sh1 t0k0sh1 commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • move_context_files used a bare fs::rename, so the crate's highest-risk multi-step FS operation (a ten-file family move) was the one thing fail_persistence_ops_after could never reach — even though storage.rs's own doc claimed every persistence operation was covered.
  • Route it through the shared rename_persisted_file choke point like every other rename in the crate, and correct the doc to say precisely what is and isn't covered (fsync and plain reads are deliberately outside the net — durability and read paths have no write-ordering story to get wrong).
  • Update the one existing test whose comment documented the bypass as a workaround, and add two new tests exercising the pivot-failure and post-pivot-straggler contracts through the injector directly.

Part of #586 (persistence-layer diagnosability audit from #533). Refs #586.

Test plan

  • cargo fmt
  • cargo clippy --all-targets (clean)
  • cargo test (full suite green)
  • Pre-PR mutation gate (cargo mutants --in-diff): 1 mutant, 1 caught, 0 missed

https://claude.ai/code/session_013NPb5cDU8ojZAKGJaq8rYy

Summary by CodeRabbit

  • バグ修正

    • コンテキストファイルの移動処理に失敗した場合でも、処理状態を正しく保持し、次回起動時に再試行できるよう改善しました。
    • 複数ファイルの移動中に一部でエラーが発生した際の処理継続とエラー報告を改善しました。
    • ファイル移動や保存処理における障害発生時の整合性と復旧性を向上しました。
  • テスト

    • ファイル移動の途中で失敗するさまざまなケースを追加検証しました。

…ke point

move_context_files used a bare fs::rename, so the crate's highest-risk
multi-step FS operation (a ten-file family move) was the one thing
fail_persistence_ops_after could never reach, even though storage.rs's
own doc claimed every persistence operation was covered. Route it
through rename_persisted_file like every other rename, correct the
doc to say what is and isn't covered (fsync and reads are deliberately
outside the net), and update the one existing test whose comment
documented the bypass as a workaround.

Refs #586
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0480c8ed-efd0-461d-b2d0-e2949b72d0a1

📥 Commits

Reviewing files that changed from the base of the PR and between f2b6441 and f32c040.

📒 Files selected for processing (4)
  • src/registry.rs
  • src/registry/lifecycle.rs
  • src/registry/meta_io.rs
  • src/storage.rs

📝 Walkthrough

Walkthrough

各ファイルの rename を rename_persisted_file 経由に変更しました。障害注入の対象範囲を明確化し、pivot rename、後続ファイル移動、再開時のマーカー保持をテストします。

Changes

リネーム永続化処理

Layer / File(s) Summary
永続化障害注入の対象定義
src/storage.rs
公開 rename、同一ディレクトリ内の移動、アンリンク、WAL 操作を障害注入対象として明記しました。ディレクトリ fsync と読み取りは対象外としました。
コンテキストファイル移動と再開検証
src/registry.rs, src/registry/meta_io.rs, src/registry/lifecycle.rs
各 rename を rename_persisted_file 経由に変更しました。pivot rename の失敗時に後続移動を停止し、pivot 後の副次ファイルの失敗時に後続移動を継続する動作をテストします。再開時のグループ書き込み失敗では、リネームマーカー保持と次回起動時の再試行を検証します。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • t0k0sh1/taguru#568: レジストリの rename 障害復旧と、メンバーシップ永続化失敗時のマーカー保持を扱います。
  • t0k0sh1/taguru#576: src/registry/lifecycle.rs の rename 再開動作と永続化障害後の再試行を扱います。
  • t0k0sh1/taguru#589: src/registry/meta_io.rsmove_context_files の rename および fsync エラー処理を扱います。
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed タイトルは、move_context_files の rename 処理をフォールト注入の共通経路へ変更する主目的を明確に示しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 586-persistence-choke-point-gap

Comment @coderabbitai help to get the list of available commands.

@t0k0sh1
t0k0sh1 merged commit d7400ee into main Aug 12, 2026
15 checks passed
@t0k0sh1
t0k0sh1 deleted the 586-persistence-choke-point-gap branch August 12, 2026 03:07
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