Skip to content

feat: Add configurable pass rule - #710

Closed
mingcheng wants to merge 1 commit into
cncf:mainfrom
mingcheng:feat/add-configurable-passrule
Closed

mingcheng wants to merge 1 commit into
cncf:mainfrom
mingcheng:feat/add-configurable-passrule

Conversation

@mingcheng

Copy link
Copy Markdown

Hello, I am a maintainer from Dragonfly. Considering the diversity of community governance, I adjusted the voting rules of gitvote.

For the compatibility, I added a new passrule rule (see the documentation for details) to both support percentage and vote_count rule. Some code was assisted by Claude Code, and I have reviewed it.

- introduce PassRule enum with Percentage and VoteCount variants
- update validation to reject conflicting or invalid pass rules
- modify results calculation and helpers to support vote count rules
- update documentation, templates and tests for new rules
- preserve legacy pass threshold behavior when pass rule is absent

Signed-off-by: mingcheng <mingcheng@apache.org>
Copilot AI balanced review requested due to automatic review settings October 7, 2026 02:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Configuration presence validation is incomplete, and the unrelated broad lockfile upgrade substantially expands the change scope.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds configurable percentage- and vote-count-based pass rules while retaining legacy threshold compatibility.

Changes:

  • Adds pass-rule parsing, validation, evaluation, and early-close logic.
  • Updates vote and audit templates to display applicable requirements.
  • Adds documentation, fixtures, and tests.
File Description
templates/​vote-status.md Displays configured pass requirements.
templates/​vote-created.md Describes vote-count rules.
templates/​vote-closed.md Shows closing thresholds.
templates/​audit-vote-details.html Shows pass rules in audits.
src/​tmpl/​tests.rs Updates and extends template tests.
src/​tmpl.rs Supplies pass-rule template data.
src/​testutil.rs Updates result fixtures.
src/​testdata/​config.yml Adds a vote-count profile.
src/​results/​tests.rs Tests vote-count evaluation.
src/​results.rs Implements rule evaluation and early closing.
src/​cfg_repo/​tests.rs Tests parsing and validation.
src/​cfg_repo.rs Defines and validates pass rules.
docs/​config/​.gitvote.yml Documents pass-rule configuration.
Cargo.lock Refreshes resolved dependencies.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/cfg_repo.rs
Comment on lines +146 to +147
if self.pass_rule.is_some() && self.pass_threshold != 0.0 {
bail!(ERR_PASS_RULES_MUTUALLY_EXCLUSIVE);
@tegioz

tegioz commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Thanks @mingcheng, but we'd prefer to take care of this ourselves 🙂

Could you open a discussion under Ideas and explain your use case?

Please note that we're trying to keep GitVote as simple as possible, so we don't necessarily add every requested feature. That said, if the community sees value in this voting mode, we'll definitely consider it.

@mingcheng

Copy link
Copy Markdown
Author

Thanks @mingcheng, but we'd prefer to take care of this ourselves 🙂

Could you open a discussion under Ideas and explain your use case?

Please note that we're trying to keep GitVote as simple as possible, so we don't necessarily add every requested feature. That said, if the community sees value in this voting mode, we'll definitely consider it.

Okay, I'll close this pull request first, then create a discussion to explain my experience and thoughts.

@mingcheng mingcheng closed this Oct 7, 2026
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.

3 participants