Skip to content

test: isolate user state during test runs - #613

Open
guix4ever wants to merge 2 commits into
EvoMap:mainfrom
guix4ever:fix/test_home_isolation
Open

test: isolate user state during test runs#613
guix4ever wants to merge 2 commits into
EvoMap:mainfrom
guix4ever:fix/test_home_isolation

Conversation

@guix4ever

Copy link
Copy Markdown

Summary

Isolate every Node test worker from the developer's real home directory so the suite cannot read or overwrite persistent EvoMap identities, credentials, mailbox state, or proxy settings. Replace the shell-interpolated npm test command with a cross-platform argv-based runner that always preloads the isolation setup.

What changed

  • Added a test-suite runner that starts Node with an explicit argv array and preloads the isolation setup.
  • Assigned each test worker a unique temporary HOME, USERPROFILE, EVOLVER_HOME, and EVOLVER_SETTINGS_DIR.
  • Removed each temporary test home when its worker exits.
  • Added an end-to-end regression test proving identity and settings files stay out of the parent home.
  • Updated the ATP proxy routing fixture to honor the isolated settings directory.
  • Added no runtime dependencies and changed no production behavior.

How to test

  1. Run npm test.
  2. Expect 3290 tests to pass with 0 failures.
  3. Run node --test test/testHomeIsolation.test.js.
  4. Expect both isolation regression tests to pass.

Risk

Low -- this changes only the test entry point and test environment. Revert the commit to restore the previous runner.

Harness/evaluator governance

Upstream governance surface: N/A
Downstream EvoX impact: N/A
Rollout-local scope: N/A
Promotion boundary: N/A
Evaluator mismatch sets: N/A
Non-regression evidence: N/A
Fix-severity review: N/A
Owner approval: N/A
Security boundary: N/A
Rollback: N/A
Live promotion: no
Autonomous evaluator self-editing: no

Self-check

  • If this PR adds a new source file under src/, it is registered in
    public.manifest.json consistently with its sibling files (e.g. listed
    in obfuscate when the rest of the directory is). Build verification
    passed: node scripts/build_public.js succeeded and the new file shows
    up in dist-public/ in the expected (obfuscated or plain) form.
  • If this PR adds or modifies a schema factory under src/gep/schemas/,
    the corresponding validate* function is invoked at every write and
    every publish call site (not just defined).
  • If this PR uses Object.assign({}, DEFAULTS, partial) to build an
    object, every reference-typed field (arrays, sub-objects) on the result
    is sliced or cloned -- not held by reference to either source.
  • If this PR introduces a new module-level constant initialized from
    process.env.X, the owning module is loaded after the entry point's
    dotenv configuration step (or the constant is migrated to the lazy
    env helpers in src/config.js).
  • No new runtime dependencies added without a clear justification in the
    "What changed" section above.
  • Tests added or updated to cover the new behavior; full suite passes
    locally (npm test).

Related

N/A

@cursor

cursor Bot commented Aug 12, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

@owen-agent-control

Copy link
Copy Markdown

👋 这个 PR 开着 11 天没动了,还在推进吗?如果和 main 有冲突就 rebase 一下解掉,需要帮忙说一声;若已不需要也可以直接关掉 🙏

@evomap-aiqa-bot

evomap-aiqa-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

Sentinel 已审核此变更,并发现 1 个已核验问题

无法定位到 diff 的已核验问题

测试隔离依赖未在所有测试入口生效

🔴 严重程度:高(P1)
test/setup.js 只有在 process.env.NODE_TEST_CONTEXT 存在时才创建临时 home 并覆盖 HOMEUSERPROFILEEVOLVER_HOMEEVOLVER_SETTINGS_DIR。但 --require 模块是在 Node 测试上下文建立前加载的;对于直接 `node --requ...(truncated)

Finding:finding_1be1b38c4484cd1df2961abb · 文件:test/setup.js · 详情:/api/v1/aiqa/findings/finding_1be1b38c4484cd1df2961abb

P0/P1 会让 Sentinel check 失败;P2/P3 不阻塞合并。

开发 agent 查询详情: 调用 MCP 工具 sentinel_pr_review_context,传入 owner_repo="evomap/evolver"pr_number=613head_sha="b0f7097fec461841671fb0bacbae6465d0e91c4c",并按条目追加 finding_idfinding_key

由 Sentinel 审核 · 目标提交 b0f7097fec46

@guix4ever

Copy link
Copy Markdown
Author

Still active. I addressed the Sentinel P1 finding in 8df5c15.

  • The preload now isolates HOME, USERPROFILE, EVOLVER_HOME, and EVOLVER_SETTINGS_DIR unconditionally; it no longer depends on NODE_TEST_CONTEXT being available.
  • The regression tests explicitly remove NODE_TEST_CONTEXT before loading the setup.

Verification:

  • Node 22.12 targeted isolation and routing tests: 9 passed, 0 failed
  • Full project suite on the current runtime: 3291 passed, 0 failed

@evomap-aiqa-bot

evomap-aiqa-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

Sentinel 已审核此变更,未发现需要报告的问题。

开发 agent 查询详情: 调用 MCP 工具 sentinel_pr_review_context,传入 owner_repo="evomap/evolver"pr_number=613head_sha="8df5c1574ec1992a025c167d1185e301911d5e07",并按条目追加 finding_idfinding_key

由 Sentinel 审核 · 目标提交 8df5c1574ec1

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