- 
                Notifications
    You must be signed in to change notification settings 
- Fork 0
feat(aci): Automatically generate names for new metric monitors #100
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
base: master
Are you sure you want to change the base?
feat(aci): Automatically generate names for new metric monitors #100
Conversation
| Automatic naming for metric monitor creation Introduces automatic title generation for the metric-detector workflow. A new hook  Supporting changes include a typed helper  Key Changes• Added  Affected Areas•  This summary was automatically generated by @propel-code-bot | 
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| export function getFormFieldValue<T extends FieldValue = FieldValue>( | ||
| form: FormModel, | ||
| field: string | ||
| ): T { | ||
| // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion | ||
| return form.getValue(field) as FieldValue; | 
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.
  Return helper as wrong generic type
The new getFormFieldValue helper is declared to return the caller‑specified generic type T, but the implementation always casts to FieldValue. Because FieldValue is only the constraint for T, this expression is not assignable to T and TypeScript will fail to compile with Type 'FieldValue' is not assignable to type 'T'. To preserve the generic typing and satisfy the compiler the value should be asserted to T instead of FieldValue.
Useful? React with 👍 / 👎.
| field: string | ||
| ): T { | ||
| // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion | ||
| return form.getValue(field) as FieldValue; | 
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.
[DataTypeCheck]
Type mismatch in function return type vs implementation:
export function getFormFieldValue<T extends FieldValue = FieldValue>(
  form: FormModel,
  field: string
): T {
  return form.getValue(field) as FieldValue; // ❌ Returns FieldValue, not T
}This function promises to return type T but actually returns FieldValue, breaking type safety.
Suggested Change
| return form.getValue(field) as FieldValue; | |
| export function getFormFieldValue<T extends FieldValue = FieldValue>( | |
| form: FormModel, | |
| field: string | |
| ): T { | |
| // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion | |
| return form.getValue(field) as T; | |
| } | 
⚡ Committable suggestion
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
Context for Agents
[**DataTypeCheck**]
Type mismatch in function return type vs implementation:
```typescript
export function getFormFieldValue<T extends FieldValue = FieldValue>(
  form: FormModel,
  field: string
): T {
  return form.getValue(field) as FieldValue; // ❌ Returns FieldValue, not T
}
```
This function promises to return type `T` but actually returns `FieldValue`, breaking type safety.
<details>
<summary>Suggested Change</summary>
```suggestion
export function getFormFieldValue<T extends FieldValue = FieldValue>(
  form: FormModel,
  field: string
): T {
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
  return form.getValue(field) as T;
}
```
⚡ **Committable suggestion**
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
</details>
File: static/app/components/workflowEngine/form/getFormFieldValue.tsx
Line: 13
Uses
useSetAutomaticNameto set a default title for metric monitors if the user has not edited it.Let me know if you have wording improvements.
Copied from getsentry#102173
Original PR: getsentry#102173