Skip to content

Commit d80144f

Browse files
committed
Merge branch 'develop' into feat/upgrade-playwright-1.56
2 parents 4ef64df + 0591b1b commit d80144f

File tree

58 files changed

+1443
-161
lines changed

Some content is hidden

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

58 files changed

+1443
-161
lines changed

.craft.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ preReleaseCommand: bash scripts/craft-pre-release.sh
44
targets:
55
# NPM Targets
66
## 1. Base Packages, node or browser SDKs depend on
7-
## 1.1 Types
8-
- name: npm
9-
id: '@sentry/types'
10-
includeNames: /^sentry-types-\d.*\.tgz$/
11-
## 1.2 Core SDKs
7+
## 1.1 Core SDKs
128
- name: npm
139
id: '@sentry/core'
1410
includeNames: /^sentry-core-\d.*\.tgz$/
11+
## 1.2 Types
12+
- name: npm
13+
id: '@sentry/types'
14+
includeNames: /^sentry-types-\d.*\.tgz$/
1515
- name: npm
1616
id: '@sentry/node-core'
1717
includeNames: /^sentry-node-core-\d.*\.tgz$/

.cursor/BUGBOT.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,16 @@ Do not flag the issues below if they appear in tests.
4545
convention as the `SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN` value.
4646
- When calling `startSpan`, check if error cases are handled. If flag that it might make sense to try/catch and call `captureException`.
4747
- When calling `generateInstrumentationOnce`, the passed in name MUST match the name of the integration that uses it. If there are more than one instrumentations, they need to follow the pattern `${INSTRUMENTATION_NAME}.some-suffix`.
48+
49+
## Testing Conventions
50+
51+
- When reviewing a `feat` PR, check if the PR includes at least one integration or E2E test.
52+
If neither of the two are present, add a comment, recommending to add one.
53+
- When reviewing a `fix` PR, check if the PR includes at least one unit, integration or e2e test that tests the regression this PR fixes.
54+
Usually this means the test failed prior to the fix and passes with the fix.
55+
If no tests are present, add a comment recommending to add one.
56+
- Check that tests actually test the newly added behaviour.
57+
For instance, when checking on sent payloads by the SDK, ensure that the newly added data is asserted thoroughly.
58+
- Flag usage of `expect.objectContaining` and other relaxed assertions, when a test expects something NOT to be included in a payload but there's no respective assertion.
59+
- Flag usage of conditionals in one test and recommend splitting up the test for the different paths.
60+
- Flag usage of loops testing multiple scenarios in one test and recommend using `(it)|(test).each` instead.

.github/workflows/build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,8 @@ jobs:
992992
working-directory: ${{ runner.temp }}/test-application
993993
timeout-minutes: 7
994994
run: ${{ matrix.build-command || 'pnpm test:build' }}
995+
env:
996+
SENTRY_E2E_WORKSPACE_ROOT: ${{ github.workspace }}
995997

996998
- name: Install Playwright
997999
uses: ./.github/actions/install-playwright
@@ -1003,6 +1005,8 @@ jobs:
10031005
working-directory: ${{ runner.temp }}/test-application
10041006
timeout-minutes: 10
10051007
run: ${{ matrix.assert-command || 'pnpm test:assert' }}
1008+
env:
1009+
SENTRY_E2E_WORKSPACE_ROOT: ${{ github.workspace }}
10061010

10071011
- name: Upload Playwright Traces
10081012
uses: actions/upload-artifact@v5

.github/workflows/create-issue-for-unreferenced-prs.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ jobs:
4141
return;
4242
}
4343
44+
// Bail if this edit was made by the GitHub Actions bot (this workflow)
45+
// This prevents infinite loops when we update the PR body with the new issue reference
46+
// We check login specifically to not skip edits from other legitimate bots
47+
if (context.payload.sender && context.payload.sender.login === 'github-actions[bot]') {
48+
console.log(`PR #${pr.number} was edited by github-actions[bot] (this workflow), skipping.`);
49+
return;
50+
}
51+
4452
// Check if the PR is already approved
4553
const reviewsResponse = await github.rest.pulls.listReviews({
4654
owner: context.repo.owner,
@@ -109,7 +117,7 @@ jobs:
109117
console.log(`Created issue #${issueID}.`);
110118
111119
// Update the PR body to reference the new issue
112-
const updatedPrBody = `${prBody}\n\nCloses #${issueID}`;
120+
const updatedPrBody = `${prBody}\n\nCloses #${issueID} (added automatically)`;
113121
114122
await github.rest.pulls.update({
115123
owner: context.repo.owner,

dev-packages/e2e-tests/run.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ async function run(): Promise<void> {
7676
REACT_APP_E2E_TEST_DSN: dsn,
7777
E2E_TEST_SENTRY_ORG_SLUG: process.env.E2E_TEST_SENTRY_ORG_SLUG || DEFAULT_SENTRY_ORG_SLUG,
7878
E2E_TEST_SENTRY_PROJECT: process.env.E2E_TEST_SENTRY_PROJECT || DEFAULT_SENTRY_PROJECT,
79+
// Pass workspace root so tests copied to temp dirs can find local packages
80+
SENTRY_E2E_WORKSPACE_ROOT: resolve(__dirname, '../..'),
7981
};
8082

8183
const env = {

dev-packages/e2e-tests/test-applications/aws-serverless/src/stack.ts

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ const LAYER_DIR = './node_modules/@sentry/aws-serverless/';
1515
const DEFAULT_NODE_VERSION = '22';
1616
export const SAM_PORT = 3001;
1717

18+
function resolvePackagesDir(): string {
19+
// When running via the e2e test runner, tests are copied to a temp directory
20+
// so we need the workspace root passed via env var
21+
const workspaceRoot = process.env.SENTRY_E2E_WORKSPACE_ROOT;
22+
if (workspaceRoot) {
23+
return path.join(workspaceRoot, 'packages');
24+
}
25+
// Fallback for local development when running from the original location
26+
return path.resolve(__dirname, '../../../../../packages');
27+
}
28+
1829
export class LocalLambdaStack extends Stack {
1930
sentryLayer: CfnResource;
2031

@@ -67,10 +78,48 @@ export class LocalLambdaStack extends Stack {
6778
const functionName = `${addLayer ? 'Layer' : 'Npm'}${lambdaDir}`;
6879

6980
if (!addLayer) {
81+
const lambdaPath = path.resolve(functionsDir, lambdaDir);
82+
const packageLockPath = path.join(lambdaPath, 'package-lock.json');
83+
const nodeModulesPath = path.join(lambdaPath, 'node_modules');
84+
85+
// Point the dependency at the locally built packages so tests use the current workspace bits
86+
// We need to link all @sentry/* packages that are dependencies of aws-serverless
87+
// because otherwise npm will try to install them from the registry, where the current version is not yet published
88+
const packagesToLink = ['aws-serverless', 'node', 'core', 'node-core', 'opentelemetry'];
89+
const dependencies: Record<string, string> = {};
90+
91+
const packagesDir = resolvePackagesDir();
92+
for (const pkgName of packagesToLink) {
93+
const pkgDir = path.join(packagesDir, pkgName);
94+
if (!fs.existsSync(pkgDir)) {
95+
throw new Error(
96+
`[LocalLambdaStack] Workspace package ${pkgName} not found at ${pkgDir}. Did you run the build?`,
97+
);
98+
}
99+
const relativePath = path.relative(lambdaPath, pkgDir);
100+
dependencies[`@sentry/${pkgName}`] = `file:${relativePath.replace(/\\/g, '/')}`;
101+
}
102+
70103
console.log(`[LocalLambdaStack] Install dependencies for ${functionName}`);
71-
const packageJson = { dependencies: { '@sentry/aws-serverless': '* || latest' } };
72-
fs.writeFileSync(path.join(functionsDir, lambdaDir, 'package.json'), JSON.stringify(packageJson, null, 2));
73-
execFileSync('npm', ['install', '--prefix', path.join(functionsDir, lambdaDir)], { stdio: 'inherit' });
104+
105+
if (fs.existsSync(packageLockPath)) {
106+
// Prevent stale lock files from pinning the published package version
107+
fs.rmSync(packageLockPath);
108+
}
109+
110+
if (fs.existsSync(nodeModulesPath)) {
111+
// Ensure we reinstall from the workspace instead of reusing cached dependencies
112+
fs.rmSync(nodeModulesPath, { recursive: true, force: true });
113+
}
114+
115+
const packageJson = {
116+
dependencies,
117+
};
118+
119+
fs.writeFileSync(path.join(lambdaPath, 'package.json'), JSON.stringify(packageJson, null, 2));
120+
// Use --install-links to copy files instead of creating symlinks for file: dependencies.
121+
// Symlinks don't work inside the Docker container because the target paths don't exist there.
122+
execFileSync('npm', ['install', '--install-links', '--prefix', lambdaPath], { stdio: 'inherit' });
74123
}
75124

76125
new CfnResource(this, functionName, {

dev-packages/e2e-tests/test-applications/aws-serverless/tests/lambda-fixtures.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const test = base.extend<{ testEnvironment: LocalLambdaStack; lambdaClien
1717
console.log('[testEnvironment fixture] Setting up AWS Lambda test infrastructure');
1818

1919
execSync('docker network prune -f');
20-
execSync(`docker network create --driver bridge ${DOCKER_NETWORK_NAME}`);
20+
createDockerNetwork();
2121

2222
const hostIp = await getHostIp();
2323
const app = new App();
@@ -71,6 +71,8 @@ export const test = base.extend<{ testEnvironment: LocalLambdaStack; lambdaClien
7171
resolve(void 0);
7272
}, 5000);
7373
});
74+
75+
removeDockerNetwork();
7476
}
7577
},
7678
{ scope: 'worker', auto: true },
@@ -88,3 +90,27 @@ export const test = base.extend<{ testEnvironment: LocalLambdaStack; lambdaClien
8890
await use(lambdaClient);
8991
},
9092
});
93+
94+
function createDockerNetwork() {
95+
try {
96+
execSync(`docker network create --driver bridge ${DOCKER_NETWORK_NAME}`);
97+
} catch (error) {
98+
const stderr = (error as { stderr?: Buffer }).stderr?.toString() ?? '';
99+
if (stderr.includes('already exists')) {
100+
console.log(`[testEnvironment fixture] Reusing existing docker network ${DOCKER_NETWORK_NAME}`);
101+
return;
102+
}
103+
throw error;
104+
}
105+
}
106+
107+
function removeDockerNetwork() {
108+
try {
109+
execSync(`docker network rm ${DOCKER_NETWORK_NAME}`);
110+
} catch (error) {
111+
const stderr = (error as { stderr?: Buffer }).stderr?.toString() ?? '';
112+
if (!stderr.includes('No such network')) {
113+
console.warn(`[testEnvironment fixture] Failed to remove docker network ${DOCKER_NETWORK_NAME}: ${stderr}`);
114+
}
115+
}
116+
}

dev-packages/e2e-tests/test-applications/aws-serverless/tests/layer.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ test.describe('Lambda layer', () => {
2323
data: {
2424
'sentry.sample_rate': 1,
2525
'sentry.source': 'custom',
26-
'sentry.origin': 'auto.otel.aws-lambda',
26+
'sentry.origin': 'auto.otel.aws_lambda',
2727
'sentry.op': 'function.aws.lambda',
2828
'cloud.account.id': '012345678912',
2929
'faas.execution': expect.any(String),
@@ -32,7 +32,7 @@ test.describe('Lambda layer', () => {
3232
'otel.kind': 'SERVER',
3333
},
3434
op: 'function.aws.lambda',
35-
origin: 'auto.otel.aws-lambda',
35+
origin: 'auto.otel.aws_lambda',
3636
span_id: expect.stringMatching(/[a-f0-9]{16}/),
3737
status: 'ok',
3838
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
@@ -91,7 +91,7 @@ test.describe('Lambda layer', () => {
9191
data: {
9292
'sentry.sample_rate': 1,
9393
'sentry.source': 'custom',
94-
'sentry.origin': 'auto.otel.aws-lambda',
94+
'sentry.origin': 'auto.otel.aws_lambda',
9595
'sentry.op': 'function.aws.lambda',
9696
'cloud.account.id': '012345678912',
9797
'faas.execution': expect.any(String),
@@ -100,7 +100,7 @@ test.describe('Lambda layer', () => {
100100
'otel.kind': 'SERVER',
101101
},
102102
op: 'function.aws.lambda',
103-
origin: 'auto.otel.aws-lambda',
103+
origin: 'auto.otel.aws_lambda',
104104
span_id: expect.stringMatching(/[a-f0-9]{16}/),
105105
status: 'ok',
106106
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
@@ -214,7 +214,7 @@ test.describe('Lambda layer', () => {
214214
data: {
215215
'sentry.sample_rate': 1,
216216
'sentry.source': 'custom',
217-
'sentry.origin': 'auto.otel.aws-lambda',
217+
'sentry.origin': 'auto.otel.aws_lambda',
218218
'sentry.op': 'function.aws.lambda',
219219
'cloud.account.id': '012345678912',
220220
'faas.execution': expect.any(String),
@@ -223,7 +223,7 @@ test.describe('Lambda layer', () => {
223223
'otel.kind': 'SERVER',
224224
},
225225
op: 'function.aws.lambda',
226-
origin: 'auto.otel.aws-lambda',
226+
origin: 'auto.otel.aws_lambda',
227227
span_id: expect.stringMatching(/[a-f0-9]{16}/),
228228
status: 'ok',
229229
trace_id: expect.stringMatching(/[a-f0-9]{32}/),

dev-packages/e2e-tests/test-applications/aws-serverless/tests/npm.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ test.describe('NPM package', () => {
2323
data: {
2424
'sentry.sample_rate': 1,
2525
'sentry.source': 'custom',
26-
'sentry.origin': 'auto.otel.aws-lambda',
26+
'sentry.origin': 'auto.otel.aws_lambda',
2727
'sentry.op': 'function.aws.lambda',
2828
'cloud.account.id': '012345678912',
2929
'faas.execution': expect.any(String),
@@ -32,7 +32,7 @@ test.describe('NPM package', () => {
3232
'otel.kind': 'SERVER',
3333
},
3434
op: 'function.aws.lambda',
35-
origin: 'auto.otel.aws-lambda',
35+
origin: 'auto.otel.aws_lambda',
3636
span_id: expect.stringMatching(/[a-f0-9]{16}/),
3737
status: 'ok',
3838
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
@@ -91,7 +91,7 @@ test.describe('NPM package', () => {
9191
data: {
9292
'sentry.sample_rate': 1,
9393
'sentry.source': 'custom',
94-
'sentry.origin': 'auto.otel.aws-lambda',
94+
'sentry.origin': 'auto.otel.aws_lambda',
9595
'sentry.op': 'function.aws.lambda',
9696
'cloud.account.id': '012345678912',
9797
'faas.execution': expect.any(String),
@@ -100,7 +100,7 @@ test.describe('NPM package', () => {
100100
'otel.kind': 'SERVER',
101101
},
102102
op: 'function.aws.lambda',
103-
origin: 'auto.otel.aws-lambda',
103+
origin: 'auto.otel.aws_lambda',
104104
span_id: expect.stringMatching(/[a-f0-9]{16}/),
105105
status: 'ok',
106106
trace_id: expect.stringMatching(/[a-f0-9]{32}/),

dev-packages/e2e-tests/test-applications/nextjs-16-cacheComponents/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"@sentry/nextjs": "latest || *",
2727
"@sentry/core": "latest || *",
2828
"import-in-the-middle": "^1",
29-
"next": "16.0.0",
29+
"next": "16.0.7",
3030
"react": "19.1.0",
3131
"react-dom": "19.1.0",
3232
"require-in-the-middle": "^7",

0 commit comments

Comments
 (0)