PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: Migorithm/duva (rust)

Issue:
Bug: client request hangs when first election is made
## Setup
- Node A, B, C.
- At time t0, Node A is the leader.
- Node A goes down.
- A new leader is elected from B or C.
- A client sends a request (e.g., a write) to the new leader.

Here, client request hangs. 

Pull request:
fix: client hang after election
closed #625 

Patch:
diff --git a/duva/src/domains/cluster_actors/consensus/log.rs b/duva/src/domains/cluster_actors/consensus/log.rs
index 5e74fe73..598df712 100644
--- a/duva/src/domains/cluster_actors/consensus/log.rs
+++ b/duva/src/domains/cluster_actors/consensus/log.rs
@@ -38,7 +38,7 @@ impl LogConsensusVoting {
         replica_count: usize,
         session_req: Option<SessionRequest>,
     ) -> Self {
-        Self { callback, cnt: 0, voters: Vec::with_capacity(replica_count), session_req }
+        Self { callback, cnt: 1, voters: Vec::with_capacity(replica_count), session_req }
     }
 
     pub(crate) fn increase_vote(&mut self, voter: PeerIdentifier) {
@@ -47,11 +47,11 @@ impl LogConsensusVoting {
     }
 
     pub(crate) fn get_required_votes(&self) -> u8 {
-        let replica_count = self.voters.capacity() as u8;
-        (replica_count + 1).div_ceil(2)
+        let total_nodes = self.voters.capacity() as u8 + 1;
+        (total_nodes + 1).div_ceil(2)
     }
 
     pub(crate) fn votable(&self, voter: &PeerIdentifier) -> bool {
-        !self.voters.iter().any(|v| v == voter)
+        !self.voters.contains(voter)
     }
 }


Test patch:
diff --git a/duva/src/domains/cluster_actors/actor/tests/replications.rs b/duva/src/domains/cluster_actors/actor/tests/replications.rs
index e7d72dbb..c00257d9 100644
--- a/duva/src/domains/cluster_actors/actor/tests/replications.rs
+++ b/duva/src/domains/cluster_actors/actor/tests/replications.rs
@@ -486,8 +486,7 @@ async fn test_consensus_voting_deleted_when_consensus_reached() {
 
     let (cluster_sender, _) = tokio::sync::mpsc::channel(100);
 
-    // - add followers to create quorum
-
+    // - add 4 followers to create quorum - so 2 votes are needed to reach consensus
     let follower_buffs = (0..4).map(|_| FakeReadWrite::new()).collect::<Vec<_>>();
     cluster_member_create_helper(
         &mut cluster_actor,
@@ -511,12 +510,12 @@ async fn test_consensus_voting_deleted_when_consensus_reached() {
         rej_reason: RejectionReason::None,
         from: PeerIdentifier("".into()),
     };
+    // Leader already has 1 vote, so we only need 1 more votes to reach consensus
     cluster_actor.track_replication_progress(follower_res.clone().set_from("repl1"));
-    cluster_actor.track_replication_progress(follower_res.clone().set_from("repl2"));
 
     // up to this point, tracker hold the consensus
     assert_eq!(cluster_actor.consensus_tracker.len(), 1);
-    assert_eq!(cluster_actor.consensus_tracker.get(&1).unwrap().voters.len(), 2);
+    assert_eq!(cluster_actor.consensus_tracker.get(&1).unwrap().voters.len(), 1);
 
     // ! Majority votes made
     cluster_actor.track_replication_progress(follower_res.set_from("repl3"));
Repository: gleam-lang/tree-sitter-gleam (js)

Issue:
Function name sometimes not highlighted
Hello! I found an instance in which a function name does not get highlighted. It's not clear to me why this is right away

![image](https://user-images.githubusercontent.com/6134406/168885923-5f14bbdb-20e2-425a-91c6-7790d4584f47.png)

https://github.com/gleam-lang/stdlib/blob/f9d57db847ff2a8471c9136bd309c870b610d04d/src/gleam/uri.gleam#L325

Pull request:
use `function` node as a locals scope rather than `function_body`
closes #25

Parameters live outside of the `function_body`, so if you have a function parameter that matches a module name, it will highlight the module as a `@variable.parameter` for the rest of the document instead of just the body of the function. As a fix we can set `function` as a scope instead, so function names, parameters, and body all live under one scope.

Patch:
diff --git a/queries/locals.scm b/queries/locals.scm
index bd5903e..4930057 100644
--- a/queries/locals.scm
+++ b/queries/locals.scm
@@ -1,5 +1,5 @@
 ; Scopes
-(function_body) @local.scope
+(function) @local.scope
 
 (case_clause) @local.scope
 


Test patch:
diff --git a/test/highlight/functions.gleam b/test/highlight/functions.gleam
index 6fe50dc..1080358 100644
--- a/test/highlight/functions.gleam
+++ b/test/highlight/functions.gleam
@@ -68,6 +68,13 @@ fn trial(uri) {
   }
 }
 
+fn my_uri_to_string(my_uri) -> String {
+  uri.to_string(my_uri)
+  // <- module
+  //   ^ function
+  //             ^ variable.parameter
+}
+
 fn myfun(argument) {
   let local_fun = fn(x) { x + 1 }
   //   ^ variable