byterover-cli icon indicating copy to clipboard operation
byterover-cli copied to clipboard

[BUG] Test failure: environment variable case sensitivity on Windows

Open albahrani opened this issue 1 year ago • 3 comments

Bug Description

The memAgent test should handle case-insensitive environment variable names fails on Windows environments.

The test should handle case-insensitive environment variable names in src/core/brain/memAgent/__test__/loader.test.ts fails on Windows due to environment variable case sensitivity differences. On Windows, environment variable names are case-insensitive, while on Unix-like systems they are case-sensitive. This causes the test to expect "lowercase" but receive "uppercase" on Windows.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Run the test suite on a Windows machine.
  2. Observe the failure in should handle case-insensitive environment variable names in loader.test.ts.

Expected Behavior

The test should pass on all platforms, regardless of environment variable case sensitivity.

Actual Behavior

On Windows, the test fails with:

AssertionError: expected 'uppercase' to be 'lowercase' // Object.is equality
Expected: "lowercase"
Received: "uppercase"

Screenshots

N/A

Environment Information

OS: Windows 11 Browser: N/A Version: 0.3.0 Node.js version: v24.5.0

Logs and Error Messages

Please provide any relevant logs, error messages, or console output:

FAIL  src/core/brain/memAgent/__test__/loader.test.ts > Loader > Environment Variable Expansion > should handle case-insensitive environment variable names
AssertionError: expected 'uppercase' to be 'lowercase' // Object.is equality
Expected: "lowercase"
Received: "uppercase"

Additional Context

Does this test actually make sense on platforms with case-insensitive environment variables (e.g., Windows)?

Possible Solution

  • Update the test to skip or adjust its expectations on platforms where environment variables are case-insensitive (such as Windows).
  • Alternatively, refactor the loader logic to normalize environment variable keys for cross-platform compatibility.
  • Or, document that this behavior is platform-dependent and exclude the test from Windows runs.

Checklist

  • [x] I have searched for similar issues before creating this one
  • [x] I have provided all the requested information above
  • [x] I have tested this on the latest version

albahrani avatar Aug 31 '25 16:08 albahrani

Please check out our PR #231 to see if it's solved your issues.

RyanNg1403 avatar Sep 01 '25 09:09 RyanNg1403

Hi, unfortunatly this bug is not fixed yet. Still getting:

FAIL  src/core/brain/memAgent/__test__/loader.test.ts > Loader > Environment Variable Expansion > should handle case-insensitive environment variable names
AssertionError: expected 'uppercase' to be 'lowercase' // Object.is equality
AssertionError: expected 'uppercase' to be 'lowercase' // Object.is equality

Expected: "lowercase"
Received: "uppercase"

 ❯ src/core/brain/memAgent/__test__/loader.test.ts:276:32
    274|    const result = (await loadAgentConfig('/path/to/config.yml')) as any;
    275|
    276|    expect(result.systemPrompt).toBe('lowercase');
       |                                ^
    277|    expect(result.llm.apiKey).toBe('uppercase');
    278|   });

I am also not sure if this is really "fixable" since in Windows environments the whole idea of having environment variable with the only difference being upper- vs. lowercase is flawed.

Running

process.env.test_var = 'lowercase';
process.env.TEST_VAR = 'uppercase';

just means overwriting one environment variable by design. So, I think this test case is only suitable for environments with case-sensitive env variable names.

I would either just remove the testcase or skip it on windows environments. But I do not know where this requirement comes from, so I am not able do determine if fixing is required or not.

However, the expectation still would be: "No failing test .... even on Windows ;-) "

albahrani avatar Sep 01 '25 12:09 albahrani

This repository has been archived. No further work will be done. For production use, please visit https://byterover.dev/

IraBond avatar Nov 05 '25 21:11 IraBond