Repository navigation
fix(webapp): forward condition value and windowSec in queryWatchFromPatch (#5065) #5079
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 |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ import { | |
| alertDraftPatchSchema, | ||
| applyDraftPatch, | ||
| errorGroupToResolve, | ||
| queryWatchFromPatch, | ||
| type AlertDraftPatch, | ||
| } from "./draftPatch"; | ||
| import { draftResultLines } from "./useCreationAgentSend"; | ||
|
|
@@ -265,6 +266,23 @@ describe("below-threshold operator", () => { | |
| const patch = { area: "query", query: "SELECT 1", condition: { operator: "<" } }; | ||
| expect(alertDraftPatchSchema.safeParse(patch).success).toBe(true); | ||
| }); | ||
|
|
||
| it("forwards condition value and windowSec in queryWatchFromPatch", () => { | ||
| const patch = { | ||
| area: "query", | ||
| query: "SELECT count() FROM runs", | ||
| querySignalChoice: { mode: "threshold" as const, measure: "count" }, | ||
| condition: { operator: ">" as const, value: 42, windowSec: 1800 }, | ||
| }; | ||
| expect(queryWatchFromPatch(patch)).toEqual({ | ||
| query: "SELECT count() FROM runs", | ||
| mode: "threshold", | ||
| measure: "count", | ||
| operator: ">", | ||
| value: 42, | ||
| windowSec: 1800, | ||
| }); | ||
|
Comment on lines
+270
to
+284
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. |
||
| }); | ||
| }); | ||
|
|
||
| describe("unknown-key rejection", () => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,6 +67,8 @@ export function queryWatchFromPatch(patch: AlertDraftPatch): QueryWatchPrefill | | |
| mode: patch.querySignalChoice?.mode, | ||
| measure: patch.querySignalChoice?.measure, | ||
| operator: patch.condition?.operator, | ||
| value: patch.condition?.value, | ||
| windowSec: patch.condition?.windowSec, | ||
|
Comment on lines
+70
to
+71
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. 🟡 Alert fix missing release note This user-facing webapp fix has no Learn moreThe agent now passes suggested alert thresholds and windows into the query alert setup. That changes behavior users can notice. The repository requires a Example: A user creating an alert from an agent suggestion now sees the suggested threshold and window populated, but the release notes omit the fix. Recommended fix: Add a Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| }; | ||
| } | ||
|
|
||
|
|
||
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.
🟡 Suggested alert window gets shortened
For a 601-second query window,
prefillWindowMinutesselects 10 minutes instead of 11. The resulting alert watches less history than requested.Learn more
Alert windows are entered and saved as whole minutes. The agent supplies
condition.windowSecin seconds, which is forwarded to this hook. Rounding to the nearest minute can produce a shorter window, although applyDraftPatch rounds the same input upward for curated alerts. The alert then evaluates a different window than the one the agent suggested.Example: With a minimum of 10 minutes, a 601-second suggestion becomes 10 minutes here, whereas rounding up gives 11 minutes.
Recommended fix: Use
Math.ceilwhen converting seconds to minutes, asapplyDraftPatchdoes; keep the existing bounds check.Was this helpful? React with 👍 or 👎 to provide feedback.