Repository navigation
fix(can-hat): install can_watchdog.sh と can_diag.sh (PR#18 review C1) - #20
Merged
Merged
Conversation
can_watchdog.service's ExecStart=/opt/can_tools/can_watchdog.sh was never satisfied: install.sh's files_to_install listed the unit but not the script it runs (or can_diag.sh, which shares its lock/pause contract), so the watchdog would crash-loop on every boot and bus-off recovery would never happen. Add both to files_to_install, and add a test asserting every installed unit's ExecStart target exists and is executable after install. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
RyodoTanaka
commented
Oct 15, 2026
RyodoTanaka
left a comment
Member
Author
There was a problem hiding this comment.
Opus レビュー(PR #18 C1 の修正)
判定: マージ可(CI の shellcheck はレビュー時点で pending。緑を確認してからマージ)
確認したこと
- enable 対象の 3 unit の ExecStart と source 先はすべて配置される:
canhat_fd_rename.service→canhat_fd_rename.bash→can_tools_lib.bashcanhat_fd_setup.service→enable_canhat_fd.sh→can_tools_lib.bash/canhat_fd_setup.bashcan_watchdog.service→can_watchdog.sh(今回追加)→$(dirname)/can_tools_lib.bashcan_diag.sh(今回追加)→can_tools_lib.bash
- 再現: 追加した 2 行を戻すと Scenario 9 が 2 件 FAIL(67/69)。修正ありでは 69/69 pass。修正を戻せば落ちる試験になっている。
- 変更は install.sh の 2 行と試験の追加だけで、範囲外の変更は無い。
指摘
- クリティカル / 高 / 中: なし
- 低: Scenario 9 は ExecStart の basename だけを見ていて、ExecStart から source されるファイル(lib)までは見ていない。また
*.serviceが 0 件でも素通りで pass になり、-/+接頭辞の ExecStart にも対応していない。いずれも将来の補強でよい。
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.
変更点
install.shのfiles_to_installにcan_watchdog.shとcan_diag.shを追加。can_watchdog.serviceのExecStart=/opt/can_tools/can_watchdog.shが配置されない本体を指しており、再起動のたびに watchdog がクラッシュループし、bus-off からの復旧が機能しない状態だった
(PR#18 レビュー C1)。
can_diag.shは watchdog とロック/一時停止の契約を共有する運用スクリプトとして同様に追加。
tests/test_install_idempotent.shに Scenario 9 を追加: install 後、配置された全 unit のExecStart実行ファイルが配置先に存在し実行可能であることを検証。修正を戻すと本 Scenario が失敗することを確認済み。
Refs #9
試験結果
bash tests/test_install_idempotent.sh: 69 passed, 0 failedshellcheck -S warning install.sh tests/test_install_idempotent.sh: 警告なし🤖 Generated with Claude Code