Skip to content

fix(plugin): remove legacy LOCK_FILE/MONOREPOS_DIR constants#495

Merged
jackwener merged 1 commit intojackwener:mainfrom
ByteYue:fix/plugin-lockfile-path
Mar 27, 2026
Merged

fix(plugin): remove legacy LOCK_FILE/MONOREPOS_DIR constants#495
jackwener merged 1 commit intojackwener:mainfrom
ByteYue:fix/plugin-lockfile-path

Conversation

@ByteYue
Copy link
Copy Markdown
Collaborator

@ByteYue ByteYue commented Mar 27, 2026

Problem

plugin.ts had two parallel path systems:

  • Legacy constants (LOCK_FILE, MONOREPOS_DIR) computed at module load time via os.homedir()
  • Getter functions (getLockFilePath(), getMonoreposDir()) that read process.env.HOME at call time

When tests set HOME for isolation, these diverge — the constants still point to the real home, while the functions point to the test directory.

Fix

Remove the legacy constants. All code now uses getLockFilePath() and getMonoreposDir(). Updated plugin.test.ts to use getLockFilePath().

Testing

All 337 unit tests pass.

Remove the module-level LOCK_FILE and MONOREPOS_DIR constants that were
computed at load time using os.homedir(). These ignored the HOME
environment variable, causing path mismatches when tests use HOME for
isolation.

All usages now go through getLockFilePath() and getMonoreposDir() which
respect process.env.HOME. Updated plugin.test.ts accordingly.
@jackwener jackwener merged commit d742635 into jackwener:main Mar 27, 2026
23 checks passed
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.

2 participants