Skip to content

fix: complete build isolation - no HOME pollution, no files outside out/#2730

Open
rockygeekz wants to merge 9 commits intoansible:mainfrom
rockygeekz:fix/complete-build-isolation
Open

fix: complete build isolation - no HOME pollution, no files outside out/#2730
rockygeekz wants to merge 9 commits intoansible:mainfrom
rockygeekz:fix/complete-build-isolation

Conversation

@rockygeekz
Copy link
Copy Markdown
Contributor

@rockygeekz rockygeekz commented Apr 13, 2026

Summary

Prevents builds and tests from creating files outside out/ or polluting
the user HOME directory, completing the remaining work for AAP-65204.

Changes

HOME isolation for unit test suites

  • Set process.env.HOME to isolated directories under out/ in globalSetup
    for ALS and extension unit tests
  • Added TMP/TMPDIR env vars to unit, ALS, and e2e tasks in Taskfile

Relocated build artifacts to out/

  • Vite dev server markers (.vite-dev-server-url, .vite-dev.pid)
  • resources/contentCreator/ symlinks created by uv.sh
  • MCP server tests now use system tmpdir instead of writing next to source

Cleanup

  • Removed __dirname derivations in favor of import.meta.dirname and
    shared FIXTURES_BASE_PATH export
  • Removed 9 .gitignore entries for files no longer created at root
  • Removed stale exclude: entries from Taskfile sources

related: AAP-65204
depends-on: #2726

Prevents builds/tests from polluting the user HOME or writing outside out/ by isolating HOME/TMP, relocating build artifacts into out/, and updating tests and tooling to use isolated or system temp directories.

  • Set process.env.HOME and USERPROFILE to out/unit/tmp/home and out/als/tmp/home in test globalSetup
  • Add TMP/TMPDIR env vars and ensure tmp dirs in Taskfile (unit, als, e2e)
  • Move Vite dev-server marker/PID files into out/
  • Create contentCreator templates and symlinks under out/resources/contentCreator/
  • Update MCP and other tests to use system tmpdir or out/ fixtures and mkdtemp
  • Replace fileURLToPath/__dirname usage with import.meta.dirname and export FIXTURES_BASE_PATH
  • Update Taskfile generates/sources and remove stale sources.exclude entries
  • Remove .gitignore entries for artifacts no longer created at repo root
    related: AAP-65204

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 13, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Repointed runtime/dev scaffolding, marker/PID files, and content-creator template paths into out/ subdirectories; centralized/exported fixture base path; isolated test HOME/TMP under out/ temp dirs; replaced ESM dirname boilerplate with import.meta.dirname; updated tests to use per-run temp dirs and synchronous file I/O.

Changes

Cohort / File(s) Summary
Build output & dev-server markers
vite.config.mts, src/webviewHtml.ts, tools/uv.sh, Taskfile.base.yml
Moved Vite dev-server marker and PID files, marker reads, and symlink/generate targets into out/ paths; ensure marker directory exists before writing.
Content Creator templates & scaffolding
src/features/lightspeed/vue/views/webviewMessageHandlers.ts, tools/uv.sh, Taskfile.base.yml, test/unit/contentCreator/scaffolding.test.ts
Changed contentCreator template source/generate locations to out/resources/contentCreator/... and updated unit tests to create/read nested .devcontainer/devfile template fixtures under out/.
Test HOME/TMP isolation & Taskfile wiring
Taskfile.yml, packages/ansible-language-server/Taskfile.yml, packages/ansible-language-server/test/globalSetup.ts, test/unit/globalSetup.ts, vitest.config.ts
Set TMP/TMPDIR and HOME/USERPROFILE to out/.../tmp/home paths, create those dirs in tasks/tests, added globalSetup usage to Vitest projects.
Fixture centralization & dirname modernization
packages/ansible-language-server/test/helper.ts, packages/ansible-language-server/test/utils/*.test.ts, eslint.config.mjs
Exported FIXTURES_BASE_PATH and refactored tests to use it instead of computing __dirname via fileURLToPath(import.meta.url); replaced usage with import.meta.dirname in ESLint config.
Tempdir-based test I/O (sync)
packages/ansible-mcp-server/test/tools/ansibleLint.test.ts, packages/ansible-mcp-server/test/tools/ansibleNavigator.test.ts
Switched tests to per-run temp dirs (mkdtempSync) and synchronous fs ops (writeFileSync, rmSync), and converted lifecycle hooks to synchronous setup/teardown.
Unit tests — dev server & webview HTML
test/unit/webviewHtml.test.ts, test/unit/contentCreator/scaffolding.test.ts
Updated tests to place .vite-dev-server-url and template fixtures under out/, and to create out/ directories before writing marker/template files.
Vitest project env & timeouts
vitest.config.ts, packages/ansible-language-server/test/utils/getAnsibleMetaData.test.ts
Enabled globalSetup for ext project and set test env HOME/USERPROFILE to out/ paths; increased a suite timeout (60s → 300s) in an EE test.
Task source filters
Taskfile.yml
Removed several sources.exclude entries (including .ansible and specific fixture excludes), altering which paths trigger task reruns.
.gitignore & Gitleaks
.gitignore, .gitleaks.toml
Replaced explicit ignores for individual Vite marker/PID files and several content-creator/Ansible-specific ignores with broader/adjusted rules; added .gitleaks.toml allowlist entry for ^out/.
Misc tests & fixtures
packages/ansible-language-server/test/fixtures/diagnostics/invalid_yaml.yml, src/features/.../webviewMessageHandlers.ts
Minor fixture comment typo fix and updated handler template paths to out/... locations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐇 I nudged markers into out/ with care,
Homes for tests now wait in temp lairs,
Fixtures gathered in one bright nest,
import.meta.dirname does the rest,
Templates and tests — a tidy hare’s cheer! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title concisely and accurately describes the main objective of the PR: achieving complete build isolation by preventing HOME pollution and ensuring all files are created under the out/ directory.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (2)
packages/ansible-mcp-server/test/tools/ansibleLint.test.ts (1)

39-42: Apply the same teardown guard here as well.

This has the same failure-mode risk: if setup aborts early, unconditional rmSync(testDir, ...) can throw in afterAll.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ansible-mcp-server/test/tools/ansibleLint.test.ts` around lines 39 -
42, The afterAll teardown currently calls rmSync(testDir, { recursive: true,
force: true }) unconditionally which can throw if setup aborted; update the
afterAll block that references testDir to first check that testDir is defined
and exists (e.g., typeof testDir !== 'undefined' && existsSync(testDir)) before
calling rmSync so the teardown is guarded and safe to run even when setup
failed.
packages/ansible-mcp-server/test/tools/ansibleNavigator.test.ts (1)

41-43: Guard teardown to avoid masking setup failures.

If beforeAll fails before testDir is assigned, rmSync(testDir, ...) can throw and hide the original failure.

Proposed refactor
   afterAll(() => {
     // Clean up temp directory
-    rmSync(testDir, { recursive: true, force: true });
+    if (testDir) {
+      rmSync(testDir, { recursive: true, force: true });
+    }
   });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ansible-mcp-server/test/tools/ansibleNavigator.test.ts` around lines
41 - 43, The afterAll teardown currently calls rmSync(testDir, { recursive:
true, force: true }) which can throw if testDir was never set due to a failing
beforeAll; update the afterAll in ansibleNavigator.test.ts to guard the cleanup
by checking that testDir is defined and exists before calling rmSync (e.g., use
a condition with testDir && existsSync(testDir)) or wrap rmSync in a try/catch
to avoid masking the original setup failure while still attempting to remove the
temp directory; reference the afterAll block and the rmSync call to locate where
to add the guard.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/ansible-language-server/Taskfile.yml`:
- Around line 49-51: The TMP/TMPDIR environment variables in the Taskfile.yml
point to out/als/tmp which may not exist; modify the task that runs "pnpm run
test" to ensure that directory is created beforehand (e.g., run a mkdir -p for
"{{ .TASKFILE_DIR }}/../../out/als/tmp" or similar) so tools using TMP/TMPDIR
won't fail; locate the task that sets env TMP/TMPDIR in Taskfile.yml and add a
pre-step to create the directory before executing the test command.

In `@packages/ansible-mcp-server/test/tools/ansibleNavigator.test.ts`:
- Around line 3-5: The test still references __dirname (which is undefined in
ESM) — replace that usage with the module-scoped testDir variable (initialized
in beforeAll) so the test runs in the temp directory and keeps isolation; locate
the lingering __dirname reference in the ansibleNavigator.test.ts test code and
swap it to use testDir (preserving any path joins) so all file paths are
resolved against the temp testDir created in beforeAll.

In `@Taskfile.yml`:
- Around line 253-255: The unit task sets TMP/TMPDIR to out/unit/tmp but never
creates that directory, causing temp-file ops to fail on clean workspaces;
modify the Taskfile's unit task (the task that runs Vitest) to create the
directory before tests run—e.g., add a step that runs mkdir -p "{{ .TASKFILE_DIR
}}/out/unit/tmp" or use a precondition to ensure out/unit/tmp exists—so that the
environment variables TMP and TMPDIR point to an existing directory when Vitest
executes.

---

Nitpick comments:
In `@packages/ansible-mcp-server/test/tools/ansibleLint.test.ts`:
- Around line 39-42: The afterAll teardown currently calls rmSync(testDir, {
recursive: true, force: true }) unconditionally which can throw if setup
aborted; update the afterAll block that references testDir to first check that
testDir is defined and exists (e.g., typeof testDir !== 'undefined' &&
existsSync(testDir)) before calling rmSync so the teardown is guarded and safe
to run even when setup failed.

In `@packages/ansible-mcp-server/test/tools/ansibleNavigator.test.ts`:
- Around line 41-43: The afterAll teardown currently calls rmSync(testDir, {
recursive: true, force: true }) which can throw if testDir was never set due to
a failing beforeAll; update the afterAll in ansibleNavigator.test.ts to guard
the cleanup by checking that testDir is defined and exists before calling rmSync
(e.g., use a condition with testDir && existsSync(testDir)) or wrap rmSync in a
try/catch to avoid masking the original setup failure while still attempting to
remove the temp directory; reference the afterAll block and the rmSync call to
locate where to add the guard.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 68b3151b-041a-4481-8e8a-465816a6b443

📥 Commits

Reviewing files that changed from the base of the PR and between be402d0 and 1eacb75.

📒 Files selected for processing (17)
  • .gitignore
  • Taskfile.base.yml
  • Taskfile.yml
  • eslint.config.mjs
  • packages/ansible-language-server/Taskfile.yml
  • packages/ansible-language-server/test/globalSetup.ts
  • packages/ansible-language-server/test/helper.ts
  • packages/ansible-language-server/test/utils/getAnsibleMetaData.test.ts
  • packages/ansible-language-server/test/utils/pathUtils.test.ts
  • packages/ansible-mcp-server/test/tools/ansibleLint.test.ts
  • packages/ansible-mcp-server/test/tools/ansibleNavigator.test.ts
  • src/features/lightspeed/vue/views/webviewMessageHandlers.ts
  • src/webviewHtml.ts
  • test/unit/globalSetup.ts
  • tools/uv.sh
  • vite.config.mts
  • vitest.config.ts

@rockygeekz rockygeekz force-pushed the fix/complete-build-isolation branch from 1eacb75 to c21b40a Compare April 13, 2026 09:01
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

❌ 25 Tests Failed:

Tests completed Failed Passed Skipped
1657 25 1632 13
View the top 3 failed test(s) by shortest run time
packages/ansible-language-server/test/providers/completionProvider.test.ts > @ee
Stack Traces | 10s run time
Error: Hook timed out in 10000ms.
If this is a long-running hook, pass a timeout value as the last argument or configure it globally with "hookTimeout".
 ❯ test/providers/completionProvider.test.ts:707:7
 ❯ testModuleKindAndDocumentation test/providers/completionProvider.test.ts:701:9
 ❯ test/providers/completionProvider.test.ts:997:9
should hover over `name` keyword::ee hover-ee Hover for play keywords should hover over `name` keyword
Stack Traces | 50s run time
Timeout of 50000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (.../e2e/hover/withEE.test.ts)
packages/ansible-language-server/test/providers/hoverProvider.test.ts > doHover() > Hover for playbook adjacent collection > @ee > should provide hovering for 'playbook adjacent module name'
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/hoverProvider.test.ts:230:5
 ❯ testPlaybookAdjacentCollection test/providers/hoverProvider.test.ts:229:9
 ❯ test/providers/hoverProvider.test.ts:567:9
packages/ansible-language-server/test/providers/completionProvider.test.ts > doCompletion() > Completion for playbook adjacent collection > @ee > should provide completion for playbook adjacent module (adjacent_org.adjacent_coll.module_1)
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/completionProvider.test.ts:496:7
 ❯ testPlaybookAdjacentCollection test/providers/completionProvider.test.ts:495:11
 ❯ test/providers/completionProvider.test.ts:1215:9
packages/ansible-language-server/test/providers/hoverProvider.test.ts > doHover() > No hover > @ee > should not provide hovering for values
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ testNoHover test/providers/hoverProvider.test.ts:179:3
 ❯ test/providers/hoverProvider.test.ts:517:9
packages/ansible-language-server/test/providers/completionProvider.test.ts > doCompletion() > Completion for variables inside jinja inline brackets > @ee > should provide completion for variables defined at task level
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/completionProvider.test.ts:647:5
 ❯ testVarsCompletionInsideJinja test/providers/completionProvider.test.ts:646:9
 ❯ test/providers/completionProvider.test.ts:1173:9
packages/ansible-language-server/test/providers/completionProvider.test.ts > doCompletion() > Completion for module options and suboptions > @ee > should provide completion for builtin module option (ansible.builtin.debug -> msg)
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/completionProvider.test.ts:312:5
 ❯ testModuleOptions test/providers/completionProvider.test.ts:311:9
 ❯ test/providers/completionProvider.test.ts:1041:9
packages/ansible-language-server/test/providers/completionProvider.test.ts > doCompletion() > Completion for task keywords > @ee > should provide completion for loop
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/completionProvider.test.ts:170:7
 ❯ testTaskKeywords test/providers/completionProvider.test.ts:169:11
 ❯ test/providers/completionProvider.test.ts:925:9
packages/ansible-language-server/test/providers/hoverProvider.test.ts > doHover() > Role keywords hover > @ee > should provide hovering for 'tags'
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/hoverProvider.test.ts:134:5
 ❯ testRoleKeywords test/providers/hoverProvider.test.ts:133:9
 ❯ test/providers/hoverProvider.test.ts:416:9
packages/ansible-language-server/test/providers/hoverProvider.test.ts > doHover() > Module name and options hover > @ee > should provide hovering for 'ansible.builtin.debug'
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/hoverProvider.test.ts:167:5
 ❯ testModuleNames test/providers/hoverProvider.test.ts:166:9
 ❯ test/providers/hoverProvider.test.ts:471:9
packages/ansible-language-server/test/providers/hoverProvider.test.ts > doHover() > Block keywords hover > @ee > should provide hovering for 'become'
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/hoverProvider.test.ts:106:5
 ❯ testBlockKeywords test/providers/hoverProvider.test.ts:105:9
 ❯ test/providers/hoverProvider.test.ts:370:9
packages/ansible-language-server/test/providers/completionProvider.test.ts > doCompletion() > Completion for module name without FQCN > @ee > should provide completion for `ping` with `pin` (ansible.builtin.ping)
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/completionProvider.test.ts:440:7
 ❯ testModuleNamesWithoutFQCN test/providers/completionProvider.test.ts:439:11
 ❯ test/providers/completionProvider.test.ts:1125:9
packages/ansible-language-server/test/providers/completionProvider.test.ts > doCompletion() > Completion for module names (with different trigger scenarios) > @ee > should provide completion for with name as first option always
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/completionProvider.test.ts:245:5
 ❯ testModuleNames test/providers/completionProvider.test.ts:244:9
 ❯ test/providers/completionProvider.test.ts:961:9
packages/ansible-language-server/test/providers/completionResolver.test.ts > doCompletionResolve() > Resolve completion for module names > Resolve completion for module names when FQCN is disabled > @ee > should resolve completion for module name with short name since it is present in declared collections in playbook (fqcn disabled)
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/completionResolver.test.ts:111:7
 ❯ testFQCNDisabled test/providers/completionResolver.test.ts:104:9
 ❯ test/providers/completionResolver.test.ts:261:11
packages/ansible-language-server/test/providers/completionProvider.test.ts > doCompletion() > Completion for block keywords > @ee > should provide completion for become_user
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/completionProvider.test.ts:130:7
 ❯ testBlockKeywords test/providers/completionProvider.test.ts:129:11
 ❯ test/providers/completionProvider.test.ts:879:9
packages/ansible-language-server/test/providers/completionProvider.test.ts > doCompletion() > Completion for option and suboption values > @ee > should provide completion for builtin module option (ansible.builtin.debug -> msg)
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/completionProvider.test.ts:371:5
 ❯ testModuleOptionsValues test/providers/completionProvider.test.ts:370:9
 ❯ test/providers/completionProvider.test.ts:1077:9
packages/ansible-language-server/test/providers/completionProvider.test.ts > doCompletion() > Completion for role keywords > @ee > should provide completion for name
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/completionProvider.test.ts:90:7
 ❯ testRoleKeywords test/providers/completionProvider.test.ts:89:11
 ❯ test/providers/completionProvider.test.ts:833:9
packages/ansible-language-server/test/providers/completionProvider.test.ts > doCompletion() > Negate completion for non playbook adjacent collection > @ee > should not provide completion for non playbook adjacent module (adjacent_org.adjacent_coll.module_1)
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/completionProvider.test.ts:536:7
 ❯ testNonPlaybookAdjacentCollection test/providers/completionProvider.test.ts:535:11
 ❯ test/providers/completionProvider.test.ts:1258:9
packages/ansible-language-server/test/providers/hoverProvider.test.ts > doHover() > Negate hover for non playbook adjacent collection > @ee > should not provide hovering for 'non playbook adjacent module name'
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/hoverProvider.test.ts:259:5
 ❯ testNonPlaybookAdjacentCollection test/providers/hoverProvider.test.ts:258:9
 ❯ test/providers/hoverProvider.test.ts:617:9
packages/ansible-language-server/test/providers/hoverProvider.test.ts > doHover() > Task keywords hover > @ee > should provide hovering for 'register'
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/hoverProvider.test.ts:78:5
 ❯ testTaskKeywords test/providers/hoverProvider.test.ts:77:9
 ❯ test/providers/hoverProvider.test.ts:334:9
packages/ansible-language-server/test/providers/completionProvider.test.ts > doCompletion() > Completion for host values with static inventory file > @ee > should provide completion for hello-worlds group as hosts value
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/completionProvider.test.ts:587:5
 ❯ testHostValues test/providers/completionProvider.test.ts:586:9
 ❯ test/providers/completionProvider.test.ts:759:9
packages/ansible-language-server/test/providers/completionProvider.test.ts > doCompletion() > Completion for play keywords > @ee > should provide completion for name
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/completionProvider.test.ts:49:7
 ❯ testPlayKeywords test/providers/completionProvider.test.ts:48:11
 ❯ test/providers/completionProvider.test.ts:792:9
packages/ansible-language-server/test/providers/completionResolver.test.ts > doCompletionResolve() > Resolve completion for module names > Resolve completion for module names when FQCN is enabled > @ee > should resolve completion for module name with full FQCN (fqcn enabled)
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/completionResolver.test.ts:46:7
 ❯ testFQCNEnabled test/providers/completionResolver.test.ts:39:9
 ❯ test/providers/completionResolver.test.ts:234:11
packages/ansible-language-server/test/providers/definitionProvider.test.ts > getDefinition() > Module name definitions > @ee > should provide 'definition for builtin modules (ansible.builtin.debug)'
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/definitionProvider.test.ts:52:5
 ❯ testModuleNamesForDefinition test/providers/definitionProvider.test.ts:51:9
 ❯ test/providers/definitionProvider.test.ts:105:9
packages/ansible-language-server/test/providers/hoverProvider.test.ts > doHover() > Play keywords hover > @ee > should provide hovering for 'name'
Stack Traces | 60s run time
Error: Test timed out in 60000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/providers/hoverProvider.test.ts:50:5
 ❯ testPlayKeywords test/providers/hoverProvider.test.ts:49:9
 ❯ test/providers/hoverProvider.test.ts:299:9

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
test/unit/contentCreator/scaffolding.test.ts (1)

140-146: Optional: centralize repeated templateSourcePath construction.

The same joined path appears in many test cases; extracting a helper/constant would make test intent clearer and reduce maintenance overhead.

Also applies to: 165-170, 192-197, 218-223, 243-248, 259-264, 285-290, 307-312, 328-339

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/unit/contentCreator/scaffolding.test.ts` around lines 140 - 146, Several
tests repeatedly construct the same templateSourcePath using path.join; extract
a single helper (e.g., a function buildTemplateSourcePath(subpath: string) or a
constant TEMPLATE_DEVCONTAINER_PATH generator) in the test file and use it
instead of duplicating path.join across cases. Replace occurrences like the
variable templateSourcePath and direct path.join(...) calls passed into
messageHandlers["scaffoldDevcontainerStructure"] (and the similar uses at the
other listed ranges) with a call to the new helper to centralize the path
construction and reduce duplication.
test/unit/webviewHtml.test.ts (1)

63-121: Optional: extract marker setup helper to reduce duplication.

outDir creation + marker write is repeated in many tests; a small helper would reduce noise and future drift.

♻️ Suggested refactor
+function writeDevServerMarker(baseDir: string, url = "http://localhost:5173") {
+  const outDir = path.join(baseDir, "out");
+  fs.mkdirSync(outDir, { recursive: true });
+  fs.writeFileSync(path.join(outDir, ".vite-dev-server-url"), url);
+}
...
-const outDir = path.join(tmpDir, "out");
-fs.mkdirSync(outDir, { recursive: true });
-fs.writeFileSync(path.join(outDir, ".vite-dev-server-url"), "http://localhost:5173");
+writeDevServerMarker(tmpDir);

Also applies to: 182-231

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/unit/webviewHtml.test.ts` around lines 63 - 121, The tests duplicate
setup for creating outDir and writing the marker file; extract a small helper
(e.g., createOutDirWithMarker or writeViteMarker) that accepts the base tmpDir
and marker content, creates the out directory, and writes ".vite-dev-server-url"
so each spec can call that helper before asserting getDevServerUrl(tmpDir);
update all occurrences (including the other block at lines ~182-231) to use this
helper and remove the repeated fs.mkdirSync / fs.writeFileSync logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@vitest.config.ts`:
- Around line 50-53: Update the env object in vitest.config.ts to set
USERPROFILE in addition to HOME so Windows tests use the isolated directory;
specifically, in the env literal where HOME is assigned via
path.resolve(__dirname, "out/unit/tmp/home"), add USERPROFILE with the same
path.resolve(...) value (keeping the existing HOME entry) so both HOME and
USERPROFILE point to the test isolation folder.

---

Nitpick comments:
In `@test/unit/contentCreator/scaffolding.test.ts`:
- Around line 140-146: Several tests repeatedly construct the same
templateSourcePath using path.join; extract a single helper (e.g., a function
buildTemplateSourcePath(subpath: string) or a constant
TEMPLATE_DEVCONTAINER_PATH generator) in the test file and use it instead of
duplicating path.join across cases. Replace occurrences like the variable
templateSourcePath and direct path.join(...) calls passed into
messageHandlers["scaffoldDevcontainerStructure"] (and the similar uses at the
other listed ranges) with a call to the new helper to centralize the path
construction and reduce duplication.

In `@test/unit/webviewHtml.test.ts`:
- Around line 63-121: The tests duplicate setup for creating outDir and writing
the marker file; extract a small helper (e.g., createOutDirWithMarker or
writeViteMarker) that accepts the base tmpDir and marker content, creates the
out directory, and writes ".vite-dev-server-url" so each spec can call that
helper before asserting getDevServerUrl(tmpDir); update all occurrences
(including the other block at lines ~182-231) to use this helper and remove the
repeated fs.mkdirSync / fs.writeFileSync logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d8a867e2-60a3-4ba5-b554-c9ed5ed879fb

📥 Commits

Reviewing files that changed from the base of the PR and between 1eacb75 and ae7440a.

📒 Files selected for processing (20)
  • .gitignore
  • Taskfile.base.yml
  • Taskfile.yml
  • eslint.config.mjs
  • packages/ansible-language-server/Taskfile.yml
  • packages/ansible-language-server/test/fixtures/diagnostics/invalid_yaml.yml
  • packages/ansible-language-server/test/globalSetup.ts
  • packages/ansible-language-server/test/helper.ts
  • packages/ansible-language-server/test/utils/getAnsibleMetaData.test.ts
  • packages/ansible-language-server/test/utils/pathUtils.test.ts
  • packages/ansible-mcp-server/test/tools/ansibleLint.test.ts
  • packages/ansible-mcp-server/test/tools/ansibleNavigator.test.ts
  • src/features/lightspeed/vue/views/webviewMessageHandlers.ts
  • src/webviewHtml.ts
  • test/unit/contentCreator/scaffolding.test.ts
  • test/unit/globalSetup.ts
  • test/unit/webviewHtml.test.ts
  • tools/uv.sh
  • vite.config.mts
  • vitest.config.ts
✅ Files skipped from review due to trivial changes (7)
  • packages/ansible-language-server/test/utils/pathUtils.test.ts
  • packages/ansible-language-server/test/fixtures/diagnostics/invalid_yaml.yml
  • tools/uv.sh
  • packages/ansible-language-server/test/globalSetup.ts
  • Taskfile.base.yml
  • .gitignore
  • src/features/lightspeed/vue/views/webviewMessageHandlers.ts
🚧 Files skipped from review as they are similar to previous changes (6)
  • eslint.config.mjs
  • packages/ansible-language-server/test/helper.ts
  • test/unit/globalSetup.ts
  • Taskfile.yml
  • packages/ansible-mcp-server/test/tools/ansibleLint.test.ts
  • packages/ansible-language-server/Taskfile.yml

@rockygeekz rockygeekz force-pushed the fix/complete-build-isolation branch from 1acdf96 to d286d9c Compare April 13, 2026 11:34
@rockygeekz rockygeekz force-pushed the fix/complete-build-isolation branch from d286d9c to 356f5ce Compare April 13, 2026 11:52
@rockygeekz rockygeekz marked this pull request as draft April 13, 2026 12:09
console.info(
"Cleaning up any leftover podman containers from previous runs...",
);
spawnSync("podman", ["system", "reset", "--force"], { stdio: "inherit" });
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I like the PR, but this is change in particular a bit like bringing an atomic nuke in a bar brawl :-). Are you 100% sure this only clean the testHome directory?
What if the user has different configuration for CONTAINER_HOST, XDG_CONFIG_HOME, XDG_DATA_HOME, XDG_RUNTIME_DIR, etc?

Overall, I'm not sure WHY this had to be done?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah you are right. This is aggressive and I was trying to clean up leftover containers from failed test runs and I have removed those aggressive changes if CI fails I'll handle it by cleanup or something.

try {
if (!SKIP_PODMAN) {
console.info("Cleaning up podman containers and storage...");
spawnSync("podman", ["system", "reset", "--force"], { stdio: "inherit" });
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes, same.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed 👍

ln -fs "$creator_resources_path/common/devcontainer/.devcontainer" "out/resources/contentCreator/createDevcontainer/"

log notice "Using $(python3 --version) from $(uv run which python3)"
if [[ "$(which python3)" != ${VIRTUAL_ENV}/bin/python3 ]]; then
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

$VIRTUAL_ENV also points outside of the source directory:

./.config/mise.toml:VIRTUAL_ENV = "{{ xdg_cache_home }}/.local/share/virtualenvs/vsa"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, VIRTUAL_ENV does point outside the repo, but that's intentional. It's managed by mise (not by our build system), and moving it inside out/ would break mise's venv management and force reinstalling all Python deps on every clean. The goal of this PR is to prevent build artifacts and temp test files from polluting HOME/repo root - not to isolate the Python environment itself. The venv is already properly isolated per-project by mise/uv.

find out -name '*:*' -exec rm -r {} \; || true
rm -rf dist
# Remove container overlay files to avoid gitleaks false positives
sudo rm -rf out/als/tmp/home/.local/share/containers/ || true
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does this prevent the CI from caching the images? Maybe we can set-up some symlink instead to continue to safe the images are at place that will be restored across builds?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

and yeah about caching. However, we can't use symlinks here because:

  1. It would defeat the isolation purpose - we'd be writing to user's actual container storage
  2. Container images are already cached at system level by podman/docker (in /var/lib/containers/ or ~/.local/share/containers/ on the runner), not in the workspace
  3. We're only removing the overlay files to avoid gitleaks false positives (they contain strings that look like API keys) The actual image layers are still cached at system level, we're just cleaning up the overlay storage used during test runs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants