Skip to content

Daemon tests that start a daemon without an npm fake ask the real npm registry for simlock@latest #1885

Done

Description

@V3RON

`startDaemon` builds a real `NodeNpmCli` when `options.npm` is not passed (src/daemon/main.ts:315), and `update.check` defaults to true (src/core/config-defaults.ts:97). So every test that starts a daemon without `npm` or `update: { check: false }` spawns `node npm-cli.js view simlock@latest version` against the registry, in its temp data directory. Files that do this include src/daemon/gateway-fleet.e2e.test.ts, main-stop.test.ts, main-leasing.test.ts, main.test.ts and about 15 more (`grep -L npm` over the test files that call `startDaemon(`).

The unit and e2e lanes then depend on the network, and each such test leaves a child process running for up to 30 s. Found while triaging #1852.

Written by an agent.

Activity

  1. added
    bug:new
    on Nov 26, 2026
  2. self-assigned this
    on Nov 26, 2026
  3. V3RON commented on Nov 26, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    Confirmed, with one correction: a daemon on MemoryFilesystem (most of main-stop, main-leasing) fails NodeNpmCli's script lookup before it spawns, so it asks nothing. Real npm view runs come from daemons on NodeFilesystem: 104 in one unit run of src/daemon, src/agent-device, src/cli and neighbours, and every e2e-lane daemon. Two tests on bug/1885-repro:

    pnpm exec vitest run --project unit src/daemon/test-rigs-npm.test.ts
      × the shared daemon test rigs > start daemons whose version check runs no real npm CLI
      AssertionError: expected [ [ 'simlock@latest' ], …(1) ] to deeply equal []
    
    pnpm test:e2e e2e/update-check-registry.test.ts
      × the e2e lane's daemons > ask no npm registry for the latest Simlock, worker and gateway alike
      AssertionError: expected [ '/simlock', '/simlock' ] to deeply equal []
    

    The e2e test points npm_config_registry at a local server that records each request.

    Root cause

    Defect, in the test rigs. src/daemon/main.ts:314 builds a real NodeNpmCli when npm is not passed, and update.check is on by default. The rigs pass neither: src/daemon/test-main.ts start/startGateway, src/daemon/test-relay-support.ts:159 startWorker, five direct startDaemon calls, and e2e/helpers/env.ts:231 seedConfig, which writes no update key for either role.

    Simplest fix

    • test-main.ts: export noRegistry(), a FakeNpmCli whose view answers { ok: false } (what memory-filesystem rigs already get). Pass npm: noRegistry() before the caller's options in start, startGateway, startWorker and the direct calls (main.test.ts:491, remote-client.e2e, session-path.e2e, main-state-db launch, gateway-fleet.e2e startWorker as options.npm ?? noRegistry()).
    • e2e/helpers/env.ts: seed update: { check: false } for both roles.

    8 files, 25 lines. Tried: both reproductions pass. 258 unit files green, zero real npm view runs. 7 e2e files green.

    Alternatives rejected

    • update: { check: false } in the unit rigs: it breaks 4 tests in main-update and gateway-fleet that pass their own npm.
    • A unit setup file that stubs NodeNpmCli.prototype.view: it hides the real adapter from npm-cli.test.ts.
    • npm_config_offline in the setup files: a child is still spawned per daemon.

    Risk

    • A new startDaemon call in a test with NodeFilesystem and no npm brings the bug back. Nothing guards against it.
    • A gateway e2e daemon with driver: "none" now gets a config file (update only).

    Fast track

    • Defect: yes
    • Fix tried: yes
    • Nothing public added or broken: yes
    • No ADR or rule changed: yes
    • One fix: yes

    Written by an agent.

  4. removed their assignment
    on Nov 26, 2026
  5. added
    bug:ready
    fast-track
    and removed
    bug:new
    on Nov 26, 2026
  6. self-assigned this
    on Nov 26, 2026
  7. V3RON commented on Nov 26, 2026

    @V3RON
    ContributorAuthor

    Decision

    Scope: this fix covers the unit and e2e lanes, and the Playwright console lane (e2e/console/fixtures.ts) and the real-proxy lane (e2e/real-proxy/lane.ts) too, in PR #1889. Each has a check that it does not ask npm. The maintainer reversed the first choice, which left the last two lanes out (2026-11-30: #1885 (comment)).

    Tests: src/daemon/test-rigs-npm.test.ts and e2e/update-check-registry.test.ts pin the unit and e2e lanes, e2e/console/update-check.test.ts the console lane, e2e/real-proxy/lane.test.ts the real-proxy lane.

    Written by an agent.

  8. V3RON commented on Nov 26, 2026

    @V3RON
    ContributorAuthor

    Handoff

    Done: fix in PR #1889 (head 08c0ced): test rigs pass a noRegistry() npm fake, and the e2e env seeds update.check: false. Both reproduction tests pass. The audit probed both tests and found them red without the fix. Console and real-proxy lanes left out (see ## Decision).

    Not done: review. Round 1 came back Assessment: incomplete: the reviewer started no spec, code or claims lens. It found no defect on its own read. e2e/update-check-registry.test.ts was not run by the reviewer.

    Findings: none raised.

    Blocked on: a full review round 1 with all three lenses. Re-run /deliver #1885 (it resumes at review), or review PR #1889 by hand.

    Written by an agent.

  9. added
    bug:blocked
    and removed
    bug:ready
    on Nov 26, 2026
  10. removed their assignment
    on Nov 26, 2026
  11. V3RON commented on Nov 26, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: none
    Parked: #1885 — review round 1 incomplete, no lens ran (PR #1889)
    Decided: #1885 — fix console and real-proxy lanes too? → left out

    Written by an agent.

  12. 7 remaining items

  13. V3RON commented on Nov 30, 2026

    @V3RON
    ContributorAuthor

    Handoff

    Done: PR #1889 at 1353d6e covers the unit, e2e, console and real-proxy lanes. Review complete: round 1 (spec, code, claims), round 2 and fix-check (code, claims); every finding is closed. The PR is ready and mergeable.

    Not done: the merge. CI on 1353d6e ended red on Static checks and Quality: a format error from main (#1846), fixed there by #1963. On 2026-11-30 the maintainer lifted the hold; main was merged in (54eae5cd1, own diff unchanged) and the gate started again.

    Findings: the review inputs do not carry ## Decision comments, so the spec lens called the wider scope unrequested.

    Blocked on: the maintainer. held: PR #1889 changes 286 lines, over 250; PR #1889 changes 18 files, over 8; PR #1889 has a "Decision taken" comment. The maintainer merges the PR, or removes fast-track and sets bug:ready.

    Written by an agent.

  14. V3RON commented on Nov 30, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: none
    Parked: #1885 — held by the fast track, PR #1889 reviewed and ready
    Decided: none

    Written by an agent.

  15. added
    bug:blocked
    and removed
    bug:ready
    on Nov 30, 2026
  16. removed their assignment
    on Nov 30, 2026
  17. added
    bug:ready
    and removed
    bug:blocked
    fast-track
    on Nov 30, 2026
  18. self-assigned this
    on Nov 30, 2026
  19. V3RON commented on Nov 30, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1889 (#1885)
    Parked: none
    Decided: none

    Written by an agent.

  20. added a commit that references this issue on Nov 30, 2026
    067d669
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug:ready

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions