Skip to main content

Module prerun

Module prerun 

Source
Expand description

Pre-run self-update hook.

Registers a rtb_app::command::BUILTIN_PRERUN_HOOKS entry that runs the throttled crate::policy check before every command dispatch (the application run loop awaits it). This keeps rtb-cli decoupled from rtb-update: the binary links this crate, the hook self-registers.

Behaviour by policy (after the throttle + version check in crate::policy::evaluate):

  • Disabled (default) — the hook returns immediately; zero overhead.
  • Prompt — on a newer release, print a notice; check failures are non-fatal (advisory — they must not block the user’s command).
  • Enabled — on a newer release, update before running; a check or update failure aborts the run with a diagnostic.

Gating: the hook is inert unless release_source is set and the policy is not Disabled. (The runtime Feature::Update flag is not reachable here — App does not carry the active Features — so feature-level gating is a documented follow-up; in practice the Disabled default makes the hook a no-op for tools that have not opted in.)

See docs/development/specs/2026-06-23-rtb-update-policy-v0.1.md.