Skip to content

fix(init): classify the preview through the pruned candidate emitter - #1722

Merged
c-vigo merged 3 commits into
devfrom
bugfix/1716-preview-walk-prunes
Sep 25, 2026
Merged

c-vigo merged 3 commits into
devfrom
bugfix/1716-preview-walk-prunes

Conversation

@c-vigo

@c-vigo c-vigo commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Description

#1715 made COPY_PRUNE_NAMES=(.git .venv) the single source of truth for the copy step's prunes, consumed by both rsync copies and by emit_template_candidates (the u+w sweep, the substitution pass, the +x sweep). The --preview classifier was left out because it needs the source-relative path for destinations that do not exist yet. It kept its own ! -path "*/.git/*" ! -path "*/.venv/*", which differs in kind: -path skips only a directory's contents, while the emitter, like rsync, prunes any entry named .git or .venv. So a file with one of those names, at any depth, was reported as ADDED but never copied.

dest → rel is lossless — both sides glue with the same "$WORKSPACE_DIR/" — so the preview now consumes the emitter and strips the prefix. That deletes the duplicated walk and gains the -L / -mindepth 1 / basename-prune semantics for free. The emitter moves up next to COPY_PRUNE_NAMES (a pure, verbatim move) because the preview block precedes its old definition point. -type f stays explicit (the emitter defaults to -true). The two docs/issues|pull-requests predicates stay, with their comment corrected: they came from #951 to mirror rsync excludes that #1466 later deleted, the template ships neither path, so they are report-only.

The report is byte-identical on the pristine template: --preview --force before and after diffed clean (117 ADDED rows, same order) — the prune only removes entries and traversal order is unchanged.

Type of Change

  • feat -- New feature
  • fix -- Bug fix
  • docs -- Documentation only
  • chore -- Maintenance task (deps, config, etc.)
  • refactor -- Code restructuring (no behavior change)
  • test -- Adding or updating tests
  • ci -- CI/CD pipeline changes
  • build -- Build system or dependency changes
  • revert -- Reverts a previous commit
  • style -- Code style (formatting, whitespace)

Modifiers

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

Changes Made

assets/init-workspace.sh

tests/bats/init-workspace.bats

Changelog Entry

No changelog needed — the issue says so; the visible change is two phantom preview rows for a template shape devkit does not ship.

Testing

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

Manual Testing Details

  • bats -j 4: init-workspace.bats 305/306 (the one failure is pre-existing and environmental — test 296 needs PyYAML in the plain nix develop python; identical at the parent commit), upgrade-atomicity.bats 6/6, install.bats 95/95
  • Pristine-template --preview --force report before vs after: identical
  • shellcheck -x and bash -n clean; file mode still 100755; prek run --all-files → 55 hooks passed

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 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 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

Rewriting the script through a temp file and mv silently dropped its executable bit once during implementation; the structural BATS test caught it and the committed blob is 100755.

Refs: #1716

@c-vigo
c-vigo merged commit 307bb7d into dev Sep 25, 2026
15 checks passed
@c-vigo
c-vigo deleted the bugfix/1716-preview-walk-prunes branch September 25, 2026 18:08
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