Skip to content

fix(workspace): never migrate scaffold-committed or template gitignore lines - #1146

Merged
c-vigo merged 2 commits into
devfrom
bugfix/1145-gitignore-migration-shadow
Jul 16, 2026
Merged

c-vigo merged 2 commits into
devfrom
bugfix/1145-gitignore-migration-shadow

Conversation

@c-vigo

@c-vigo c-vigo commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

The #1111 gitignore migration (migrate_root_gitignore() in assets/init-workspace.sh) copied consumer lines from the old root .gitignore into .gitignore.project with two defects, both observed live on the sync-issues-action 1.3.0 deploy (field report: vig-os/sync-issues-action#106, PR vig-os/sync-issues-action#108):

  1. It migrated entries that shadow scaffold-COMMITTED files. The old Python-template .gitignore shipped .envrc; in direnv mode .envrc is scaffold-committed for nix-direnv onboarding (T4.2 — Downstream pattern: minimal flake stub (non-overwriting) + nix2container production builder #640). Because .gitignore.project is appended to the regenerated root .gitignore ([BUG] Managed .gitignore rewrite (#1024) drops consumer-required ignores with no durable committed extension point for repo-root paths #1092), the migrated entry silently kept the scaffolded .envrc untracked and broke direnv onboarding on every clone.
  2. It migrated stale devkit language-template junk as if consumer-authored. The managed set was built from the template base plus the DETECTED languages' fragments only, so a repo that switched language templates (old Python-flavored managed .gitignore, now a Node repo) got ~90 lines of __pycache__//.tox/-style template material dumped into its consumer-owned file.

Fix (two never-migrate rules)

  • Rule 1 — scaffold-committed denylist: entries whose pattern equals a file the scaffold itself commits never migrate: .envrc, .gitignore.project, flake.nix, flake.lock, justfile, justfile.project, .vig-os. These are literal file names, not glob patterns, so a plain literal line match suffices (commented in the code).
  • Rule 2 — filter against ALL fragments: the managed set now iterates every gitignore.d/*.gitignore fragment instead of only the detected languages'. The OLD root .gitignore was a devkit-managed template for whatever language set applied back then, so any line found in ANY devkit fragment is template material, never consumer-authored.

Order, dedup, idempotency, and append-only behavior are unchanged; the function's header comment documents both rules.

Test evidence (strict TDD)

Notes

Closes #1145

Note: Closes #N does not auto-close on dev-targeted merges in this repo (main-only) — close #1145 manually on merge.

Refs: #1145

c-vigo added 2 commits July 16, 2026 10:30
…leaks

Pin two migrate_root_gitignore defects observed live on the
sync-issues-action 1.3.0 deploy (vig-os/sync-issues-action#106, PR #108):
a scaffold-committed .envrc entry migrated into .gitignore.project
shadows the committed file and breaks direnv onboarding, and lines from
a NON-detected language fragment (old Python template junk on a Node
repo) migrate as if consumer-authored.

Refs: #1145
…e lines

migrate_root_gitignore (#1111) had two defects, observed live on the
sync-issues-action 1.3.0 deploy (vig-os/sync-issues-action#106, PR #108):

1. It migrated entries that shadow scaffold-COMMITTED files: the old
   Python-template .gitignore shipped .envrc, and since
   .gitignore.project is appended to the regenerated root .gitignore
   (#1092), the migrated entry kept the scaffolded .envrc (#640)
   untracked and broke direnv onboarding on every clone. A never-migrate
   denylist of scaffold-committed file names (.envrc,
   .gitignore.project, flake.nix, flake.lock, justfile,
   justfile.project, .vig-os) now guards these; literal file names, so a
   plain literal line match suffices.

2. It treated stale devkit language-template lines as consumer-authored:
   the managed set covered only the DETECTED languages' fragments, so a
   repo that switched language templates inherited ~90 lines of
   cross-language junk in its consumer-owned file. The managed set is
   now built from ALL gitignore.d fragments — any line found in any
   devkit fragment is template material, never migrated.

Order, dedup, idempotency, and append-only behavior are unchanged.

Refs: #1145
@c-vigo
c-vigo merged commit 7c409d4 into dev Jul 16, 2026
13 checks passed
@c-vigo
c-vigo deleted the bugfix/1145-gitignore-migration-shadow branch July 16, 2026 08:55
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