Skip to content

Feat/new feedback endpoint#1278

Merged
aslakihle merged 17 commits into
mainfrom
feat/new-feedback-endpoint
May 8, 2026
Merged

Feat/new feedback endpoint#1278
aslakihle merged 17 commits into
mainfrom
feat/new-feedback-endpoint

Conversation

@aslakihle
Copy link
Copy Markdown
Contributor

@aslakihle aslakihle commented May 4, 2026

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

  1. build-and-use this branch into an application
  2. run application locally
  3. submit feedback in the topbar
  4. check amplify-test in slack (where feedback from localhost and development is posted) that it shows the feedback there
  5. Check the backlog/boards for the app you chose in devops to see if bug/user story was created

Copilot AI review requested due to automatic review settings May 4, 2026 11:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 WorkItemType and severity to BugSeverity from @equinor/subsurface-app-management.
  • Replaces Slack post/file-upload hooks with a single WorkItemsService.createWorkItemWithAttachment mutation 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

  • UrgencyOption is still used in the updateFeedback type signature, but feedbackContent.urgency has been migrated to BugSeverity. This makes the context API misleading and can allow/encourage storing non-BugSeverity values (e.g. old urgency strings) into localStorage/state. Update the updateFeedback parameter type to accept BugSeverity (and consider removing UrgencyOption entirely 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

  • UrgencyOption is now stale: the form uses BugSeverity from @equinor/subsurface-app-management, but this enum (and the SlackStatus/FeedbackRequestStatus types 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.

Comment thread src/organisms/TopBar/Resources/Feedback/Feedback.utils.ts
Comment thread src/organisms/TopBar/Resources/Feedback/tests/ReportABug.test.tsx
Comment thread src/organisms/TopBar/Resources/Feedback/hooks/useCreateWorkItemWithAttachment.ts Outdated
Comment thread src/organisms/TopBar/Resources/Feedback/Feedback.const.ts
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 100% (🎯 100%) 17390 / 17390
🔵 Statements 100% (🎯 100%) 17390 / 17390
🔵 Functions 100% (🎯 100%) 1283 / 1283
🔵 Branches 100% (🎯 100%) 4451 / 4451
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/organisms/TopBar/Resources/Resources.tsx 100% 100% 100% 100%
src/organisms/TopBar/Resources/Feedback/Feedback.const.ts 100% 100% 100% 100%
src/organisms/TopBar/Resources/Feedback/Feedback.tsx 100% 100% 100% 100%
src/organisms/TopBar/Resources/Feedback/Feedback.utils.ts 100% 100% 100% 100%
src/organisms/TopBar/Resources/Feedback/FeedbackForm/Description.tsx 100% 100% 100% 100%
src/organisms/TopBar/Resources/Feedback/FeedbackForm/FeedbackForm.tsx 100% 100% 100% 100%
src/organisms/TopBar/Resources/Feedback/FeedbackForm/Severity.tsx 100% 100% 100% 100%
src/organisms/TopBar/Resources/Feedback/ResponsePage/RequestStatus.tsx 100% 100% 100% 100%
src/organisms/TopBar/Resources/Feedback/ResponsePage/ResponseStatus.tsx 100% 100% 100% 100%
src/organisms/TopBar/Resources/Feedback/ResponsePage/Success.tsx 100% 100% 100% 100%
src/organisms/TopBar/Resources/Feedback/hooks/useCreateWorkItemWithAttachment.ts 100% 100% 100% 100%
src/organisms/TopBar/Resources/Feedback/providers/FeedbackContextProvider.tsx 100% 100% 100% 100%
Generated in workflow #2307 for commit 69788ff by the Vitest Coverage Report Action

Copilot AI review requested due to automatic review settings May 4, 2026 13:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/organisms/TopBar/Resources/Feedback/FeedbackForm/Severity.tsx Outdated
Comment thread src/organisms/TopBar/Resources/Feedback/providers/FeedbackContextProvider.tsx Outdated
Comment thread src/organisms/TopBar/Resources/Feedback/tests/ReportABug.test.tsx
Comment thread src/organisms/TopBar/Resources/Feedback/Feedback.types.ts
Copilot AI review requested due to automatic review settings May 5, 2026 10:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/organisms/TopBar/Resources/Feedback/providers/FeedbackContextProvider.tsx Outdated
Comment thread src/organisms/TopBar/Resources/Feedback/FeedbackForm/Severity.tsx
Comment thread src/organisms/TopBar/Resources/Feedback/Feedback.utils.ts Outdated
Comment thread src/organisms/TopBar/Resources/Feedback/Feedback.const.ts Outdated
Comment thread src/organisms/TopBar/Resources/Feedback/Feedback.types.ts
Comment thread src/organisms/TopBar/Resources/Feedback/hooks/useCreateWorkItemWithAttachment.ts Outdated
Copilot AI review requested due to automatic review settings May 5, 2026 11:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/organisms/TopBar/Resources/Feedback/providers/FeedbackContextProvider.tsx Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-attachment echoes back HttpResponse.formData(body). If WorkItemsService.createWorkItemWithAttachment expects 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.

Comment thread src/organisms/TopBar/Resources/Feedback/hooks/useCreateWorkItemWithAttachment.ts Outdated
Comment thread src/organisms/TopBar/Resources/Feedback/Feedback.utils.ts Outdated
Comment thread src/organisms/TopBar/Resources/Feedback/providers/FeedbackContextProvider.tsx Outdated
Copilot AI review requested due to automatic review settings May 6, 2026 07:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Comment thread src/organisms/TopBar/Resources/Feedback/Feedback.utils.ts
Comment thread src/organisms/TopBar/Resources/Feedback/Feedback.utils.ts
Copilot AI review requested due to automatic review settings May 6, 2026 10:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • RequestStatus supports StatusEnum.pending, but handleSave never sets either serviceNowRequestResponse.status or workItemRequestResponse.status to pending when starting a request. This means the response page can show stale error/success state while a retry is in-flight (e.g., still showing the previous error message until the request completes). Consider setting the relevant status to pending (and clearing any previous errorText) immediately before awaiting serviceNowIncident(...) / 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();

@aslakihle aslakihle marked this pull request as ready for review May 6, 2026 11:06
@aslakihle aslakihle requested a review from a team as a code owner May 6, 2026 11:06
@aslakihle aslakihle requested a review from arkadiy93 May 6, 2026 11:06
Copilot AI review requested due to automatic review settings May 8, 2026 10:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 21 changed files in this pull request and generated 2 comments.

Comment thread src/organisms/TopBar/Resources/Feedback/Feedback.const.ts
Comment thread src/organisms/TopBar/Resources/Feedback/Feedback.utils.ts
@aslakihle aslakihle merged commit f929d42 into main May 8, 2026
14 of 15 checks passed
@aslakihle aslakihle deleted the feat/new-feedback-endpoint branch May 8, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants