Skip to content

Chunk large governance vote submissions#44

Merged
sidhujag merged 3 commits into
masterfrom
fix/gov-vote-entry-chunking
May 16, 2026
Merged

Chunk large governance vote submissions#44
sidhujag merged 3 commits into
masterfrom
fix/gov-vote-entry-chunking

Conversation

@sidhujag
Copy link
Copy Markdown
Member

Summary

  • Split /gov/vote frontend submissions into 256-entry chunks to match the backend per-request cap.
  • Merge chunk responses back into the existing { accepted, rejected, results } shape so the vote modal behavior is unchanged.
  • Add coverage for a 257-entry submission spanning two requests with mixed per-entry results.

Test plan

  • npm test -- --runTestsByPath src/lib/governanceService.test.js --watchAll=false
  • npm run build
  • Backend sanity: npm test -- --runTestsByPath lib/gov.test.js in sysnode-backend

Made with Cursor

Split frontend vote relay payloads at the backend per-request entry cap so large operators can submit all signed votes without hitting too_many_entries.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sidhujag
Copy link
Copy Markdown
Member Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 005d449d31

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +164 to +170
const res = await client.post(VOTE_PATH, {
proposalHash,
voteOutcome,
voteSignal,
time,
entries: chunk,
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Surface partial chunk success on mid-batch failure

When any later chunk request fails, submitVote throws and discards results from earlier chunks that were already accepted by the backend. This changes the operation from effectively all-or-nothing (single request) to partially committed but reported as total failure, which breaks retry assumptions in callers (they will resend already-submitted entries and show misleading error state). A concrete case is entries.length > 256 where chunk 1 succeeds and chunk 2 hits a transient 429/network error: users see only an error even though some votes were already relayed.

Useful? React with 👍 / 👎.

Return already-accepted chunk results with retryable per-entry failures when a later chunk request fails, instead of hiding partial success behind a top-level error.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sidhujag
Copy link
Copy Markdown
Member Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d0f108745

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib/governanceService.js Outdated
Comment on lines +227 to +229
if (merged.results.length === 0) {
throw normalized;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Track chunk success independently of result rows

The partial-failure path decides whether to throw based on merged.results.length === 0, but results is treated as optional/defensive (Array.isArray(data.results)), so a successful earlier chunk with a non-array or omitted results still leaves this at 0. In that case, a later chunk error incorrectly throws and discards already accepted/rejected progress, defeating the new “preserve successful chunks” behavior for mixed backend responses. Use an explicit success flag (or chunkIndex > 0) instead of results.length to detect prior successful chunk submissions.

Useful? React with 👍 / 👎.

Use successful chunk completion rather than returned result rows to decide whether a later chunk failure should preserve partial progress.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sidhujag
Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@sidhujag sidhujag merged commit 947e43c into master May 16, 2026
4 checks passed
@sidhujag sidhujag deleted the fix/gov-vote-entry-chunking branch May 16, 2026 22:53
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