Skip to content

fix: gate WhatsApp helpers used only by the Web adapter - #162

Merged
senamakel merged 1 commit into
mainfrom
fix/whatsapp-dead-code
Oct 26, 2026
Merged

senamakel merged 1 commit into
mainfrom
fix/whatsapp-dead-code

Conversation

@senamakel

@senamakel senamakel commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Under rustc 1.99.1 a build without whatsapp-web warned: WaFailure::BadFormat never constructed, bad_format never used, ClearOnDrop never constructed. They are only used by the Web adapter (and tests), so bad_format and ClearOnDrop are now gated on any(test, feature = "whatsapp-web"); the variant, still matched by the Cloud adapter, carries a matching cfg_attr(allow(dead_code)).

Verified with cargo +1.99.1 clippy -D warnings (lib and all-targets) for no-default-features, email-send, whatsapp-web, email+lark+relay-websocket, workspace default and --all-features; nextest passes in all-features and no-default-features. The regression guard is the lint itself (a compile-time warning); no behaviour changes, so no new runtime test.

Co-authored-by: Medulla medulla@tinyhumans.ai

Summary by CodeRabbit

  • Chores
    • Made small build-time adjustments to keep the WhatsApp integration’s behavior unchanged while reducing unnecessary code in configurations where it isn’t used.
    • No user-visible changes.

Avoids dead-code warnings when whatsapp-web is off.

Co-authored-by: Medulla <medulla@tinyhumans.ai>
@tinysweeper

tinysweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Reviewed head: dab567941cdc89d285b9929c675208fbe1949ae0

Verdict: Ready for maintainer review · Priority: none
Coverage: Reviewed 2 of 2 files.
Pull request purpose (title): fix: gate WhatsApp h…

Diagnostics and supporting details

Full summary

Pull request purpose (title): fix: gate WhatsApp helpers used only by the Web adapter. This pull request silences new `rustc 1.99.1` dead-code warnings for WhatsApp helpers that are only used when the `whatsapp-web` feature is on or under test. `WaFailure::bad_format` and `window::ClearOnDrop` (struct and its `Drop` impl) are now gated on `any(test, feature = "whatsapp-web")`, while the `WaFailure::BadFormat` variant — still matched by the Cloud adapter — carries a `cfg_attr(not(any(test, feature = "whatsapp-web")), allow(dead_code))` attribute and an explanatory doc comment. The latest-push delta could not be established, so no push-level comparison is reported.

Review snapshot

Change surface Files Review signal Count
Production 2 Active findings 0
Tests 0 Noted findings 0
Documentation 0 Resolved findings 0
Configuration 0 Pending checks/questions 0

Completeness: Complete
Test assessment: No supported feature-to-test mapping was available; this does not mean tests are absent or passed.

What changed

Conditional-compilation and lint-attribute changes only, in two files. `WaFailure::bad_format` and `ClearOnDrop` (the struct plus its `Drop` implementation) are restricted to `cfg(any(test, feature = "whatsapp-web"))` builds, and `WaFailure::BadFormat` gains a doc comment plus `#[cfg_attr(not(any(test, feature = "whatsapp-web")), allow(dead_code))]` so the variant stays defined for the Cloud adapter's match arm without warning when the Web adapter is absent. No runtime path, branch, or input handling is altered.

Features

  • Modified — Gate `WaFailure::bad_format` behind test/whatsapp-web configuration: The constructor is only compiled when tests are built or the `whatsapp-web` feature is enabled, matching its only consumers and removing the feature-off dead-code warning; the `BadFormat` variant itself remains available with an `allow(dead_code)` attribute. (src/providers/whatsapp_shared/error.rs pub(crate) enum WaFailure {, src/providers/whatsapp_shared/error.rs impl WaFailure {, src/providers/whatsapp_shared/error.rs)
  • Modified — Gate `ClearOnDrop` behind test/whatsapp-web configuration: The drop-guard struct and its `Drop` impl are compiled only for tests or the `whatsapp-web` feature, so non-Web builds no longer report the type as never constructed while the Web adapter retains the guard's channel-clearing behavior. (src/providers/whatsapp_shared/window.rs impl BoundedMap {, src/providers/whatsapp_shared/window.rs)

Tests

No supported feature-to-test mapping was produced. Test execution is not inferred.

Findings

No active actionable findings.

Before merge

None.

Agent review details

critique

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The critique lane answered after reviewing both changed files and reported no findings.
  • Lane summary: Reviewed 2 files; 0 findings. _The code index is behind this pull request (indexed at `96216404e83d`), so retrieved context may be out of date._

security

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The security lane answered after reviewing both changed files and reported no findings.
  • Lane summary: Reviewed 2 files; 0 findings. _The code index is behind this pull request (indexed at `96216404e83d`), so retrieved context may be out of date._

tests

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The tests lane answered with no findings, noting the gated items exist exactly where they are used and the attribute only silences a feature-off dead-code warning, so no regression path is introduced.
  • Lane summary: The diff only adds `cfg` gates (`#[cfg(any(test, feature = "whatsapp-web"))]` and `#[cfg_attr(not(any(test, feature = "whatsapp-web")), allow(dead_code))]`) plus doc comments to `BadFormat`/`bad_format` and `ClearOnDrop`. These are conditional-compilation and lint-attribute changes with no behavioural path: the gated items exist exactly where they are used (the Web adapter, per the existing `failure_of`/`bad_format` usage), and the attribute only silences a feature-off dead-code warning. There is no new branch, no new runtime input, and nothing that can regress silently, so no test is warranted and I found no reportable defect in the two changed files. _The code index is behind this pull request (indexed at `96216404e83d`), so retrieved context may be out of date._

commits

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The commits lane answered and reported no sensitive content in the committed files.
  • Lane summary: No sensitive content in committed files. _The code index is behind this pull request (indexed at `96216404e83d`), so retrieved context may be out of date._

description

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The description lane answered and found the stated gating of `bad_format` and `ClearOnDrop` consistent with the observed use sites and the change safe to merge.
  • Lane summary: This change gates `WaFailure::bad_format` and `window::ClearOnDrop` behind `any(test, feature = "whatsapp-web")` and adds a matching `cfg_attr(..., allow(dead_code))` to the `BadFormat` variant, which matches what the description says and is consistent with every use site I could see (the Web adapter, the WhatsApp Cloud adapter's match arm, and the module's own tests). The description is accurate and the change is safe to merge. _The code index is behind this pull request (indexed at `96216404e83d`), so retrieved context may be out of date._
Evidence and run details
  • Models: ladder/vectors-oai3, deepseek-v4.1-flash
  • Spend: $0.001252
  • Tokens: 141941 input · 3930 output · 44032 cached · 63 embedding
  • Updated: 2026-10-26T11:14:38Z
Head State Pass summary
dab567941cdc ready for maintainer review 0 active finding(s), 0 resolved finding(s) (at 2026-10-26T11:14:38Z)

tinysweeper 0.1.2

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 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-10-26T11:15:05.675083Z dab5679 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.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 262740d8-c843-4f22-a2b7-54cef4dd815c
Commits

Reviewing files that changed from the base of the PR and between e04f7a3 and dab5679.

Files selected for processing: 2
  • src/providers/whatsapp_shared/error.rs
  • src/providers/whatsapp_shared/window.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The BadFormat constructor and ClearOnDrop type and Drop implementation are now compiled only for tests or when the whatsapp-web feature is enabled. The BadFormat declaration also allows dead code when neither condition applies.

Changes: WhatsApp shared helpers

Layer / File(s) Summary
Gate Web-specific helpers
src/providers/whatsapp_shared/error.rs, src/providers/whatsapp_shared/window.rs
The bad_format constructor, ClearOnDrop, and its Drop implementation are gated on tests or the whatsapp-web feature. The BadFormat declaration allows dead code when neither condition applies.

Priority: Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested reviewers: tinysweeper

Merge Risk: Minimal · up to dab56

No actionable merge-blocking risk remains in the reviewed changes.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: WhatsApp helpers used only by the Web adapter are now gated behind cfg attributes. The raw summary confirms that bad_format, ClearOnDrop, and WaFailure::BadFormat were…
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.
Full details: Title check

Explanation

The title names the main change: WhatsApp helpers used only by the Web adapter are now gated behind cfg attributes. The raw summary confirms that bad_format, ClearOnDrop, and WaFailure::BadFormat were changed to address dead-code warnings when whatsapp-web is disabled. The title is specific and follows the fix: prefix convention, so it is a clear match for the changeset.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 Clippy (1.99.0)

Clippy execution failed

A rabbit checks the feature gate,
And keeps each helper in its state.
When tests or Web are in the run,
The guarded code can greet the sun.
Then hops away, the changes done.

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

@tinysweeper tinysweeper Bot 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.

tinysweeper found nothing blocking. Approving.

Diagnostics

Total spend: $0.0013

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Oct 26, 2026
@senamakel
senamakel merged commit b8c8445 into main Oct 26, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant