Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add component contract check #4117

Merged
merged 1 commit into from
Mar 29, 2024
Merged

ci: add component contract check #4117

merged 1 commit into from
Mar 29, 2024

Conversation

erwanor
Copy link
Member

@erwanor erwanor commented Mar 27, 2024

This add a quick cargo check to avoid leaking platform specific dependencies in our workspace, and breaking downstream dependencies like the wasm crate used by the extension.

The script itself could be refactored into a one-liner, but the current structure makes it easy to observe which crate fails to build for the special target.

@erwanor erwanor requested a review from conorsch March 27, 2024 17:25
Copy link
Contributor

@jessepinho jessepinho left a comment

Choose a reason for hiding this comment

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

Nice, thanks for this!

@cratelyn cratelyn added this to the Sprint 3 milestone Mar 27, 2024
@cratelyn cratelyn added the A-wasm Area: Related to WebAssembly components label Mar 27, 2024
@conorsch conorsch self-assigned this Mar 27, 2024
@conorsch conorsch force-pushed the erwan/wasm_ci_check_compat branch from 232475e to d61dae8 Compare March 27, 2024 23:32
@conorsch conorsch force-pushed the erwan/wasm_ci_check_compat branch from 0f763d9 to 7656082 Compare March 27, 2024 23:37
@conorsch conorsch force-pushed the erwan/wasm_ci_check_compat branch from 7656082 to c9bf6fd Compare March 28, 2024 00:03
@conorsch
Copy link
Contributor

This CI check runs with --no-default-features. That's a nice start, but over in the web repo, some crates do use the default features to in order to compile: https://github.com/penumbra-zone/web/blob/d7d46634faae608928fb696c6ae276e06dc1aa09/packages/wasm/crate/Cargo.toml#L17-L32

Therefore I think the sanest strategy we can have to prevent breakage is:

  1. clone web from its main
  2. patch its wasm cargo.toml to use a path dep on a local checkout of the monorepo feature branch being tested
  3. ensure the web's wasm crate builds with those path modifications

Anything else is prone to breakage without us noticing. I'll pop into web sync tomorrow to ask for more detail; I know you and @jessepinho already spoke a lot about this!

@conorsch conorsch marked this pull request as draft March 28, 2024 00:22
@erwanor
Copy link
Member Author

erwanor commented Mar 28, 2024

Respectfully disagree, we should have a check that our core crates, in particular the core/component ones, always honor the component feature contract. This contract consists in gating the complicated platform-specific logic behind a special feature (component), and allow downstreams to import basic data structures modeling the protocol (e.g. penumbra_stake::UnbondingToken). We should do this for all the relevant crates, even if they're not currently used by the wasm planner (e.g. penumbra-funding or penumbra-governance).

The wasm crate is the primary consumer of the penumbra core crates, but there could be many more and we want to allow tooling to be possible to build by default.

There are two crates that the wasm crate import with default-features = true it's true, but they're basic structure crates (e.g. penumbra-num) and should be platform-agnostic almost definitionally.

@erwanor erwanor changed the title ci: add wasm check ci: add component contract check Mar 29, 2024
@conorsch conorsch force-pushed the erwan/wasm_ci_check_compat branch from c9bf6fd to 3bd9604 Compare March 29, 2024 23:17
Back in [0] we removed the wasm crate from the monorepo, so that the web
team could own it and iterate more quickly. We also purged associated
testing, however, so we missed some breakage around the release of
v0.70.0. This check attempts to restore some visibility into the
potential of breaking APIs relevant to web work.

[0] #3819
@conorsch conorsch force-pushed the erwan/wasm_ci_check_compat branch from 3bd9604 to f90a801 Compare March 29, 2024 23:20
@conorsch
Copy link
Contributor

Discussed this OOB with @erwanor, and we're both happy with the changes here.

@conorsch conorsch marked this pull request as ready for review March 29, 2024 23:20
@conorsch conorsch merged commit 5dbb548 into main Mar 29, 2024
7 checks passed
@conorsch conorsch deleted the erwan/wasm_ci_check_compat branch March 29, 2024 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-wasm Area: Related to WebAssembly components
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants