Skip to content

Deduplicate watchdog pre-abort threshold derivation (0.75x floored) #3912

Description

@tomerweller

Follow-up from PR #3911 (issue #3767). Non-blocking simplification concern raised by the correctness reviewer; reviewer APPROVEd rather than requesting changes, so filing as backlog.

Concern

crates/app/src/app/mod.rs — the pre-abort threshold derivation (abort_threshold_secs * 3 / 4).max(1) (0.75x floored at 1, 0 when disabled) is duplicated in two places:

  • WatchdogSnapshot::pre_abort_threshold_secs() (method)
  • emit_watchdog_started_line() (free fn, boot-diagnostics line)

Both are documented as needing to stay in sync and both are test-pinned (the boot-line test asserts pre=90 for abort=120), so there is no current drift. Extracting a single shared const fn (e.g. derive_pre_abort_threshold(abort: u64) -> u64) called from both sites would remove the drift risk entirely.

Severity

Low / non-blocking — maintainability nit, no behavioral defect.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    crate:apphenyey-app crateenhancementNew feature or requestfollow-upDeferred work from a completed implementationlowLow severity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions