Skip to content

Conversation

coodos
Copy link
Contributor

@coodos coodos commented Aug 26, 2025

Description of change

Issue Number

Type of change

  • Breaking (any change that would cause existing functionality to not work as expected)
  • New (a change which implements a new feature)
  • Update (a change which updates existing functionality)
  • Fix (a change which fixes an issue)
  • Docs (changes to the documentation)
  • Chore (refactoring, build scripts or anything else that isn't user-facing)

How the change has been tested

Change checklist

  • I have ensured that the CI Checks pass locally
  • I have removed any unnecessary logic
  • My code is well documented
  • I have signed my commits
  • My code follows the pattern of the application
  • I have self reviewed my code

Summary by CodeRabbit

  • New Features

    • Final Results now display voter turnout for public and private polls.
    • Results auto-refresh when voting ends.
    • Ranked polls use Instant Runoff Voting (IRV) for outcomes.
    • Poll creation blocks commas in option text with an inline warning.
  • Improvements

    • Deadline reminders are simpler and sent every 5 minutes.
  • Chores

    • Background jobs start automatically after startup.
    • Reduced debug logging noise.
  • Style

    • Updated version label in eVault settings to v0.2.1.1.

Copy link
Contributor

coderabbitai bot commented Aug 26, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Updates span UI text in eID Wallet, frontend eVoting pages adding turnout display and end-of-vote refetch, PollResults type extensions, API bootstrap to start cron jobs, cron cadence change, deadline notification refactor, VoteService turnout and IRV ranking logic, and removal of debug logs in web3 subscribers.

Changes

Cohort / File(s) Summary
eID Wallet UI Text
infrastructure/eid-wallet/src/routes/(app)/settings/+page.svelte
Button label updated from "Version v0.2.1.0" to "Version v0.2.1.1".
eVoting Frontend: Results & Creation
platforms/eVoting/src/app/(app)/[id]/page.tsx, platforms/eVoting/src/app/(app)/create/page.tsx
Result page: re-fetch on expiration; turnout cards for private/public polls. Create page: forbid commas in option text with schema validation and runtime toast guard.
eVoting Types
platforms/eVoting/src/lib/pollApi.ts
PollResults interface gains optional totalEligibleVoters?: number and turnout?: number.
API Bootstrap & Scheduling
platforms/evoting-api/src/index.ts, platforms/evoting-api/src/services/CronManagerService.ts
After DB init, start cron jobs via CronManagerService.startAllJobs() with logging. Deadline check cron cadence changed from every 10 minutes to every 5 minutes.
Deadline Processing
platforms/evoting-api/src/services/DeadlineCheckService.ts
Refactors expired poll handling: early exit if none, per-poll processing via processExpiredPoll, simplified message generation with link, updated stats via query builders; logs added.
Vote Tally & Turnout
platforms/evoting-api/src/services/VoteService.ts
Adds turnout and eligible voter counts across tally paths; introduces IRV for rank-mode with ballot parsing, elimination tie-breakers, rounds, and blind-vote turnout support; helper methods added.
Web3 Subscribers: Logging Cleanup
platforms/evoting-api/src/web3adapter/watchers/subscriber.ts, platforms/group-charter-manager-api/src/web3adapter/watchers/subscriber.ts
Removes debug console logs; no functional changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant API as evoting-api
  participant DB as Database
  participant Cron as CronManagerService
  participant DCS as DeadlineCheckService
  participant Group as Group/Message System

  rect rgba(220,235,255,0.5)
  note over API: Startup
  API->>DB: AppDataSource.initialize()
  DB-->>API: ready
  API->>Cron: startAllJobs()
  Cron-->>API: "Cron jobs started successfully"
  end

  rect rgba(235,250,220,0.5)
  note over Cron,DCS: Every 5 minutes
  Cron->>DCS: checkExpiredPolls()
  DCS->>DB: Query expired polls (deadline < now, not sent)
  alt Any expired
    loop For each expired poll
      DCS->>Group: Send simple deadline message (title, voteId, link)
      Group-->>DCS: ack
      DCS->>DB: Mark deadlineMessageSent = true
    end
  else None
    DCS-->>Cron: No expired polls
  end
  end
Loading
sequenceDiagram
  autonumber
  participant FE as eVoting Frontend
  participant API as evoting-api VoteService
  participant DB as Database
  participant Group as Group Service

  rect rgba(245,235,255,0.5)
  note over FE: Poll page lifecycle
  FE->>API: GET /polls/:id/results
  API->>DB: Fetch poll, votes, groupId
  opt rank mode
    API->>API: tallyIRV(votes, options)
  end
  opt groupId present
    API->>Group: getGroupMemberCount(groupId)
    Group-->>API: totalEligibleVoters
    API->>API: Compute turnout = totalVotes / eligible
  end
  API-->>FE: { results, totalVotes, totalEligibleVoters?, turnout? }
  FE->>FE: Render results + turnout card
  end

  rect rgba(235,250,220,0.5)
  note over FE: After "Voting has ended"
  FE->>API: Re-fetch results
  API-->>FE: Updated results
  FE->>FE: Update UI
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • prototype#305: Touches the same eVoting files (results page, create page, pollApi, VoteService), indicating overlapping logic and types.
  • prototype#318: Threads groupId through poll creation; this PR uses groupId for turnout calculations in VoteService.
  • prototype#282: Alters logging in web3 adapter; this PR removes debug logs in related subscriber modules.

Suggested reviewers

  • sosweetham

Poem

A hop and a tally, I count with delight,
IRV rounds whirl in the soft moonlight.
Turnout now twinkles, clear as the dew,
Cron chimes at five, with messages new.
When polls take a bow and curtains descend—
I nibble the carrots and fetch results again. 🥕✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 731ef80 and e5fda39.

⛔ Files ignored due to path filters (3)
  • infrastructure/eid-wallet/src-tauri/gen/android/app/arm64/release/eid-w3ds-v0.2.1.1.apk is excluded by !**/gen/**
  • infrastructure/eid-wallet/src-tauri/gen/apple/eid-wallet.xcodeproj/project.pbxproj is excluded by !**/gen/**
  • infrastructure/eid-wallet/src-tauri/gen/apple/eid-wallet_iOS/Info.plist is excluded by !**/gen/**
📒 Files selected for processing (10)
  • infrastructure/eid-wallet/src/routes/(app)/settings/+page.svelte (1 hunks)
  • platforms/eVoting/src/app/(app)/[id]/page.tsx (3 hunks)
  • platforms/eVoting/src/app/(app)/create/page.tsx (2 hunks)
  • platforms/eVoting/src/lib/pollApi.ts (1 hunks)
  • platforms/evoting-api/src/index.ts (1 hunks)
  • platforms/evoting-api/src/services/CronManagerService.ts (1 hunks)
  • platforms/evoting-api/src/services/DeadlineCheckService.ts (5 hunks)
  • platforms/evoting-api/src/services/VoteService.ts (5 hunks)
  • platforms/evoting-api/src/web3adapter/watchers/subscriber.ts (1 hunks)
  • platforms/group-charter-manager-api/src/web3adapter/watchers/subscriber.ts (0 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/evoting-fixes

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coodos coodos merged commit 38688c1 into main Aug 26, 2025
0 of 4 checks passed
@coodos coodos deleted the chore/evoting-fixes branch August 26, 2025 11:00
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