Repository navigation
fix(webapp): forward condition value and windowSec in queryWatchFromPatch (#5065) - #5071
MilindChatrabhuji wants to merge 1 commit into
Conversation
|
|
Caution Review failedThe pull request is closed. Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @MilindChatrabhuji, thanks for your interest in contributing! This project requires that pull request authors are vouched, and you are not in the list of vouched users. This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details. |
| const prefillWindowMinutes = | ||
| prefill.windowSec !== undefined ? Math.round(prefill.windowSec / 60) : undefined; |
There was a problem hiding this comment.
🟡 Query watch windows shorten unexpectedly
For a query patch requesting 630 seconds, prefillWindowMinutes becomes 10 instead of 11. The created alert watches a shorter interval than requested.
Learn more
Query watch alerts store their windows in whole minutes. The patch contract accepts any number of seconds, and applyDraftPatch rounds curated alert windows up. Rounding to the nearest minute here shortens intervals with a remainder under 30 seconds. The resulting window is used by queryAlertRequestBody when the alert is created.
Example: With a 601-second patch window and a 600-second minimum cadence, this code prefills 10 minutes and creates a 600-second alert rather than covering all 601 seconds.
Recommended fix: Use Math.ceil(prefill.windowSec / 60) before checking the analysis bounds, matching applyDraftPatch and avoiding a shorter requested interval.
| const prefillWindowMinutes = | |
| prefill.windowSec !== undefined ? Math.round(prefill.windowSec / 60) : undefined; | |
| const prefillWindowMinutes = | |
| prefill.windowSec !== undefined ? Math.ceil(prefill.windowSec / 60) : undefined; |
Was this helpful? React with 👍 or 👎 to provide feedback.
| value: patch.condition?.value, | ||
| windowSec: patch.condition?.windowSec, |
There was a problem hiding this comment.
🟡 Query watch fix missing release note
This user-facing query watch fix has no .server-changes entry. Customers will not see the fix in server release notes.
Learn more
The repository's server changes guidance requires a release note for a user-facing server-only bug fix. This change restores query watch condition and window prefills for customers, but the PR adds no release note.
Example: A customer whose query alert previously lost its threshold now sees it prefilled, but the release summary does not mention the fix.
Recommended fix: Add a .server-changes/ Markdown file with area: webapp, type: fix, and a one-sentence user-facing description of the restored query watch prefills.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Fixes #5065
When the dashboard agent prefills a query watch alert patch,
queryWatchFromPatchpreviously only forwardedoperator: patch.condition?.operatorintoQueryWatchPrefill, droppingpatch.condition?.valueandpatch.condition?.windowSec. In addition,useQueryAlertDraftinitializedvalueTextto"", causingdraft.valueValidto remainfalseeven if an operator was prefilled, preventing automatic pre-selection of the threshold step.Changes:
queryWatchFromPatch(apps/webapp/app/components/dashboard-agent/alert-creation/draftPatch.ts): Forwardsvalue: patch.condition?.valueandwindowSec: patch.condition?.windowSectoQueryWatchPrefill.QueryWatchPrefill&QueryAlertPrefill(QueryAlertTranscript.tsx,queryAlertLink.ts): Extended types to include optionalvalueandwindowSecfields, and forwarded fromfullinQueryAlertTranscript.useQueryAlertDraft(apps/webapp/app/components/alerts/useQueryAlertDraft.ts):valueTextwithprefill.value !== undefined ? String(prefill.value) : ""sodraft.valueValidevaluates totruewhen prefilled with a valid number.prefill.windowSecinto minutes when present (Math.round(prefill.windowSec / 60)) and validates against analysis limits before settingwindowText.draftPatch.test.ts): Added unit test verifying thatqueryWatchFromPatchproperly forwardsvalueandwindowSecfrom the patch condition intoQueryWatchPrefill.@algora-pbc /claim #5065