Feat/new feedback endpoint#1278
Conversation
…or slack/devops logic
There was a problem hiding this comment.
Pull request overview
This PR updates the TopBar feedback flow to use the new SAM backend endpoint that creates work items (and still posts to Slack) instead of calling the legacy Slack endpoints directly from the frontend.
Changes:
- Migrates feedback “type” to
WorkItemTypeand severity toBugSeverityfrom@equinor/subsurface-app-management. - Replaces Slack post/file-upload hooks with a single
WorkItemsService.createWorkItemWithAttachmentmutation and updates the response/status UI accordingly. - Updates tests/utilities/constants to align with the new types and request flow (though one test suite still targets old Slack endpoints and labels).
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/organisms/TopBar/Resources/Resources.tsx | Switches menu IDs/state to WorkItemType for opening feedback dialogs. |
| src/organisms/TopBar/Resources/Feedback/tests/ReportABug.test.tsx | Partially updated to WorkItemType, but still uses old urgency labels and mocks Slack endpoints. |
| src/organisms/TopBar/Resources/Feedback/ResponsePage/Success.tsx | Updates success text conditional to WorkItemType. |
| src/organisms/TopBar/Resources/Feedback/ResponsePage/ResponseStatus.tsx | Simplifies status display to ServiceNow + work-item request (removes Slack breakdown). |
| src/organisms/TopBar/Resources/Feedback/ResponsePage/FullSlackResponse.tsx | Removes detailed Slack request status component. |
| src/organisms/TopBar/Resources/Feedback/providers/FeedbackContextProvider.tsx | Replaces Slack mutations with work-item creation; updates context fields and request state. |
| src/organisms/TopBar/Resources/Feedback/hooks/useSlackPostMessage.ts | Removed (legacy Slack endpoint). |
| src/organisms/TopBar/Resources/Feedback/hooks/useSlackFileUpload.ts | Removed (legacy Slack endpoint). |
| src/organisms/TopBar/Resources/Feedback/hooks/useCreateWorkItemWithAttachment.ts | Adds React Query mutation for new work-item endpoint. |
| src/organisms/TopBar/Resources/Feedback/FeedbackForm/Severity.tsx | Uses BugSeverity and display mapping for the severity select. |
| src/organisms/TopBar/Resources/Feedback/FeedbackForm/FeedbackForm.tsx | Updates bug/suggestion conditional rendering to WorkItemType. |
| src/organisms/TopBar/Resources/Feedback/FeedbackForm/Description.tsx | Updates bug/suggestion conditional rendering to WorkItemType. |
| src/organisms/TopBar/Resources/Feedback/Feedback.utils.ts | Migrates slack message/severity helpers to BugSeverity/WorkItemType and adds display mapping. |
| src/organisms/TopBar/Resources/Feedback/Feedback.utils.test.ts | Updates emoji mapping test to BugSeverity. |
| src/organisms/TopBar/Resources/Feedback/Feedback.types.ts | Removes FeedbackType but still contains stale UrgencyOption/Slack status types. |
| src/organisms/TopBar/Resources/Feedback/Feedback.tsx | Updates selectedType prop to WorkItemType. |
| src/organisms/TopBar/Resources/Feedback/Feedback.test.tsx | Updates component test to use WorkItemType. |
| src/organisms/TopBar/Resources/Feedback/Feedback.const.ts | Updates default local storage shape and sets default severity to BugSeverity. |
Comments suppressed due to low confidence (2)
src/organisms/TopBar/Resources/Feedback/providers/FeedbackContextProvider.tsx:31
UrgencyOptionis still used in theupdateFeedbacktype signature, butfeedbackContent.urgencyhas been migrated toBugSeverity. This makes the context API misleading and can allow/encourage storing non-BugSeverityvalues (e.g. old urgency strings) into localStorage/state. Update theupdateFeedbackparameter type to acceptBugSeverity(and consider removingUrgencyOptionentirely if it's no longer used).
import {
FeedbackContentType,
FeedbackLocalStorage,
RequestStatusType,
StatusEnum,
UpdateRequestStatusHandler,
UrgencyOption,
} from '../Feedback.types';
src/organisms/TopBar/Resources/Feedback/Feedback.types.ts:21
UrgencyOptionis now stale: the form usesBugSeverityfrom@equinor/subsurface-app-management, but this enum (and theSlackStatus/FeedbackRequestStatustypes below) still reflect the old Slack-based flow. Keeping these around increases the risk of tests/components continuing to use the old types and drifting out of sync. Remove or refactor these types to match the new work-item based API.
export enum UrgencyOption {
NO_IMPACT = 'I am not impacted',
IMPEDES = 'It impedes my progress',
UNABLE = 'I am unable to work',
}
export enum StatusEnum {
error = 'error',
idle = 'idle',
pending = 'pending',
success = 'success',
partial = 'partial',
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…n up urgency options
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
src/tests/mockHandlers.ts:355
- The MSW handler for
POST /api/v1/WorkItems/workitem-with-attachmentechoes backHttpResponse.formData(body). IfWorkItemsService.createWorkItemWithAttachmentexpects JSON (common for generated API clients), this can cause response parsing errors in tests/runtime. Prefer returning a JSON body (even{}) with a 200/201 status (and optionally the fields the client expects).
http.post('*/api/v1/WorkItems/workitem-with-attachment', async (resolver) => {
await delay('real');
const body = (await resolver.request.formData()) as FormData;
return HttpResponse.formData(body);
}),
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 21 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/organisms/TopBar/Resources/Feedback/providers/FeedbackContextProvider.tsx:206
RequestStatussupportsStatusEnum.pending, buthandleSavenever sets eitherserviceNowRequestResponse.statusorworkItemRequestResponse.statustopendingwhen starting a request. This means the response page can show staleerror/successstate while a retry is in-flight (e.g., still showing the previous error message until the request completes). Consider setting the relevant status topending(and clearing any previouserrorText) immediately before awaitingserviceNowIncident(...)/createWorkItemWithAttachment(...)so the UI accurately reflects in-progress retries.
const handleSave = async () => {
// Service now request
toggleShowResponsePage();
let sysId: string | undefined | null =
serviceNowRequestResponse.serviceNowId ?? '';
if (
selectedType === WorkItemType.BUG &&
userEmail &&
serviceNowRequestResponse.status !== StatusEnum.success
) {
const serviceNowFormData = new FormData();
Azure DevOps links
User story
AB#743986 (Placeholder for task in SAM backlog, check related user story)
Needs to be tested locally by reviewer
Could be more tested i think, but I have tested that it worked for Premo, should work for all apps.
Felix mentioned that maybe the newest apps would be missing some setup to get the auto creation of user story in devops, but it would still post to slack regardless.
Description
Updates to new endpoint in SAM backend for taking in feedback to the team
The new endpoint still posts to slack, but also stores work items in DB and creates a userstory or bug in devops (and hopefully Jira when we move over to that)
Test steps
amplify-testin slack (where feedback from localhost and development is posted) that it shows the feedback there