GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Read --json envelopes in CLI tests through one tests/common/envelope module (#1089) by mikolalysenko · Pull Request #1272 · SocketDev/socket-patch

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

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

Refs #1089 (child 1: the shared JSON assertion helpers). Also refs #824 (one test-support module).

Summary

CLI tests now read the --json envelope through one module, tests/common/envelope.rs. It parses stdout, reads events[], finds an event, and collects error and warning codes. About 25 private copies of those readers in 24 test files are deleted. A ratchet test stops new copies from appearing.

Why

  • The "assert on stable codes, not sentences" tracker (#1089, register row C32; the living document's Part 8, "Exact human-text assertions") needs one set of envelope readers before its children can rewrite sentence assertions as code checks. Child 1 (Assert error codes instead of sentences in remove's covgap suite and add shared JSON assertion helpers #1090) asked for these helpers. Its own file, remove/covgap_commands_remove.rs, is changed by Use tests/common's binary() and git_sha256 in 40 more CLI tests (#824) #1258, so it moves in a later PR.
  • Every suite has been hand-rolling the same readers, and the copies have drifted. Some panic on a missing events, others return empty. find_event takes either Option<&str> or a required code. events returns either Vec<(purl, action, errorCode)> or &Vec<Value>. There are five recursive "every code" walkers and six warning-code collectors.
  • Leverage: B 0 · U 1 (Tracking: assert stable codes instead of human sentences in CLI tests, and fold the covgap suites #1089 children 2–6 assert through these helpers) · D ≈25 duplicate test helpers · S 0 · R L (tests only).

What changed

  • New tests/common/envelope.rs, re-exported from common and includable on its own with #[path = "common/envelope.rs"] mod envelope;:
    • parse_json_envelope, json_string, envelope_error_code, envelope_error_message. These moved from common/mod.rs unchanged and are re-exported, so existing callers don't change.
    • events (strict), find_event(env, action, Option<code>), event_triples, event_codes (lenient), codes_in(warnings_array) and all_codes (recursive code/errorCode).
  • Callers moved onto it, with their copies deleted:
    • covgap_commands_vendor, vendor_eject, vendor_partial_staging_e2e, apply/check_verifies_installed_tree and vendor_group_commit_e2e;
    • e2e_vendor_{bun,cargo,gem,golang,yarn_classic}_build;
    • e2e_sbt_{build,hosted,vendor,vendor_build}, e2e_scala_cli_vendor, e2e_sbt/agent and e2e_vex_lockfile/{golang,sbt_vendored};
    • e2e_gradle_agent_build, gradle_agent_cli, mode_migration_{bun,vlt}, covgap_commands_scan_hosted and coverage_fix_scan_hosted_dryrun_vendored.
  • New cli/envelope_helper_copies.rs:
    • a ratchet that fails when a new top-level private reader appears. Files still listed are changed by open PRs, shared modules whose includers are, or readers with a rule of their own. A stale entry is not an error.
    • self-tests that run each former copy's shape through the shared readers on the inputs where the copies differed: strict vs lenient events, the golang Option find, absent triple fields, two chained warning arrays, non-string codes, and the order of errorCode vs code.

Deleted

git diff --stat origin/main: 28 files, +575/−462. All of it is test code; no production lines change. Of the additions, 109 are the shared module and 268 are the ratchet plus its self-tests. Without those, the migrated files are about −290 net.

Behavior

No production change. In the tests:

  • events is now strict (it panics on a missing array) for the three callers that read it leniently. Every command envelope serializes events, and those suites pass.
  • e2e_vendor_golang_build's three find_event(..).is_some() asserts now panic with the envelope, instead of a custom message, when the event is missing.
  • Parse-failure panic texts now read "failed to parse JSON envelope".

Test evidence

  • cargo clippy --workspace --all-features -- -D warnings: clean.
  • cargo test -p socket-patch-cli --all-features --tests --no-run: every CLI test target compiles with no warnings, including the ignored e2e and docker binaries.
  • Suites passed: cli 105 (with the new ratchet and self-tests), apply 119, vendor_eject 8, vendor_partial_staging_e2e 9, covgap_commands_scan_hosted 55, coverage_fix_scan_hosted_dryrun_vendored 9, gradle_agent_cli 52, vendor_group_commit_e2e 11, e2e_sbt_vendor 37, mode_migration_bun 33, mode_migration_vlt 26 (14 ignored), e2e_sbt_hosted 29, spawn_env_hygiene 12.
  • covgap_commands_vendor: 52 passed, 3 failed. The 3 *_state_write_failure_* tests depend on chmod and fail the same way on main in this sandbox, because it runs as root; they pass in CI.

Risk

Low. The change is test-only and compiles across every test target. The e2e build suites that need real package managers (bun, cargo, gem, Go, yarn classic, sbt, scala-cli, Gradle) were compiled but not run here.

🤖 Generated with Claude Code


Note

Low Risk
Test-only refactor with no production code changes; behavior shifts are limited to stricter envelope helpers in migrated tests.

Overview
Centralizes CLI --json envelope parsing for tests in tests/common/envelope.rs (parse_json_envelope, events, find_event, event_triples, codes_in, all_codes, etc.) and re-exports the parse/error helpers from common/mod.rs.

~24 test files drop duplicated local readers and call the shared module instead (via common::envelope or #[path = "common/envelope.rs"]). cli/envelope_helper_copies.rs adds a ratchet that fails on new private envelope readers (with an allowlist for files still migrating) and self-tests that lock in former copy behavior (strict vs lenient events, warning chaining, etc.).

Test-only refactor for #1089; a few assertions now use stricter events / panic-on-miss find_event where envelopes always include events[].

Reviewed by Cursor Bugbot for commit 1ff215e. Configure here.


Generated by Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@claude
Start refactor for #1089
5f9c320
Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko Mikola Lysenko (mikolalysenko) added arch-refactor PR opened by the scheduled architecture refactor routine refactor Structural change: duplicated code or logic, missing abstraction, layering, dead code labels Oct 9, 2026
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 9, 2026
Tracking: assert stable codes instead of human sentences in CLI tests, and fold the covgap suites #1089
Open
14 tasks
Claude (claude) added 2 commits October 9, 2026 13:08
@claude
Share --json envelope readers in CLI tests
bd58217
About 25 test files each carried a private copy of the same --json
envelope readers: parse stdout, read events[], find an event, and
collect error and warning codes. The copies had drifted on strictness
and shape, so the next suite to assert on codes would add one more.

tests/common/envelope.rs now owns them, re-exported from common and
includable on its own. The migrated files delete their copies, and a
ratchet in the cli binary keeps new ones out (files changed by open
PRs stay pending). Its self-tests run each former shape through the
shared readers on the inputs where the copies differed.

No production change.

Assisted-by: Claude Code:claude-opus-5-5
@claude
Borrow events in the apply --check test
1ff215e
Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review October 9, 2026 13:18
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

cursor[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Mikola Lysenko (mikolalysenko) pushed a commit that referenced this pull request Oct 9, 2026
@claude
refactor: run 20261009T131841Z (PR #1272)
f82e062
cursor[bot]
cursor Bot reviewed Oct 9, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

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 1ff215e. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

[agent] gradle 8.14.3 / jdk 21 / vendor / windows-latest failed in e2e_vendor_jvm_build::gradle_multi_project_vendor_locked_offline_tamper_and_byte_exact_revert. The failure is a Gradle BUILD FAILED inside an artifact download (DefaultExternalResourceArtifactResolver.downloadByCoords). In the same leg, the other two Gradle cells passed.

I don't think this PR caused it. The PR changes only CLI test helpers and doesn't touch e2e_vendor_jvm_build, any JVM fixture or any production code. The failure is in Gradle's own fetch, before any socket-patch assertion runs. No fix exists to port.

This session can't re-run the job (the rerun call returned 403). Please re-run the failed job once. If it fails again, it's a real failure and needs a look.


Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Tanmay182003
Tanmay Singla (Tanmay182003) approved these changes Oct 9, 2026
View reviewed changes
@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Oct 9, 2026
@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Oct 9, 2026
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

Ready for review at 1ff215ec5.

  • CI: every check on this head green. The one red job (gradle 8.14.3 / jdk 21 / vendor / windows-latest, a Gradle artifact-download failure in a test this PR doesn't touch) passed on re-run. Merges cleanly into current main (88d5c598, which now includes Use tests/common's binary() and git_sha256 in 40 more CLI tests (#824) #1258's test-helper move).
  • Bugbot: reviewed this head, no new issues; no open review threads.
  • Test-only change: CLI tests read --json envelopes through tests/common/envelope.
  • Slack: not announced (this run's Slack connector has no send tool); the next run should retry.

Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Merged via the queue into main with commit 65b9498 Oct 9, 2026
420 of 421 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the arch-refactor/1089-envelope-helpers branch October 9, 2026 15:17
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 14, 2026
CI: remove suite asserts codes, not sentences (#1089) #1535
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cursor cursor[bot] cursor[bot] left review comments
@Tanmay182003 Tanmay Singla (Tanmay182003) Tanmay182003 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

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

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mikolalysenko @Tanmay182003 @claude
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.