feat: add backwards compatibility for base mainnet subgraph#987
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (17)
📝 WalkthroughWalkthroughAdds chain-gated support for updatable proposal subgraph queries, normalizes their fields through SDK request helpers, updates dashboard and OG metadata retrieval, guards replaced-proposal redirects, and persists timestamps for newly received votes. ChangesUpdatable proposal support
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant VotePage
participant SDK
participant Subgraph
VotePage->>SDK: request chain-specific proposal metadata
SDK->>Subgraph: execute standard or updatable query
Subgraph-->>SDK: return proposal data and votes
SDK-->>VotePage: provide normalized metadata
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. 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
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/sdk/src/subgraph/queries/daosForDashbaordUpdatable.graphql`:
- Around line 13-18: Update the proposals filter in the dashboard query used by
dashboardRequest to exclude replaced proposals, using the schema-supported
replacement predicate consistent with getProposals. Ensure replaced proposals
cannot reach dashboard results without relying on later normalization.
In `@packages/sdk/src/subgraph/queries/proposalVersions.graphql`:
- Line 7: Restore Base compatibility across the proposal-version query flow: in
packages/sdk/src/subgraph/queries/proposalVersions.graphql:7, retain a legacy
Proposal operation and add a separate operation using ProposalUpdatable; in
packages/sdk/src/subgraph/requests/proposalVersionsQuery.ts:5-29, support both
ProposalFragment and ProposalUpdatableFragment; and at :39 select the
appropriate operation via supportsUpdatableProposals(chainId), using the legacy
query for unsupported chains.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d9dbe0b8-879b-45ff-bcf8-86ad9882e5e1
⛔ Files ignored due to path filters (1)
packages/sdk/src/subgraph/sdk.generated.tsis excluded by!**/*.generated.*
📒 Files selected for processing (16)
apps/web/src/pages/dao/[network]/[token]/vote/[id].tsxpackages/constants/src/subgraph.tspackages/proposal-ui/src/components/ProposalActions/VoteStatus/VoteStatus.test.tsxpackages/proposal-ui/src/components/ProposalActions/VoteStatus/VoteStatus.tsxpackages/sdk/src/subgraph/fragments/Proposal.graphqlpackages/sdk/src/subgraph/fragments/ProposalDetailUpdatable.graphqlpackages/sdk/src/subgraph/fragments/ProposalUpdatable.graphqlpackages/sdk/src/subgraph/queries/daosForDashbaordUpdatable.graphqlpackages/sdk/src/subgraph/queries/proposalOGMetadataUpdatable.graphqlpackages/sdk/src/subgraph/queries/proposalUpdatable.graphqlpackages/sdk/src/subgraph/queries/proposalVersions.graphqlpackages/sdk/src/subgraph/queries/proposalsUpdatable.graphqlpackages/sdk/src/subgraph/requests/dashboardQuery.tspackages/sdk/src/subgraph/requests/proposalQuery.tspackages/sdk/src/subgraph/requests/proposalVersionsQuery.tspackages/sdk/src/subgraph/requests/proposalsQuery.ts
💤 Files with no reviewable changes (1)
- packages/sdk/src/subgraph/fragments/Proposal.graphql
| orderDirection: asc | ||
| ) { | ||
| ...Proposal | ||
| ...ProposalUpdatable |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Restore Base-compatible proposal-version queries.
proposalVersions now always selects ProposalUpdatable, but Line 39 invokes it for CHAIN_ID.BASE too. Base will reject the unsupported fields, so proposal-version history cannot load there.
packages/sdk/src/subgraph/queries/proposalVersions.graphql#L7-L7: retain a legacyProposaloperation and add a separate updatable operation.packages/sdk/src/subgraph/requests/proposalVersionsQuery.ts#L5-L29: accept bothProposalFragmentandProposalUpdatableFragment.packages/sdk/src/subgraph/requests/proposalVersionsQuery.ts#L39-L39: select the operation usingsupportsUpdatableProposals(chainId).
Proposed direction
query proposalVersions($where: Proposal_filter) {
proposals(where: $where, orderBy: updateCount, orderDirection: asc) {
- ...ProposalUpdatable
+ ...Proposal
+ }
+}
+
+query proposalVersionsUpdatable($where: Proposal_filter) {
+ proposals(where: $where, orderBy: updateCount, orderDirection: asc) {
+ ...ProposalUpdatable
}
}-const data = await SDK.connect(chainId).proposalVersions({ where })
+const sdk = SDK.connect(chainId)
+const data = supportsUpdatableProposals(chainId)
+ ? await sdk.proposalVersionsUpdatable({ where })
+ : await sdk.proposalVersions({ where })📍 Affects 2 files
packages/sdk/src/subgraph/queries/proposalVersions.graphql#L7-L7(this comment)packages/sdk/src/subgraph/requests/proposalVersionsQuery.ts#L5-L29packages/sdk/src/subgraph/requests/proposalVersionsQuery.ts#L39-L39
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/sdk/src/subgraph/queries/proposalVersions.graphql` at line 7,
Restore Base compatibility across the proposal-version query flow: in
packages/sdk/src/subgraph/queries/proposalVersions.graphql:7, retain a legacy
Proposal operation and add a separate operation using ProposalUpdatable; in
packages/sdk/src/subgraph/requests/proposalVersionsQuery.ts:5-29, support both
ProposalFragment and ProposalUpdatableFragment; and at :39 select the
appropriate operation via supportsUpdatableProposals(chainId), using the legacy
query for unsupported chains.
…oposals subgraph changes sync
33e903d to
1e85ccd
Compare
note: this commit is intended to reverted once base subgraph syncs (within a week)
Summary by CodeRabbit