test: keep unit tests out of the developer's home directory
The marketplace installer and the skill security cache resolve paths from os.homedir() at import time, so npm run test wrote fixtures into the real ~/.waggle/security-cache and ~/.waggle/plugins/registry.json. Point HOME and USERPROFILE at a temporary directory per worker and silence npm's update notice that a fresh home triggers (UF-022). Log the four test files that fail on macOS (UF-023).
This commit is contained in:
@@ -50,6 +50,8 @@ Baseline: commit `b20b138` of `git.os-dev.tech/oleg.m/waggle-os`.
|
||||
| UF-019 | Memory count pluralization: "1 Memories" | Open | Web UI |
|
||||
| UF-020 | WhatsApp connector bundles GPL-3.0 code into the sidecar | Open | Licensing |
|
||||
| UF-021 | Settings visual-regression baseline is ignored by git | Fixed | Tests, git |
|
||||
| UF-022 | Unit tests write into the developer's real `~/.waggle` | Fixed | Tests |
|
||||
| UF-023 | Four unit-test files fail on macOS | Open | Tests, macOS |
|
||||
|
||||
## Entries
|
||||
|
||||
@@ -214,3 +216,21 @@ Entries UF-010 to UF-019 come from the UI audit `anti-slop/audit-001-2026-10-14.
|
||||
- Cause: a broad ignore rule meant for stray screenshots also matches baseline file names.
|
||||
- What we did: added the exception `!tests/visual/baselines/**/*.png` to `.gitignore`. The Settings baselines still need to be generated with `npm run test:visual -- --update-snapshots` and committed.
|
||||
- Recommendation: apply the same exception in the main project and commit the Settings baselines.
|
||||
|
||||
### UF-022. Unit tests write into the developer's real `~/.waggle`
|
||||
- Status: Fixed
|
||||
- Found: 2026-10-15
|
||||
- Where: `packages/marketplace/src/installer.ts:47-50` (`~/.waggle/plugins/registry.json`); `packages/marketplace/src/security.ts:183` (`~/.waggle/security-cache`); `vitest.setup.ts`
|
||||
- Symptom: `npm run test` creates fixture files such as `evil-skill-*.json` and `safe-skill-*.json` in `~/.waggle/security-cache` and creates or overwrites `~/.waggle/plugins/registry.json` with an empty registry. The developer's own Waggle data directory is modified by the test suite.
|
||||
- Cause: these modules compute their paths from `os.homedir()` when they are imported, the tests do not override them, and the Vitest setup does not isolate the home directory.
|
||||
- What we did: `vitest.setup.ts` now points `HOME` and `USERPROFILE` at one temporary directory per test worker before any test module loads, and turns off npm's update notice, which a fresh home would otherwise print into CLI test output. Verified: after the full root suite nothing new appears under the real `~/.waggle` or `~/.claude`.
|
||||
- Recommendation: apply the same setup change in the main project, and resolve these paths from the configured data directory at call time instead of at import time.
|
||||
|
||||
### UF-023. Four unit-test files fail on macOS
|
||||
- Status: Open
|
||||
- Found: 2026-10-15
|
||||
- Where: `packages/server/tests/local/managed-ollama-runtime.test.ts`; `packages/hive-mind-hooks-openclaw/tests/handler.test.ts:330`; `packages/server/tests/local/files.test.ts:721`; `packages/server/tests/local/external-tool-runs.test.ts:1270`
|
||||
- Symptom: on macOS arm64 the root suite has 41 failing tests in these four files. 38 managed Ollama runtime tests fail with "Official runtime archive did not contain ollama.exe". The OpenClaw handler test expects `/var/folders/...` and receives `/private/var/folders/...`. A storage move test is rejected with "escapes workspace root through symlink". An OpenClaw run test times out with "OpenClaw run did not settle". All four files fail the same way when run on their own.
|
||||
- Cause: the runtime fixtures appear to assume the Windows archive layout, and the path checks do not account for `/var` being a symlink to `/private/var` on macOS. The OpenClaw timeout is not investigated yet.
|
||||
- What we did: nothing yet. The failures are recorded as known in `docs/oss/baseline.md`.
|
||||
- Recommendation: make the runtime fixtures platform-aware, compare resolved paths (`fs.realpathSync`) in path assertions, and run the unit suite on macOS and Linux in CI.
|
||||
|
||||
Reference in New Issue
Block a user