Skip to content

fix(client): preserve MongoDB error labels from responses - #51

Open
medeirosinacio wants to merge 1 commit into
utopia-php:mainfrom
medeirosinacio:fix/preserve-mongodb-error-labels
Open

medeirosinacio wants to merge 1 commit into
utopia-php:mainfrom
medeirosinacio:fix/preserve-mongodb-error-labels

Conversation

@medeirosinacio

Copy link
Copy Markdown

Summary

  • preserve MongoDB errorLabels when decoding top-level command errors
  • keep server responses distinct from client-side UnsentException
  • retain primary-change connection invalidation and session preservation

Why

Utopia\Mongo\Exception already exposes getErrorLabels() and isRetryableWrite(), but Client::parseResponse() discarded labels from real wire responses. This makes the existing API work as intended and provides a prerequisite for retryable writes discussed in #45 without implementing retry behavior in this PR.

Tests

  • command errors preserve retryable and transaction labels
  • server HostUnreachable responses remain potentially sent
  • primary-change errors retain labels while preserving reconnect behavior
  • unlabeled permanent errors keep their existing message and code
  • full PHPUnit suite: 64 tests, 330 assertions
  • Pint and PHPStan pass

Co-authored-by: GPT-5.6 Sol <noreply@openai.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: c6e3c4ea-b1ef-4b5d-945c-9b92808e2e28


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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 10, 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-10T20:45:17.379671Z 1dc8b16 PR opened
ℹ️ 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.

@greptile-apps

greptile-apps Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the label-preservation change maintains existing error and connection-lifecycle contracts.

Summary

  • Retains existing error messages, codes, and the distinction between server errors and unsent operations.
  • Leaves primary-change connection invalidation and session preservation intact.
  • Adds BSON-response regression coverage for label preservation, label-driven predicates, and unlabeled errors.
  • No actionable issues identified. Tests were inspected but not executed during this review.

Reviews (1) · Last reviewed commit: "fix(client): preserve MongoDB error labe..."

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