-
Notifications
You must be signed in to change notification settings - Fork 66
Show production commit on status page with GitHub link #1373
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,7 @@ import { | |
| } from './status-types.ts' | ||
|
|
||
| const providerIncidentsMetaKey = 'provider_incidents_cache' | ||
| const productionCommitMetaKey = 'production_commit_sha' | ||
|
|
||
| export type StatusWorkerEnv = { | ||
| STATUS_STORE: DurableObjectNamespace<StatusStore> | ||
|
|
@@ -385,11 +386,14 @@ export class StatusStore extends DurableObject<StatusWorkerEnv> { | |
| } | ||
|
|
||
| async runProbes(): Promise<void> { | ||
| const outcomes = await runAllProbes({ | ||
| const { outcomes, productionCommitSha } = await runAllProbes({ | ||
| primaryOrigin: this.env.PRIMARY_ORIGIN, | ||
| packageAppOrigin: this.env.PACKAGE_APP_ORIGIN, | ||
| }) | ||
| const now = Date.now() | ||
| if (productionCommitSha) { | ||
| this.setMeta(productionCommitMetaKey, productionCommitSha) | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stale production commit persistsMedium Severity
Reviewed by Cursor Bugbot for commit 0fb3e35. Configure here. |
||
| for (const outcome of outcomes) { | ||
| this.recordOutcome(outcome, now) | ||
| } | ||
|
|
@@ -417,7 +421,7 @@ export class StatusStore extends DurableObject<StatusWorkerEnv> { | |
| openIncidents: this.listIncidents('open'), | ||
| recentIncidents: this.listIncidents('resolved'), | ||
| providerIncidents: this.readProviderIncidents(now), | ||
| buildCommit: this.env.BUILD_COMMIT ?? null, | ||
| productionCommit: this.getMeta(productionCommitMetaKey), | ||
| } | ||
| } | ||
|
|
||
|
|
||


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.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Handle non-string
commitShavalues.At Line 74,
.trim()runs without runtime type validation. A malformed health response with a numeric or objectcommitSharejectsrunAllProbes. This stops status sampling, incident processing, and pruning for that run. Treat non-string values as invalid and returnnull. Add an integration test for a non-stringcommitSha.Proposed fix
function readProductionCommitSha(body: AppHealthBody | null): string | null { - const commitSha = body?.commitSha?.trim() + const rawCommitSha = body?.commitSha + if (typeof rawCommitSha !== 'string') return null + const commitSha = rawCommitSha.trim() if (!commitSha || !/^[0-9a-f]{7,40}$/i.test(commitSha)) return null return commitSha.toLowerCase() }📝 Committable suggestion
🤖 Prompt for AI Agents