Skip to content

feat: add backwards compatibility for base mainnet subgraph#987

Merged
dan13ram merged 2 commits into
stagingfrom
feat/updatable-proposals
Jul 22, 2026
Merged

feat: add backwards compatibility for base mainnet subgraph#987
dan13ram merged 2 commits into
stagingfrom
feat/updatable-proposals

Conversation

@dan13ram

@dan13ram dan13ram commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

note: this commit is intended to reverted once base subgraph syncs (within a week)

Summary by CodeRabbit

  • New Features
    • Added support for updatable proposals on compatible networks, including updated proposal, version, and dashboard data.
    • Proposal pages now use network-appropriate metadata for supported chains.
    • Vote status now records and persists vote timestamps for more accurate display.
  • Bug Fixes
    • Improved handling of replaced proposals to redirect safely using available replacement data.
    • Updated subgraph URL/version selection to avoid hardcoding a single subgraph version.
  • Tests
    • Updated vote status tests to match the new timestamped vote payload.

@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
testnet-nouns-builder Ready Ready Preview Jul 22, 2026 2:04pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
nouns-builder Ignored Ignored Jul 22, 2026 2:04pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e30aca0a-cb7e-4cea-a5cd-1d1ba1d78aa6

📥 Commits

Reviewing files that changed from the base of the PR and between 33e903d and 1e85ccd.

⛔ Files ignored due to path filters (1)
  • packages/sdk/src/subgraph/sdk.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing (17)
  • apps/web/src/pages/dao/[network]/[token]/vote/[id].tsx
  • packages/constants/src/subgraph.ts
  • packages/proposal-ui/src/components/ProposalActions/VoteStatus/VoteStatus.test.tsx
  • packages/proposal-ui/src/components/ProposalActions/VoteStatus/VoteStatus.tsx
  • packages/sdk/src/subgraph/fragments/Proposal.graphql
  • packages/sdk/src/subgraph/fragments/ProposalDetailUpdatable.graphql
  • packages/sdk/src/subgraph/fragments/ProposalUpdatable.graphql
  • packages/sdk/src/subgraph/queries/daosForDashbaordUpdatable.graphql
  • packages/sdk/src/subgraph/queries/proposalOGMetadataUpdatable.graphql
  • packages/sdk/src/subgraph/queries/proposalUpdatable.graphql
  • packages/sdk/src/subgraph/queries/proposalVersions.graphql
  • packages/sdk/src/subgraph/queries/proposalVersionsUpdatable.graphql
  • packages/sdk/src/subgraph/queries/proposalsUpdatable.graphql
  • packages/sdk/src/subgraph/requests/dashboardQuery.ts
  • packages/sdk/src/subgraph/requests/proposalQuery.ts
  • packages/sdk/src/subgraph/requests/proposalVersionsQuery.ts
  • packages/sdk/src/subgraph/requests/proposalsQuery.ts

📝 Walkthrough

Walkthrough

Adds 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.

Changes

Updatable proposal support

Layer / File(s) Summary
Updatable proposal contracts
packages/constants/src/subgraph.ts, packages/sdk/src/subgraph/fragments/*, packages/sdk/src/subgraph/queries/*
Adds updatable proposal fragments and queries, chain support rules, and updated proposal-version ordering.
SDK query routing and normalization
packages/sdk/src/subgraph/requests/*
Selects standard or updatable queries per chain, widens result types, and normalizes optional update, candidate, and replacement fields.
Vote page metadata and vote state
apps/web/src/pages/dao/.../vote/[id].tsx, packages/proposal-ui/src/components/ProposalActions/VoteStatus/*
Uses matching OG metadata queries, guards replacement redirects, and stores Unix timestamps for received votes.

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
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is only a short note and misses the required template sections for the change, motivation, review notes, type, and checklist. Fill out the template sections with a change summary, motivation/context, code review notes, type of change, and checklist items.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and matches the main change: adding Base subgraph backward compatibility.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/updatable-proposals

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between b8d5951 and 33e903d.

⛔ Files ignored due to path filters (1)
  • packages/sdk/src/subgraph/sdk.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing (16)
  • apps/web/src/pages/dao/[network]/[token]/vote/[id].tsx
  • packages/constants/src/subgraph.ts
  • packages/proposal-ui/src/components/ProposalActions/VoteStatus/VoteStatus.test.tsx
  • packages/proposal-ui/src/components/ProposalActions/VoteStatus/VoteStatus.tsx
  • packages/sdk/src/subgraph/fragments/Proposal.graphql
  • packages/sdk/src/subgraph/fragments/ProposalDetailUpdatable.graphql
  • packages/sdk/src/subgraph/fragments/ProposalUpdatable.graphql
  • packages/sdk/src/subgraph/queries/daosForDashbaordUpdatable.graphql
  • packages/sdk/src/subgraph/queries/proposalOGMetadataUpdatable.graphql
  • packages/sdk/src/subgraph/queries/proposalUpdatable.graphql
  • packages/sdk/src/subgraph/queries/proposalVersions.graphql
  • packages/sdk/src/subgraph/queries/proposalsUpdatable.graphql
  • packages/sdk/src/subgraph/requests/dashboardQuery.ts
  • packages/sdk/src/subgraph/requests/proposalQuery.ts
  • packages/sdk/src/subgraph/requests/proposalVersionsQuery.ts
  • packages/sdk/src/subgraph/requests/proposalsQuery.ts
💤 Files with no reviewable changes (1)
  • packages/sdk/src/subgraph/fragments/Proposal.graphql

Comment thread packages/sdk/src/subgraph/queries/daosForDashbaordUpdatable.graphql
orderDirection: asc
) {
...Proposal
...ProposalUpdatable

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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 legacy Proposal operation and add a separate updatable operation.
  • packages/sdk/src/subgraph/requests/proposalVersionsQuery.ts#L5-L29: accept both ProposalFragment and ProposalUpdatableFragment.
  • packages/sdk/src/subgraph/requests/proposalVersionsQuery.ts#L39-L39: select the operation using supportsUpdatableProposals(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-L29
  • packages/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.

@dan13ram
dan13ram force-pushed the feat/updatable-proposals branch from 33e903d to 1e85ccd Compare July 22, 2026 13:55
@dan13ram
dan13ram merged commit 42a375a into staging Jul 22, 2026
2 of 4 checks passed
@dan13ram
dan13ram deleted the feat/updatable-proposals branch July 22, 2026 13:55
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.

1 participant