nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: denoland/deno_core
Pull request #696 (2024-04-12 03:47:45)

Fix extension! parameters with `const fn` decl
Added a test which compiles


Patch:
diff --git a/core/extensions.rs b/core/extensions.rs
index 308eeb6..40270b4 100644
--- a/core/extensions.rs
+++ b/core/extensions.rs
@@ -450,10 +450,9 @@ macro_rules! extension {
             const V: ::std::option::Option<&'static ::std::primitive::str> = $crate::or!($(::std::option::Option::Some($esm_entry_point))?, ::std::option::Option::None);
             V
           },
-          ops: ::std::borrow::Cow::Borrowed(&[$($({
+          ops: ::std::borrow::Cow::Owned(vec![$($({
             $( #[ $m ] )*
-            const DECL: $crate::OpDecl =  $( $op )::+ $( :: < $($op_param),* > )? ();
-            DECL
+            $( $op )::+ $( :: < $($op_param),* > )? ()
           }),+)?]),
           external_references: ::std::borrow::Cow::Borrowed(&[ $( $external_reference ),* ]),
           global_template_middleware: ::std::option::Option::None,


Test patch:
diff --git a/testing/checkin/runner/mod.rs b/testing/checkin/runner/mod.rs
index f144a54..83c9fa7 100644
--- a/testing/checkin/runner/mod.rs
+++ b/testing/checkin/runner/mod.rs
@@ -36,8 +36,13 @@ mod ops_worker;
 mod testing;
 mod ts_module_loader;
 
+trait SomeType {}
+
+impl SomeType for () {}
+
 deno_core::extension!(
   checkin_runtime,
+  parameters = [P: SomeType],
   ops = [
     ops::op_log_debug,
     ops::op_log_info,
@@ -46,6 +51,7 @@ deno_core::extension!(
     ops::op_stats_diff,
     ops::op_stats_dump,
     ops::op_stats_delete,
+    ops::op_nop_generic<P>,
     ops_io::op_pipe_create,
     ops_io::op_file_open,
     ops_async::op_async_yield,
@@ -93,7 +99,7 @@ fn create_runtime(
   parent: Option<WorkerCloseWatcher>,
 ) -> (JsRuntime, WorkerHostSide) {
   let (worker, worker_host_side) = worker_create(parent);
-  let extensions_for_snapshot = vec![checkin_runtime::init_ops_and_esm()];
+  let extensions_for_snapshot = vec![checkin_runtime::init_ops_and_esm::<()>()];
 
   let runtime_for_snapshot = JsRuntimeForSnapshot::new(RuntimeOptions {
     extensions: extensions_for_snapshot,
@@ -105,7 +111,7 @@ fn create_runtime(
 
   let snapshot = runtime_for_snapshot.snapshot();
   let snapshot = Box::leak(snapshot);
-  let extensions = vec![checkin_runtime::init_ops()];
+  let extensions = vec![checkin_runtime::init_ops::<()>()];
   let module_loader =
     Rc::new(ts_module_loader::TypescriptModuleLoader::default());
   let mut runtime = JsRuntime::new(RuntimeOptions {
diff --git a/testing/checkin/runner/ops.rs b/testing/checkin/runner/ops.rs
index c2aae63..ec0e220 100644
--- a/testing/checkin/runner/ops.rs
+++ b/testing/checkin/runner/ops.rs
@@ -15,6 +15,7 @@ use deno_core::OpState;
 use super::testing::Output;
 use super::testing::TestData;
 use super::testing::TestFunctions;
+use super::SomeType;
 
 #[op2(fast)]
 pub fn op_log_debug(#[string] s: &str) {
@@ -106,3 +107,8 @@ impl Stateful {
 #[allow(dead_code)]
 const STATEFUL_DECL: [OpDecl; 3] =
   [Stateful::get_name(), Stateful::len(), Stateful::delay()];
+
+#[op2(fast)]
+pub fn op_nop_generic<T: SomeType + 'static>(state: &mut OpState) {
+  state.take::<T>();
+}
Repository: denoland/deno_core
Pull request #750 (2024-05-22 22:14:10)

fix(core): remove assert flag


Patch:
diff --git a/core/runtime/setup.rs b/core/runtime/setup.rs
index 460d7a0..de3a68a 100644
--- a/core/runtime/setup.rs
+++ b/core/runtime/setup.rs
@@ -22,7 +22,6 @@ fn v8_init(
   }
 
   let base_flags = concat!(
-    " --harmony-import-assertions",
     " --wasm-test-streaming",
     " --no-validate-asm",
     " --turbo_fast_api_calls",


Test patch:
diff --git a/core/modules/tests.rs b/core/modules/tests.rs
index 71a319b..f02f4b0 100644
--- a/core/modules/tests.rs
+++ b/core/modules/tests.rs
@@ -504,35 +504,9 @@ fn test_json_module() {
 
   let module_map = runtime.module_map().clone();
 
-  let (mod_a, mod_b, mod_c) = {
+  let (mod_b, mod_c) = {
     let scope = &mut runtime.handle_scope();
-    let specifier_a = ascii_str!("file:///a.js");
     let specifier_b = ascii_str!("file:///b.js");
-    let mod_a = module_map
-      .new_es_module(
-        scope,
-        true,
-        specifier_a,
-        ascii_str!(
-          r#"
-          import jsonData from './c.json' assert {type: "json"};
-          assert(jsonData.a == "b");
-          assert(jsonData.c.d == 10);
-        "#
-        ),
-        false,
-        None,
-      )
-      .unwrap();
-
-    let imports = module_map.get_requested_modules(mod_a);
-    assert_eq!(
-      imports,
-      Some(vec![ModuleRequest {
-        specifier: ModuleSpecifier::parse("file:///c.json").unwrap(),
-        requested_module_type: RequestedModuleType::Json,
-      },])
-    );
 
     let mod_b = module_map
       .new_es_module(
@@ -569,18 +543,11 @@ fn test_json_module() {
       .unwrap();
     let imports = module_map.get_requested_modules(mod_c).unwrap();
     assert_eq!(imports.len(), 0);
-    (mod_a, mod_b, mod_c)
+    (mod_b, mod_c)
   };
 
   runtime.instantiate_module(mod_c).unwrap();
-  assert_eq!(loader.counts(), ModuleLoadEventCounts::new(2, 0, 0));
-
-  runtime.instantiate_module(mod_a).unwrap();
-
-  let receiver = runtime.mod_evaluate(mod_a);
-  futures::executor::block_on(runtime.run_event_loop(Default::default()))
-    .unwrap();
-  futures::executor::block_on(receiver).unwrap();
+  assert_eq!(loader.counts(), ModuleLoadEventCounts::new(1, 0, 0));
 
   runtime.instantiate_module(mod_b).unwrap();
Repository: nukosuke/go-zendesk
Pull request #268 (2023-03-01 23:44:56)

Add support for ticket comment attachment redaction
addresses #267 


Patch:
diff --git a/fixture/PUT/redact_ticket_comment_attachment.json b/fixture/PUT/redact_ticket_comment_attachment.json
new file mode 100644
index 0000000..d277ba6
--- /dev/null
+++ b/fixture/PUT/redact_ticket_comment_attachment.json
@@ -0,0 +1,11 @@
+{
+  "attachment": {
+    "content_type": "application/binary",
+    "content_url": "https://company.zendesk.com/attachments/myfile.dat",
+    "file_name": "myfile.dat",
+    "id": 498483,
+    "size": 2532,
+    "thumbnails": [],
+    "url": "https://company.zendesk.com/api/v2/attachments/498483.json"
+  }
+}
diff --git a/zendesk/attachment.go b/zendesk/attachment.go
index 6166a45..11cdb68 100644
--- a/zendesk/attachment.go
+++ b/zendesk/attachment.go
@@ -196,3 +196,11 @@ func (z *Client) GetAttachment(ctx context.Context, id int64) (Attachment, error
 
 	return result.Attachment, nil
 }
+
+// RedactCommentAttachment deletes an attachment with attachmentID on comment with commentID for ticket with ticketID
+// https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-attachments/#redact-comment-attachment
+func (z *Client) RedactCommentAttachment(ctx context.Context, ticketID, commentID, attachmentID int64) error {
+	path := fmt.Sprintf("/api/v2/tickets/%d/comments/%d/attachments/%d/redact", ticketID, commentID, attachmentID)
+	_, err := z.put(ctx, path, nil)
+	return err
+}


Test patch:
diff --git a/zendesk/attachment_test.go b/zendesk/attachment_test.go
index ddd60a0..3d6199b 100644
--- a/zendesk/attachment_test.go
+++ b/zendesk/attachment_test.go
@@ -118,3 +118,15 @@ func TestGetAttachment(t *testing.T) {
 		t.Fatalf("Returned attachment does not have the expected ID %d. Attachment id is %d", expectedID, attachment.ID)
 	}
 }
+
+func TestRedactCommentAttachment(t *testing.T) {
+	mockAPI := newMockAPI(http.MethodPut, "redact_ticket_comment_attachment.json")
+	client := newTestClient(mockAPI)
+	defer mockAPI.Close()
+
+	err := client.RedactCommentAttachment(ctx, 123, 456, 789)
+
+	if err != nil {
+		t.Fatalf("Failed to redact ticket comment attachment: %s", err)
+	}
+}