Skip to content

Commit 9574dcc

Browse files
authored
build: implement SDK breaking change detection (#538)
## 🎟️ Tracking https://bitwarden.atlassian.net/browse/PM-22218 bitwarden/clients#17314 bitwarden/clients#17075 ## 📔 Objective Implement automated SDK breaking change detection that provides immediate feedback when SDK PRs introduce TypeScript compilation issues for client applications. This system catches breaking changes at SDK development time rather than during client integration. Previously, breaking changes in the SDK weren't discovered until someone tried to update the SDK version in client repositories, making fixes difficult and disruptive. This PR implements a cross-repository workflow system that: 1. Triggers when SDK PRs have successful WASM artifacts built 2. Downloads and tests the new SDK artifacts against the typechecker in `clients` 3. Provides immediate feedback via PR comments and labels This was designed to be modular: hopefully we can just "slot in" mobile with any appropriate available job in those repos. ## Screenshots An example failure comment. It links to [this run](https://github.com/bitwarden/clients/actions/runs/19080851865). I created a breaking change on purpose and then reverted it. <img width="1970" height="882" alt="Screenshot 2025-11-04 at 3 03 36 PM" src="https://github.com/user-attachments/assets/b3653da7-7325-4939-a1ca-d2107686a431" /> The comment when no breaking changes are detected. <img width="1996" height="880" alt="Screenshot 2025-11-04 at 4 22 17 PM" src="https://github.com/user-attachments/assets/562c78d9-ad5f-448a-be94-f69ba82ca978" /> ## ⏰ Reminders before review - [x] Contributor guidelines followed - [x] All formatters and local linters executed and passed - [x] Written new unit and / or integration tests where applicable - [x] Protected functional changes with optionality (feature flags) - [x] Used internationalization (i18n) for all UI strings - [x] CI builds passed - [x] Communicated to DevOps any deployment requirements - [x] Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes [PM-22218]: https://bitwarden.atlassian.net/browse/PM-22218?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent 1586bd8 commit 9574dcc

File tree

3 files changed

+409
-6
lines changed

3 files changed

+409
-6
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@
66

77
<!-- Describe what the purpose of this PR is, for example what bug you're fixing or new feature you're adding. -->
88

9+
## 🚨 Breaking Changes
10+
11+
<!-- Does this PR introduce any breaking changes? If so, please describe the impact and migration path for clients.
12+
13+
If you're unsure, the automated TypeScript compatibility check will run when you open/update this PR and provide feedback.
14+
15+
For breaking changes:
16+
1. Describe what changed in the client interface
17+
2. Explain why the change was necessary
18+
3. Provide migration steps for client developers
19+
4. Link to any paired client PRs if needed
20+
21+
Otherwise, you can remove this section. -->
22+
923
## ⏰ Reminders before review
1024

1125
- Contributor guidelines followed

.github/workflows/build-wasm-internal.yml

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
env:
4444
PR_HEAD_REF: "${{ github.event.pull_request.head.ref }}"
4545
run: |
46-
echo REF_NAME="$PR_HEAD_REF" >> $GITHUB_ENV
46+
echo REF_NAME="${PR_HEAD_REF}" >> $GITHUB_ENV
4747
echo SHA="${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
4848
4949
- name: Set env variables (Branch/Tag)
@@ -119,24 +119,53 @@ jobs:
119119
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
120120
client_id: ${{ secrets.AZURE_CLIENT_ID }}
121121

122-
- name: Retrieve github PAT secrets
123-
id: retrieve-secret-pat
122+
- name: Get Azure Key Vault secrets
123+
id: get-kv-secrets
124124
uses: bitwarden/gh-actions/get-keyvault-secrets@main
125125
with:
126-
keyvault: "bitwarden-ci"
127-
secrets: "github-pat-bitwarden-devops-bot-repo-scope"
126+
keyvault: gh-org-bitwarden
127+
secrets: "BW-GHAPP-ID,BW-GHAPP-KEY"
128+
129+
- name: Generate GH App token
130+
uses: actions/create-github-app-token@30bf6253fa41bdc8d1501d202ad15287582246b4 # v2.0.3
131+
id: app-token
132+
with:
133+
app-id: ${{ steps.get-kv-secrets.outputs.BW-GHAPP-ID }}
134+
private-key: ${{ steps.get-kv-secrets.outputs.BW-GHAPP-KEY }}
135+
owner: bitwarden
136+
repositories: sdk-internal
137+
permission-actions: write
128138

129139
- name: Log out from Azure
130140
uses: bitwarden/gh-actions/azure-logout@main
131141

132142
- name: Trigger WASM publish
133143
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
134144
with:
135-
github-token: ${{ steps.retrieve-secret-pat.outputs.github-pat-bitwarden-devops-bot-repo-scope }}
145+
github-token: ${{ steps.app-token.outputs.token }}
136146
script: |
137147
await github.rest.actions.createWorkflowDispatch({
138148
owner: 'bitwarden',
139149
repo: 'sdk-internal',
140150
workflow_id: 'publish-wasm-internal.yml',
141151
ref: 'main',
142152
})
153+
154+
trigger-breaking-change-check:
155+
name: Trigger client breaking change checks
156+
if: github.event_name == 'pull_request'
157+
needs: build
158+
permissions:
159+
contents: read
160+
pull-requests: write
161+
id-token: write
162+
uses: ./.github/workflows/detect-breaking-changes.yml
163+
secrets: inherit
164+
with:
165+
pr_number: ${{ github.event.number }}
166+
pr_head_sha: ${{ github.event.pull_request.head.sha }}
167+
pr_head_ref: ${{ github.event.pull_request.head.ref }}
168+
build_run_id: ${{ github.run_id }}
169+
client_repo: "bitwarden/clients"
170+
client_label: "typescript"
171+
client_workflow: "sdk-breaking-change-check.yml"

0 commit comments

Comments
 (0)