Repository navigation
fix(init-workspace): make post-scaffold dependency sync mode-aware and non-fatal - #1125
Merged
Merged
Conversation
Add regression tests for the post-scaffold `just sync` step: direnv mode must skip the container-side sync entirely, and a failing sync in devcontainer mode must warn-and-continue with init exiting 0. Refs: #1118
…d non-fatal Skip the container-side `just sync` entirely in direnv and bare modes, where the consumer's host nix/direnv shell owns dependency install and a container `npm ci`/`uv sync` would write wrong-platform, wrong-owner artifacts into the bind-mounted workspace. In devcontainer and both modes the sync still runs but warns and continues on failure instead of aborting init with a misleading "Failed to initialize workspace" after an otherwise complete scaffold. Refs: #1118
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
During a direnv-mode
install.sh --forceupgrade, after all scaffold files were written successfully,init-workspace.shranjust sync(npm ci) inside the container; underset -euo pipefaila sync failure (observed:npm error Exit handler never called!) aborted the whole init andinstall.shreported a misleading "Failed to initialize workspace". Two fixes, per the issue's two questions: the container-side sync is now skipped entirely in direnv/bare modes (the consumer's host nix/direnv shell owns dependency install; a container-sidenpm ciwrites wrong-platform, wrong-owner artifacts into the bind-mounted workspace), and where it does run (devcontainer/both) a failure warns and continues so the exit status reflects the scaffold result. Observed on thevig-os/commit-action1.2.1 upgrade (vig-os/commit-action#80).Closes #1118
Type of Change
feat-- New featurefix-- Bug fixdocs-- Documentation onlychore-- Maintenance task (deps, config, etc.)refactor-- Code restructuring (no behavior change)test-- Adding or updating testsci-- CI/CD pipeline changesbuild-- Build system or dependency changesrevert-- Reverts a previous commitstyle-- Code style (formatting, whitespace)Modifiers
!) -- This change breaks backward compatibilityChanges Made
assets/init-workspace.sh(post-scaffold sync block): mode gate —direnv/bareskip the sync with an informational line;devcontainer/bothrun it asjust sync || echo "Warning: …" >&2(warn-and-continue, reusing the established non-fatal post-scaffold idiom). The existing [CHORE] Field-validate 0.4.0-rc4 in real consumer repos before finalize #859 "nosyncrecipe" warn-and-continue branch is preserved. Comment block updated to document both behaviors.tests/bats/init-workspace.bats:_scaffold_syncloghelper (ajuststub that logs invocations and controls thesyncexit code) + two regression tests: direnv mode never invokesjust syncand prints the skip message; devcontainer mode with a failingsyncrecipe exits 0 with the warning (and asserts sync was actually attempted).Changelog Entry
Fixed
direnvandbaremodes the container-sidejust syncis now skipped entirely: the consumer's host nix/direnv shell owns dependency install, and a container-sidenpm ci/uv syncwould write wrong-platform, wrong-owner artifacts into the bind-mounted workspace. An informational line notes the skip.devcontainer/bothmodes the sync still runs but is non-fatal — a failure (e.g.npm error Exit handler never called!) now warns and continues instead of aborting init with a misleading "Failed to initialize workspace", since the scaffold itself is already complete.Testing
just test)Manual Testing Details
tests/bats/init-workspace.bats: 200 tests, 0 failures, exit 0 (implementation run + independent review run).prek run --all-files: green.Checklist
docs/templates/, then runjust docs)CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
Part of the commit-action-deployment bug batch. The image-side root cause of
npm error Exit handler never called!is out of scope here (this PR only removes its blast radius); worth a separate look if it recurs.Refs: #1118