-
Notifications
You must be signed in to change notification settings - Fork 5
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
Upgrade page fixes #181
Upgrade page fixes #181
Conversation
WalkthroughThis pull request introduces enhancements to the Changes
Sequence DiagramsequenceDiagram
participant User
participant UpgradeModal
participant useBlockHeight
participant LCDClient
User->>UpgradeModal: Open Upgrade Modal
UpgradeModal->>useBlockHeight: Fetch Current Block Height
useBlockHeight->>LCDClient: Query Block Status
LCDClient-->>useBlockHeight: Return Block Height
useBlockHeight-->>UpgradeModal: Provide Block Height
UpgradeModal->>UpgradeModal: Validate Upgrade Height
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #181 +/- ##
==========================================
- Coverage 55.04% 54.78% -0.27%
==========================================
Files 153 153
Lines 15515 15606 +91
==========================================
+ Hits 8540 8549 +9
- Misses 6975 7057 +82 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (3)
components/admins/modals/upgradeModal.tsx (2)
57-69
: Add unit tests for upgrade height validation logicThe custom validation in
UpgradeSchema
checks that the proposed upgrade height is at least 1000 blocks above the current height. Unit tests will help verify that this validation works correctly under different conditions.Would you like help in writing unit tests for this validation logic?
🧰 Tools
🪛 Biome (1.9.4)
[error] 62-62: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.
See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.(lint/suspicious/noGlobalIsNan)
[error] 62-62: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.
See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.(lint/suspicious/noGlobalIsNan)
🪛 GitHub Check: codecov/patch
[warning] 57-67: components/admins/modals/upgradeModal.tsx#L57-L67
Added lines #L57 - L67 were not covered by tests
336-336
: Provide a default value forblockHeight
in the labelWhen
blockHeight
is undefined, the label displays "HEIGHT (Current: undefined)". To enhance user experience, consider providing a default value like"..."
or"Loading"
.Apply this diff to handle the undefined case:
-label={`HEIGHT (Current: ${blockHeight})`} +label={`HEIGHT (Current: ${blockHeight || '...'})`}🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 336-336: components/admins/modals/upgradeModal.tsx#L336
Added line #L336 was not covered by testshooks/useQueries.ts (1)
962-982
: Add unit tests foruseBlockHeight
hookThe new
useBlockHeight
hook is crucial for retrieving the current block height at regular intervals. Adding unit tests will ensure its reliability and help catch potential issues early.Would you like assistance in creating unit tests for this hook?
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 962-982: hooks/useQueries.ts#L962-L982
Added lines #L962 - L982 were not covered by tests
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
components/admins/modals/upgradeModal.tsx
(7 hunks)components/react/inputs/BaseInput.tsx
(1 hunks)hooks/useQueries.ts
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- components/react/inputs/BaseInput.tsx
🧰 Additional context used
🪛 GitHub Check: codecov/patch
hooks/useQueries.ts
[warning] 962-982: hooks/useQueries.ts#L962-L982
Added lines #L962 - L982 were not covered by tests
components/admins/modals/upgradeModal.tsx
[warning] 30-32: components/admins/modals/upgradeModal.tsx#L30-L32
Added lines #L30 - L32 were not covered by tests
[warning] 35-35: components/admins/modals/upgradeModal.tsx#L35
Added line #L35 was not covered by tests
[warning] 40-42: components/admins/modals/upgradeModal.tsx#L40-L42
Added lines #L40 - L42 were not covered by tests
[warning] 57-67: components/admins/modals/upgradeModal.tsx#L57-L67
Added lines #L57 - L67 were not covered by tests
[warning] 77-78: components/admins/modals/upgradeModal.tsx#L77-L78
Added lines #L77 - L78 were not covered by tests
[warning] 110-115: components/admins/modals/upgradeModal.tsx#L110-L115
Added lines #L110 - L115 were not covered by tests
[warning] 117-138: components/admins/modals/upgradeModal.tsx#L117-L138
Added lines #L117 - L138 were not covered by tests
[warning] 144-144: components/admins/modals/upgradeModal.tsx#L144
Added line #L144 was not covered by tests
[warning] 181-188: components/admins/modals/upgradeModal.tsx#L181-L188
Added lines #L181 - L188 were not covered by tests
[warning] 212-221: components/admins/modals/upgradeModal.tsx#L212-L221
Added lines #L212 - L221 were not covered by tests
[warning] 227-227: components/admins/modals/upgradeModal.tsx#L227
Added line #L227 was not covered by tests
[warning] 336-336: components/admins/modals/upgradeModal.tsx#L336
Added line #L336 was not covered by tests
[warning] 338-338: components/admins/modals/upgradeModal.tsx#L338
Added line #L338 was not covered by tests
[warning] 342-342: components/admins/modals/upgradeModal.tsx#L342
Added line #L342 was not covered by tests
🪛 Biome (1.9.4)
components/admins/modals/upgradeModal.tsx
[error] 62-62: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.
See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.
(lint/suspicious/noGlobalIsNan)
[error] 62-62: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.
See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.
(lint/suspicious/noGlobalIsNan)
🔇 Additional comments (1)
components/admins/modals/upgradeModal.tsx (1)
77-78
: Handle potential undefinedblockHeight
The
blockHeight
retrieved fromuseBlockHeight
might be undefined if the query fails or is loading. Ensure that the code handles this scenario to prevent unexpected behavior.Please verify that
blockHeight
is defined before using it in the component.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 77-78: components/admins/modals/upgradeModal.tsx#L77-L78
Added lines #L77 - L78 were not covered by tests
const nameMatch = body.match(/- \*\*Upgrade Handler Name\*\*: (.*?)(?:\r?\n|$)/); | ||
const upgradeableMatch = body.match(/- \*\*Upgradeable\*\*: (.*?)(?:\r?\n|$)/); | ||
const commitHashMatch = body.match(/- \*\*Commit Hash\*\*: (.*?)(?:\r?\n|$)/); | ||
|
||
if (!nameMatch || !upgradeableMatch || !commitHashMatch) { | ||
console.warn('Failed matches:', { nameMatch, upgradeableMatch, commitHashMatch }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add unit tests for parseReleaseBody
function
The parseReleaseBody
function has been updated with new regex patterns and logging for failed matches. Adding unit tests will ensure that it accurately parses the release body in various scenarios and handles edge cases effectively.
Would you like assistance in creating unit tests for this function?
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 30-32: components/admins/modals/upgradeModal.tsx#L30-L32
Added lines #L30 - L32 were not covered by tests
[warning] 35-35: components/admins/modals/upgradeModal.tsx#L35
Added line #L35 was not covered by tests
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Félix C. Morency <[email protected]>
Summary by CodeRabbit
Release Notes
New Features
Improvements
Technical Enhancements