Skip to content

chore: log Cloud push gateway response on accepted (200) pushes#41572

Open
Nahid-NHB wants to merge 1 commit into
RocketChat:developfrom
Nahid-NHB:fix/push-gateway-debug-logging
Open

chore: log Cloud push gateway response on accepted (200) pushes#41572
Nahid-NHB wants to merge 1 commit into
RocketChat:developfrom
Nahid-NHB:fix/push-gateway-debug-logging

Conversation

@Nahid-NHB

@Nahid-NHB Nahid-NHB commented Jul 25, 2026

Copy link
Copy Markdown

Proposed changes (including videos or screenshots)

When a push is sent through the Cloud push gateway (gateway.rocket.chat), sendGatewayPush already logs on the 406, 422 and 401 branches, but the success path (result.ok) just returns silently. That means once the gateway accepts a push, the server has zero record of what it actually returned, only that the HTTP call didn't error out.

This showed up clearly in #41569: the gateway was returning 200 with an empty body for every push, and the only way the reporter could see that was by putting a transparent proxy in front of the gateway and capturing raw responses by hand. That's not something we should be asking self-hosted admins to do to get basic visibility into their own push pipeline.

This PR adds a single debug-level log line on the success path with the service (apn/gcm), status code and response body, mirroring the log calls already used for the other branches. It doesn't change any behavior, just makes the existing "black box" 200 response visible in logs (LOG_LEVEL=debug) so admins/support can tell at a glance whether the gateway is actually echoing anything useful back, instead of having to intercept traffic themselves.

Worth noting: this doesn't fix delivery for the workspace in #41569. I dug through the gateway request/payload code in this repo (push.ts, apn.ts, the Push_production setting) and found nothing wrong on the client side, no missing fields, no recent regression. The gateway consistently accepting (200) but never delivering to FCM/APNs for one specific workspace looks like a server-side issue on the Cloud gateway (credential provisioning for that workspace, most likely), which lives outside this repo. This is a small, self-contained improvement to make that class of problem diagnosable from server logs going forward.

Issue(s)

Related to #41569

Steps to test or reproduce

  1. Enable gateway push (Push_enable, Push_enable_gateway) with LOG_LEVEL=debug.
  2. Send a push notification to a registered device.
  3. Once the gateway responds with a successful status, check the server logs for a push sent to gateway debug entry containing service, status and response.

Unit test added: apps/meteor/tests/unit/server/lib/notifications/push/push.spec.ts (sendGatewayPush() suite), covering the new log call.

Further comments

Considered forwarding this info back to the client/API response instead, but that's unnecessary. This is purely an operator-facing diagnostic, so a debug log is the right scope, no API or behavior changes.

Review in cubic

Summary by CodeRabbit

  • Improvements

    • Added debug logging for successful Cloud push gateway responses, including the service, HTTP status, and response content.
    • Provides additional diagnostic information when a gateway accepts a notification but delivery does not complete downstream.
  • Tests

    • Added coverage verifying successful gateway responses are logged correctly.

Push notifications sent through the Cloud push gateway
(gateway.rocket.chat) that return a successful HTTP status were never
logged, so operators had no visibility into the gateway's response
body when troubleshooting delivery issues (gateway accepts a push but
it never reaches FCM/APNs). This adds a debug-level log of the
service, response status, and response body on the success path,
matching the existing log calls already in place for the 406/422/401
branches.
@Nahid-NHB
Nahid-NHB requested a review from a team as a code owner July 25, 2026 13:46
@dionisio-bot

dionisio-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d29ac43

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@CLAassistant

CLAassistant commented Jul 25, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f085ad8f-c7b2-4e2c-8df2-55f9d9b41ba2

📥 Commits

Reviewing files that changed from the base of the PR and between 6dc66fb and d29ac43.

📒 Files selected for processing (3)
  • .changeset/push-gateway-debug-logging.md
  • apps/meteor/server/lib/notifications/push/push.ts
  • apps/meteor/tests/unit/server/lib/notifications/push/push.spec.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: cubic · AI code reviewer
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/server/lib/notifications/push/push.ts
  • apps/meteor/tests/unit/server/lib/notifications/push/push.spec.ts
**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use .spec.ts extension for test files (e.g., login.spec.ts)

Files:

  • apps/meteor/tests/unit/server/lib/notifications/push/push.spec.ts
🧠 Learnings (6)
📚 Learning: 2026-03-16T21:50:37.589Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: .changeset/migrate-users-register-openapi.md:3-3
Timestamp: 2026-03-16T21:50:37.589Z
Learning: For changes related to OpenAPI migrations in Rocket.Chat/OpenAPI, when removing endpoint types and validators from rocket.chat/rest-typings (e.g., UserRegisterParamsPOST, /v1/users.register) document this as a minor changeset (not breaking) per RocketChat/Rocket.Chat-Open-API#150 Rule 7. Note that the endpoint type is re-exposed via a module augmentation .d.ts in the consuming package (e.g., packages/web-ui-registration/src/users-register.d.ts). In reviews, ensure the changeset clearly states: this is a non-breaking change, the major version should not be bumped, and the changeset reflects a minor version bump. Do not treat this as a breaking change during OpenAPI migrations.

Applied to files:

  • .changeset/push-gateway-debug-logging.md
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/server/lib/notifications/push/push.ts
  • apps/meteor/tests/unit/server/lib/notifications/push/push.spec.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/server/lib/notifications/push/push.ts
  • apps/meteor/tests/unit/server/lib/notifications/push/push.spec.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/server/lib/notifications/push/push.ts
  • apps/meteor/tests/unit/server/lib/notifications/push/push.spec.ts
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.

Applied to files:

  • apps/meteor/tests/unit/server/lib/notifications/push/push.spec.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.

Applied to files:

  • apps/meteor/tests/unit/server/lib/notifications/push/push.spec.ts
🔇 Additional comments (5)
apps/meteor/server/lib/notifications/push/push.ts (1)

305-305: LGTM!

apps/meteor/tests/unit/server/lib/notifications/push/push.spec.ts (3)

9-15: LGTM!


115-119: LGTM!


121-137: LGTM!

.changeset/push-gateway-debug-logging.md (1)

1-5: LGTM!


Walkthrough

The Cloud push gateway now logs successful response status and body details at debug level. Unit tests stub the gateway request, verify the log output for an HTTP 200 response, and add a patch changeset entry.

Changes

Push gateway response logging

Layer / File(s) Summary
Gateway response logging and coverage
apps/meteor/server/lib/notifications/push/push.ts, apps/meteor/tests/unit/server/lib/notifications/push/push.spec.ts, .changeset/push-gateway-debug-logging.md
Successful gateway pushes log the service, HTTP status, and response body. Unit tests inject a fetch stub and verify the debug log and request call, while a patch changeset documents the update.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: type: chore

Suggested reviewers: sampaiodiego, ricardogarim

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding logging for successful Cloud push gateway responses.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants