Skip to content

Add Pi Windows home-dir and package artifact regressions - #16

Open
safzanpirani wants to merge 3 commits into
JeanMeijer:mainfrom
safzanpirani:fix/pi-windows-release-coverage
Open

Add Pi Windows home-dir and package artifact regressions#16
safzanpirani wants to merge 3 commits into
JeanMeijer:mainfrom
safzanpirani:fix/pi-windows-release-coverage

Conversation

@safzanpirani

@safzanpirani safzanpirani commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a regression test that exercises Pi discovery from the default ~/.pi/agent/sessions layout without setting PI_CODING_AGENT_DIR
  • add a packed-artifact smoke test that verifies the published CLI package still advertises and ships Pi support
  • make the pack/extract helpers work on Windows so the release check runs there too

Why

I dug into the Windows report and the current source tree does detect Pi usage correctly from %USERPROFILE%\.pi\agent\sessions. The bigger issue is that the published slopmeter@latest artifact can drift from source, so this adds coverage for both the Windows default-home path and the package artifact itself.

Validation

  • bun run --cwd packages/cli test

Summary by cubic

Add regression coverage to ensure Pi works on Windows. Tests default home-dir discovery (~/.pi/agent/sessions) with an isolated home env, ignores mixed-case PI_CODING_AGENT_DIR overrides on Windows, and verifies the packed CLI still advertises and ships Pi support.

Adds Windows-safe pack/extract helpers (npm.cmd, tar.exe) so the release check runs on Windows.

Written for commit 3fb71e2. Summary will update on new commits.

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/cli/test/cli.test.ts">

<violation number="1" location="packages/cli/test/cli.test.ts:69">
P2: The new Pi default-home regression test is not isolated: it sets both HOME and USERPROFILE and does not clear PI_CODING_AGENT_DIR, so it can pass without strictly exercising Windows default-home discovery.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread packages/cli/test/cli.test.ts

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/cli/test/cli.test.ts">

<violation number="1" location="packages/cli/test/cli.test.ts:73">
P2: Windows env cleanup removes only exact-case keys, so mixed-case inherited `PI_CODING_AGENT_DIR` variants can leak into spawned CLI and break test isolation.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread packages/cli/test/cli.test.ts

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/cli/test/cli.test.ts">

<violation number="1" location="packages/cli/test/cli.test.ts:848">
P2: The mixed-case PI_CODING_AGENT_DIR regression test is ineffective on Windows because createHomeEnv sets PI_CODING_AGENT_DIR: undefined and createChildEnv deletes unset keys case-insensitively, which removes Pi_Coding_Agent_Dir before spawn. The CLI only sees default home env, so the test won't catch a regression that incorrectly honors the mixed-case variant.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

const result = await runCli(
["--pi", "--format", "json", "--output", outputPath],
{
...createHomeEnv(workspace),

@cubic-dev-ai cubic-dev-ai Bot Mar 13, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: The mixed-case PI_CODING_AGENT_DIR regression test is ineffective on Windows because createHomeEnv sets PI_CODING_AGENT_DIR: undefined and createChildEnv deletes unset keys case-insensitively, which removes Pi_Coding_Agent_Dir before spawn. The CLI only sees default home env, so the test won't catch a regression that incorrectly honors the mixed-case variant.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/cli/test/cli.test.ts, line 848:

<comment>The mixed-case PI_CODING_AGENT_DIR regression test is ineffective on Windows because createHomeEnv sets PI_CODING_AGENT_DIR: undefined and createChildEnv deletes unset keys case-insensitively, which removes Pi_Coding_Agent_Dir before spawn. The CLI only sees default home env, so the test won't catch a regression that incorrectly honors the mixed-case variant.</comment>

<file context>
@@ -800,6 +821,49 @@ test("Pi discovers ~/.pi/agent/sessions from the default home directory layout",
+  const result = await runCli(
+    ["--pi", "--format", "json", "--output", outputPath],
+    {
+      ...createHomeEnv(workspace),
+      Pi_Coding_Agent_Dir: leakedPiAgentDir,
+    },
</file context>
Fix with Cubic

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