Registry Mirror
Skip to content

Conversation

@rustatian

@rustatian rustatian commented Sep 6, 2026 •

Copy link
Copy Markdown
Member

Add github.com/roadrunner-server/zstd/v6 as a zstd-only HTTP middleware.

  • Reuse gzhttp response handling and follow the gzip plugin lifecycle and tracing behavior.
  • Add unit tests and HTTP integration tests with a PHP worker.
  • Add usage documentation and a CI workflow.

closes: roadrunner-server/roadrunner#2080.

Copilot AI lite review requested due to automatic review settings September 6, 2026 10:31

Copilot AI 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.

🟡 Changes recommended

The CI workflow references a non-existent actions/setup-go@v7, and the middleware span currently ends before downstream handling, producing incorrect/invalid trace structure.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a standalone RoadRunner HTTP middleware plugin that enables Zstandard (zstd) response compression using klauspost/compress/gzhttp, along with docs, tests (unit + PHP-backed integration), and CI to validate the plugin end-to-end.

Changes:

  • Introduces zstd.Plugin implementing the RoadRunner HTTP middleware interface with gzhttp configured for zstd-only compression.
  • Adds unit tests (encoding/response/flush + OTEL propagation) and an integration test module that runs a real PHP PSR-7 worker.
  • Adds usage documentation and a Linux CI workflow to run Go + PHP test suites.
File summaries
File Description
plugin.go Implements the zstd middleware plugin using gzhttp and OTEL propagation.
doc.go Adds package-level documentation.
plugin_test.go Unit tests for encoding negotiation, response behavior, and flush behavior.
plugin_otel_test.go Unit tests for OTEL tracing/propagation behavior.
go.mod Defines the root Go module and dependencies for the plugin.
go.sum Locks root Go module dependencies.
tests/zstd_test.go Integration tests that boot RoadRunner via Endure and validate zstd responses over HTTP.
tests/go.mod Separate Go module for integration tests (with replace pointing to the repo root).
tests/go.sum Locks integration-test module dependencies.
tests/php_test_files/worker.php Minimal PHP PSR-7 worker used by integration tests.
tests/php_test_files/composer.json PHP dependencies for the integration worker.
tests/php_test_files/composer.lock Locked PHP dependency graph for reproducible CI runs.
README.md Documents usage, behavior, and how to run unit/integration tests locally.
.gitignore Ignores the PHP vendor directory for the integration test fixture.
.github/workflows/linux.yml CI workflow running Go unit + integration tests and PHP dependency install.
Review details
  • Files reviewed: 11/15 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread plugin.go
Comment on lines +35 to +43
if val, ok := r.Context().Value(rrcontext.OtelTracerNameKey).(string); ok {
tp := trace.SpanFromContext(r.Context()).TracerProvider()
ctx, span := tp.Tracer(val, trace.WithSchemaURL(semconv.SchemaURL),
trace.WithInstrumentationVersion(otelhttp.Version)).
Start(r.Context(), PluginName, trace.WithSpanKind(trace.SpanKindInternal))

p.prop.Inject(ctx, propagation.HeaderCarrier(r.Header))
r = r.WithContext(ctx)
span.End()
@rustatian rustatian self-assigned this Sep 6, 2026
@rustatian
rustatian merged commit 2492ed3 into master Sep 6, 2026
2 checks passed
@rustatian
rustatian deleted the feature/initialize-middleware branch September 6, 2026 13:04
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.

[💡 FEATURE REQUEST]: Add zstd support

2 participants