Skip to content

fix: simplify storage error type labels - #1302

Open
ayaanoncrypto wants to merge 1 commit into
OpenZeppelin:masterfrom
ayaanoncrypto:fix/strip-storage-type-keywords
Open

ayaanoncrypto wants to merge 1 commit into
OpenZeppelin:masterfrom
ayaanoncrypto:fix/strip-storage-type-keywords

Conversation

@ayaanoncrypto

@ayaanoncrypto ayaanoncrypto commented Aug 19, 2026 •

Copy link
Copy Markdown

Closes #728

Storage compatibility errors now remove leading Solidity type keywords such as struct, enum, and contract from displayed type labels. This keeps retype annotations copy-pastable while preserving the underlying storage comparison behavior.

Validation: git diff --check passed. Full TypeScript and AVA validation was unavailable because dependencies are not installed in the sandbox.

Summary by CodeRabbit

  • Bug Fixes
    • Improved type-change and layout reports by presenting cleaner, more readable type labels.
    • Removed contract-specific text from type descriptions across nested mappings, arrays, structs, enums, unknown types, and transition details.
    • Preserved the original label when a cleaner description is unavailable.

@coderabbitai

coderabbitai Bot commented Aug 19, 2026 •

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The storage report now removes contract-specific substrings from type labels. It applies the normalized labels to layout changes, nested types, unknown types, struct and enum members, and type transition descriptions. Original labels remain as a fallback.

Changes

Type label normalization

Layer / File(s) Summary
Normalize storage report explanations
packages/core/src/storage/report.ts
The report adds typeLabel and uses it across layout, nested type, member, unknown-type, and type transition explanations. The helper falls back to the original label when stripping returns undefined.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: 🔵 Low · up to 64957

The change simplifies displayed storage type labels, but it may hide struct-versus-enum type-kind changes in compatibility reports if those transitions are valid. The PR is mergeable with explicit owner confirmation of this bounded reporting risk.

Poem

I’m a rabbit with labels to trim,
Contract words now grow rather slim.
Layouts speak clear,
Type changes draw near,
And fallback keeps every name in the brim. 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: simplifying storage error type labels.
Linked Issues check ✅ Passed The changes remove contract-specific type keywords from storage error labels, meeting issue #728 and preserving comparison behavior.
Out of Scope Changes check ✅ Passed The changes are limited to formatting storage compatibility error type labels and align with issue #728.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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

🔇 Additional comments (2)
packages/core/src/storage/report.ts (2)

14-14: LGTM!

Also applies to: 122-122, 188-192, 224-224, 269-269, 284-284, 337-340


315-316: 🎯 Functional Correctness

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify that normalized labels do not hide type-kind changes.

describeTransition now compares normalized labels. If parsed types such as struct C.Item and enum C.Item can occur in a transition, the report will show only to C.Item and omit the detected type-kind change. Compare a type identity that retains the kind, and use normalized labels only for display when these pairs are valid.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4fd1788e-863b-4576-bfa3-97746a0ac43b

📥 Commits

Reviewing files that changed from the base of the PR and between 3aa87ac and 64957dd.

📒 Files selected for processing (1)
  • packages/core/src/storage/report.ts

Included review availability: Your plan provides up to 4 included reviews per hour; 1 remains after this review.

This branch has not been deployed

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

Remove type keyword from layout error report

1 participant