PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: Behat/Gherkin (php)

Issue:
Background should not be allowed after the first Scenario
We currently parse the Background and Scenario out of a file like this:

```
Feature: Whatever

   Scenario: Something
     Then I should fail

   Background:
     Given I am in the wrong sequence
```

However, cucumber/gherkin will report this as a parse error, because it does not allow Background nodes after the first Scenario.

There is not yet any testdata for this case, either here or upstream.

See #323 

Pull request:
change: Throw ParserException if Background comes after first Scenario
Gherkin requires that any Feature `Background:` must come before the first Scenario / Scenario Outline in a file (to match the execution order of these steps).

We were previously allowing the background to appear anywhere at the top (Feature) level of the file. This will now throw a ParserException.

Although this could theoretically cause existing features to break, I do not consider it to be a BC break - we are now just being stricter that the input matches the expected schema.

Fixes #328

Patch:
diff --git a/src/Parser.php b/src/Parser.php
index f3361f2..befdc6b 100644
--- a/src/Parser.php
+++ b/src/Parser.php
@@ -224,7 +224,9 @@ class Parser
                 continue;
             }
 
-            if (!$background && $node instanceof BackgroundNode) {
+            $isBackgroundAllowed = ($background === null && $scenarios === []);
+
+            if ($isBackgroundAllowed && $node instanceof BackgroundNode) {
                 $background = $node;
                 continue;
             }
@@ -235,7 +237,7 @@ class Parser
             }
 
             throw new UnexpectedParserNodeException(
-                match ($background === null && $scenarios === []) {
+                match ($isBackgroundAllowed) {
                     true => 'Background, Scenario or Outline',
                     false => 'Scenario or Outline',
                 },


Test patch:
diff --git a/tests/Cucumber/extra_testdata/bad/background_after_scenario.feature b/tests/Cucumber/extra_testdata/bad/background_after_scenario.feature
new file mode 100644
index 0000000..c57e1a3
--- /dev/null
+++ b/tests/Cucumber/extra_testdata/bad/background_after_scenario.feature
@@ -0,0 +1,7 @@
+Feature: Feature background cannot come after first scenario
+
+    Scenario:
+        Then I should fail
+
+    Background:
+        Given I am in the wrong sequence
diff --git a/tests/Cucumber/extra_testdata/bad/background_after_scenario.feature.errors.ndjson b/tests/Cucumber/extra_testdata/bad/background_after_scenario.feature.errors.ndjson
new file mode 100644
index 0000000..7c0ee49
--- /dev/null
+++ b/tests/Cucumber/extra_testdata/bad/background_after_scenario.feature.errors.ndjson
@@ -0,0 +1,1 @@
+{"parseError":{"message":"(6:5): expected: #EOF, #TableRow, #DocStringSeparator, #StepLine, #TagLine, #ExamplesLine, #ScenarioLine, #RuleLine, #Comment, #Empty, got 'Background:'","source":{"location":{"column":5,"line":6},"uri":"../bad/background_after_scenario.feature"}}}
Repository: wilkerlucio/pathom (clojure)

Issue:
env should contain full query/tx
My use case would be sending out the full query in case of a `::p/process-error` invocation.

Pull request:
Closes #118

Patch:
diff --git a/src/com/wsscode/pathom/core.cljc b/src/com/wsscode/pathom/core.cljc
index 7ebcebad..ceba3847 100644
--- a/src/com/wsscode/pathom/core.cljc
+++ b/src/com/wsscode/pathom/core.cljc
@@ -978,7 +978,8 @@
            ::request-cache     (atom {})
            ::entity-key        ::entity
            ::entity-path-cache (atom {})
-           ::parent-query      tx}
+           ::parent-query      tx
+           ::root-query        tx}
           env
           {::plugin-actions (group-plugins-by-action plugins)
            ::plugins        plugins


Test patch:
diff --git a/test/com/wsscode/pathom/connect_test.cljc b/test/com/wsscode/pathom/connect_test.cljc
index d9202d65..a02c8f77 100644
--- a/test/com/wsscode/pathom/connect_test.cljc
+++ b/test/com/wsscode/pathom/connect_test.cljc
@@ -3207,6 +3207,19 @@
 
 #?(:clj
    (deftest test-parallel-parser-with-connect
+     (testing "using root-query"
+       (is (= (quick-parser {::pc/register [(pc/resolver 'base
+                                              {::pc/output [{:base [{:deep [:data]}]}]}
+                                              (fn [env _]
+                                                {:base {:deep {:data "value"}}}))
+
+                                            (pc/resolver 'root-query
+                                              {::pc/output [:root-query]}
+                                              (fn [{::p/keys [root-query]} _]
+                                                {:root-query root-query}))]}
+                '[{:base [{:deep [:root-query]}]}])
+              {:base {:deep {:root-query [{:base [{:deep [:root-query]}]}]}}})))
+
      (testing "parallel mutation join with environment override"
        (is (= (quick-parser {::pc/register [(pc/resolver 'token-value
                                               {::pc/output [:nada
Repository: yegor256/cactoos (java)

Issue:
missing analog to get substring from the end of the line
Function in commons-lang3 for StringUtils.substring can be called with negative start value to get tail from the string 
 
https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#substring-java.lang.String-int-int-

Pull request:
Feat: add support for negative value to get tail from the string
Closes #1717

@yegor256 please review and consider merging it, thanks!

Patch:
diff --git a/src/main/java/org/cactoos/text/Sub.java b/src/main/java/org/cactoos/text/Sub.java
index 6378501c..c0743e02 100644
--- a/src/main/java/org/cactoos/text/Sub.java
+++ b/src/main/java/org/cactoos/text/Sub.java
@@ -148,13 +148,22 @@ public final class Sub extends TextEnvelope {
             new Mapped(
                 origin -> {
                     int begin = start.apply(origin);
+                    if (begin < 0) {
+                        begin = origin.length() + begin;
+                    }
                     if (begin < 0) {
                         begin = 0;
                     }
                     int finish = end.apply(origin);
-                    if (origin.length() < finish) {
+                    if (finish < 0) {
+                        finish = origin.length() + finish;
+                    }
+                    if (finish > origin.length()) {
                         finish = origin.length();
                     }
+                    if (finish < 0) {
+                        finish = 0;
+                    }
                     return origin.substring(begin, finish);
                 },
                 text


Test patch:
diff --git a/src/test/java/org/cactoos/text/SubTest.java b/src/test/java/org/cactoos/text/SubTest.java
index a6a139d5..07c6d751 100644
--- a/src/test/java/org/cactoos/text/SubTest.java
+++ b/src/test/java/org/cactoos/text/SubTest.java
@@ -67,4 +67,31 @@ final class SubTest {
         ).affirm();
     }
 
+    @Test
+    void cutTextWithNegativeStart() {
+        new Assertion<>(
+            "Can't cut text with negative start",
+            new Sub("hello world", -5),
+            new HasString("world")
+        ).affirm();
+    }
+
+    @Test
+    void cutTextWithNegativeStartAndEnd() {
+        new Assertion<>(
+            "Can't cut text with negative start and positive end",
+            new Sub("hello world", -5, 8),
+            new HasString("wo")
+        ).affirm();
+    }
+
+    @Test
+    void cutTextWithNegativeStartAndNegativeEnd() {
+        new Assertion<>(
+            "Can't cut text with negative start and negative end",
+            new Sub("hello world", -5, -2),
+            new HasString("wor")
+        ).affirm();
+    }
+
 }