Skip to content

fix(can-hat): install can_watchdog.sh と can_diag.sh (PR#18 review C1) - #20

Merged
RyodoTanaka merged 1 commit into
developfrom
fix/install-watchdog-files
Oct 15, 2026
Merged

RyodoTanaka merged 1 commit into
developfrom
fix/install-watchdog-files

Conversation

@RyodoTanaka

Copy link
Copy Markdown
Member

変更点

  • 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 failed
  • shellcheck -S warning install.sh tests/test_install_idempotent.sh: 警告なし

🤖 Generated with Claude Code

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 RyodoTanaka left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opus レビュー(PR #18 C1 の修正)

判定: マージ可(CI の shellcheck はレビュー時点で pending。緑を確認してからマージ)

確認したこと

  • enable 対象の 3 unit の ExecStart と source 先はすべて配置される:
    • canhat_fd_rename.service → canhat_fd_rename.bash → can_tools_lib.bash
    • canhat_fd_setup.service → enable_canhat_fd.sh → can_tools_lib.bash / canhat_fd_setup.bash
    • can_watchdog.service → can_watchdog.sh(今回追加)→ $(dirname)/can_tools_lib.bash
    • can_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 にも対応していない。いずれも将来の補強でよい。

@RyodoTanaka
RyodoTanaka merged commit bbf5bff into develop Oct 15, 2026
2 checks passed
@RyodoTanaka
RyodoTanaka deleted the fix/install-watchdog-files branch October 15, 2026 07:25
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