Skip to content

Clear tmp directory when switching controller versions - #698

Closed
Apollon77 with Copilot wants to merge 2 commits into
masterfrom
copilot/clear-tmp-directory-on-switch
Closed

Clear tmp directory when switching controller versions#698
Apollon77 with Copilot wants to merge 2 commits into
masterfrom
copilot/clear-tmp-directory-on-switch

Conversation

Copilot AI commented Nov 8, 2025

Copy link
Copy Markdown
Contributor

When integration tests switch between controller versions (e.g., devlatest), leftover node_modules and data directories cause version conflicts and stale state.

Changes

Version tracking via .controller-version file:

  • getInstalledControllerVersion() - reads current version from tracking file
  • saveControllerVersion() - persists version after installation
  • getControllerVersionFilePath() - returns path to tracking file

Automatic cleanup on version change:

  • clearTmpDirectory() - empties node_modules and data directories
  • prepareTestDir() - detects version changes and clears before installation

Behavior

// First run with 'dev' - installs and saves version
await controllerSetup.prepareTestDir('dev');

// Same version - skips cleanup, fast npm install
await controllerSetup.prepareTestDir('dev');

// Version change - clears directories, fresh install
await controllerSetup.prepareTestDir('latest');

Version changes trigger cleanup; same version preserves state for faster subsequent runs.

Original prompt

This section details on the original issue you should resolve

<issue_title>Clear tmp directory when switching controller versions</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: Apollon77 <11976694+Apollon77@users.noreply.github.com>
Copilot AI changed the title [WIP] Clear tmp directory when switching controller versions Clear tmp directory when switching controller versions Nov 8, 2025
Copilot AI requested a review from Apollon77 November 8, 2025 13:47
@GermanBluefox

Copy link
Copy Markdown
Contributor

Manuell in master übernommen (commit 355bf24), da dieser Branch nicht mehr auf den aktuellen Stand von prepareTestDir() passte (Node-abhängige Default-Version 7.2.2 vs. dev).

Änderungen gegenüber diesem PR:

  • Die Version wird nach der Default-Auflösung getrackt, damit auch ein Wechsel zwischen Node 20 (7.2.2) und Node 22+ (dev) ohne explizites controllerVersion erkannt wird
  • Das Log-Verzeichnis wird ebenfalls geleert
  • Lese-/Schreibfehler der .controller-version-Datei brechen den Testlauf nicht mehr ab
  • Die Version wird erst nach erfolgreicher Installation gespeichert

Danke!

GermanBluefox added a commit that referenced this pull request Sep 6, 2026
Track the installed js-controller version in `<testDir>/.controller-version`
and empty `node_modules`, the data dir and the log dir when the requested
version differs from the one used in the previous run. Otherwise leftover
files and stale states of the old version can break the test run.

Implements #698 with the following adjustments:
- The version is tracked after the Node.js-dependent default resolution,
  so switching between Node 20 (7.2.2) and Node 22+ (dev) is detected too
- The log directory is cleared as well
- Reading/writing the version file never fails the test run
- The version is only stored after a successful installation

Closes #526

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EQZhzwNsGRdbQrL3TH53tS
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.

Clear tmp directory when switching controller versions

3 participants