-
Notifications
You must be signed in to change notification settings - Fork 170
👷 do not rely on monitors for deployment gate #3973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
thomas-lebeau
merged 9 commits into
main
from
thomas.lebeau/better-release-monitor-check
Jan 8, 2026
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bd7ca9a
👷 replace monitor checks by logs query
thomas-lebeau 06a759e
✅ add unit test for deploy-prod-dc script
thomas-lebeau 931ed9e
fixup! 👷 replace monitor checks by logs query
thomas-lebeau 855e546
♻️ refactor check-monitors scripts to query by orgs id and message
thomas-lebeau 54cf67e
🛠️ update error handling in check-monitors script to log missing data…
thomas-lebeau 52c439a
fix pr comment
thomas-lebeau 6f521b7
refactor: rename checkMonitors to checkTelemetryErrors
thomas-lebeau a5ad496
feat: widen first telemetry error check version
thomas-lebeau d752774
fix: pr comments
thomas-lebeau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| import assert from 'node:assert/strict' | ||
| import path from 'node:path' | ||
| import { beforeEach, before, describe, it, mock, type Mock } from 'node:test' | ||
| import { browserSdkVersion } from '../lib/browserSdkVersion.ts' | ||
| import type { CommandDetail } from './lib/testHelpers.ts' | ||
| import { mockModule, mockCommandImplementation } from './lib/testHelpers.ts' | ||
|
|
||
| const currentBrowserSdkVersionMajor = browserSdkVersion.split('.')[0] | ||
|
|
||
| describe('deploy-prod-dc', () => { | ||
| const commandMock = mock.fn() | ||
| const checkTelemetryErrorsMock: Mock<(datacenters: string[], version: string) => Promise<void>> = mock.fn() | ||
|
|
||
| let commands: CommandDetail[] | ||
| let checkTelemetryErrorsCalls: Array<{ version: string; datacenters: string[] }> | ||
|
|
||
| before(async () => { | ||
| await mockModule(path.resolve(import.meta.dirname, '../lib/command.ts'), { command: commandMock }) | ||
| await mockModule(path.resolve(import.meta.dirname, '../lib/executionUtils.ts'), { | ||
| timeout: () => Promise.resolve(), | ||
| }) | ||
| await mockModule(path.resolve(import.meta.dirname, './lib/checkTelemetryErrors.ts'), { | ||
| checkTelemetryErrors: checkTelemetryErrorsMock, | ||
| }) | ||
| }) | ||
|
|
||
| beforeEach(() => { | ||
| commands = mockCommandImplementation(commandMock) | ||
| checkTelemetryErrorsCalls = [] | ||
| checkTelemetryErrorsMock.mock.mockImplementation((datacenters: string[], version: string) => { | ||
| checkTelemetryErrorsCalls.push({ version, datacenters }) | ||
| return Promise.resolve() | ||
| }) | ||
| }) | ||
|
|
||
| it('should deploy a given datacenter', async () => { | ||
| await runScript('./deploy-prod-dc.ts', 'v6', 'us1') | ||
|
|
||
| // Should not call checkTelemetryErrors by default (no flag) | ||
| assert.strictEqual(checkTelemetryErrorsCalls.length, 0) | ||
|
|
||
| assert.deepEqual(commands, [ | ||
| { command: 'node ./scripts/deploy/deploy.ts prod v6 us1' }, | ||
| { command: 'node ./scripts/deploy/upload-source-maps.ts v6 us1' }, | ||
| ]) | ||
| }) | ||
|
|
||
| it('should deploy a given datacenter with check monitors', async () => { | ||
| await runScript('./deploy-prod-dc.ts', 'v6', 'us1', '--check-telemetry-errors') | ||
|
|
||
| // Should call checkTelemetryErrors 31 times: 1 initial + 30 during gating | ||
| assert.strictEqual(checkTelemetryErrorsCalls.length, 31) | ||
| assert.deepEqual(checkTelemetryErrorsCalls[0], { | ||
| version: `${currentBrowserSdkVersionMajor}.*`, | ||
| datacenters: ['us1'], | ||
| }) // Initial check | ||
| assert.deepEqual(checkTelemetryErrorsCalls[30], { version: browserSdkVersion, datacenters: ['us1'] }) // Last gating check | ||
|
|
||
| assert.deepEqual(commands, [ | ||
| { command: 'node ./scripts/deploy/deploy.ts prod v6 us1' }, | ||
| { command: 'node ./scripts/deploy/upload-source-maps.ts v6 us1' }, | ||
| ]) | ||
| }) | ||
|
|
||
| it('should only check monitors before deploying if the upload path is root', async () => { | ||
| await runScript('./deploy-prod-dc.ts', 'v6', 'root', '--check-telemetry-errors') | ||
|
|
||
| // Should only call checkTelemetryErrors once (no gating for root) | ||
| assert.strictEqual(checkTelemetryErrorsCalls.length, 1) | ||
| assert.deepEqual(checkTelemetryErrorsCalls[0], { | ||
| version: `${currentBrowserSdkVersionMajor}.*`, | ||
| datacenters: ['root'], | ||
| }) | ||
|
|
||
| assert.deepEqual(commands, [ | ||
| { command: 'node ./scripts/deploy/deploy.ts prod v6 root' }, | ||
| { command: 'node ./scripts/deploy/upload-source-maps.ts v6 root' }, | ||
| ]) | ||
| }) | ||
|
|
||
| it('should deploy all minor datacenters', async () => { | ||
| await runScript('./deploy-prod-dc.ts', 'v6', 'minor-dcs', '--no-check-telemetry-errors') | ||
|
|
||
| // Should not call checkTelemetryErrors when --no-check-telemetry-errors is used | ||
| assert.strictEqual(checkTelemetryErrorsCalls.length, 0) | ||
|
|
||
| assert.deepEqual(commands, [ | ||
| { command: 'node ./scripts/deploy/deploy.ts prod v6 us3,us5,ap1,ap2,prtest00' }, | ||
| { command: 'node ./scripts/deploy/upload-source-maps.ts v6 us3,us5,ap1,ap2,prtest00' }, | ||
| ]) | ||
| }) | ||
| }) | ||
|
|
||
| async function runScript(scriptPath: string, ...args: string[]): Promise<void> { | ||
| const { main } = (await import(scriptPath)) as { main: (...args: string[]) => Promise<void> } | ||
|
|
||
| return main(...args) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: checking monitors before deploy is pointless since
check-monitorsonly care about the new version being deployed. Maybe we could remove this, or make the query broader