nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: jhipster/jhipster-lite
Pull request #10941 (2024-09-22 08:04:00)

Add dev command for angular


Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactory.java
index 006a81a4a..c30f68e37 100644
--- a/src/main/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactory.java
@@ -1,8 +1,7 @@
 package tech.jhipster.lite.generator.client.angular.core.domain;
 
 import static tech.jhipster.lite.module.domain.JHipsterModule.*;
-import static tech.jhipster.lite.module.domain.npm.JHLiteNpmVersionSource.ANGULAR;
-import static tech.jhipster.lite.module.domain.npm.JHLiteNpmVersionSource.COMMON;
+import static tech.jhipster.lite.module.domain.npm.JHLiteNpmVersionSource.*;
 
 import tech.jhipster.lite.module.domain.Indentation;
 import tech.jhipster.lite.module.domain.JHipsterModule;
@@ -59,6 +58,8 @@ public class AngularModuleFactory {
         .addDevDependency(packageName("typescript"), ANGULAR)
         .addDevDependency(packageName("typescript-eslint"), COMMON)
         .addDevDependency(packageName("npm-run-all2"), COMMON)
+        .addScript(scriptKey("dev"), scriptCommand("npm-run-all --parallel dev:*"))
+        .addScript(scriptKey("dev:ng"), scriptCommand("ng serve"))
         .addScript(scriptKey("ng"), scriptCommand("ng"))
         .addScript(scriptKey("start"), scriptCommand("ng serve"))
         .addScript(scriptKey("build"), scriptCommand("npm-run-all build:*"))


Test patch:
diff --git a/src/test/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactoryTest.java
index 5a737023a..a9cfb8217 100644
--- a/src/test/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactoryTest.java
@@ -45,6 +45,8 @@ class AngularModuleFactoryTest {
       .containing(nodeDependency("globals"))
       .containing(nodeDependency("typescript-eslint"))
       .containing(nodeDependency("npm-run-all2"))
+      .containing(nodeScript("dev", "npm-run-all --parallel dev:*"))
+      .containing(nodeScript("dev:ng", "ng serve"))
       .containing(nodeScript("ng", "ng"))
       .containing(nodeScript("watch", "npm-run-all --parallel watch:*"))
       .containing(nodeScript("watch:ng", "ng build --watch --configuration development"))
Repository: jhipster/jhipster-lite
Pull request #11101 (2024-10-12 02:03:27)

fix(jqassistant): execute maven plugin on verify phase
That ways jqassistant won't scan the project if there are failing integration tests


Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/server/documentation/jqassistant/domain/JQAssistantModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/server/documentation/jqassistant/domain/JQAssistantModuleFactory.java
index f8d48aa7f..681937d18 100644
--- a/src/main/java/tech/jhipster/lite/generator/server/documentation/jqassistant/domain/JQAssistantModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/server/documentation/jqassistant/domain/JQAssistantModuleFactory.java
@@ -64,7 +64,7 @@ public class JQAssistantModuleFactory {
   private static MavenPlugin jQAssistantPluginManagement() {
     return jQAssistantPluginBuilder()
       .versionSlug("jqassistant")
-      .addExecution(pluginExecution().goals("scan", "analyze").id("default-cli"))
+      .addExecution(pluginExecution().goals("scan", "analyze").phase(VERIFY).id("default-cli"))
       .build();
   }
 


Test patch:
diff --git a/src/test/java/tech/jhipster/lite/generator/server/documentation/jqassistant/domain/JQAssistantModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/server/documentation/jqassistant/domain/JQAssistantModuleFactoryTest.java
index 145e1d538..6952b68db 100644
--- a/src/test/java/tech/jhipster/lite/generator/server/documentation/jqassistant/domain/JQAssistantModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/server/documentation/jqassistant/domain/JQAssistantModuleFactoryTest.java
@@ -42,6 +42,7 @@ class JQAssistantModuleFactoryTest {
                   <executions>
                     <execution>
                       <id>default-cli</id>
+                      <phase>verify</phase>
                       <goals>
                         <goal>scan</goal>
                         <goal>analyze</goal>
Repository: jhipster/jhipster-lite
Pull request #11355 (2024-11-13 20:07:45)

React/ESLint: add @typescript-eslint/consistent-type-imports rule
Related to #11296 


Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java b/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java
index e0ecae086..b29a12265 100644
--- a/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java
@@ -146,6 +146,7 @@ public class ReactCoreModulesFactory {
               \t\t\t'@typescript-eslint/no-explicit-any': 'off',
               \t\t\t'@typescript-eslint/no-unsafe-argument': 'off',
               \t\t\t'@typescript-eslint/await-thenable': 'off',
+              \t\t\t'@typescript-eslint/consistent-type-imports': 'error',
               \t\t\t'@typescript-eslint/no-misused-promises': [
               \t\t\t\t'error',
               \t\t\t\t{


Test patch:
diff --git a/src/test/resources/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.shouldBuildModuleWithStyle.eslint.config.js.approved.txt b/src/test/resources/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.shouldBuildModuleWithStyle.eslint.config.js.approved.txt
index 51b0b8c3a..5897a041c 100644
--- a/src/test/resources/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.shouldBuildModuleWithStyle.eslint.config.js.approved.txt
+++ b/src/test/resources/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.shouldBuildModuleWithStyle.eslint.config.js.approved.txt
@@ -34,6 +34,7 @@ export default typescript.config(
       '@typescript-eslint/no-explicit-any': 'off',
       '@typescript-eslint/no-unsafe-argument': 'off',
       '@typescript-eslint/await-thenable': 'off',
+      '@typescript-eslint/consistent-type-imports': 'error',
       '@typescript-eslint/no-misused-promises': [
         'error',
         {
Repository: jhipster/jhipster-lite
Pull request #11487 (2024-12-02 17:06:58)

React/ESLint: enable @typescript-eslint/no-unsafe-argument


Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java b/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java
index ea66e65ff..9c05f41dc 100644
--- a/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java
@@ -144,7 +144,6 @@ public class ReactCoreModulesFactory {
               """
               \t\t\t'react/react-in-jsx-scope': 'off',
               \t\t\t'@typescript-eslint/no-explicit-any': 'off',
-              \t\t\t'@typescript-eslint/no-unsafe-argument': 'off',
               \t\t\t'@typescript-eslint/await-thenable': 'off',
               \t\t\t'@typescript-eslint/consistent-type-imports': 'error',
               \t\t\t'@typescript-eslint/no-misused-promises': [


Test patch:
diff --git a/src/test/resources/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.shouldBuildModuleWithStyle.eslint.config.js.approved.txt b/src/test/resources/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.shouldBuildModuleWithStyle.eslint.config.js.approved.txt
index 35443b984..8799c402d 100644
--- a/src/test/resources/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.shouldBuildModuleWithStyle.eslint.config.js.approved.txt
+++ b/src/test/resources/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactoryTest.shouldBuildModuleWithStyle.eslint.config.js.approved.txt
@@ -32,7 +32,6 @@ export default typescript.config(
     rules: {
       'react/react-in-jsx-scope': 'off',
       '@typescript-eslint/no-explicit-any': 'off',
-      '@typescript-eslint/no-unsafe-argument': 'off',
       '@typescript-eslint/await-thenable': 'off',
       '@typescript-eslint/consistent-type-imports': 'error',
       '@typescript-eslint/no-misused-promises': [
Repository: jhipster/jhipster-lite
Pull request #11660 (2024-12-29 16:39:43)

Vue/ESLint v-html directive can lead to XSS attack
Fix
![image](https://github.com/user-attachments/assets/2822aac0-8593-4f7d-b0f1-67d6ee79bc50)



Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/client/vue/i18n/domain/VueI18nModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/client/vue/i18n/domain/VueI18nModuleFactory.java
index 0a8f0673d..c2f7a976a 100644
--- a/src/main/java/tech/jhipster/lite/generator/client/vue/i18n/domain/VueI18nModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/client/vue/i18n/domain/VueI18nModuleFactory.java
@@ -62,7 +62,7 @@ public class VueI18nModuleFactory {
         .and()
       .optionalReplacements()
         .in(path(INDEX + "/home/infrastructure/primary/HomepageVue.vue"))
-          .add(lineAfterRegex("Vue 3 \\+ TypeScript \\+ Vite"), properties.indentation().times(2) + "<h2 v-html=\"$t('home.translationEnabled')\"></h2>")
+          .add(lineAfterRegex("Vue 3 \\+ TypeScript \\+ Vite"), properties.indentation().times(2) + "<h2>{{ $t('home.translationEnabled') }}</h2>")
           .and()
         .and()
       .build();


Test patch:
diff --git a/src/test/java/tech/jhipster/lite/generator/client/vue/i18n/domain/VueI18nModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/client/vue/i18n/domain/VueI18nModuleFactoryTest.java
index 2f216cad9..2b39ea0c1 100644
--- a/src/test/java/tech/jhipster/lite/generator/client/vue/i18n/domain/VueI18nModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/client/vue/i18n/domain/VueI18nModuleFactoryTest.java
@@ -40,7 +40,7 @@ class VueI18nModuleFactoryTest {
       .containing("app.use(I18NextVue, { i18next });")
       .and()
       .hasFile("src/main/webapp/app/home/infrastructure/primary/HomepageVue.vue")
-      .containing("<h2 v-html=\"$t('home.translationEnabled')\"></h2>")
+      .containing("<h2>{{ $t('home.translationEnabled') }}</h2>")
       .and()
       .hasFile("src/test/setupTests.ts")
       .and()
Repository: tikv/client-go
Pull request #678 (2023-01-30 07:22:25)

Rewind after region cache GC reaches the end
https://github.com/tikv/client-go/pull/664 was incomplete. The searching cursor increases monotonically without rewinding. So, if the regions split after the cursor passes their start keys, they will not be cleared after being stale.

This PR rewinds the cursor after reaching the end.


Patch:
diff --git a/internal/locate/region_cache.go b/internal/locate/region_cache.go
index ddc659d..7cdc7bb 100644
--- a/internal/locate/region_cache.go
+++ b/internal/locate/region_cache.go
@@ -1924,7 +1924,8 @@ func (c *RegionCache) cacheGC() {
 	ticker := time.NewTicker(cleanCacheInterval)
 	defer ticker.Stop()
 
-	iterItem := newBtreeSearchItem([]byte(""))
+	beginning := newBtreeSearchItem([]byte(""))
+	iterItem := beginning
 	expired := make([]*btreeItem, cleanRegionNumPerRound)
 	for {
 		select {
@@ -1950,6 +1951,11 @@ func (c *RegionCache) cacheGC() {
 			})
 			c.mu.RUnlock()
 
+			// Reach the end of the region cache, start from the beginning
+			if count <= cleanRegionNumPerRound {
+				iterItem = beginning
+			}
+
 			if len(expired) > 0 {
 				c.mu.Lock()
 				for _, item := range expired {


Test patch:
diff --git a/internal/locate/region_cache_test.go b/internal/locate/region_cache_test.go
index 27fbdff..d5b8e79 100644
--- a/internal/locate/region_cache_test.go
+++ b/internal/locate/region_cache_test.go
@@ -1648,8 +1648,8 @@ func (s *testRegionCacheSuite) TestShouldNotRetryFlashback() {
 }
 
 func (s *testRegionCacheSuite) TestBackgroundCacheGC() {
-	// Prepare 50 regions
-	regionCnt := 50
+	// Prepare 100 regions
+	regionCnt := 100
 	regions := s.cluster.AllocIDs(regionCnt)
 	regions = append([]uint64{s.region1}, regions...)
 	peers := [][]uint64{{s.peer1, s.peer2}}
@@ -1679,6 +1679,26 @@ func (s *testRegionCacheSuite) TestBackgroundCacheGC() {
 		s.cache.mu.RLock()
 		defer s.cache.mu.RUnlock()
 		return len(s.cache.mu.regions) == remaining
-	}, 2*time.Second, 200*time.Millisecond)
+	}, 3*time.Second, 200*time.Millisecond)
+	s.checkCache(remaining)
+
+	// Make another part of the regions stale
+	remaining = 0
+	s.cache.mu.Lock()
+	now = time.Now().Unix()
+	for verID, r := range s.cache.mu.regions {
+		if verID.id%3 == 1 {
+			atomic.StoreInt64(&r.lastAccess, now-regionCacheTTLSec-10)
+		} else {
+			remaining++
+		}
+	}
+	s.cache.mu.Unlock()
+
+	s.Eventually(func() bool {
+		s.cache.mu.RLock()
+		defer s.cache.mu.RUnlock()
+		return len(s.cache.mu.regions) == remaining
+	}, 3*time.Second, 200*time.Millisecond)
 	s.checkCache(remaining)
 }
Repository: tikv/client-go
Pull request #679 (2023-01-31 03:31:06)

Cherry pick #678 to tidb-5.4 branch


Patch:
diff --git a/internal/locate/region_cache.go b/internal/locate/region_cache.go
index 457377a..e942d2c 100644
--- a/internal/locate/region_cache.go
+++ b/internal/locate/region_cache.go
@@ -1645,7 +1645,8 @@ func (c *RegionCache) cacheGC() {
 	ticker := time.NewTicker(cleanCacheInterval)
 	defer ticker.Stop()
 
-	iterItem := newBtreeSearchItem([]byte(""))
+	beginning := newBtreeSearchItem([]byte(""))
+	iterItem := beginning
 	expired := make([]*btreeItem, cleanRegionNumPerRound)
 	for {
 		select {
@@ -1672,6 +1673,11 @@ func (c *RegionCache) cacheGC() {
 			})
 			c.mu.RUnlock()
 
+			// Reach the end of the region cache, start from the beginning
+			if count <= cleanRegionNumPerRound {
+				iterItem = beginning
+			}
+
 			if len(expired) > 0 {
 				c.mu.Lock()
 				for _, item := range expired {


Test patch:
diff --git a/internal/locate/region_cache_test.go b/internal/locate/region_cache_test.go
index 6d6f58a..ea697fb 100644
--- a/internal/locate/region_cache_test.go
+++ b/internal/locate/region_cache_test.go
@@ -1444,8 +1444,8 @@ func (s *testRegionCacheSuite) TestNoBackoffWhenFailToDecodeRegion() {
 }
 
 func (s *testRegionCacheSuite) TestBackgroundCacheGC() {
-	// Prepare 50 regions
-	regionCnt := 50
+	// Prepare 100 regions
+	regionCnt := 100
 	regions := s.cluster.AllocIDs(regionCnt)
 	regions = append([]uint64{s.region1}, regions...)
 	peers := [][]uint64{{s.peer1, s.peer2}}
@@ -1475,6 +1475,26 @@ func (s *testRegionCacheSuite) TestBackgroundCacheGC() {
 		s.cache.mu.RLock()
 		defer s.cache.mu.RUnlock()
 		return len(s.cache.mu.regions) == remaining
-	}, 2*time.Second, 200*time.Millisecond)
+	}, 3*time.Second, 200*time.Millisecond)
+	s.checkCache(remaining)
+
+	// Make another part of the regions stale
+	remaining = 0
+	s.cache.mu.Lock()
+	now = time.Now().Unix()
+	for verID, r := range s.cache.mu.regions {
+		if verID.id%3 == 1 {
+			atomic.StoreInt64(&r.lastAccess, now-regionCacheTTLSec-10)
+		} else {
+			remaining++
+		}
+	}
+	s.cache.mu.Unlock()
+
+	s.Eventually(func() bool {
+		s.cache.mu.RLock()
+		defer s.cache.mu.RUnlock()
+		return len(s.cache.mu.regions) == remaining
+	}, 3*time.Second, 200*time.Millisecond)
 	s.checkCache(remaining)
 }
Repository: apollographql/apollo-rs
Pull request #587 (2023-06-20 11:57:26)

chore(compiler): separate `UndefinedDirective` diagnostic
Improve the error message so it doesn't say `"cannot find type @directive"`



Patch:
diff --git a/crates/apollo-compiler/src/diagnostics.rs b/crates/apollo-compiler/src/diagnostics.rs
index e3310e6..945215b 100644
--- a/crates/apollo-compiler/src/diagnostics.rs
+++ b/crates/apollo-compiler/src/diagnostics.rs
@@ -192,6 +192,11 @@ pub enum DiagnosticData {
         /// Name of the type not in scope
         name: String,
     },
+    #[error("cannot find directive `{name}` in this document")]
+    UndefinedDirective {
+        /// Name of the missing directive
+        name: String,
+    },
     #[error("variable `{name}` is not defined")]
     UndefinedVariable {
         /// Name of the variable not in scope
diff --git a/crates/apollo-compiler/src/validation/directive.rs b/crates/apollo-compiler/src/validation/directive.rs
index 79d32f8..fd023e7 100644
--- a/crates/apollo-compiler/src/validation/directive.rs
+++ b/crates/apollo-compiler/src/validation/directive.rs
@@ -295,9 +295,9 @@ pub fn validate_directives(
                 ApolloDiagnostic::new(
                     db,
                     loc.into(),
-                    DiagnosticData::UndefinedDefinition { name: name.into() },
+                    DiagnosticData::UndefinedDirective { name: name.into() },
                 )
-                .label(Label::new(loc, "not found in this scope")),
+                .label(Label::new(loc, "directive not defined")),
             )
         }
     }


Test patch:
diff --git a/crates/apollo-compiler/test_data/diagnostics/0052_undefined_directive.txt b/crates/apollo-compiler/test_data/diagnostics/0052_undefined_directive.txt
index 5ed0b52..a109e83 100644
--- a/crates/apollo-compiler/test_data/diagnostics/0052_undefined_directive.txt
+++ b/crates/apollo-compiler/test_data/diagnostics/0052_undefined_directive.txt
@@ -20,11 +20,11 @@
                     offset: 46,
                     length: 11,
                 },
-                text: "not found in this scope",
+                text: "directive not defined",
             },
         ],
         help: None,
-        data: UndefinedDefinition {
+        data: UndefinedDirective {
             name: "directiveA",
         },
     },