Skip to content

test: daemon-starting suites refuse on a developer machine; make verify-full-container - #643

Merged
atlas-from-plumb merged 16 commits into
mainfrom
atlas/plan-526-no-host-daemon-tests
Oct 12, 2026
Merged

atlas-from-plumb merged 16 commits into
mainfrom
atlas/plan-526-no-host-daemon-tests

Conversation

@atlas-from-plumb

Copy link
Copy Markdown
Collaborator

Why

A developer machine should run exactly one plumb daemon: the one its sessions use. Two test suites start plumb daemons of their own:

  • cmd/smoke (the integration tag, so part of make verify-full);
  • cmd/clientsmoke (the clients, clients_e2e and clients_conformance tags).

Run on a developer machine, they put more daemons beside that one. A leak from a similar harness elsewhere left 64 of them running.

What

  • internal/separateenv (foundation) answers one question: may this process start a daemon of its own? It accepts exactly three kinds of evidence:

    • GITHUB_ACTIONS=true, on any OS;
    • Linux with a readable /.dockerenv or /run/.containerenv;
    • Linux with PLUMB_SEPARATE_ENV=vm.

    No CI=true, no override, no case folding. An unreadable marker counts as absent. The test vectors are shared byte-for-byte with the Node copy of the rule in dsh-plumb-identity. This is a guard against accidental runs, not a security boundary.

  • cmd/smoke gets a new TestMain, and cmd/clientsmoke's existing TestMain gets the guard first. Both refuse with exit 2 before building or starting anything. An inventory of every test package confirms these are the only two that start a real plumb daemon process; everything else is in-process.

  • make verify-full-container (scripts/verify-full-container.sh plus build/docker/verify.Dockerfile) runs make verify-full in a Linux container with pinned Go, golangci-lint, gopls, pyright and the npm language servers.

    • It streams in the working tree as git sees it, then makes a one-commit snapshot so the checks that call git work.
    • It runs with --init --rm.
    • It counts plumb daemon processes by exact argv every 200 ms during the suite, with at most one allowed, and watches for 30 s after the suite, when none may be left.
    • It fails closed if the process table can't be read, and treats the container as gone only when the engine says so.
  • Docs: AGENTS.md, CONTRIBUTING.md, docs/contributing.md, the make verify success message, the pre-commit hook text and the PR template all point at make verify-full-container. make docker-integration gains --init. There is a CHANGELOG entry.

CI is unaffected: hosted runners set GITHUB_ACTIONS=true.

Verification

  • go test ./internal/separateenv/: 18 shared vectors, real-filesystem marker checks, and a child re-exec that must exit 2.
  • On the host, go test -tags=integration ./cmd/smoke/ and -tags=clients ./cmd/clientsmoke/ both print the refusal and exit before building anything. The host daemon count is unchanged.
  • The census and the "gone" check were tested in a container against fakes and a real engine.
  • Full make verify-full-container: see the follow-up comment.

Part of PLAN-526 (plumb-ops). Reviewed with a peer agent.

🤖 Generated with Claude Code

@golimpio
golimpio force-pushed the atlas/plan-526-no-host-daemon-tests branch 2 times, most recently from 05c1c36 to 7d0d1b9 Compare October 12, 2026 03:02
atlas-from-plumb and others added 16 commits October 12, 2026 23:09
…fy-full-container (PLAN-526)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed on an unreadable process table (PLAN-526 review)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ne's answer (PLAN-526 review)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r that lived through the suite (PLAN-526 review)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ite (PLAN-526 review)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ies (found by pure-antelope)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… child as a second daemon (PLAN-526)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…from a daemon by PF_FORKNOEXEC (PLAN-526 review)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rge-tree -X, and runs as a non-root user (found by pure-antelope)

On main the container run failed 7 tests for environmental reasons: no
history or tags in the one-commit snapshot (TestLifecycleSaveCost, the
v0.0.0 version in TestSmoke_ServeReplacementResumesByName), bookworm's git
2.39 lacking merge-tree -X, and root defeating the chmod-unwritable tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ll-container as it now is

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s, for diagnosis (PLAN-526)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…error out of the log

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pid (comm) header (PLAN-526 review)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hed results (PLAN-526)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- verify-full-container fails when its watcher sees no daemon at all
  (cmd/smoke always starts one), reads any non-count as an unread table,
  keeps the packaging loop's status from its last file, cleans its input dir
  on any exit, and runs docker in the background so its trap can fire;
- a go/parser test pins separateenv.RequireForTestMain as the first
  statement of each daemon-starting TestMain, which CI and the container,
  both separate environments, could never notice missing;
- docs: the verify message names cmd/smoke, the CHANGELOG no longer claims a
  pinned git, CONTRIBUTING says the verify image has no client CLIs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ll ends on the engine's gone answer (PLAN-526 review)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@golimpio
golimpio force-pushed the atlas/plan-526-no-host-daemon-tests branch from b6c8a82 to 56a80d5 Compare October 12, 2026 12:09

@golimpio golimpio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved under the owner's delegation. Bar met at 56a80d5: independent agent review PASS (should-fixes folded), peer review by serene-antelope, all 10 CI checks green on this exact head, make verify-full-container green on this exact head (uncached; cmd/smoke ran 121 s; at most one plumb daemon; none left; container gone), outer-wrapper SIGTERM control PASS, mutation-tested guard wiring and census.

@atlas-from-plumb
atlas-from-plumb merged commit cc2f053 into main Oct 12, 2026
10 checks passed
@atlas-from-plumb
atlas-from-plumb deleted the atlas/plan-526-no-host-daemon-tests branch October 12, 2026 12:33
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.

2 participants