Skip to content

HOME shorthand log-path test disagrees with sandboxed HOME #4810

Description

@Widthdom

Summary

ProgramRunnerTests.GlobalToolLog_OverrideDirectory_ExpandsHomeShorthand fails when the test process runs with HOME redirected to a sandbox directory. The production resolver expands ~, $HOME, and ${HOME} from the environment, while the test builds its expected path with Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), which can continue to return the OS account profile.

Observed behavior

A wider ProgramRunnerTests run during Codex adversarial review failed all three theory cases:

  • ~/cdidx-logs
  • $HOME/cdidx-logs
  • ${HOME}/cdidx-logs

Expected: /Users/widthdom/cdidx-logs

Actual: the sandboxed /var/folders/.../cdidx-logs path selected through HOME.

Reproduction context

dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj --no-restore --no-build -f net8.0 --filter "FullyQualifiedName~ProgramRunnerTests" --logger "console;verbosity=minimal"

The failure is environment-dependent and was observed with HOME intentionally redirected by the review sandbox. The test should derive its expectation from the environment semantics it is exercising, or explicitly establish the intended user-profile contract before resolving the path.

Discovered while validating #4801; unrelated to that fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .NET codebugSomething isn't workingtests

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions