nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: liamg/tfsec
Pull request #160 (2020-09-14 06:00:35)

CloudFront recommended Security Policy version is TLSv1.2_2019
AWS recommends CloudFront security policy version **TLSv1.2_2019**.

![image](https://user-images.githubusercontent.com/8839280/93048878-d492ac00-f69a-11ea-81c5-538bc8592ace.png)

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/secure-connections-supported-viewer-protocols-ciphers.html

P.S. Thank you for your great tool!

P.S. I found another PR https://github.com/liamg/tfsec/pull/153 after creating this PR, but I am also modifying the test code, so please review it once.

Resolves https://github.com/liamg/tfsec/issues/152


Patch:
diff --git a/internal/app/tfsec/checks/aws_cloudfront_outdated_protocol.go b/internal/app/tfsec/checks/aws_cloudfront_outdated_protocol.go
index b725c559b..d57514a31 100644
--- a/internal/app/tfsec/checks/aws_cloudfront_outdated_protocol.go
+++ b/internal/app/tfsec/checks/aws_cloudfront_outdated_protocol.go
@@ -36,10 +36,10 @@ func init() {
 						scanner.SeverityError,
 					),
 				}
-			} else if minVersion.Type() == cty.String && minVersion.Value().AsString() != "TLSv1.2_2018" {
+			} else if minVersion.Type() == cty.String && minVersion.Value().AsString() != "TLSv1.2_2019" {
 				return []scanner.Result{
 					check.NewResult(
-						fmt.Sprintf("Resource '%s' defines outdated SSL/TLS policies (not using TLSv1.2_2018)", block.Name()),
+						fmt.Sprintf("Resource '%s' defines outdated SSL/TLS policies (not using TLSv1.2_2019)", block.Name()),
 						minVersion.Range(),
 						scanner.SeverityError,
 					),


Test patch:
diff --git a/internal/app/tfsec/aws_cloudfront_outdated_protocol_test.go b/internal/app/tfsec/aws_cloudfront_outdated_protocol_test.go
index ebd58c7a8..7dca6c608 100644
--- a/internal/app/tfsec/aws_cloudfront_outdated_protocol_test.go
+++ b/internal/app/tfsec/aws_cloudfront_outdated_protocol_test.go
@@ -32,12 +32,12 @@ resource "aws_cloudfront_distribution" "s3_distribution" {
 			mustIncludeResultCode: checks.AWSCloudFrontOutdatedProtocol,
 		},
 		{
-			name: "check TLSv1.2_2018 not used",
+			name: "check TLSv1.2_2019 not used",
 			source: `
 resource "aws_cloudfront_distribution" "s3_distribution" {
   viewer_certificate {
     cloudfront_default_certificate = true
-	minimum_protocol_version = "TLSv1.1_2016"
+	minimum_protocol_version = "TLSv1.2_2018"
   }
 }`,
 			mustIncludeResultCode: checks.AWSCloudFrontOutdatedProtocol,
Repository: PrismJS/prism
Pull request #3473 (2022-06-14 02:19:16)

hoon: process escaped strings correctly
As per urbit/urbit.org#770, this PR changes the string regex to handle escaped tapes (that is, "lists of strings") and strings (or "cords") correctly.

github-actions[bot]: 
<!--
  0 failure: 
  0 warning: 
  
  1 markdown notices
  DangerID: danger-id-Danger;
-->



## JS File Size Changes (gzipped)

A total of 1 files have changed, with a combined diff of +6 B (+1.9%).

<details>

| file | master | pull | size diff | % diff |
| --- | --- | --- | --- | --- |
| components/prism-hoon.min.js | 316 B | 322 B | +6 B | +1.9% |

</details>

<p align="right">
  Generated by :no_entry_sign: <a href="https://danger.systems/js">dangerJS</a> against 65342058809afe9dcf5f91be51a2291c26d9f80c
</p>


Patch:
diff --git a/components/prism-hoon.js b/components/prism-hoon.js
index 400a1bd2..57d1dd70 100644
--- a/components/prism-hoon.js
+++ b/components/prism-hoon.js
@@ -4,7 +4,7 @@ Prism.languages.hoon = {
 		greedy: true
 	},
 	'string': {
-		pattern: /"[^"]*"|'[^']*'/,
+		pattern: /"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/,
 		greedy: true
 	},
 	'constant': /%(?:\.[ny]|[\w-]+)/,
diff --git a/components/prism-hoon.min.js b/components/prism-hoon.min.js
index 168915a4..7ffbe148 100644
--- a/components/prism-hoon.min.js
+++ b/components/prism-hoon.min.js
@@ -1,1 +1,1 @@
-Prism.languages.hoon={comment:{pattern:/::.*/,greedy:!0},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},constant:/%(?:\.[ny]|[\w-]+)/,"class-name":/@(?:[a-z0-9-]*[a-z0-9])?|\*/i,function:/(?:\+[-+] {2})?(?:[a-z](?:[a-z0-9-]*[a-z0-9])?)/,keyword:/\.[\^\+\*=\?]|![><:\.=\?!]|=[>|:,\.\-\^<+;/~\*\?]|\?[>|:\.\-\^<\+&~=@!]|\|[\$_%:\.\-\^~\*=@\?]|\+[|\$\+\*]|:[_\-\^\+~\*]|%[_:\.\-\^\+~\*=]|\^[|:\.\-\+&~\*=\?]|\$[|_%:<>\-\^&~@=\?]|;[:<\+;\/~\*=]|~[>|\$_%<\+\/&=\?!]|--|==/};
\ No newline at end of file
+Prism.languages.hoon={comment:{pattern:/::.*/,greedy:!0},string:{pattern:/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/,greedy:!0},constant:/%(?:\.[ny]|[\w-]+)/,"class-name":/@(?:[a-z0-9-]*[a-z0-9])?|\*/i,function:/(?:\+[-+] {2})?(?:[a-z](?:[a-z0-9-]*[a-z0-9])?)/,keyword:/\.[\^\+\*=\?]|![><:\.=\?!]|=[>|:,\.\-\^<+;/~\*\?]|\?[>|:\.\-\^<\+&~=@!]|\|[\$_%:\.\-\^~\*=@\?]|\+[|\$\+\*]|:[_\-\^\+~\*]|%[_:\.\-\^\+~\*=]|\^[|:\.\-\+&~\*=\?]|\$[|_%:<>\-\^&~@=\?]|;[:<\+;\/~\*=]|~[>|\$_%<\+\/&=\?!]|--|==/};
\ No newline at end of file


Test patch:
diff --git a/tests/languages/hoon/strings_with_escapes.test b/tests/languages/hoon/strings_with_escapes.test
new file mode 100644
index 00000000..5691f4f3
--- /dev/null
+++ b/tests/languages/hoon/strings_with_escapes.test
@@ -0,0 +1,7 @@
+"blah\"blah"
+
+----------------------------------------------------
+
+[
+	["string", "\"blah\\\"blah\""]
+]
Repository: FormidableLabs/urql
Pull request #927 (2020-07-29 11:46:45)

(graphcahce) - fix resolver types
<!--
  Thanks for opening a pull request! We appreciate your dedication and help!
  Before submitting your pull request, please make sure to read our CONTRIBUTING guide.

  The best contribution is always a PR! However, if you're starting to work on a large
  change, it's best to make sure to open an issue first.

  If this PR is already related to an issue, please reference it like so:
  Resolves #123
-->

## Summary

Fixes: https://github.com/FormidableLabs/urql/issues/926

## Set of changes

- adds an object return possibility


changeset-bot[bot]: ###  🦋  Changeset is good to go

Latest commit: c8f2654556c2026f4b9068c043fa31411b24b7c8

**We got this.**

<details><summary>This PR includes changesets to release 1 package</summary>

  | Name                      | Type  |
| ------------------------- | ----- |
| @urql/exchange-graphcache | Patch |

</details>

Not sure what this means? [Click here  to learn what changesets are](https://github.com/changesets/changesets/blob/master/docs/adding-a-changeset.md).

[Click here if you're a maintainer who wants to add another changeset to this PR](https://github.com/FormidableLabs/urql/new/fix-graphcache-resolver-typings?filename=.changeset/short-llamas-scream.md&value=---%0A%22%40urql%2Fexchange-graphcache%22%3A%20patch%0A---%0A%0A(graphcahce)%20-%20fix%20resolver%20types%0A)



Patch:
diff --git a/.changeset/hungry-cycles-kiss.md b/.changeset/hungry-cycles-kiss.md
new file mode 100644
index 00000000..2a7d1f61
--- /dev/null
+++ b/.changeset/hungry-cycles-kiss.md
@@ -0,0 +1,5 @@
+---
+'@urql/exchange-graphcache': patch
+---
+
+Fix return type for resolvers to allow data objects to be returned with `__typename` as expected
diff --git a/exchanges/graphcache/src/types.ts b/exchanges/graphcache/src/types.ts
index 2030d7a3..4aa3c52f 100644
--- a/exchanges/graphcache/src/types.ts
+++ b/exchanges/graphcache/src/types.ts
@@ -122,13 +122,19 @@ export interface Cache {
   ): void;
 }
 
+type ResolverResult =
+  | DataField
+  | (DataFields & { __typename?: string })
+  | null
+  | undefined;
+
 // Cache resolvers are user-defined to overwrite an entity field result
 export type Resolver = (
   parent: Data,
   args: Variables,
   cache: Cache,
   info: ResolveInfo
-) => DataField | undefined;
+) => ResolverResult;
 
 export interface ResolverConfig {
   [typeName: string]: {


Test patch:
diff --git a/exchanges/graphcache/src/cacheExchange.test.ts b/exchanges/graphcache/src/cacheExchange.test.ts
index 793591aa..e791f717 100644
--- a/exchanges/graphcache/src/cacheExchange.test.ts
+++ b/exchanges/graphcache/src/cacheExchange.test.ts
@@ -1264,6 +1264,10 @@ describe('custom resolvers', () => {
     pipe(
       cacheExchange({
         resolvers: {
+          Query: {
+            // TS-check
+            author: (_parent, args) => ({ __typename: 'Author', id: args.id }),
+          },
           Author: {
             name: parent => {
               called.push(parent.name);
Repository: tweag/nickel
Pull request #238 (2020-12-04 09:49:13)

[Syntax]Support line comments
Related to #207. Support for line comments using `//`: `1 + 1 // This is a number`.


Patch:
diff --git a/src/parser/lexer.rs b/src/parser/lexer.rs
index ca098a79..6c6c110e 100644
--- a/src/parser/lexer.rs
+++ b/src/parser/lexer.rs
@@ -234,6 +234,8 @@ pub enum NormalToken<'input> {
     RAngleBracket,
     #[token(">=")]
     GreaterOrEq,
+    #[regex("//[^\n]*")]
+    LineComment,
 }
 
 /// The tokens in string mode.
@@ -542,6 +544,8 @@ impl<'input> Iterator for Lexer<'input> {
             | Some(MultiStr(MultiStringToken::Error)) => {
                 return Some(Err(LexicalError::Generic(span.start, span.end)))
             }
+            // Ignore comment
+            Some(Normal(NormalToken::LineComment)) => return self.next(),
             _ => (),
         }
 


Test patch:
diff --git a/src/parser/tests.rs b/src/parser/tests.rs
index 6bcb6a40..9cc73e8c 100644
--- a/src/parser/tests.rs
+++ b/src/parser/tests.rs
@@ -294,3 +294,19 @@ fn multiline_str_escape() {
         mk_single_chunk("#Hel##{lo###{"),
     );
 }
+
+#[test]
+fn line_comments() {
+    assert_eq!(
+        parse_without_pos("// 1 +\n1 + 1// + 3\n//+ 2"),
+        parse_without_pos("1 + 1")
+    );
+    assert_eq!(
+        parse_without_pos(
+            "{ // Some comment
+            field = foo; // Some description
+            } // Some other"
+        ),
+        parse_without_pos("{field = foo}")
+    );
+}
Repository: tweag/nickel
Pull request #444 (2021-11-05 10:21:16)

Do not require parenthesis for applying contracts stored in records 
Records are used as modules to regroup functions, values and contracts (as e.g. stdlib modules `strings`, `lists`, and so on). Hence we often use a record field as a contract, but anything else than an atom (variable and constants) currently requires parentheses, that is we have to write `let list | #(lists.NonEmpty) = [1, 2]`.

This is neither aesthetically pleasant nor justified, so this PR allows any record operation sequence (basically any sequence of field access like `foo.bar.baz`) to appear as a custom contract after a `#` without parentheses. We can now write `let list | #lists.NonEmpty = [1, 2]`.


Patch:
diff --git a/examples/record-contract/record-contract.ncl b/examples/record-contract/record-contract.ncl
index 1e894fe2..89276472 100644
--- a/examples/record-contract/record-contract.ncl
+++ b/examples/record-contract/record-contract.ncl
@@ -38,7 +38,7 @@ let KubernetesConfig = {
   },
 
   spec = {
-    replicas | #(nums.PosNat)
+    replicas | #nums.PosNat
              | doc "The number of replicas"
              | default = 1,
 
diff --git a/src/grammar.lalrpop b/src/grammar.lalrpop
index ea63430a..17fb169e 100644
--- a/src/grammar.lalrpop
+++ b/src/grammar.lalrpop
@@ -482,7 +482,7 @@ subType : Types = {
         Types(AbsType::List(ty))
     },
     <Ident> => Types(AbsType::Var(<>)),
-    "#" <WithPos<Atom>> => Types(AbsType::Flat(<>)),
+    "#" <WithPos<RecordOperand>> => Types(AbsType::Flat(<>)),
     "(" <Types> ")",
     "<" <rows:(<Ident> ",")*> <last: (<Ident>)?> <tail: ("|" <Ident>)?> ">" => {
         let ty = rows.into_iter()


Test patch:
diff --git a/tests/pass/serialize-package.ncl b/tests/pass/serialize-package.ncl
index f12ffcec..1c5b2e7d 100644
--- a/tests/pass/serialize-package.ncl
+++ b/tests/pass/serialize-package.ncl
@@ -57,7 +57,7 @@ builtins.serialize `Json (
   {
     name = "nickel",
     buildInputs = [{package = "hello"}],
-  } | #(ctr.Shell)
+  } | #ctr.Shell
 ) == builtins.serialize `Json {
   name = "nickel",
   buildInputs = [{input = "nixpkgs", package = "hello", "_type" = "package"}],
Repository: go-delve/delve
Pull request #2810 (2021-11-29 21:36:42)

service/dap: move presentationHint to frame from source
This change visually indicates which frames are runtime code using frame.presentationHint. This removes "deemphasize" from the source presentation hint. "deemphasize" indicated that the source should be skipped in stepping, causing the frames to be collapsed. This was inconvenient for users if they wanted to inspect the runtime code that they were stepping through.

Updates golang/vscode-go#1916


suzmue: Before:
<img width="1333" alt="Screen Shot 2021-11-29 at 12 00 26 PM" src="https://user-images.githubusercontent.com/6634754/143946298-bf14214e-d734-4f7e-9dab-df1957406639.png">
After:
<img width="726" alt="Screen Shot 2021-11-29 at 4 33 10 PM" src="https://user-images.githubusercontent.com/6634754/143946350-08222521-fe33-4c9f-9ec3-eb1600ec000c.png">
<img width="898" alt="Screen Shot 2021-11-29 at 4 33 13 PM" src="https://user-images.githubusercontent.com/6634754/143946375-cc9dd7af-30bd-4e59-8c03-79458e7c0ec4.png">


Patch:
diff --git a/service/dap/server.go b/service/dap/server.go
index 3db64834..6c86ad02 100644
--- a/service/dap/server.go
+++ b/service/dap/server.go
@@ -1991,7 +1991,7 @@ func (s *Session) onStackTraceRequest(request *dap.StackTraceRequest) {
 
 		packageName := fnPackageName(loc)
 		if !isSystemGoroutine && packageName == "runtime" {
-			stackFrame.Source.PresentationHint = "deemphasize"
+			stackFrame.PresentationHint = "subtle"
 		}
 		stackFrames = append(stackFrames, stackFrame)
 	}


Test patch:
diff --git a/service/dap/server_test.go b/service/dap/server_test.go
index a4a0a60d..de7e1066 100644
--- a/service/dap/server_test.go
+++ b/service/dap/server_test.go
@@ -4786,8 +4786,8 @@ func TestPanicBreakpointOnContinue(t *testing.T) {
 					st := client.ExpectStackTraceResponse(t)
 					for i, frame := range st.Body.StackFrames {
 						if strings.HasPrefix(frame.Name, "runtime.") {
-							if frame.Source.PresentationHint != "deemphasize" {
-								t.Errorf("\ngot Body.StackFrames[%d]=%#v\nwant Source.PresentationHint=\"deemphasize\"", i, frame)
+							if frame.PresentationHint != "subtle" {
+								t.Errorf("\ngot Body.StackFrames[%d]=%#v\nwant Source.PresentationHint=\"subtle\"", i, frame)
 							}
 						} else if frame.Source.PresentationHint != "" {
 							t.Errorf("\ngot Body.StackFrames[%d]=%#v\nwant Source.PresentationHint=\"\"", i, frame)
Repository: obsidian-tasks-group/obsidian-tasks
Pull request #2500 (2023-12-12 10:36:52)

fix: can now postpone scheduled dates from file name
<!--- Provide a general summary of your changes in the Title above -->

# Description

Postpone scheduled dates from file name.

## Motivation and Context

Fix this bug.

## How has this been tested?

Unit test + exploratory test.

## Types of changes

Changes visible to users:

- [x] **Bug fix** (prefix: `fix` - non-breaking change which fixes an issue)

Internal changes:

- [x] **Tests** (prefix: `test` - additions and improvements to unit tests and the smoke tests)

## Checklist

- [x] My code follows the code style of this project and passes `yarn run lint`.
- [x] My change has adequate [Unit Test coverage](https://publish.obsidian.md/tasks-contributing/Testing/About+Testing).

## Terms

- [x] My contribution follow this project's [contributing guide](https://publish.obsidian.md/tasks-contributing)
- [x] I agree to follow this project's [Code of Conduct](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/CODE_OF_CONDUCT.md)



Patch:
diff --git a/src/Scripting/Postponer.ts b/src/Scripting/Postponer.ts
index 178806c8..d45b1781 100644
--- a/src/Scripting/Postponer.ts
+++ b/src/Scripting/Postponer.ts
@@ -1,4 +1,5 @@
 import type { Moment, unitOfTime } from 'moment';
+import { DateFallback } from '../DateFallback';
 import { Task } from '../Task';
 import { TasksDate } from './TasksDate';
 
@@ -42,7 +43,12 @@ export function createPostponedTask(
 ) {
     const dateToPostpone = task[dateFieldToPostpone];
     const postponedDate = new TasksDate(dateToPostpone).postpone(timeUnit, amount);
-    const postponedTask = new Task({ ...task, [dateFieldToPostpone]: postponedDate });
+    const postponedTask = DateFallback.removeInferredStatusIfNeeded(task, [
+        new Task({
+            ...task,
+            [dateFieldToPostpone]: postponedDate,
+        }),
+    ])[0];
     return { postponedDate, postponedTask };
 }
 


Test patch:
diff --git a/tests/Scripting/Postponer.test.ts b/tests/Scripting/Postponer.test.ts
index e4807597..eef8b4f9 100644
--- a/tests/Scripting/Postponer.test.ts
+++ b/tests/Scripting/Postponer.test.ts
@@ -219,7 +219,7 @@ describe('postpone - new task creation', () => {
         testPostponedTaskAndDate(task, 'scheduledDate', '2023-12-04');
     });
 
-    it.failing('should postpone a task scheduled today to tomorrow, when the scheduled date is inferred', () => {
+    it('should postpone a task scheduled today to tomorrow, when the scheduled date is inferred', () => {
         const task = new TaskBuilder().scheduledDate('2023-12-03').scheduledDateIsInferred(true).build();
         testPostponedTaskAndDate(task, 'scheduledDate', '2023-12-04');
     });
Repository: dvanoni/notero
Pull request #606 (2024-10-16 07:08:33)

fix(sync): Prevent duplicate notes due to unsaved sync data


Patch:
diff --git a/src/content/data/item-data.ts b/src/content/data/item-data.ts
index ff349df..43b9d37 100644
--- a/src/content/data/item-data.ts
+++ b/src/content/data/item-data.ts
@@ -1,5 +1,4 @@
 import { NOTION_TAG_NAME } from '../constants';
-import { NoteroPref, getNoteroPref } from '../prefs/notero-pref';
 import { getPageIDFromURL, isNotionURL } from '../sync/notion-utils';
 import { isObject } from '../utils';
 
@@ -172,14 +171,12 @@ so that it can properly update the Notion page for this item.</p>
 <p>Last synced: ${new Date().toLocaleString()}</p>
 `;
 
-  if (getNoteroPref(NoteroPref.syncNotes)) {
-    const syncedNotesJSON = syncedNotes
-      ? JSON.stringify(syncedNotes)
-      : getSyncedNotesJSON(attachment);
+  const syncedNotesJSON = syncedNotes
+    ? JSON.stringify(syncedNotes)
+    : getSyncedNotesJSON(attachment);
 
-    if (syncedNotesJSON) {
-      note += `<pre id="${SYNCED_NOTES_ID}">${syncedNotesJSON}</pre>`;
-    }
+  if (syncedNotesJSON) {
+    note += `<pre id="${SYNCED_NOTES_ID}">${syncedNotesJSON}</pre>`;
   }
 
   attachment.setNote(note);


Test patch:
diff --git a/src/content/data/__tests__/item-data.spec.ts b/src/content/data/__tests__/item-data.spec.ts
index 9f1d686..6ed4c79 100644
--- a/src/content/data/__tests__/item-data.spec.ts
+++ b/src/content/data/__tests__/item-data.spec.ts
@@ -56,6 +56,27 @@ describe('getSyncedNotesFromAttachment', () => {
 });
 
 describe('saveNotionLinkAttachment', () => {
+  it('preserves synced notes when `syncNotes` is disabled', async () => {
+    mockZoteroPrefs();
+    setNoteroPref(NoteroPref.syncNotes, false);
+    const pageURL =
+      'notion://www.notion.so/page-00000000000000000000000000000000';
+    const syncedNotes =
+      '<pre id="notero-synced-notes">{"existing":"notes"}</pre>';
+    const item = createZoteroItemMock();
+    const attachment = createZoteroItemMock();
+    item.getAttachments.mockReturnValue([attachment.id]);
+    attachment.getField.calledWith('url').mockReturnValue(pageURL);
+    attachment.getNote.mockReturnValue(syncedNotes);
+
+    await saveNotionLinkAttachment(item, pageURL);
+
+    // eslint-disable-next-line @typescript-eslint/unbound-method
+    expect(attachment.setNote).toHaveBeenCalledWith(
+      expect.stringContaining(syncedNotes),
+    );
+  });
+
   it('preserves synced notes when page ID does not change', async () => {
     mockZoteroPrefs();
     setNoteroPref(NoteroPref.syncNotes, true);