Skip to content

fix(newsletter): send fetch_pinned_messages on metadata queries - #240

Merged
vinikjkkj merged 1 commit into
masterfrom
fix/newsletter-fetch-pinned-messages
Aug 11, 2026
Merged

fix(newsletter): send fetch_pinned_messages on metadata queries#240
vinikjkkj merged 1 commit into
masterfrom
fix/newsletter-fetch-pinned-messages

Conversation

@vinikjkkj

@vinikjkkj vinikjkkj commented Aug 11, 2026

Copy link
Copy Markdown
Owner

FetchNewsletter and FetchNewsletterDehydrated declare every fetch_* flag as a Relay condition variable (Boolean!), so the server rejects the whole query with 400 Bad Request when one is absent or null, before validating any input. Both call sites omitted fetch_pinned_messages, which broke fetch(), fetchByInvite() and fetchDehydrated() for every newsletter, including ones the account owns.

The generated MEX variable types mark all fields optional, so TypeScript never flagged the omission. The new tests assert the exact key set each query declares to keep it from regressing.

Closes #238

Review in cubic

Summary by CodeRabbit

  • New Features

    • Newsletter discovery now includes pinned messages when retrieving newsletter metadata.
  • Bug Fixes

    • Improved metadata retrieval to consistently apply the setting that enables pinned message fetching.
  • Tests

    • Added coverage to verify newsletter requests send the expected query parameters and identifiers.

FetchNewsletter and FetchNewsletterDehydrated declare every fetch_* flag as
a Relay condition variable (Boolean!), so the server rejects the whole query
with 400 Bad Request when one is absent or null, before validating any input.
Both call sites omitted fetch_pinned_messages, which broke fetch(),
fetchByInvite() and fetchDehydrated() for every newsletter, including ones
the account owns.

The generated MEX variable types mark all fields optional, so TypeScript
never flagged the omission. The new tests assert the exact key set each
query declares to keep it from regressing.

Closes #238
@github-actions github-actions Bot added the fix Bug fix label Aug 11, 2026
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 662e4d94-f770-41c0-92c1-4bba08516a7d

📥 Commits

Reviewing files that changed from the base of the PR and between 7f7f560 and 2ca897a.

📒 Files selected for processing (2)
  • src/client/coordinators/__tests__/newsletter-coordinator.test.ts
  • src/client/newsletter/discovery.ts

📝 Walkthrough

Walkthrough

Newsletter metadata and dehydrated metadata requests now enable fetch_pinned_messages. Coordinator tests verify the query IDs, variable sets, and enabled flag.

Changes

Newsletter pinned-message requests

Layer / File(s) Summary
Request flags and coordinator coverage
src/client/newsletter/discovery.ts, src/client/coordinators/__tests__/newsletter-coordinator.test.ts
Metadata and dehydrated metadata requests set fetch_pinned_messages to true. Tests verify the query IDs, complete variable-key sets, and enabled flag.

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

🚥 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 clearly identifies the newsletter metadata fix and the missing fetch_pinned_messages condition variable.
Linked Issues check ✅ Passed The changes add fetch_pinned_messages to the newsletter metadata queries and test the required variables, addressing issue #238.
Out of Scope Changes check ✅ Passed The implementation and tests are limited to the newsletter metadata query fix described in issue #238.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/newsletter-fetch-pinned-messages

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.

@vinikjkkj
vinikjkkj merged commit 460c9b0 into master Aug 11, 2026
29 checks passed
@vinikjkkj
vinikjkkj deleted the fix/newsletter-fetch-pinned-messages branch August 11, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: newsletter.fetch() retorna 400 ao buscar canal

1 participant