PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: pmcelhaney/counterfact (ts)
Issue: ContextRegistry not finding closest path context, defaults to root due to Dispatcher bug
With an OpenApi v2 doc with a specific `basePath` the `contextRegistry.find` operation receives a path with the full `basePath` included. Since the contextRegistry entries do not include the basePath in their key it can't find any path-level contexts and defaults to the root context.
Pull request description: fix(server): correct dispatcher request method to use matchedPath
fixes #585 where the dispatcher needs the matchedPath passed to the contextRegistry find method so it does not include the api basePath.

Patch:
diff --git a/.changeset/small-snakes-brush.md b/.changeset/small-snakes-brush.md
new file mode 100644
index 0000000..05f3cbf
--- /dev/null
+++ b/.changeset/small-snakes-brush.md
@@ -0,0 +1,5 @@
+---
+"counterfact": patch
+---
+
+Fixes issue #585 where dispatcher.ts needs to use the matchedPath when calling the contextRegistry.find method
diff --git a/src/server/dispatcher.ts b/src/server/dispatcher.ts
index f954ec6..19d4f07 100644
--- a/src/server/dispatcher.ts
+++ b/src/server/dispatcher.ts
@@ -245,7 +245,7 @@ export class Dispatcher {
       this.parameterTypes(operation?.parameters),
     )({
       body,
-      context: this.contextRegistry.find(path),
+      context: this.contextRegistry.find(matchedPath),
       headers,
 
       proxy: async (url: string) => {


Test patch:
diff --git a/test/server/dispatcher.test.ts b/test/server/dispatcher.test.ts
index 889811c..a0b5277 100644
--- a/test/server/dispatcher.test.ts
+++ b/test/server/dispatcher.test.ts
@@ -509,6 +509,34 @@ describe("a dispatcher", () => {
     expect(result.body).toBe("test context");
   });
 
+  it("passes a context object (not in the root)", async () => {
+    const registry = new Registry();
+    const contextRegistry = new ContextRegistry();
+
+    contextRegistry.add("/", { id: "test context" });
+
+    contextRegistry.add("/echo/{id}", { id: "echo context" });
+    registry.add("/echo/{id}", {
+      GET({ context }) {
+        // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
+        return { body: (context as { id: string }).id };
+      },
+    });
+
+    const dispatcher = new Dispatcher(registry, contextRegistry);
+
+    const result = await dispatcher.request({
+      body: "",
+      headers: {},
+      method: "GET",
+      path: "/echo/1",
+      query: {},
+      req: { path: "/echo/1" },
+    });
+
+    expect(result.body).toBe("echo context");
+  });
+
   it("converts query, path, and header parameters to numbers if necessary", async () => {
     const registry = new Registry();
Repository: mgechev/revive (go)
Issue: `chan struct{}` triggers nested-structs error
**Describe the bug**
`chan struct{}` triggers the nested-structs error.

**Expected behavior**
I expected this use case to be ignored.

**Desktop (please complete the following information):**
 - OS: macOS Monterey
 - Version of Go: 1.19

**Additional context**
I'm presuming this is a false positive bug and there's no idiomatic go way to work around it (apologies if there is and I wasn't aware).

Pull request description: fix #744: `chan struct{}` triggers nested-structs error
Closes #744 


Patch:
diff --git a/rule/nested-structs.go b/rule/nested-structs.go
index b4f7352..968511f 100644
--- a/rule/nested-structs.go
+++ b/rule/nested-structs.go
@@ -43,6 +43,11 @@ func (l *lintNestedStructs) Visit(n ast.Node) ast.Visitor {
 		}
 		return nil
 	case *ast.Field:
+		_, isChannelField := v.Type.(*ast.ChanType)
+		if isChannelField {
+			return nil
+		}
+
 		filter := func(n ast.Node) bool {
 			switch n.(type) {
 			case *ast.StructType:


Test patch:
diff --git a/testdata/nested-structs.go b/testdata/nested-structs.go
index 7e5abaf..8823d65 100644
--- a/testdata/nested-structs.go
+++ b/testdata/nested-structs.go
@@ -35,3 +35,8 @@ func fred() interface{} {
 type Bad struct {
 	Field []struct{} // MATCH /no nested structs are allowed/
 }
+
+// issue744
+type issue744 struct {
+	c chan struct{}
+}