Skip to content

feat: Environment preparation: ignore a cache-only node_modules the package manager doesn't manage (#785) - #788

Merged
mabry1985 merged 1 commit into
mainfrom
feat/bd-rb6zb-environment-preparation-ignore-a-cache-o
Nov 18, 2026
Merged

mabry1985 merged 1 commit into
mainfrom
feat/bd-rb6zb-environment-preparation-ignore-a-cache-o

Conversation

@mabry1985

Copy link
Copy Markdown
Member

Summary

A cache-only node_modules no longer counts as an installed environment, so it can't fail restore with "setup_cmd did not recreate environments" (#785). The three targeted test files pass (44 tests); the full suite was not run.

  • Rule (worktree.py, new _stray_node_modules): a node_modules is skipped when it is a real directory holding only hidden entries, with no package-manager state inside and no package.json beside it. It is logged once per directory at info and never quarantined or deleted.
  • Where it applies: _installed_environments (so promotion markers stop naming strays) and the pending marker read back in restore_worktree_environment (so an old marker naming a stray no longer blocks).
  • Deviation from the card, on purpose: the card says to skip any node_modules without .modules.yaml, .package-lock.json, .yarn-state.yml, .yarn-integrity or a sibling package.json. Taken literally, that breaks existing tests in tests/test_promoted_worktree_environment.py and tests/test_environment_restore_737.py, which require an empty or package-holding node_modules with no package.json to stay an environment. So a directory is ignored only when it is positively cache-shaped; these still count as environments:
    • an empty directory;
    • a symlink;
    • a directory holding any non-hidden entry;
    • a directory holding .bin or .pnpm.
  • Tests (tests/test_environment_stray_node_modules_785.py, new):
    • a cache-only directory is not reported, does not block restore, and is left in place;
    • an old marker naming it does not block;
    • a stray beside a real environment leaves only the real one rebuilt;
    • each manager marker and the package.json root case are still reported and still required after setup_cmd.
  • Unlisted file: changelog.d/785.md. The card says there is no CHANGELOG, but recent commits each add a fragment there, so I added one; drop it if unwanted.
  • ruff format . left all 237 files unchanged. No existing behaviour was removed.

Fixes #785

@mabry1985 mabry1985 added the reviewer-of-record:board Reviewed by the project board's review gate (reviewer of record) label Nov 18, 2026

@protoreview protoreview Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA panel review — PASS

reviewer-of-record · head 9b1c9a00ad9d · formal

Reviewer of record: project board. This PR is labelled reviewer-of-record:board, so its review belongs to that reviewer, and its board/review-gate status is success at 9b1c9a00ad9d (“Review gate clean — 0 finding(s), none blocking”). This PASS carries that verdict into the gates that read this panel's; no panel ran on this head. Comment @vera review for an independent review.

No findings — the review came back clean.

findings JSON (machine-readable)
[]

@protoreview protoreview Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Promoting the PASS verdict for head 9b1c9a00ad9d: all checks terminal-green, zero unresolved review threads. (approve-on-green)

@mabry1985
mabry1985 merged commit acb8314 into main Nov 18, 2026
6 checks passed
@mabry1985
mabry1985 deleted the feat/bd-rb6zb-environment-preparation-ignore-a-cache-o branch November 18, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewer-of-record:board Reviewed by the project board's review gate (reviewer of record)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Environment preparation treats a gitignored stray cache dir as an environment setup_cmd must recreate

1 participant