Skip to content

Conversation

@rouzwelt
Copy link
Contributor

@rouzwelt rouzwelt commented Sep 5, 2025

Motivation

Solution

Checks

By submitting this for review, I'm confirming I've done the following:

  • made this PR as small as possible
  • unit-tested any new functionality
  • linked any relevant issues or PRs
  • included screenshots (if this involves a front-end change)

Summary by CodeRabbit

  • Refactor
    • Updated WebAssembly TypeScript bindings: fields previously using custom Address/Hex types now use 0x${string} literal types for hex values.
  • Chores
    • Removed legacy wasm-bindgen TypeScript augmentation for custom TS types. Non-WASM behavior remains unchanged.

@coderabbitai
Copy link

coderabbitai bot commented Sep 5, 2025

Walkthrough

Removed wasm-specific TypeScript augmentation from crates/cli/src/meta/mod.rs and replaced dependent tsify annotations in crates/cli/src/meta/types/dotrain/gui_state_v1.rs to use inline 0x-prefixed string types. No Rust types, runtime logic, or non-wasm behavior changed.

Changes

Cohort / File(s) Summary
Wasm TS augmentation removal
crates/cli/src/meta/mod.rs
Deleted cfg-wasm wasm_bindgen import and typescript_custom_section (TS_APPEND_CONTENT) that defined Address/Hex TS types.
TS binding updates to inline hex strings
crates/cli/src/meta/types/dotrain/gui_state_v1.rs
Updated tsify(type) for ShortenedTokenCfg.address and DotrainGuiStateV1.dotrain_hash from Address/Hex aliases to "0x${string}"; Rust field types unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Tweak 888 meta #79 — Adjusts wasm-related TypeScript bindings and wasm_bindgen usage similar to this PR; likely introduced the TS_APPEND_CONTENT and tsify patterns now being removed/updated.

Suggested reviewers

  • findolor
  • hardyjosh
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 2025-09-05-fix-overallping-bindings

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

@rouzwelt rouzwelt self-assigned this Sep 5, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 79a43ab and 879c14c.

📒 Files selected for processing (2)
  • crates/cli/src/meta/mod.rs (0 hunks)
  • crates/cli/src/meta/types/dotrain/gui_state_v1.rs (2 hunks)
💤 Files with no reviewable changes (1)
  • crates/cli/src/meta/mod.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: test
  • GitHub Check: standard-tests (ubuntu-latest, rainix-rs-test)
  • GitHub Check: standard-tests (ubuntu-latest, rainix-sol-test)
  • GitHub Check: standard-tests (ubuntu-latest, rainix-rs-static)
  • GitHub Check: standard-tests (ubuntu-latest, rainix-sol-artifacts)
  • GitHub Check: standard-tests (macos-latest, rainix-rs-artifacts)
  • GitHub Check: standard-tests (ubuntu-latest, rainix-sol-static)
  • GitHub Check: standard-tests (macos-latest, rainix-rs-test)
  • GitHub Check: standard-tests (ubuntu-latest, rainix-rs-artifacts)
🔇 Additional comments (1)
crates/cli/src/meta/types/dotrain/gui_state_v1.rs (1)

34-36: The script output only shows the first search—please manually verify that the other checks ran and returned no matches:

  • No TS_APPEND_CONTENT, TS_DECLARATIONS, or ts_append macros anywhere
  • No .ts/.d.ts files still referring to Address or Hex

Confirm the full script ran and produced no output.

Comment on lines +46 to 48
#[cfg_attr(target_family = "wasm", tsify(type = "`0x${string}`"))]
pub dotrain_hash: B256,
/// User-configured field values
Copy link

@coderabbitai coderabbitai bot Sep 5, 2025

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

B256 → 0x${string} narrows shape but loses length semantics; document and note breaking change

This matches serde’s string output, but TS can’t enforce 32-byte length. Add a short doc hint (e.g., “0x-prefixed 32-byte hex”) and call out the TS-facing breaking change in the changelog/release notes.

Confirm the runtime JSON across the wasm boundary is a lowercased 0x-prefixed hex string (no ArrayBuffer/bytes) and that any consumers didn’t rely on a distinct Hex type for narrowing.

Consider adding a wasm-only comment near the field to state the expected length for maintainers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

its ok, no worries

Copy link

Choose a reason for hiding this comment

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

@rouzwelt Thanks for confirming! I understand you're comfortable with this change. The type binding adjustment looks good to go.


🧠 Learnings used
Learnt from: brusherru
PR: rainlanguage/rain.metadata#80
File: crates/cli/src/metaboard.rs:36-45
Timestamp: 2025-08-14T16:28:50.322Z
Learning: In crates/cli/src/metaboard.rs, the validate_dotrain_content function intentionally only checks for non-empty content. Full .rain syntax validation is planned for future work but was considered out of scope for the initial implementation.

@hardyjosh hardyjosh merged commit fa10931 into main Sep 6, 2025
10 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2025

@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment:

S/M/L PR Classification Guidelines:

This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed.

Small (S)

Characteristics:

  • Simple bug fixes, typos, or minor refactoring
  • Single-purpose changes affecting 1-2 files
  • Documentation updates
  • Configuration tweaks
  • Changes that require minimal context to review

Review Effort: Would have taken 5-10 minutes

Examples:

  • Fix typo in variable name
  • Update README with new instructions
  • Adjust configuration values
  • Simple one-line bug fixes
  • Import statement cleanup

Medium (M)

Characteristics:

  • Feature additions or enhancements
  • Refactoring that touches multiple files but maintains existing behavior
  • Breaking changes with backward compatibility
  • Changes requiring some domain knowledge to review

Review Effort: Would have taken 15-30 minutes

Examples:

  • Add new feature or component
  • Refactor common utility functions
  • Update dependencies with minor breaking changes
  • Add new component with tests
  • Performance optimizations
  • More complex bug fixes

Large (L)

Characteristics:

  • Major feature implementations
  • Breaking changes or API redesigns
  • Complex refactoring across multiple modules
  • New architectural patterns or significant design changes
  • Changes requiring deep context and multiple review rounds

Review Effort: Would have taken 45+ minutes

Examples:

  • Complete new feature with frontend/backend changes
  • Protocol upgrades or breaking changes
  • Major architectural refactoring
  • Framework or technology upgrades

Additional Factors to Consider

When deciding between sizes, also consider:

  • Test coverage impact: More comprehensive test changes lean toward larger classification
  • Risk level: Changes to critical systems bump up a size category
  • Team familiarity: Novel patterns or technologies increase complexity

Notes:

  • the assessment must be for the totality of the PR, that means comparing the base branch to the last commit of the PR
  • the assessment output must be exactly one of: S, M or L (single-line comment) in format of: SIZE={S/M/L}
  • do not include any additional text, only the size classification
  • your assessment comment must not include tips or additional sections
  • do NOT tag me or anyone else on your comment

@coderabbitai
Copy link

coderabbitai bot commented Sep 6, 2025

Tip

For best results, initiate chat on the files or code changes.

SIZE=M

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.

3 participants