Skip to content

feat(workspace): ship a doctor host-preflight recipe on the consumer surface - #1451

Merged
c-vigo merged 5 commits into
release/1.8.0from
feature/1448-consumer-doctor-recipe
Aug 12, 2026
Merged

c-vigo merged 5 commits into
release/1.8.0from
feature/1448-consumer-doctor-recipe

Conversation

@c-vigo

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

Copy link
Copy Markdown
Contributor

Description

Implements #1448. Targets release/1.8.0 — the train is cut and 1.8.0-rc1 is tagged; this lands ahead of rc2.

just doctor (#1418, extended with a core.hooksPath diagnostic in #1430) existed only in devkit's own justfile. The scaffolded consumer surface shipped no equivalent, so a consumer clone got no host preflight at all — the same "configured, believed active, never executed" failure #1430 documents, in the population devkit actually ships to, where the person committing is least likely to know devkit's installer exists.

Type of Change

  • feat -- New feature
  • test -- Adding or updating tests
  • refactor -- Code restructuring (no behavior change)

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Changes Made

  • assets/workspace/justfile -- new [group('info')] doctor recipe. Diagnostics only: PASS/WARN lines, always exits 0. Reports git identity, commit signing, core.hooksPath, ssh-agent and gh auth.
  • tests/bats/consumer-doctor.bats -- 14 tests driving the real shipped justfile in a fixture workspace, using the doctor.bats harness idiom (GIT_CONFIG_GLOBAL/GIT_CONFIG_SYSTEM pinned, SSH_AUTH_SOCK stripped, stub gh) so host state never leaks in.
  • CHANGELOG.md (+ hook-synced mirror) -- entry under the 1.8.0 ### Added.

Why the managed root justfile. It is the only managed justfile layer present in every delivery mode — direnv/bare ship no .devcontainer/ — and justfile.project is a PRESERVE_FILES entry, so a recipe placed there would never reach an existing consumer on upgrade. (Note: the .devcontainer/justfile.base layer named in the issue's context was retired in 0.4.0 and no longer exists.)

Mode-aware remediation. Devkit's hint is ./scripts/init.sh, a file no consumer has. The consumer hint is driven by DEVKIT_MODE in .vig-os, with the universal command always first and the mode entry point named on top of it:

mode inert-hooks WARN tail
direnv (run: git config core.hooksPath .githooks); normally set on dev-shell entry: run direnv allow
devcontainer (run: git config core.hooksPath .githooks); normally set by the devcontainer setup: reopen the container
both (run: …); normally set by the devcontainer setup (reopen the container) or on dev-shell entry (direnv allow)
bare / no .vig-os (run: git config core.hooksPath .githooks) — nothing wires it, so no entry point is named

./scripts/init.sh never appears in any mode, and that is test-enforced. The .vig-os read uses the same sed -n 's/^KEY=//p' … | head -n1 form the scaffolded devkit-upgrade.yml already uses.

Sharing vs. duplication — two implementations, drift pinned by a test. Three sharing routes were evaluated and rejected: a synced shared script (needs a brand-new always-shipped managed root path — .devcontainer/ is absent in direnv/bare and there is no scaffolded root scripts/); a manifest transform (scripts/manifest.toml transforms whole files, so splicing one recipe from file A into file B needs a new transform type bought for a single recipe); and importing devkit's justfile (never scaffolded, full of image/release recipes). The two also genuinely differ in behavior, not just wording — see the hint table.

Rather than force the abstraction, the shared contract is pinned: consumer doctor checks exactly what devkit's doctor checks runs both recipes under the same controlled environment, extracts the check labels from the PASS|WARN <label>: lines, and asserts the sets are non-empty and identical. Adding a check to one and not the other now fails CI.

Manifest/sync wiring: none needed, and verified why. scripts/manifest.toml governs only files copied from the repo root into assets/workspace/; assets/workspace/justfile is authored directly in the scaffold tree, picked up by init-workspace.sh's rsync of TEMPLATE_DIR, and already in the never-migrate managed literal list (assets/init-workspace.sh:1124). The .vig-os manifest contract suite declares keys; this adds no knob, it only reads the existing DEVKIT_MODE.

Changelog Entry

Placed in ## [1.8.0] - TBD -> ### Added, not ## Unreleased: the changelog was frozen for 1.8.0 at 046ca547, and the post-freeze fixes on this branch (#1443, #1444, #1447) all did the same. An Unreleased entry would be stranded out of these release notes.

### Added

- **`just doctor` now ships on the consumer surface** ([#1448](https://github.com/vig-os/devkit/issues/1448))

Testing

  • Tests pass locally
  • Manual testing performed (describe below)

Manual Testing Details

  • Baseline on the pristine branch point b60b306a: bats tests/bats/ -> 482 ok, exit 0; uv run pytest tests/ -q -> 1 failed, 776 passed, 20 skipped.
  • RED: bats tests/bats/consumer-doctor.bats -> 14/14 not ok, all error: justfile does not contain recipe 'doctor' (the drift guard failing on an empty consumer label set while printing devkit's six).
  • GREEN, post-merge of release/1.8.0: bats tests/bats/ -> 496 ok, 0 failures, exit 0 (482 + 14 new).
  • uv run pytest tests/test_flake_hooks.py -> 63 passed, exit 0 (confirms [BUG] check-expirations consumer fragment still resolves through the project venv (uv run) instead of a store path #1447's tests still hold after the merge).
  • prek run --all-files -> exit 0, fully green.
  • Full pytest: 776 passed, 20 skipped, 1 failed — the known tests/test_image.py::TestFileStructure::test_manifest_files. Verified pre-existing, and provably the stale image: the destination sha is byte-identical between the baseline and final runs (0b4f7b0ff94c…); only the source sha moved when CHANGELOG.md was edited. CI rebuilds the image.

Real output, from workspaces produced by the actual assets/init-workspace.sh --no-prompts --mode <mode>:

############ mode=direnv | hooksPath UNSET (fresh clone) ############
vigOS devkit doctor
===================
PASS git user.name: Carlos Vigo
PASS git user.email: …
WARN commit signing: incomplete (…)
WARN git hooks: core.hooksPath not set, .githooks is tracked but inert (run: git config core.hooksPath .githooks); normally set on dev-shell entry: run direnv allow
PASS ssh-agent: reachable with 9 key(s)
PASS gh auth: logged in
EXIT=0
############ mode=direnv | hooksPath WIRED ############
PASS git hooks: core.hooksPath -> .githooks
############ mode=direnv | hooksPath ELSEWHERE ############
WARN git hooks: core.hooksPath=.git/hooks, expected .githooks (run: …); normally set on dev-shell entry: run direnv allow
############ mode=devcontainer | hooksPath UNSET ############
WARN git hooks: … normally set by the devcontainer setup: reopen the container
############ ad-hoc checkout: no .vig-os ############
WARN git hooks: core.hooksPath not set, .githooks is tracked but inert (run: git config core.hooksPath .githooks)
EXIT=0

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 (edit docs/templates/, then run just docs)
  • I have updated CHANGELOG.md (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

Known limitation, worth a follow-up covering both doctors together. Linked worktrees are not special-cased. justfile.worktree deliberately --unsets core.hooksPath and installs prek hooks into .git/hooks, and githooksPathHook guards itself to the main worktree — so just doctor inside a just worktree-start worktree reports WARN git hooks … inert when the hooks are in fact live. Devkit's own doctor has the identical behavior today, so this is not a regression, but a diagnostic that lies is exactly the failure class #1430 is about. Left alone here under YAGNI/minimal-diff given this is an rc; the fix (detect git-dir != common-dir, then PASS on an installed .git/hooks/pre-commit) should land in both recipes at once.

Not done deliberately: no consumer docs edit (the scaffolded README.md is a seeded stub enumerating no recipes), no .vig-os knob, no changes to devkit's own justfile.

Closes #1448

Refs: #1448

@c-vigo
c-vigo merged commit f49c645 into release/1.8.0 Aug 12, 2026
12 checks passed
@c-vigo
c-vigo deleted the feature/1448-consumer-doctor-recipe branch August 12, 2026 09:49
c-vigo added a commit that referenced this pull request Aug 12, 2026
…lbacks (#1460)

## Description

Fixes #1459. **Targets `release/1.8.0`.** Restores the #1447 and #1448
content that two failed `release.yml` dispatches stripped off the
release branch.

Both PRs (#1449, #1451) merged green and both issues are closed, but the
content is absent from the branch tip. Without this, 1.8.0 would ship
claiming two fixes it does not contain, and the changelog would omit
both.

| Rollback commit | Time | Triggering run | Destroyed |
|---|---|---|---|
| `71cd72fb` | 09:49Z | `31583273344` (failed: `Candidate tag
'1.8.0-rc2' already exists on origin`) | **#1447** — `nix/hooks.nix`
fix, 102 lines of tests, changelog entry |
| `c1cc5d82` | 09:59Z | `31584765199` (failed: validate's PR gate —
#1441 is a draft with `REVIEW_REQUIRED`) | **#1448** — 77-line `doctor`
recipe, 241-line `consumer-doctor.bats`, changelog entry |

## Type of Change

- [x] `revert` -- Reverts a previous commit

### Modifiers

- [ ] Breaking change (`!`) -- This change breaks backward compatibility

## Changes Made

`git revert --no-commit c1cc5d8 71cd72f`, squashed into one commit. No
hand edits, no conflicts:

```
CHANGELOG.md                                |  31 ++
assets/workspace/.devcontainer/CHANGELOG.md |  31 ++
assets/workspace/justfile                   |  77 ++
nix/hooks.nix                               |  12 +-
tests/bats/consumer-doctor.bats             | 241 ++
tests/test_flake_hooks.py                   | 102 ++
6 files changed, 490 insertions(+), 4 deletions(-)
```

## Root cause (tracked separately — not fixed here)

`release.yml`'s **Rollback on Failure** job
(`.github/workflows/release.yml:1551`) builds a commit whose **tree is
`PRE_SHA`** — the branch tip captured when `validate` started — parented
onto the current tip. A tree-level reset expressed as a commit.

Two properties make it destructive:

1. It runs when **`validate`** fails. `Finalize Release` was **skipped**
in both runs — nothing needed rolling back — yet the tree was reset
anyway.
2. `PRE_SHA` is a run-start snapshot, so **anything merged to the
release branch while a release run is in flight is destroyed if that run
fails**, related to the release or not.

The trigger was merging into the release branch while a run was live.
The defect is that a rollback for a step that never executed discards
unrelated merged commits. Filed separately; this PR only restores
content.

**Interim operating rule:** never merge into a release branch while a
`release.yml` run is in flight.

## Changelog Entry

No new entry. This restores the #1447 and #1448 entries that the
rollbacks deleted from the `## [1.8.0] - TBD` section; adding a
"restored the changelog" bullet would be noise in the released notes.

## Testing

- [x] Tests pass locally
- [x] Manual testing performed (describe below)

### Manual Testing Details

Content restoration verified item by item on the branch:

| item | present |
|---|---|
| `check-expirations` store-path entry (`nix/hooks.nix`) | yes |
| `TestNoConsumerHookResolvesVigUtilsThroughTheVenv` | yes |
| consumer `doctor` recipe (`assets/workspace/justfile`) | yes |
| `tests/bats/consumer-doctor.bats` | yes |
| changelog entries #1447 / #1448 | yes / yes |
| #1434 title bullet (from #1453) | exactly 1, not duplicated |

- `bats tests/bats/` -> **496 ok, 0 not ok, exit 0** — exactly the
pre-loss baseline, confirming #1448's 14 tests are back and passing.
- `uv run pytest tests/test_flake_hooks.py` -> 63 passed, exit 0 —
#1447's tests restored and green.
- `uv run pytest tests/ -q` -> 780 passed, 20 skipped, 1 failed. The
single failure is the known
`tests/test_image.py::TestFileStructure::test_manifest_files`, which
checksums the working-tree `CHANGELOG.md` against a stale locally cached
devcontainer image; it reproduces on a clean `dev` without this branch,
and CI rebuilds the image.
- `prek run --all-files` -> exit 0, fully green.
- `git status` clean; no stray or untracked files in the revert.

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have updated the documentation accordingly
- [x] I have updated `CHANGELOG.md` (restores the deleted entries)
- [x] My changes generate no new warnings or errors
- [x] I have added tests that prove my fix is effective or that my
feature works (restores the deleted tests)
- [x] New and existing unit tests pass locally with my changes
- [x] Any dependent changes have been merged and published

## Additional Notes

**Merge only while no `release.yml` run is in flight** — otherwise this
PR is subject to the very defect it repairs. I will re-check immediately
before merging.

**`1.8.0-rc2` is stale.** It is tagged at `b60b306a`, which predates
#1447, #1448, #1453 and #1454. After this lands (and #1454 after it) the
branch matches no existing RC, so a fresh candidate is warranted before
finalize rather than finalizing content no RC validated. Published tags
are immutable, so it must be rc3 — re-dispatching rc2 is what failed at
09:31.

#1454 is complete and pushed but not yet PR'd: its
`consumer-doctor.bats` additions conflict until this restores the base
file.

Closes #1459

Refs: #1459
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