fix(hooks): skip checkpoint-policy warning for detached trail-refresh · Entire

fix(hooks): skip checkpoint-policy warning for detached trail-refresh

71c5a4c→main·

suhaanthayyil·6d ago·2 files·+5 added/-1 removed

The detached __refresh_trail_enablement background command inherits the post-run checkpoint-policy warning path, unlike its sibling __send_analytics. Its stdout/stderr are discarded so nothing leaks, but it still does a pointless repo-open and local policy read on every spawn. Add it to the warning-exclusion list for parity with the other hidden background commands.

Changes

2

24 unmodified lines

25
26
27
28
28
29
30
31

24 unmodified lines

func isCheckpointPolicyWarningExcludedCommand(name string) bool {
    switch name {
    case "hooks", "__send_analytics", "curl-bash-post-install":
    case "hooks", "__send_analytics", "__refresh_trail_enablement", "curl-bash-post-install":
        return true
    default:
        return false

Mcmd/entire/cli/checkpoint_policy_warning.go+1/-1

46 unmodified lines

47
48
49
50
51
52
53
54
55
56
57
58

46 unmodified lines

sendAnalytics := &cobra.Command{Use: "__send_analytics", Hidden: true}
    root.AddCommand(sendAnalytics)

refreshTrailEnablement := &cobra.Command{Use: "__refresh_trail_enablement", Hidden: true}
    root.AddCommand(refreshTrailEnablement)

require.True(t, ShouldCheckCheckpointPolicyWarning(visible))
    require.True(t, ShouldCheckCheckpointPolicyWarning(hiddenAlias))
    require.False(t, ShouldCheckCheckpointPolicyWarning(gitHook))
    require.False(t, ShouldCheckCheckpointPolicyWarning(sendAnalytics))
    require.False(t, ShouldCheckCheckpointPolicyWarning(refreshTrailEnablement))
}

Mcmd/entire/cli/checkpoint_policy_warning_test.go+4