Repository navigation
#676 [tests] planner の issue458 の試験が root(Docker uid 0)で落ちる:昇格の失敗を権限に頼らない形にする - #681
Merged
Kewton merged 1 commit intoOct 15, 2026
Conversation
…r tests 判断: recovery_contract_binding:275 は製品コードであり、そのテストは readonly() ビットのみを検証しているため root (uid 0) でも pass することを確認し、製品コードおよびテストは無変更とした 読み替え: path_guard:990 の黙った return を tests/missing_read_paths と同じく unprivileged account 要求の明示的 assert_eq! に揃えた
5 tasks
Kewton
deleted the
feature/issue-676-tests-planner-issue458-root-docker-uid-0
branch
October 17, 2026 10:36
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.
Refs #676
概要
issue458 の
promotionの mode は、workspace のapp.txtを読み取り専用にして、昇格の書き込みを失敗させていました。root はファイルの権限(DAC)を無視するので、Docker の uid 0 では書き込みが成功して昇格が起き、issue458_finish_terminal_observation_and_transaction_matrixが落ちていました。この PR は、昇格の失敗を試験用の故障注入で起こし、権限に頼らない形にします。権限に頼るほかの試験(P3)の扱いもそろえます。
変更の要約
src/planner/recovery_snapshot.rs#[cfg(test)] pub(crate) mod test_hooksを足しました。仕組みは次のとおりです。fail_sync_source_tree_copy_for_workspace(&Path)が guard を返します。guard はDropで元に戻すので、panic しても戻ります。sync_source_treeの copy を失敗させます。sync_source_treeのstd::fs::copyの直前に、#[cfg(test)]の分岐を足しました。エラーの context は製品と同じrestore Recovery control artifact …です。test_hooks_fail_sync_copy_is_scoped_and_resets_on_dropも足しました。src/planner/auto_recovery/issue458_tests.rspromotionの mode で、finishの前に hook を仕込みます。unexpected promotion、source の sha が変わらないこと、NonRecoverable、昇格の event が無いこと、treatment_promotion_failed:の event があること。src/tools/path_guard.rs:権限が効かないときに黙って return していた部分を、理由を出して落ちる assert に替えました。tests/missing_read_paths.rs:判定は同じです。root でも理由の文が必ず出る形にしました。docs/dev/parallel-dev-harness.md:§3a の Docker の規則に「baseline と mutation の両方を uid 1000 で流す」という 1 文を足しました。P3 の分類
src/tools/path_guard.rsensure_bash_write_target_rejects_unreadable_parentrun under an unprivileged account)を出して落ちる。前は黙って pass していたtests/missing_read_paths.rsactual_permission_denial_is_not_ordinary_missingsrc/planner/recovery_contract_binding.rs:275readonly()のビットだけを見る利用者に見える挙動の変化
#[cfg(test)]の部分だけで、製品の挙動・event・schema は変わりません。検証(head
963b24cf)commandmate verifypassed 15/15。最後の commit の後で、clean です。cargo-zigbuild clippy --all-targets --target x86_64-unknown-linux-gnuexit 0。cargo build --releaseの binary のnm・stringsに、hook の記号とsimulated failure copyingの文字列は 0 件でした。--network none、mount なし、--privilegedなし。同じ image で uid 0 と uid 1000 を流しました。issue458_finish_terminal_observation_and_transaction_matrixplanner::recovery_snapshot::(hook の単体試験を含む 8 本)planner::recovery_contract_binding::(5 本)ensure_bash_write_target_rejects_unreadable_parenttests/missing_read_paths(10 本)if mode == "promotion"をif false && …にしたもの。worktree の外の使い捨て)を流しました。promotion: unexpected promotionで FAILED、HEAD では pass でした。つまり、uid 0 で pass したのは hook が昇格の失敗の経路を通しているからです。注意
path_guardで、意図どおりです。🤖 Generated with Claude Code