Skip to content

Share one docker test harness (#1968, first slice) - #1972

Merged
Mikola Lysenko (mikolalysenko) merged 2 commits into
mainfrom
arch-refactor/1968-docker-common
Nov 2, 2026
Merged

Mikola Lysenko (mikolalysenko) merged 2 commits into
mainfrom
arch-refactor/1968-docker-common

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

LLM Description written by Claude Code:claude-opus-5-5

Refs #1968 (register T60, living document Part 5). This is the first slice. The issue stays open for the rest (listed under "Remaining").

Why

Each docker_e2e_* suite carried its own copy of the container scaffolding. 9 copies of cov_docker_args and 8 of assert_vex_agent_attested were byte-identical (md5-checked), and skip_if_no_image had drifted: 7 copies never read the required switch, and deno read SOCKET_PATCH_REQUIRE_DOCKER, which nothing sets.

Changes (test-only)

  • New tests/docker_common/mod.rs, the one home for:
    • cov_docker_args, with sbt's SOCKET_PATCH_DOCKER_BIN branch folded in;
    • skip_if_no_image(image) / skip_or_require_image, moved from docker_vendor_common;
    • run_container(image, script);
    • assert_vex_agent_attested(stdout, purl, ghsa).
  • Deleted per-suite copies:
    • cov_docker_args ×10, counting docker_vendor_common and sbt's binary_mounts;
    • skip_if_no_image ×10, counting npm's skip_if_no_docker_image and sbt's required();
    • run_container ×5 and npm's run_in_container;
    • the inline docker run blocks in cargo, golang and maven;
    • assert_vex_agent_attested ×8;
    • plain_sha256 ×3 and pypi's sha256_hex (use common::sha256_hex).
  • Other deletions:
    • deno's SOCKET_PATCH_REQUIRE_DOCKER gate;
    • the dead docker_vendor_common::run_in_image;
    • npm's unused Duration import and its const _ suppressor.
  • docker_vendor_common builds its docker run on crate::docker_common::cov_docker_args. Its includers (5 vendor suites, docker_e2e_npm, tests/vendor/main.rs) also declare docker_common. The selftest imports skip_or_require_image from there.

Diff: +260 / −1,113, all in tests (net −853). No production lines change.

Behavior

  • The required gate. Every agent suite now honours SOCKET_PATCH_DOCKER_E2E_REQUIRED=1 the way sbt and the vendor capstones already did. The variable is set only for:

    • the sbt) arm of both docker jobs;
    • composer-compatibility.yml, which runs only docker_e2e_vendor_composer;
    • scripts/sbt-compat-matrix.sh, which runs only docker_e2e_sbt.

    So no CI leg changes outcome.

  • SOCKET_PATCH_DOCKER_BIN. It now overrides the binary in every suite, not only in sbt. Only sbt-compat-matrix.sh sets it.

  • Skip messages. Their wording is now uniform. npm's no-docker message no longer mentions SOCKET_PATCH_TEST_HOST, which the module doc still documents.

Verification

  • All 15 docker_e2e_* binaries build and pass with --features docker-e2e. Without images, the container tests skip and the host-side tests run: 17–31 per binary.
  • tests/vendor's docker_vendor_common selftests pass 8/8, including a_required_docker_suite_fails_on_a_missing_image.
  • cargo clippy --workspace --all-features -- -D warnings is clean.
  • The containers themselves only run in the coverage-docker / e2e-docker jobs, so this needs a full-scope CI dispatch to prove them.

/code-review high

It raised 10 findings. None were fixed, for these reasons:

  1. Deno lost SOCKET_PATCH_REQUIRE_DOCKER. This is intended (Share one docker test harness: cov_docker_args ×10, skip_if_no_image ×11 and assert_vex_agent_attested ×8 are copied, and 8 docker suites never honour SOCKET_PATCH_DOCKER_E2E_REQUIRED #1968, step 3): nothing sets the variable, and the shared gate reads SOCKET_PATCH_DOCKER_E2E_REQUIRED.
  2. SOCKET_PATCH_DOCKER_BIN now applies everywhere and skips the coverage mounts. Its only setter runs sbt alone, so it keeps sbt's precedence.
  3. Agent suites now honour REQUIRED. This is intended, and as shown above no runner sets it across suites.
  4. npm's host-mode hint is gone from the skip message. The module doc still documents host mode.
  5. run_container takes no extra args. Folding in sbt (-m 2g, -e), docker_vendor_common::docker_command and npm's vlt smoke needs an extra parameter. That is left for the follow-up, together with items 6 and 7.
  6. host.docker.internal URL ×15 and api_url_for_container ×2: follow-up.
  7. assert_api_path_exercised ×4, drifted: follow-up, as the issue's assert_api_exercised.
  8. crate::docker_common is a crate-root requirement. A missing declaration fails compilation at that line.
  9. A docker image inspect runs per test. That was already the case and is cheap.
  10. A ci.yml comment names the per-suite files. ci.yml is left alone because ci-janitor PRs Retry pinned bundler installs in the e2e legs #1854 and Annotate failing tests in macOS/Windows test legs #1890 change it.

Remaining on #1968

  • export REQUIRED for every docker leg in ci.yml;
  • the shared assert_api_exercised and container URL;
  • the GIT_SHA256_FN copies ×3 → git_blob_sha;
  • the bash "applied": 1 greps → assert_summary (gem matches 10);
  • run_container with extra args.

Risk

Low to medium. The change is test-only and compile-checked, but the docker containers can't run in this sandbox.

🤖 Generated with Claude Code

https://claude.ai/code/session_011f9aeP9dHgNGnDr1A5rmCp


Note

Low Risk
Changes are confined to integration tests and shared test modules; production code is untouched, with minor env-gate alignment that the PR notes should not alter current CI legs.

Overview
Introduces tests/docker_common/mod.rs as the shared home for Docker integration-test plumbing, and wires every docker_e2e_* (and vendor suites that already used overlapping helpers) through it instead of copy-pasted locals.

Consolidated helpers: cov_docker_args (now also honors SOCKET_PATCH_DOCKER_BIN before coverage mounts), skip_if_no_image / skip_or_require_image, run_container(image, script), and assert_vex_agent_attested(stdout, purl, ghsa) with an explicit GHSA argument. docker_vendor_common drops its duplicate skip/coverage logic and calls crate::docker_common::cov_docker_args; the unused run_in_image helper is removed.

Suite cleanup: Per-file duplicates of coverage mounts, skip gates, container runners, VEX oracles, and local plain_sha256 / pypi sha256_hex are deleted in favor of common::sha256_hex. Agent suites pass an IMAGE constant into the shared skip/run APIs; sbt swaps binary_mounts for cov_docker_args.

Intentional test behavior alignment: All agent docker suites now respect SOCKET_PATCH_DOCKER_E2E_REQUIRED=1 (replacing deno’s unused SOCKET_PATCH_REQUIRE_DOCKER gate). Skip messaging is unified (npm no longer mentions host mode in the skip line).

Reviewed by Cursor Bugbot for commit 22c76cc. Configure here.


Generated by Claude Code

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko Mikola Lysenko (mikolalysenko) added refactor Structural change: duplicated code or logic, missing abstraction, layering, dead code arch-refactor PR opened by the scheduled architecture refactor routine labels Nov 2, 2026
Add tests/docker_common as the one home for the container plumbing
every docker suite copied: cov_docker_args (with sbt's
SOCKET_PATCH_DOCKER_BIN branch), skip_if_no_image /
skip_or_require_image, run_container and assert_vex_agent_attested.

Delete the copies in the 10 docker_e2e agent suites and
docker_vendor_common, the plain_sha256/sha256_hex copies (common has
sha256_hex), deno's SOCKET_PATCH_REQUIRE_DOCKER gate (set nowhere),
the dead run_in_image and npm's unused Duration import.

Every agent suite's skip now honours SOCKET_PATCH_DOCKER_E2E_REQUIRED
like the sbt and vendor suites. CI sets it only on legs whose images
it builds, so no CI leg changes outcome.

Refs #1968

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review November 2, 2026 05:07
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

Mikola Lysenko (mikolalysenko) pushed a commit that referenced this pull request Nov 2, 2026
Assisted-by: Claude Code:claude-opus-5-5

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 22c76cc. Configure here.

Mikola Lysenko (mikolalysenko) pushed a commit that referenced this pull request Nov 2, 2026
Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Nov 2, 2026
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

Ready for review at 22c76cc8 (burn-down agent).


Generated by Claude Code

@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

Final review brief

What it does: Adds a shared tests/docker_common module (cov_docker_args, skip_if_no_image / skip_or_require_image, run_container, assert_vex_agent_attested) and deletes the per-suite copies from the 10 agent docker suites and docker_vendor_common. This is the first slice of #1968. It changes test code only.

Risk: low. I compared every deleted copy line by line with the shared code. The images, docker flags (sbt keeps -m 2g and SOCKET_PATCH_JDK), coverage mounts, env vars and VEX checks are all unchanged. Two behaviours change, and the description states both: every suite now honours SOCKET_PATCH_DOCKER_E2E_REQUIRED=1 and SOCKET_PATCH_DOCKER_BIN. The only CI legs that set those already ran suites that honoured them, so no CI outcome changes.

Look here:

Verified: I read the full diff against #1968. cargo test -p socket-patch-cli --features docker-e2e --no-run builds all 15 docker_e2e_* targets plus --test vendor. Without docker, all 15 binaries pass with their container tests skipped, and the docker_vendor_common selftests pass 8/8. I diffed --list output for every binary against the merge-base: the test names are identical, none lost or added. Clippy with --all-targets shows no lints in the touched code; the existing lints in untouched files are the same at base and head. CI is green (ci-ok, clippy). Bugbot is neutral. CHANGELOG.md is untouched. The containers themselves were not run here, since there is no docker in this environment.

Changes I made: none.

Open questions / nits (non-blocking, for the follow-up slices):

Auto-merge is armed, so approving sends this straight to the merge queue.


Generated by Claude Code

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.

[agent] Reviewed 22c76cc86f38c0d8f4e0be42971dbcda0fb31a87. Checked shared Docker image gates, coverage mounts, execution flags and agent VEX assertions against migrated suites. No major correctness issues found. Validation: source and regression-test review plus the available exact-head CI checks; no local test pass is claimed.

@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 44d22d2 Nov 2, 2026
82 checks passed
@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the arch-refactor/1968-docker-common branch November 2, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-refactor PR opened by the scheduled architecture refactor routine Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review refactor Structural change: duplicated code or logic, missing abstraction, layering, dead code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants