Skip to content

Consolidate plugin protocol round-trip tests - #296

Merged
leynos merged 1 commit into
mainfrom
test-quality-protocol-roundtrip-20260923-restacked
Nov 8, 2026
Merged

leynos merged 1 commit into
mainfrom
test-quality-protocol-roundtrip-20260923-restacked

Conversation

@leynos

@leynos leynos commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Consolidates the JSON round-trip assertions in the plugin protocol unit tests
behind one private helper, so serialization, deserialization and equality are
checked in a single place while each protocol test keeps its own assertions.

This branch previously sat on a chain of layers that had not landed. Its base
is now main at 327a0f26, and it carries only its own commit.

What changed

  • crates/weaver-plugins/src/protocol/tests.rs gains
    assert_json_round_trip, which serializes a value, deserializes it back,
    asserts the value survived, and returns the decoded copy so each caller can
    make its protocol-specific checks. Five call sites use it, replacing a
    repeated three-line to_string / from_str / assert_eq sequence.
  • docs/developers-guide.md records the helper's reuse boundary as a new
    section, so it is not mistaken for a test-support API that other crates may
    depend on.

Replay

The prior head, ad9864d8, sat on thirteen commits that had not landed:
#292 (merged as df6d78e7), #295 (merged as 327a0f26) and #294
(closed as superseded). Only ad9864d8 is this PR's own work, so it was
replayed directly onto main with git cherry-pick:

  • The Rust change applied cleanly and the result is byte-identical to the
    previous head's file (sha256 a435c287…), so no protocol behaviour moved.
  • The only conflict was in docs/developers-guide.md. main has renumbered
    every ## heading, so the new prose could not stay where it was. It is now
    ## 26, appended after the existing ## 25. Renumbering 23–25 was not
    an option: all twenty-five headings are numbered, and anchor links such as
    developers-guide.md#12-adding-or-renaming-public-commands are already
    referenced from the execplans, so shifting numbers would break live links.

The reviewed diff is therefore two files, not the 18 the previous base
implied.

Validation

  • cargo nextest run -p weaver-plugins protocol: 22 passed, 113 filtered out.
    These are the tests this change touches.
  • git merge-tree against main reports a clean merge.
  • Hosted build-test passed on the previous head. It is being re-run for this
    head because the base changed.

References

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review.

Summary

  • Add a private assert_json_round_trip helper for plugin protocol tests. It checks JSON serialization, deserialization and equality, then returns the decoded value.
  • Use the helper in request and response tests while retaining protocol-specific assertions.
  • Document that the helper is for use within the protocol test module, not shared test support.

Walkthrough

The protocol tests add and use a shared JSON round-trip assertion helper. The developer guide documents the helper and states that its reuse is limited to the protocol test module.

Changes

Protocol JSON round-trip tests

Layer / File(s) Summary
Add and use the round-trip helper
crates/weaver-plugins/src/protocol/tests.rs, docs/developers-guide.md
The helper serialises and deserialises values, reports conversion failures, checks equality, and returns the decoded value. Request, response, failure-response, empty-output, and analysis-output tests use it. The guide documents the helper and its module-local use.

Change: Other

Merge Risk: Minimal · up to ad986

This change consolidates protocol tests without changing production behavior; no concrete merge-blocking risk is identified.

Pre-merge checks: Passed 14

Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Testing (Overall) Passed The authoritative diff changes only crates/weaver-plugins/src/protocol/tests.rs and documentation. It introduces no production functionality or behavioural change. The new private helper performs re…
User-Facing Documentation Passed The pull request changes only crates/weaver-plugins/src/protocol/tests.rs and docs/developers-guide.md. The code change is a private test helper that consolidates existing JSON round-trip assertio…
Developer Documentation Passed Pass this check. The pull request adds only the private assert_json_round_trip test helper and reuses it within crates/weaver-plugins/src/protocol/tests.rs. docs/developers-guide.md documents it…
Module-Level Documentation Passed The changed Rust module crates/weaver-plugins/src/protocol/tests.rs has the module-level doc comment //! Unit tests for the IPC protocol types. The comment states the module's purpose and its rela…
Testing (Unit And Behavioural) Passed Pass this check. The pull request changes only protocol tests and documentation. The private helper exercises the real serde JSON boundary for PluginRequest and PluginResponse, checks serializatio…
Testing (Property / Proof) Passed PASS: The pull request changes only crates/weaver-plugins/src/protocol/tests.rs and documentation. It consolidates existing finite request and response round-trip cases behind a private helper and a…
Testing (Compile-Time / Ui) Passed Pass this check. The reviewed diff changes only crates/weaver-plugins/src/protocol/tests.rs and documentation. It adds a private test helper and refactors existing JSON round-trip assertions; it doe…
Unit Architecture Passed Pass this check. The pull request changes only a private test helper and developer documentation. assert_json_round_trip performs explicit JSON serialization, deserialization, equality checking, and…
Domain Architecture Passed The reviewed range changes only crates/weaver-plugins/src/protocol/tests.rs and docs/developers-guide.md. The code change adds a private test-only JSON round-trip helper and replaces duplicated as…
Observability Passed Mark this check PASS. The pull request changes only crates/weaver-plugins/src/protocol/tests.rs and docs/developers-guide.md. It consolidates test-only JSON round-trip assertions and adds document…
Title check Passed The title "Consolidate plugin protocol round-trip tests" matches the main change. The PR adds a private helper, assert_json_round_trip, in crates/weaver-plugins/src/protocol/tests.rs, and five call si…
Description check Passed The description relates directly to the changeset. It explains the new assert_json_round_trip helper, the five call sites in the protocol tests, and the new developers-guide section that records the h…
Full details: Testing (Overall)

Explanation

The authoritative diff changes only crates/weaver-plugins/src/protocol/tests.rs and documentation. It introduces no production functionality or behavioural change. The new private helper performs real JSON serialization, deserialization, and PartialEq comparison. Its callers cover requests, success and failure responses, diagnostics, empty output, and analysis output, while retaining field-level assertions. These tests would fail for common incorrect wire representations or lost values, so they are not vacuous.

Full details: User-Facing Documentation

Explanation

The pull request changes only crates/weaver-plugins/src/protocol/tests.rs and docs/developers-guide.md. The code change is a private test helper that consolidates existing JSON round-trip assertions; it introduces no user-facing functionality or behaviour and no exported API changes. Therefore, docs/users-guide.md documentation is not required.

Full details: Developer Documentation

Explanation

Pass this check. The pull request adds only the private assert_json_round_trip test helper and reuses it within crates/weaver-plugins/src/protocol/tests.rs. docs/developers-guide.md documents its serialization, deserialization, equality checks, private scope, and reuse boundary. The change introduces no public API, architecture, tooling, build requirement, roadmap item, or design decision that requires an ADR or separate design update.

Full details: Module-Level Documentation

Explanation

The changed Rust module crates/weaver-plugins/src/protocol/tests.rs has the module-level doc comment //! Unit tests for the IPC protocol types. The comment states the module's purpose and its relationship to the IPC protocol types. The pull request preserves this documentation while adding the private helper.

Full details: Testing (Unit And Behavioural)

Explanation

Pass this check. The pull request changes only protocol tests and documentation. The private helper exercises the real serde JSON boundary for PluginRequest and PluginResponse, checks serialization, deserialization, and equality, and returns the decoded value. Existing request, success, failure, empty-output, diagnostics, tagged-output, and analysis assertions remain in place. The base comparison confirms that the refactor preserves these cases and removes only duplicated round-trip code. No new externally observable workflow requires an end-to-end test.

Full details: Testing (Property / Proof)

Explanation

PASS: The pull request changes only crates/weaver-plugins/src/protocol/tests.rs and documentation. It consolidates existing finite request and response round-trip cases behind a private helper and adds no new production invariant, state transition, or protocol behaviour. The cases cover a small, readable table of representative variants, so the custom check does not require a property test or exhaustive proof.

Full details: Testing (Compile-Time / Ui)

Explanation

Pass this check. The reviewed diff changes only crates/weaver-plugins/src/protocol/tests.rs and documentation. It adds a private test helper and refactors existing JSON round-trip assertions; it does not change compile-time behaviour, production protocol declarations, or public entities. The tests retain focused semantic checks for request fields, response success and diagnostics, output variants, and JSON kind tags. A trybuild test is therefore not required, and snapshot tests are not necessary for this focused assertion-based coverage.

Full details: Unit Architecture

Explanation

Pass this check. The pull request changes only a private test helper and developer documentation. assert_json_round_trip performs explicit JSON serialization, deserialization, equality checking, and panic reporting inside crates/weaver-plugins/src/protocol/tests.rs; it does not add production queries, commands, external state mutation, network access, clocks, global dependencies, or hidden fallible work in a read API. The helper remains local to the test module, and the existing protocol-specific assertions remain at each caller.

Full details: Domain Architecture

Explanation

The reviewed range changes only crates/weaver-plugins/src/protocol/tests.rs and docs/developers-guide.md. The code change adds a private test-only JSON round-trip helper and replaces duplicated assertions; it does not change domain models, commands, adapters, repositories, transport code, or infrastructure boundaries. The guide explicitly keeps the helper private to the protocol test module. No stated Domain Architecture failure condition is introduced.

Full details: Observability

Explanation

Mark this check PASS. The pull request changes only crates/weaver-plugins/src/protocol/tests.rs and docs/developers-guide.md. It consolidates test-only JSON round-trip assertions and adds documentation. It does not alter production or operational behaviour, so no logging, metrics, tracing, or alerts are required.

Full details: Title check

Explanation

The title "Consolidate plugin protocol round-trip tests" matches the main change. The PR adds a private helper, assert_json_round_trip, in crates/weaver-plugins/src/protocol/tests.rs, and five call sites use it in place of repeated serialize, deserialize and equality checks. The title does not reference a roadmap item or an issue number. The title requirements do not require either, because the PR is neither a roadmap task nor an issue fix, and it contains no new execplan.

Full details: Description check

Explanation

The description relates directly to the changeset. It explains the new assert_json_round_trip helper, the five call sites in the protocol tests, and the new developers-guide section that records the helper's reuse boundary. It also describes the cherry-pick replay onto main and the validation run.

Round-trip the values through JSON’s door
Check each decoded value once more
Requests and responses join the ride
Diagnostics and outputs stay beside
The guide records where the helper belongs
Let clear test signals carry on###

ℹ️ Recent review info

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: f7689c8f-cca1-4088-9a22-caae2114c0bc

📥 Commits

Reviewing files that changed from the base of the PR and between 4ebdd5b and ad9864d.

📒 Files selected for processing (2)

  • crates/weaver-plugins/src/protocol/tests.rs
  • docs/developers-guide.md
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • leynos/nixie (auto-detected)
  • leynos/ortho-config (auto-detected)
  • leynos/typos-config-builder (auto-detected)
  • leynos/whitaker (auto-detected)
  • leynos/shared-actions (auto-detected)

Included review availability: 5 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 6 reviews per hour.

@sourcery-ai

sourcery-ai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Documentation

Document that the JSON round-trip helper is private to the protocol tests and should not become shared test support.

  • docs/developers-guide.md L2323-2330

Tests

Add a private JSON round-trip assertion that checks serialization, deserialization, and equality, then use it across protocol tests while retaining their specific assertions.

  • crates/weaver-plugins/src/protocol/tests.rs L3-30 (+6 small edits)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

codescene-access[bot]

This comment was marked as outdated.

@leynos
leynos marked this pull request as ready for review September 23, 2026 20:55

@sourcery-ai sourcery-ai 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.

Sorry @leynos, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 13 hours and 51 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-23T20:56:55.127274Z 6a36600 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@leynos
leynos force-pushed the test-quality-sweep-20260923 branch from 28be3da to 8757693 Compare September 24, 2026 01:02
@leynos
leynos force-pushed the test-quality-protocol-roundtrip-20260923-restacked branch from 6a36600 to 89fb8b3 Compare September 24, 2026 01:12
codescene-access[bot]

This comment was marked as outdated.

@leynos
leynos force-pushed the test-quality-sweep-20260923 branch from 8757693 to 4ebdd5b Compare September 24, 2026 02:31
@leynos
leynos force-pushed the test-quality-protocol-roundtrip-20260923-restacked branch from 89fb8b3 to ad9864d Compare September 24, 2026 02:42
codescene-access[bot]

This comment was marked as outdated.

@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@leynos
leynos added this pull request to stack #353 October 18, 2026 01:12
@leynos
leynos force-pushed the test-quality-sweep-20260923 branch from 4ebdd5b to afb858a Compare November 8, 2026 22:22
@leynos
leynos removed this pull request from stack #353 November 8, 2026 22:27
Base automatically changed from test-quality-sweep-20260923 to main November 8, 2026 22:46
codescene-access[bot]

This comment was marked as outdated.

Keep serialization failures and equality checks in one private test
helper while retaining each protocol-specific assertion. Document its
local reuse boundary in the developer guide.
@leynos
leynos force-pushed the test-quality-protocol-roundtrip-20260923-restacked branch from ad9864d to c21b769 Compare November 8, 2026 23:20
@wafflecat-df12

Copy link
Copy Markdown
Collaborator

macOS build failure: transient runner DNS error

The first run on head c21b769d (run
42534697065) has a
red build-macos (x86_64-apple-darwin) job. It is not a code failure.

The job failed in its setup step, 76 seconds in, before any Rust
compilation. actions-rust-lang/setup-rust-toolchain could not reach
static.rust-lang.org:

error: could not download file from
'https://static.rust-lang.org/dist/2026-11-06/channel-rust-nightly.toml.sha256'
... client error (Connect): dns error: error resolving DNS: failed to lookup
address information: nodename nor servname provided, or not known

The aarch64-apple-darwin sibling shows cancelled rather than a result of its
own. build-macos declares no fail-fast: false, so GitHub's default cancelled
it when the x86_64 job failed. Neither macOS job read this PR's code.

build-linux (both arches) and release / metadata pass on the same head. The
failed jobs are being re-run verbatim; no check is being weakened, skipped or
disabled.

@leynos
leynos merged commit 1374b93 into main Nov 8, 2026
19 of 21 checks passed
@leynos
leynos deleted the test-quality-protocol-roundtrip-20260923-restacked branch November 8, 2026 23:52
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.

3 participants