Skip to content

fix(doctor): expand a leading tilde in user.signingkey before the readability test - #1551

Merged
c-vigo merged 3 commits into
devfrom
bugfix/1546-doctor-tilde-signingkey
Aug 20, 2026
Merged

c-vigo merged 3 commits into
devfrom
bugfix/1546-doctor-tilde-signingkey

Conversation

@c-vigo

@c-vigo c-vigo commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Description

just doctor reported WARN commit signing: incomplete for a correctly
configured SSH-signing host whenever user.signingkey is a tilde path
(~/.ssh/<key>.pub). The readability guard used test -r "$signingkey", and
test -r performs no tilde expansion — the shell expands ~ only as an
unquoted literal at the start of a word, never the contents of a variable — so
the check tested a relative path literally named ~ and always failed. Git
itself does expand ~ when it consumes user.signingkey, so signing worked;
only the diagnostic was wrong. A false negative from the recipe whose job is to
rule that failure mode out.

Type of Change

  • fix -- Bug fix

Modifiers

  • Breaking change (!)

Changes Made

  • Expand a leading ~/ against $HOME into a separate keypath variable
    before the -r test, in both copies of the guard: devkit's own
    justfile and the scaffolded assets/workspace/justfile (which must stay in
    sync — consumer doctor checks exactly what devkit's doctor checks pins
    that).
  • The PASS line keeps echoing the raw $signingkey, so the output still
    mirrors git config rather than a rewritten path.
  • Only a leading ~/ is expanded; ~user/... is left alone, and an inline
    ssh-... key value still takes the existing literal-key branch.

Changelog Entry

### Fixed

- **`just doctor` no longer calls a tilde signing-key path incomplete**
  ([#1546](https://github.com/vig-os/devkit/issues/1546))
  - `user.signingkey = ~/.ssh/<key>.pub` is a working SSH-signing setup — git
    expands the leading `~/` when it consumes the value — but the readability
    guard tested it with `test -r`, which performs no tilde expansion, so a
    correctly configured host was told its signing was `incomplete`
  - The guard now expands a leading `~/` against `$HOME` before the test, in
    both the devkit `justfile` and the scaffolded `assets/workspace/justfile`.
    The `PASS` line still reports the raw value, so it keeps mirroring
    `git config`

Testing

  • Tests pass locally
  • Manual testing performed

TDD, RED confirmed before the fix. Four new bats tests (two per copy of the
recipe), each driving a pinned HOME and GIT_CONFIG_GLOBAL so host state
cannot leak in:

  • doctor reports PASS for a tilde signing key path / consumer twin — the
    regression itself. Both failed on the pre-fix recipe with
    WARN commit signing: incomplete (... user.signingkey=~/key.pub).
  • doctor warns when a tilde signing key path does not exist / consumer twin —
    pins that expansion does not turn the guard into a rubber stamp: a tilde path
    to a missing file must still WARN.
tests/bats/doctor.bats           11/11 ok
tests/bats/consumer-doctor.bats  19/19 ok
prek run --all-files             all hooks pass, tree clean

Manual Testing Details

Reproduced on the reporting host (NixOS, direnv mode, real
user.signingkey=~/.ssh/github.pub):

before: WARN commit signing: incomplete (commit.gpgsign=true, gpg.format=ssh, user.signingkey=~/.ssh/github.pub)
after:  PASS commit signing: ssh key ~/.ssh/github.pub

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (no doc template covers this line)
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

Consumers pick this up with their next scaffold/upgrade, since the fix is in the
managed root justfile (the layer that is regenerated on upgrade), not in the
preserved justfile.project.

Refs: #1546

@c-vigo
c-vigo merged commit 9d37073 into dev Aug 20, 2026
12 checks passed
@c-vigo
c-vigo deleted the bugfix/1546-doctor-tilde-signingkey branch August 20, 2026 07:52
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