- Notifications
You must be signed in to change notification settings - Fork 50
University frontend deploy #2142
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
base: dev
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for kleros-v2-testnet ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for kleros-v2-testnet-devtools ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for kleros-v2-neo ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughAdded a stray "x" line in Changes
Sequence Diagram(s)sequenceDiagram autonumber participant UI as UI / Reveal.tsx participant Logic as getSaltAndChoice participant Candidates as Candidate Builder participant Reducer as Reduction (salt & choice) UI->>Logic: call getSaltAndChoice(answers) alt answers non-empty Logic->>Reducer: reduce over answers else answers empty Logic->>Candidates: build fallback candidates (includes "Refuse To Arbitrate") Candidates-->>Logic: candidates[] Logic->>Reducer: reduce over candidates end Reducer-->>UI: return { salt, choice } Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
✅ Deploy Preview for kleros-v2-university ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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: 0
🧹 Nitpick comments (1)
subgraph/README.md (1)
68-69: Remove stray character.The single "x" appears to be an accidental artifact in the README.
-x
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
subgraph/README.md(1 hunks)
⏰ 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). (11)
- GitHub Check: Redirect rules - kleros-v2-university
- GitHub Check: Header rules - kleros-v2-university
- GitHub Check: Pages changed - kleros-v2-university
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Analyze (javascript)
- GitHub Check: hardhat-tests
536c3dc to 8332f5c Compare 8332f5c to 1c19cad Compare |
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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx(3 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2024-10-22T10:23:15.789Z
Learnt from: Harman-singh-waraich Repo: kleros/kleros-v2 PR: 1703 File: kleros-sdk/src/sdk.ts:1-3 Timestamp: 2024-10-22T10:23:15.789Z Learning: In `kleros-sdk/src/sdk.ts`, the `PublicClient` type is used and should not be flagged as unused. Applied to files:
web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx
📚 Learning: 2024-10-14T13:58:25.708Z
Learnt from: Harman-singh-waraich Repo: kleros/kleros-v2 PR: 1703 File: web/src/hooks/queries/usePopulatedDisputeData.ts:58-61 Timestamp: 2024-10-14T13:58:25.708Z Learning: In `web/src/hooks/queries/usePopulatedDisputeData.ts`, the query and subsequent logic only execute when `disputeData.dispute?.arbitrableChainId` and `disputeData.dispute?.externalDisputeId` are defined, so `initialContext` properties based on these values are safe to use without additional null checks. Applied to files:
web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx
📚 Learning: 2025-05-15T06:50:40.859Z
Learnt from: tractorss Repo: kleros/kleros-v2 PR: 1982 File: web/src/pages/Resolver/Landing/index.tsx:62-62 Timestamp: 2025-05-15T06:50:40.859Z Learning: In the Landing component, it's safe to pass `dispute?.dispute?.arbitrated.id as 0x${string}` to `usePopulatedDisputeData` without additional null checks because the hook internally handles undefined parameters through its `isEnabled` flag and won't execute the query unless all required data is available. Applied to files:
web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx
⏰ 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: Redirect rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Redirect rules - kleros-v2-neo
- GitHub Check: Header rules - kleros-v2-neo
- GitHub Check: Pages changed - kleros-v2-neo
🔇 Additional comments (2)
web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx (2)
10-10: LGTM! Necessary imports added.The
Answertype is used in the function signature and the new fallback logic, andEnsureChainis used in the component rendering.Also applies to: 21-21
154-163: LGTM! Correct usage of the candidates array.The reduce operation correctly uses the new
candidatesarray, which provides proper fallback handling whenanswersis empty or undefined.
| // when dispute is invalid, just add RFA to the answers array | ||
| const candidates = | ||
| answers?.length > 0 | ||
| ? answers | ||
| : [{ id: "0x0", title: "Refuse To Arbitrate", description: "Refuse To Arbitrate" } as Answer]; |
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.
🧩 Analysis chain
Verify the hardcoded RFA ID and consider type safety.
The fallback logic handles empty answers by creating a "Refuse To Arbitrate" candidate with ID "0x0". Consider these concerns:
- Comment accuracy: The comment says "add RFA to the answers array" but the code creates a new
candidatesarray rather than modifyinganswers. - Type cast safety: The
as Answercast assumes the object shape matches theAnswerinterface from@kleros/kleros-sdk. IfAnswerrequires additional fields beyondid,title, anddescription, this could cause runtime issues. - Hardcoded ID verification: Ensure
"0x0"is the correct ID for "Refuse To Arbitrate" in invalid dispute scenarios within your system's conventions.
Run the following script to verify the Answer type structure and search for other RFA ID usage patterns:
🏁 Script executed:
#!/bin/bash # Search for Answer type definition and RFA ID patterns # Find the Answer type definition in kleros-sdk echo "=== Searching for Answer type definition ===" fd -e ts -e tsx . | xargs rg -n "type Answer|interface Answer" -A 10 # Search for "Refuse To Arbitrate" usage patterns echo -e "\n=== Searching for Refuse To Arbitrate patterns ===" rg -n "Refuse To Arbitrate|RefuseToArbitrate|RFA" -C 3 # Search for 0x0 ID usage in answer contexts echo -e "\n=== Searching for 0x0 ID usage ===" rg -n 'id.*["\']0x0["\']|["\']0x0["\'].*id' -C 3Length of output: 11494
Use RefuseToArbitrateAnswer constant and fix title/description text.
The fallback RFA object has incorrect title and description values. The code should import and use the RefuseToArbitrateAnswer constant from the kleros-sdk rather than hardcoding, which is already used elsewhere in the codebase (e.g., OptionsContainer.tsx).
Update line 152 to:
: [RefuseToArbitrateAnswer];This ensures consistency with the SDK's standard RFA definition where title and description are "Refuse to Arbitrate / Invalid", not "Refuse To Arbitrate". You'll need to add the import:
import { RefuseToArbitrateAnswer } from "@kleros/kleros-sdk/src/dataMappings/utils/disputeDetailsSchema";Additionally, update the comment on line 148 to clarify that a new candidates array is created (not modifying answers).
🤖 Prompt for AI Agents
In web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx around lines 148 to 152, the fallback RFA object is hardcoded with incorrect title/description and mutates/uses answers; replace the fallback with the SDK constant and adjust the comment: import RefuseToArbitrateAnswer from "@kleros/kleros-sdk/src/dataMappings/utils/disputeDetailsSchema", change the comment to say a new candidates array is created (not modifying answers), and replace the ternary fallback to use [RefuseToArbitrateAnswer] instead of the manually constructed object to ensure correct title/description and consistency. 


PR-Codex overview
This PR focuses on enhancing the
Reveal.tsxcomponent by adding functionality to handle cases where there are no valid answers for a dispute, introducing a default option to refuse arbitration.Detailed summary
Answerfrom@kleros/kleros-sdk.EnsureChainfromcomponents/EnsureChain.AnswerandEnsureChain.answersis empty, titled "Refuse To Arbitrate".Summary by CodeRabbit
Documentation
Bug Fixes