fix(ci): skip storage check for new contracts without baseline#1047
fix(ci): skip storage check for new contracts without baseline#1047wbobbynmworley wants to merge 1 commit into
Conversation
Closes ubiquity#972 Problem: When a new contract is added, core-contracts-storage-check.yml and diamond-storage-check.yml fail because there's no storage baseline to compare against. Solution: Add a step that checks if each changed contract/library has an existing storage baseline in storage-layouts/. Skip storage checks for contracts that are new (no baseline exists). QA covered: 1. No storage updates -> CI passing 2. Storage update, no collision -> CI passing 3. Storage update, collision -> CI failing 4. New contract added -> CI passing (fixed)
📝 WalkthroughWalkthroughBoth GitHub Actions workflows ( 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1d792cff-0b30-4a0e-9616-6a66f417cc88
📒 Files selected for processing (2)
.github/workflows/core-contracts-storage-check.yml.github/workflows/diamond-storage-check.yml
| grep -v "^$CONTRACT$" contracts.txt > contracts_filtered.txt || true | ||
| mv contracts_filtered.txt contracts.txt |
There was a problem hiding this comment.
Use fixed-string filtering when removing matrix entries.
grep -v "^$CONTRACT$" treats $CONTRACT as regex. A path like src/dollar/core/Foo.sol:Foo contains regex-significant chars (e.g., .), so this can remove unintended lines and silently skip required checks.
Suggested patch
- grep -v "^$CONTRACT$" contracts.txt > contracts_filtered.txt || true
+ grep -Fvx -- "$CONTRACT" contracts.txt > contracts_filtered.txt || true
mv contracts_filtered.txt contracts.txt| grep -v "^$LIB$" contracts.txt > contracts_filtered.txt || true | ||
| mv contracts_filtered.txt contracts.txt |
There was a problem hiding this comment.
Use fixed-string matching for library filtering as well.
Dynamic regex in grep -v "^$LIB$" can overmatch and drop non-target libraries from contracts.txt, which may skip checks that should run.
Suggested patch
- grep -v "^$LIB$" contracts.txt > contracts_filtered.txt || true
+ grep -Fvx -- "$LIB" contracts.txt > contracts_filtered.txt || true
mv contracts_filtered.txt contracts.txt
Summary
Closes #972
When a new contract is added to the codebase, both core-contracts-storage-check.yml and diamond-storage-check.yml workflows fail because there is no existing storage baseline to compare against.
Changes
core-contracts-storage-check.yml
Added check-new-contracts step that filters out contracts without a storage baseline (storage-layouts/.json). If ALL changed contracts are new (no baseline), the is_new_only flag is set to rue and the check_storage_layout job is skipped entirely.
diamond-storage-check.yml
Same fix applied to the diamond library storage check workflow.
QA
Per #972 requirements, this PR covers all test scenarios:
How to Test
Bounty: (Issue #972)