hk install --global omits --staged; HK_STASH=git defeats pkl stash policy #1030
Unanswered
Distortedlogic
asked this question in
Troubleshooting and Bug Reports
Replies: 1 comment
-
|
Opened a ready-for-review PR for this in #1043: #1043 The PR adds Validation run:
Reported-by credit is included in the commit/PR body. This comment was generated by Codex. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
hk install --globalwriteshook.hk-pre-commit.commandwithout--staged. Any consumer that relies onhk.pklhooks["pre-commit"].stash = "none"can have that invariant silently defeated byHK_STASH=gitenv var (or--stash gitCLI flag), because there is no--stagedon the resolved command line to force staged-only mode.Version
hk 1.48.0git 2.54.0Reproduction
Fresh box.
hk install --global. Confirm:(no
--staged).Any consumer repo with
hk.pkl:Probe:
hk stashes despite
stash = "none"in the consumer config. The env override wins.Expected
Either:
hk install --globalincludes--stagedon the pre-commit hook by default (so hooks default to staged-only mode); orstash = "none"in the pkl-levelhooks[...].stashis authoritative and cannot be overridden byHK_STASHenv /--stashCLI (astrictorfinalsemantics on the pkl field); orhk.stashfrom git-config (whichhk config explain stashclaims to read) is actually consulted at pre-commit time (it currently isn't; see companion issue).Impact
Any fleet-wide
stash = "none"policy is defense-in-depth only. The load-bearing guard is--stagedon the command hk itself writes into~/.gitconfig, so end users have to hand-patchhook.hk-pre-commit.commandafterhk install --globalto enforce the policy theirhk.pkldeclares.Suggested minimal fix
Change
hk install --global(and the local equivalent) to emit:Alternatively, thread a
hk configkey (e.g.hk.default-pre-commit-mode = staged) that bothhk installandhk runconsult.Beta Was this translation helpful? Give feedback.
All reactions