Skip to content

Commit adfd8ad

Browse files
committed
Merge remote-tracking branch 'origin/master' into HEAD
2 parents ac76171 + 337959a commit adfd8ad

File tree

333 files changed

+23745
-4589
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

333 files changed

+23745
-4589
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: unreliable test
3+
about: Help us monitor our test suite by reporting flaky tests.
4+
labels: tests-ci-cd
5+
---
6+
7+
## Test Details
8+
9+
- Name of test:
10+
- OS of failure:
11+
- VSCode version of failure (minimum/insider/stable):
12+
- Link to failing run:
13+
- Link to failing test:
14+
15+
## Log of Test Failure
16+
17+
## Additional Information

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
---
88

9-
<!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md -->
9+
- Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time.
10+
- Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
1011

1112
License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,86 @@
1-
# github actions: https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-nodejs
2-
# setup-node: https://github.com/actions/setup-node
1+
# # github actions: https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-nodejs
2+
# # setup-node: https://github.com/actions/setup-node
33

4-
name: Copy-Paste Detection
4+
# name: Copy-Paste Detection
55

6-
on:
7-
pull_request:
8-
branches: [master, feature/*, staging]
6+
# on:
7+
# pull_request:
8+
# branches: [master, feature/*, staging]
99

10-
jobs:
11-
jscpd:
12-
runs-on: ubuntu-latest
13-
strategy:
14-
matrix:
15-
node-version: [18.x]
16-
env:
17-
NODE_OPTIONS: '--max-old-space-size=8192'
10+
# jobs:
11+
# jscpd:
12+
# runs-on: ubuntu-latest
13+
# strategy:
14+
# matrix:
15+
# node-version: [18.x]
16+
# env:
17+
# NODE_OPTIONS: '--max-old-space-size=8192'
1818

19-
steps:
20-
- uses: actions/checkout@v4
21-
with:
22-
fetch-depth: 0
19+
# steps:
20+
# - uses: actions/checkout@v4
21+
# with:
22+
# fetch-depth: 0
2323

24-
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v4
26-
with:
27-
node-version: ${{ matrix.node-version }}
24+
# - name: Use Node.js ${{ matrix.node-version }}
25+
# uses: actions/setup-node@v4
26+
# with:
27+
# node-version: ${{ matrix.node-version }}
2828

29-
- name: Fetch fork upstream
30-
run: |
31-
git remote add forkUpstream https://github.com/${{ github.event.pull_request.head.repo.full_name }} # URL of the fork
32-
git fetch forkUpstream # Fetch fork
29+
# - name: Fetch fork upstream
30+
# run: |
31+
# git remote add forkUpstream https://github.com/${{ github.event.pull_request.head.repo.full_name }} # URL of the fork
32+
# git fetch forkUpstream # Fetch fork
3333

34-
- name: Determine base and target branches for comparison.
35-
run: |
36-
echo "CURRENT_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
37-
echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
38-
- run: git diff --name-only origin/$TARGET_BRANCH forkUpstream/$CURRENT_BRANCH > diff_output.txt
39-
- run: |
40-
npm install -g jscpd
34+
# - name: Determine base and target branches for comparison.
35+
# run: |
36+
# echo "CURRENT_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
37+
# echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
38+
# - run: git diff --name-only origin/$TARGET_BRANCH forkUpstream/$CURRENT_BRANCH > diff_output.txt
39+
# - run: |
40+
# npm install -g jscpd
4141

42-
- run: jscpd --config "$GITHUB_WORKSPACE/.github/workflows/jscpd.json"
42+
# - run: jscpd --config "$GITHUB_WORKSPACE/.github/workflows/jscpd.json"
4343

44-
- if: always()
45-
uses: actions/upload-artifact@v4
46-
with:
47-
name: unfiltered-jscpd-report
48-
path: ./jscpd-report.json
44+
# - if: always()
45+
# uses: actions/upload-artifact@v4
46+
# with:
47+
# name: unfiltered-jscpd-report
48+
# path: ./jscpd-report.json
4949

50-
- name: Filter jscpd report for changed files
51-
run: |
52-
if [ ! -f ./jscpd-report.json ]; then
53-
echo "jscpd-report.json not found"
54-
exit 1
55-
fi
56-
echo "Filtering jscpd report for changed files..."
57-
CHANGED_FILES=$(jq -R -s -c 'split("\n")[:-1]' diff_output.txt)
58-
echo "Changed files: $CHANGED_FILES"
59-
jq --argjson changed_files "$CHANGED_FILES" '
60-
.duplicates | map(select(
61-
(.firstFile?.name as $fname | $changed_files | any(. == $fname)) or
62-
(.secondFile?.name as $sname | $changed_files | any(. == $sname))
63-
))
64-
' ./jscpd-report.json > filtered-jscpd-report.json
65-
cat filtered-jscpd-report.json
50+
# - name: Filter jscpd report for changed files
51+
# run: |
52+
# if [ ! -f ./jscpd-report.json ]; then
53+
# echo "jscpd-report.json not found"
54+
# exit 1
55+
# fi
56+
# echo "Filtering jscpd report for changed files..."
57+
# CHANGED_FILES=$(jq -R -s -c 'split("\n")[:-1]' diff_output.txt)
58+
# echo "Changed files: $CHANGED_FILES"
59+
# jq --argjson changed_files "$CHANGED_FILES" '
60+
# .duplicates | map(select(
61+
# (.firstFile?.name as $fname | $changed_files | any(. == $fname)) or
62+
# (.secondFile?.name as $sname | $changed_files | any(. == $sname))
63+
# ))
64+
# ' ./jscpd-report.json > filtered-jscpd-report.json
65+
# cat filtered-jscpd-report.json
6666

67-
- name: Check for duplicates
68-
run: |
69-
if [ $(wc -l < ./filtered-jscpd-report.json) -gt 1 ]; then
70-
echo "filtered_report_exists=true" >> $GITHUB_ENV
71-
else
72-
echo "filtered_report_exists=false" >> $GITHUB_ENV
73-
fi
74-
- name: upload filtered report (if applicable)
75-
if: env.filtered_report_exists == 'true'
76-
uses: actions/upload-artifact@v4
77-
with:
78-
name: filtered-jscpd-report
79-
path: ./filtered-jscpd-report.json
67+
# - name: Check for duplicates
68+
# run: |
69+
# if [ $(wc -l < ./filtered-jscpd-report.json) -gt 1 ]; then
70+
# echo "filtered_report_exists=true" >> $GITHUB_ENV
71+
# else
72+
# echo "filtered_report_exists=false" >> $GITHUB_ENV
73+
# fi
74+
# - name: upload filtered report (if applicable)
75+
# if: env.filtered_report_exists == 'true'
76+
# uses: actions/upload-artifact@v4
77+
# with:
78+
# name: filtered-jscpd-report
79+
# path: ./filtered-jscpd-report.json
8080

81-
- name: Fail and log found duplicates.
82-
if: env.filtered_report_exists == 'true'
83-
run: |
84-
cat ./filtered-jscpd-report.json
85-
echo "Duplications found, failing the check."
86-
exit 1
81+
# - name: Fail and log found duplicates.
82+
# if: env.filtered_report_exists == 'true'
83+
# run: |
84+
# cat ./filtered-jscpd-report.json
85+
# echo "Duplications found, failing the check."
86+
# exit 1

.github/workflows/node.js.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
8686
NODE_OPTIONS: ''
8787
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && github.ref == 'master' }}
88-
uses: codecov/codecov-action@v4
88+
uses: codecov/codecov-action@v5
8989
with:
9090
flags: macos-toolkit-unittests
9191
verbose: true
@@ -96,7 +96,7 @@ jobs:
9696
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
9797
NODE_OPTIONS: ''
9898
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && github.ref == 'master' }}
99-
uses: codecov/codecov-action@v4
99+
uses: codecov/codecov-action@v5
100100
with:
101101
flags: macos-amazonq-unittests
102102
verbose: true
@@ -155,7 +155,7 @@ jobs:
155155
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
156156
NODE_OPTIONS: ''
157157
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && github.ref == 'master' }}
158-
uses: codecov/codecov-action@v4
158+
uses: codecov/codecov-action@v5
159159
with:
160160
flags: windows-unittests
161161
verbose: true

CONTRIBUTING.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,12 @@ You can find documentation to create VSCode IDE settings for CodeCatalyst bluepr
238238
239239
Before sending a pull request:
240240
241+
1. Treat all work as PUBLIC. Private `feature/x` branches will _not_ be squash-merged at release time. This has several benefits:
242+
- Avoids mistakes (accidental exposure to public)!
243+
- Avoids needing to erase (squash-merge) history.
241244
1. Check that you are working against the latest source on the `master` branch.
242-
2. Check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
243-
3. Open an issue to discuss any significant work.
245+
1. Check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
246+
1. Open an issue to discuss any significant work.
244247
245248
To send a pull request:
246249

buildspec/release/35opengate.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 0.2
2+
3+
phases:
4+
install:
5+
runtime-versions:
6+
nodejs: 16
7+
8+
pre_build:
9+
commands:
10+
- STAGE_NAME=SourceWithGit
11+
- PIPELINE=$(echo $CODEBUILD_INITIATOR | sed -e 's/codepipeline\///')
12+
build:
13+
commands:
14+
- |
15+
aws codepipeline enable-stage-transition \
16+
--pipeline-name "$PIPELINE" \
17+
--stage-name "$STAGE_NAME" \
18+
--transition-type "Inbound"

buildspec/shared/common.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@
66

77
# Ignore these patterns when deciding if the build should fail.
88
# - "waiting for browser": from `ssoAccessTokenProvider.test.ts`, unclear how to fix it.
9-
# - "Webview is disposed": only happens on vscode "minimum" (1.68.0)
109
# - "HTTPError: Response code …": caused by github rate-limiting.
1110
# - "npm WARN deprecated querystring": transitive dep of aws sdk v2 (check `npm ls querystring`), so that's blocked until we migrate to v3.
1211
_ignore_pat='Timed-out waiting for browser login flow\|HTTPError: Response code 403\|HTTPError: Response code 404\|npm WARN deprecated querystring\|npm WARN deprecated'
13-
if [ "$VSCODE_TEST_VERSION" = 'minimum' ]; then
14-
_ignore_pat="$_ignore_pat"'\|Webview is disposed'
15-
fi
1612

1713
# Do not print (noisy) lines matching these patterns.
1814
# - "ERROR:bus… Failed to connect to the bus": noise related to "xvfb". https://github.com/cypress-io/cypress/issues/19299

docs/telemetry.md

Lines changed: 48 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -142,20 +142,23 @@ Finally, if `setupStep2()` was the thing that failed we would see a metric like:
142142

143143
## Adding a "Stack Trace" to your metric
144144

145-
### Problem
145+
When errors are thrown we do not attach the stack trace in telemetry. We only know about the error itself, but
146+
not the path it took to get there. We sometimes need this stack trace to debug, and only have telemetry to get insight on what happened since we do not have access to logs.
147+
148+
### Scenario
146149

147150
Common example: _"I have a function, `thisFailsSometimes()` that is called in multiple places. The function sometimes fails, I know from telemetry, but I do not know if it is failing when it is a specific caller. If I knew the call stack/trace that it took to call my function that would help me debug."_
148151

149152
```typescript
150-
function outerA() {
153+
function runsSuccessfully() {
151154
thisFailsSometimes(1) // this succeeds
152155
}
153156

154-
function outerB() {
157+
function thisThrows() {
155158
thisFailsSometimes(0) // this fails
156159
}
157160

158-
function thisFailsSometimes(num: number) {
161+
function failsDependingOnInput(num: number) {
159162
return telemetry.my_Metric.run(() => {
160163
if (number === 0) {
161164
throw Error('Cannot be 0')
@@ -167,31 +170,61 @@ function thisFailsSometimes(num: number) {
167170

168171
### Solution
169172

170-
Add a value to `function` in the options of a `run()`. This will result in a stack of functions identifiers that were previously called
171-
before `thisFailsSometimes()` was run. You can then retrieve the stack in the `run()` of your final metric using `getFunctionStack()`.
173+
On class methods, use the `@withTelemetryContext()` decorator to add context to the execution. Depending on the args set, it provides features like emitting the result, or adding it's context to errors.
174+
175+
> NOTE: Decorators are currently only supported for methods and not functions
176+
177+
```typescript
178+
class MyClass {
179+
@withTelemetryContext({ name: 'runsSuccessfully', class: 'MyClass' })
180+
public runsSuccessfully() {
181+
failsDependingOnInput(1)
182+
}
183+
184+
@withTelemetryContext({ name: 'thisThrows', class: 'MyClass', errorCtx: true })
185+
public thisThrows() {
186+
failsDependingOnInput(0)
187+
}
188+
189+
@withTelemetryContext({ name: 'failsDependingOnInput' class: 'MyClass', emit: true, errorCtx: true})
190+
private failsDependingOnInput(num: number) {
191+
if (number === 0) {
192+
throw Error('Cannot be 0')
193+
}
194+
...
195+
}
196+
}
197+
198+
// Results in a metric: { source: 'MyClass#thisThrows,failsDependingOnInput', result: 'Failed' }
199+
// Results in an error that has context about the methods that lead up to it.
200+
new MyClass().thisThrows()
201+
```
202+
203+
Separately if you must use a function, add a value to `function` in the options of a `run()`. This will result in a stack of functions identifiers that were previously called
204+
before `failsDependingOnInput()` was run. You can then retrieve the stack in the `run()` of your final metric using `getFunctionStack()`.
172205

173206
```typescript
174-
function outerA() {
175-
telemetry.my_Metric.run(() => thisFailsSometimes(1), { functionId: { name: 'outerA' }})
207+
function runsSuccessfully() {
208+
telemetry.my_Metric.run(() => failsDependingOnInput(1), { functionId: { name: 'runsSuccessfully' }})
176209
}
177210

178-
function outerB() {
179-
telemetry.my_Metric.run(() => thisFailsSometimes(0), { functionId: { source: 'outerB' }})
211+
function thisThrows() {
212+
telemetry.my_Metric.run(() => failsDependingOnInput(0), { functionId: { source: 'thisThrows' }})
180213
}
181214

182-
function thisFailsSometimes(num: number) {
215+
function failsDependingOnInput(num: number) {
183216
return telemetry.my_Metric.run(() => {
184217
telemetry.record({ theCallStack: asStringifiedStack(telemetry.getFunctionStack())})
185218
if (number === 0) {
186219
throw Error('Cannot be 0')
187220
}
188221
...
189-
}, { functionId: { name: 'thisFailsSometimes' }})
222+
}, { functionId: { name: 'failsDependingOnInput' }})
190223
}
191224

192-
// Results in a metric: { theCallStack: 'outerB:thisFailsSometimes', result: 'Failed' }
193-
// { theCallStack: 'outerB:thisFailsSometimes' } implies 'outerB' was run first, then 'thisFailsSometimes'. See docstrings for more info.
194-
outerB()
225+
// Results in a metric: { theCallStack: 'thisThrows:failsDependingOnInput', result: 'Failed' }
226+
// { theCallStack: 'thisThrows:failsDependingOnInput' } implies 'thisThrows' was run first, then 'failsDependingOnInput'. See docstrings for more info.
227+
thisThrows()
195228
```
196229

197230
### Important Notes
@@ -216,25 +249,6 @@ outerB()
216249
c() // result: 'a:c', note that 'b' is not included
217250
```
218251

219-
- If you are using `run()` with a class method, you can also add the class to the entry for more context
220-
221-
```typescript
222-
class A {
223-
a() {
224-
return telemetry.my_Metric.run(() => this.b(), { functionId: { name: 'a', class: 'A' } })
225-
}
226-
227-
b() {
228-
return telemetry.my_Metric.run(() => asStringifiedStack(telemetry.getFunctionStack()), {
229-
functionId: { name: 'b', class: 'A' },
230-
})
231-
}
232-
}
233-
234-
const inst = new A()
235-
inst.a() // 'A#a,b'
236-
```
237-
238252
- If you do not want your `run()` to emit telemetry, set `emit: false` in the options
239253

240254
```typescript

0 commit comments

Comments
 (0)