Skip to content

Delete dead newtypes and regexes in meta/types/common/v1.rs - #321

Merged
thedavidmeister merged 1 commit into
mainfrom
2026-09-03-delete-common-v1-dead-types
Sep 3, 2026
Merged

thedavidmeister merged 1 commit into
mainfrom
2026-09-03-delete-common-v1-dead-types

Conversation

@thedavidmeister

Copy link
Copy Markdown
Contributor

Closes #319.

crates/cli/src/meta/types/common/v1.rs lost its consumers when #318 deleted the SolidityAbiMeta and InterpreterCallerMeta models. This deletes what nothing uses and keeps what authoring/v1.rs and authoring/v2.rs still import.

Deleted, each confirmed by grep -rnw to have hits only inside common/v1.rs (definition and its own test):

  • RainSymbol, RainTitle, RainString, SolidityIdentifier and their tests
  • pub type Description = RainString; (not named in the issue; it cannot outlive RainString, and has zero consumers)
  • REGEX_SOLIDITY_IDENTIFIER, REGEX_RAIN_TITLE, HASH_PATTERN and test_hash_pattern
  • the validator, serde and schemars imports of this file, unused once the derive-carrying structs are gone

Kept:

  • REGEX_RAIN_SYMBOL (used by authoring/v1.rs:8,32 and authoring/v2.rs:17,25)
  • REGEX_RAIN_STRING (used by authoring/v1.rs:8,41 and authoring/v2.rs:17,30)
  • test_rain_symbol_validate and test_rain_string_validate, retargeted from RainSymbol { value }.validate() / RainString { value }.validate() to REGEX_RAIN_SYMBOL.is_match / REGEX_RAIN_STRING.is_match with the valid and invalid input lists unchanged

Cargo.toml is untouched: validator (cli/mod.rs, cli/validate.rs, error/mod.rs, metaboard.rs, authoring v1 and v2), schemars (cli/schema.rs, lib.rs, authoring v1), once_cell (cli/schema_check.rs) and regex (this file) each keep other users.

QA

All commands run in the branch worktree at dd655b3 inside nix develop -c.

  • cargo fmt --all: exit 0, git diff --stat unchanged afterwards (1 file, 6 insertions, 218 deletions).
  • cargo test --workspace 2>&1 | grep -E "^error|^test result|FAILED|panicked": 11 test result: ok lines, 347 passed, 0 failed, 0 ^error lines. common/v1.rs carries 2 #[test] (base: 5; the 3 gone are test_rain_title_validate, test_solidity_identifier_validate, test_hash_pattern).
  • cargo test --workspace --all-features: same 11 lines, 347 passed, 0 failed.
  • cargo clippy --workspace --all-targets -- -D warnings: exit 0, no warnings. cargo clippy --workspace --all-targets --all-features -- -D warnings -D clippy::all (what rainix-rs-static runs): exit 0, no warnings.
  • cargo build -p rain-metadata --features cli: exit 0.
  • Grep, before each deletion: grep -rnw <name> . (rs, toml, md, json, ts, js, nix, yml) for RainSymbol, RainTitle, RainString, Description, SolidityIdentifier, REGEX_SOLIDITY_IDENTIFIER, REGEX_RAIN_TITLE, HASH_PATTERN hits only crates/cli/src/meta/types/common/v1.rs on base. REGEX_RAIN_SYMBOL and REGEX_RAIN_STRING hit authoring/v1.rs and authoring/v2.rs, so they stay. grep -rnE "pub use .*common|mod common" finds only pub mod common; in meta/types/mod.rs, no re-export.
  • Discriminating tests: compile probe appended to meta/types/common/mod.rs, #[cfg(test)] use self::v1::{RainSymbol, RainTitle, RainString, Description, SolidityIdentifier, REGEX_SOLIDITY_IDENTIFIER, REGEX_RAIN_TITLE, HASH_PATTERN};, then cargo check -p rain-metadata --tests. On base (d40cff9, detached worktree, shared target dir) it compiles, Finished, exit 0, because every name is still defined there; on this branch it fails with error[E0432]: unresolved imports naming all eight, exit 101. The retained test_rain_symbol_validate and test_rain_string_validate pass on both base and branch by design, since the regexes and inputs are unchanged. Probe removed from both; base worktree removed.
  • Mutations applied: each on common/v1.rs, restored from a byte-for-byte backup afterwards with diff confirming the restore, then cargo test -p rain-metadata common::v1 re-run green (2 passed).
    • v1.rs:6 REGEX_RAIN_SYMBOL first class [a-z] widened to [a-zA-Z] -> test_rain_symbol_validate FAILED (panic at v1.rs:34, the invalids loop); test_rain_string_validate ok.
    • v1.rs:11 REGEX_RAIN_STRING class replaced by [\s!-~] -> test_rain_string_validate FAILED (panic at v1.rs:61, the invalids loop, Unicode whitespace accepted); test_rain_symbol_validate ok.
  • Oracle: the base file at origin/main:crates/cli/src/meta/types/common/v1.rs. The two retained regex literals and the valid and invalid input lists of the two retained tests are copied from it unchanged; only the assertion subject changed from <Newtype> { value }.validate().is_ok()/is_err() to REGEX_*.is_match(i) / !REGEX_*.is_match(i). Consumer absence inside the repo is the grep above; the org-wide and crates.io consumer absence is as stated in Delete dead newtypes and regexes in meta/types/common/v1.rs #319 and not re-derived here.
  • Category check: Delete dead newtypes and regexes in meta/types/common/v1.rs #319 asks to delete seven named items with their tests, keep REGEX_RAIN_SYMBOL and REGEX_RAIN_STRING with their tests, and drop unused imports without touching Cargo.toml. Covered all of it. The PR additionally removes pub type Description = RainString;, which the issue names in its first line and which cannot compile without RainString. No other file changes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EyWWorieTJV9FmMm2JM6Ua

RainSymbol, RainTitle, RainString (and its alias Description),
SolidityIdentifier, REGEX_SOLIDITY_IDENTIFIER, REGEX_RAIN_TITLE and
HASH_PATTERN lost their last consumers when #318 deleted the
SolidityAbiMeta and InterpreterCallerMeta models. REGEX_RAIN_SYMBOL and
REGEX_RAIN_STRING stay for authoring v1 and v2; their tests now match
the regexes directly with the same inputs.

Closes #319.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EyWWorieTJV9FmMm2JM6Ua
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: 9d87a54c-9edb-4069-8254-8ad05bf7636f

📥 Commits

Reviewing files that changed from the base of the PR and between 5c44aa9 and dd655b3.

📒 Files selected for processing (1)
  • crates/cli/src/meta/types/common/v1.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.

@thedavidmeister
thedavidmeister merged commit f81c861 into main Sep 3, 2026
12 checks passed
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@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

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.

Delete dead newtypes and regexes in meta/types/common/v1.rs

1 participant