Skip to content

fix(deps): take whatsapp-rust 0.7.0 from crates.io - #12

Merged
jlucaso1 merged 2 commits into
mainfrom
deps/whatsapp-rust-0.7.0
Aug 7, 2026
Merged

fix(deps): take whatsapp-rust 0.7.0 from crates.io#12
jlucaso1 merged 2 commits into
mainfrom
deps/whatsapp-rust-0.7.0

Conversation

@jlucaso1

@jlucaso1 jlucaso1 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

The core publishes to the registry now, so this stops tracking a branch. A version is reproducible without pinning a commit, and anyone depending on this crate no longer needs the git URL to resolve.

-whatsapp-rust = { git = "https://github.com/oxidezap/whatsapp-rust", branch = "main", … }
+whatsapp-rust = { version = "0.7.0", … }

Why this touches the codegen

Switching registries moves the sources the type generator reads off disk. A published crate is unpacked on its own, so the two roots are siblings:

registry/src/index.crates.io-*/wacore-0.7.0/src
registry/src/index.crates.io-*/whatsapp-rust-0.7.0/src

while a git checkout or working clone nests them in one tree (root/wacore/src, root/src). The generator only knew the repository shape, so on its own this change would have failed — loudly, thanks to #10, but failed, and gen runs before anything else in bun run build.

It now resolves the registry layout first, keyed by the versions in Cargo.lock, and falls back to the git checkout or a sibling clone. The guard checks whichever directories the resolved layout actually yields, rather than a fixed list that only made sense for one of them.

Verified

All three layouts, by exit code rather than by diff:

registry (new default)     exit 0 — 183 types from wacore-0.7.0/src and whatsapp-rust-0.7.0/src
sibling clone, empty cache exit 0 — 183 types from ../../whatsapp-rust
neither available          panics naming the missing directories

Output is byte-identical to the committed file, so the drift check added in #10 passes — which also confirms your note that 0.7.0 carries nothing new: same 183 types.

cargo clippy --all-targets --all-features clean, bun run build fine, bun test tests/ 87 pass / 0 fail (7 skipped are the E2E pair needing the local mock server).


Summary by cubic

Switch whatsapp-rust to the published 0.7.0 on crates.io and harden the type generator to correctly resolve registry sources from Cargo.lock, with git/sibling fallback. Builds are reproducible without a git URL, and generated types are unchanged.

  • Refactors

    • Parse Cargo.lock package stanzas; use the registry layout only when the lock’s source is a registry.
    • Scan all registry/src roots and pick the one containing both whatsapp-rust-<ver> and wacore-<ver>; otherwise fall back to Cargo git cache or a sibling clone.
    • Guard checks directories from the detected layout (wacore/src, src/features, src/types, src/send) to prevent partial generation.
  • Dependencies

    • Use whatsapp-rust 0.7.0 from crates.io.
    • Cargo.lock now pins wacore, wacore-*, waproto, and whatsapp-rust to 0.7.0 from the registry.

Written for commit 8c1369a. Summary will update on new commits.

Review in cubic

The core publishes to the registry now, so the dependency no longer has
to track a branch: a version is reproducible without pinning a commit,
and consumers stop needing the git URL to resolve.

That moves the sources the type generator reads. A published crate is
unpacked on its own, so `wacore` and `whatsapp-rust` sit side by side as
`<crate>-<version>` rather than nested in one repository — the generator
looked only for the repository shape and would have failed, loudly now
rather than silently, but failed.

It resolves both: registry layout first, keyed by the versions in the
lock file, then the git checkout or a sibling clone. The guard checks the
directories each layout actually yields.

Output is unchanged at 183 types, byte-identical to the committed file,
which matches 0.7.0 carrying no type changes.
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@jlucaso1, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 4 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d3e5b752-429a-4b3d-bf31-e1ecc8ee3eda

📥 Commits

Reviewing files that changed from the base of the PR and between 7305764 and 8c1369a.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • Cargo.toml
  • codegen/src/main.rs

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 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f9690ec21

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codegen/src/main.rs Outdated
Comment thread codegen/src/main.rs Outdated
… root

Two ways the registry lookup could read the wrong sources.

It took the first directory under registry/src. That path holds one entry
per registry, so a private registry beside crates.io — or a leftover from
an older protocol — could be picked while the packages sit under another,
failing with sources that are present. It now looks for a root holding
both locked packages.

And it matched on version alone. A dependency temporarily on a git
revision or a patched path can share a version with a registry copy still
in the cache, so the generator would have emitted declarations for a
revision Cargo was not going to compile — silently, since a plausible
version was found. Package stanzas are parsed now, and the registry
layout is used only when the lock says that is where the package comes
from.
@jlucaso1

jlucaso1 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Both valid, both fixed in 03a9f9f.

First registry root winsregistry/src holds one entry per registry, so a private registry beside crates.io, or a leftover from an older protocol, could be selected while the packages sit under another. It failed with the sources present. Now it looks for a root that holds both locked packages.

Verified by planting a decoy that sorts first:

registry/src/aaa-decoy-first/        <- picked before, would have failed
registry/src/index.crates.io-*/      <- chosen now
exit 0, 183 types

Version matched without checking the source — the sharper of the two. A dependency temporarily on a git revision or a patched path can share a version number with a registry copy still in the cache, so the generator would have read that copy and emitted declarations for a revision Cargo was never going to compile. Silently, because a plausible version was found, and without reaching the git fallback it advertises.

Fixed by parsing [[package]] stanzas instead of scanning loose lines — which also removes the older hazard of reading a version from one package and a source from another — and using the registry layout only when the lock says that is where the package comes from.

Verified by rewriting the lock so whatsapp-rust and wacore carry a git+… source while the 0.7.0 registry copies stay on disk:

source = "git+https://github.com/oxidezap/whatsapp-rust?branch=main#deadbeef…"
-> Using local path: ../../whatsapp-rust   (registry ignored, as intended)

Output is unchanged: 183 types, byte-identical to the committed file, drift check passes, codegen clippy clean.

@jlucaso1
jlucaso1 merged commit 66c945d into main Aug 7, 2026
3 checks passed

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8c1369ab15

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codegen/src/main.rs
Comment on lines +109 to +112
.find(|root| {
root.join(format!("whatsapp-rust-{core}")).is_dir()
&& root.join(format!("wacore-{wacore}")).is_dir()
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Bind the source lookup to the locked registry

Although this now searches every registry root, the new .find predicate still discards the source parsed from Cargo.lock and compares only crate names and versions. If both crates.io and a private registry or mirror contain whatsapp-rust and wacore at these versions, read_dir may select either root, so codegen can read different sources from those Cargo compiles. Resolve the root associated with each locked registry source rather than accepting the first root containing matching directory names.

Useful? React with 👍 / 👎.

@jlucaso1
jlucaso1 deleted the deps/whatsapp-rust-0.7.0 branch August 17, 2026 19:25
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