Skip to content

refactor(proxy): migrate PostgreSQL protocol to pg-proto - #443

Draft
freshtonic wants to merge 7 commits into
mainfrom
refactor/pg-proto
Draft

refactor(proxy): migrate PostgreSQL protocol to pg-proto#443
freshtonic wants to merge 7 commits into
mainfrom
refactor/pg-proto

Conversation

@freshtonic

@freshtonic freshtonic commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Migrate the proxy PostgreSQL protocol implementation to published pg-proto 0.1.0 and remove the superseded local protocol stack.

What changed

  • delegate tagged framing, direction-specific decoding, validation, and serialization to pg-proto
  • delegate startup, SSL, cancellation, authentication, and diagnostic message representation to pg-proto
  • pair downstream/upstream protocol state machines while preserving pipelining
  • retain only CipherStash-specific state and message handling for SQL, parameter, metadata, and row rewrites
  • preserve buffering, authentication policy, TLS policy, error factories, metrics, timeouts, and cancellation forwarding
  • reject malformed, oversized, and unknown-tag frames through the pg-proto codecs

Legacy cleanup

Removed the handwritten frontend/backend tag enums, startup codes/messages, authentication wire model, ReadyForQuery and Terminate serializers, frame length/tag parsing, diagnostic serialization, and redundant Parse/Bind wire counts. The cleanup commit removes 1,251 lines while adding 296 lines of typed integration and retained policy.

Verification

  • cargo fmt --all -- --check
  • cargo clippy -p cipherstash-proxy --all-targets -- -D warnings
  • CS_PROMETHEUS__ENABLED unset: 127/127 unit tests pass, plus doc tests
  • focused PostgreSQL protocol and rewrite tests pass
  • live MD5 authentication, simple query, extended Parse/Bind/Execute, invalid Bind, and Sync recovery smoke tests passed before the cleanup; the cleanup preserves those typed paths
  • git diff --check

Full Docker/TLS/COPY/asynchronous-message integration coverage has not yet been run.

Acknowledgment

By submitting this pull request, I confirm that CipherStash can use, modify, copy, and redistribute this contribution, under the terms of CipherStash's choice.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4cf710f8-fa49-47db-b0c7-0c417c2b2c49

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@freshtonic
freshtonic requested a review from tobyhede August 4, 2026 06:40
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.

1 participant