-
Notifications
You must be signed in to change notification settings - Fork 5
Escalation voting improvements #214
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
Draft
vcarl
wants to merge
11
commits into
main
Choose a base branch
from
vc-fix-votes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- simple (default): Early resolution when any option hits quorum (3 votes) - majority: No early resolution; voting stays open until timeout, plurality wins Changes: - Add voting_strategy column to escalations table - Add shouldTriggerEarlyResolution() to check strategy before triggering - Update handlers to set strategy based on escalation level (0=simple, 1+=majority) - Update UI to show strategy-specific status and hide "Require majority" when active - Simplify escalationResolver since both strategies resolve identically on timeout 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Documents Discord API mocking challenges, time-dependent behavior, multi-actor workflows, and proposes solutions including pure logic extraction and time abstraction. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Update test expectations for the new timeout formula: max(0, 36 - 4 * (voteCount - 1)) - 0 votes = 40h (was 24h) - 1 vote = 36h (was 16h) - 2 votes = 32h (was 8h) - 3 votes = 28h (was 0h) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
All these were implicitly testing the same voting logic, but with various layers of indirection in pulling out the output. Not helpful, not worth keeping
Replace dynamic timeout calculation on every poll with a stored scheduled_for timestamp. The column is updated whenever votes change, making the resolver query a simple indexed lookup instead of requiring vote tallies for every pending escalation. - Add migration with backfill for existing pending escalations - Add calculateScheduledFor, updateScheduledFor, getDueEscalations - Update vote/escalate handlers to persist new scheduled time - Simplify resolver to query due escalations directly 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Simplify function signatures by passing the escalation object instead of individual fields. This makes the code cleaner and allows direct use of scheduled_for for Discord timestamps instead of recalculating. - buildVoteMessageContent now takes (modRoleId, escalation, tally, votingStrategy) - buildConfirmedMessageContent now takes (escalation, resolution, tally) - Update all call sites in handlers.ts - Update tests with mock escalation helper 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add getDisabledButtons helper to disable vote buttons on resolution - Handle edge case where user left server or deleted account - Forward resolution notices to mod log channel - Clean up resolution message format with consistent timestamp display 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
36hr - (4vote * 4hr)=20hr