Skip to content
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

feat(autofix): Write access is optional in check #81100

Merged
merged 5 commits into from
Nov 21, 2024

Conversation

jennmueng
Copy link
Member

Makes sure the frontend treats the githubWriteIntegration as optional and optionally passes checkWriteAccess to true

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 21, 2024
Copy link

codecov bot commented Nov 21, 2024

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
8240 2 8238 0
View the top 2 failed tests by shortest run time
AutofixSetupWriteAccessModal displays success text when installed repos for github app text
Stack Traces | 1.04s run time
Error: Expected test not to call console.error().

If the error is expected, test for it explicitly by mocking it out using jest.spyOn(console, 'error').mockImplementation() and test that the warning occurs.



Error: No mocked response found for request: GET .../1/autofix/setup/?check_write_access=true
    at Object.<anonymous> (.../events/autofix/autofixSetupWriteAccessModal.spec.tsx:82:48)
    at Promise.then.completed (.../jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../jest-circus/build/utils.js:231:10)
    at _callCircusTest (.../jest-circus/build/run.js:316:40)
    at _runTest (.../jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:121:9)
    at run (.../jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../jest-runner/build/runTest.js:367:16)
    at runTest (.../jest-runner/build/runTest.js:444:34)
    at Object.worker (.../jest-runner/build/testWorker.js:106:12)
    at console.captureMessage [as error] (.../node_modules/jest-fail-on-console/index.js:83:25)
    at Object.<anonymous> (.../app/__mocks__/api.tsx:47:15)
    at Promise.then.completed (.../jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../jest-circus/build/utils.js:231:10)
    at _callCircusHook (.../jest-circus/build/run.js:281:40)
    at _runTest (.../jest-circus/build/run.js:254:5)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:121:9)
    at run (.../jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../jest-runner/build/runTest.js:367:16)
    at runTest (.../jest-runner/build/runTest.js:444:34)
    at Object.worker (.../jest-runner/build/testWorker.js:106:12)
    at flushUnexpectedConsoleCalls (.../node_modules/jest-fail-on-console/index.js:48:13)
    at Object.<anonymous> (.../node_modules/jest-fail-on-console/index.js:139:7)
    at Promise.then.completed (.../jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../jest-circus/build/utils.js:231:10)
    at _callCircusHook (.../jest-circus/build/run.js:281:40)
    at _runTest (.../jest-circus/build/run.js:254:5)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:121:9)
    at run (.../jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../jest-runner/build/runTest.js:367:16)
    at runTest (.../jest-runner/build/runTest.js:444:34)
    at Object.worker (.../jest-runner/build/testWorker.js:106:12)
AutofixSetupWriteAccessModal displays help text when repos are not all installed
Stack Traces | 1.13s run time
Error: Expected test not to call console.error().

If the error is expected, test for it explicitly by mocking it out using jest.spyOn(console, 'error').mockImplementation() and test that the warning occurs.



Error: No mocked response found for request: GET .../1/autofix/setup/?check_write_access=true
    at Object.<anonymous> (.../events/autofix/autofixSetupWriteAccessModal.spec.tsx:38:34)
    at Promise.then.completed (.../jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../jest-circus/build/utils.js:231:10)
    at _callCircusTest (.../jest-circus/build/run.js:316:40)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
    at _runTest (.../jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:121:9)
    at run (.../jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../jest-runner/build/runTest.js:367:16)
    at runTest (.../jest-runner/build/runTest.js:444:34)
    at Object.worker (.../jest-runner/build/testWorker.js:106:12)
    at console.captureMessage [as error] (.../node_modules/jest-fail-on-console/index.js:83:25)
    at Object.<anonymous> (.../app/__mocks__/api.tsx:47:15)
    at Promise.then.completed (.../jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../jest-circus/build/utils.js:231:10)
    at _callCircusHook (.../jest-circus/build/run.js:281:40)
    at _runTest (.../jest-circus/build/run.js:254:5)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:121:9)
    at run (.../jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../jest-runner/build/runTest.js:367:16)
    at runTest (.../jest-runner/build/runTest.js:444:34)
    at Object.worker (.../jest-runner/build/testWorker.js:106:12)
    at flushUnexpectedConsoleCalls (.../node_modules/jest-fail-on-console/index.js:48:13)
    at Object.<anonymous> (.../node_modules/jest-fail-on-console/index.js:139:7)
    at Promise.then.completed (.../jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../jest-circus/build/utils.js:231:10)
    at _callCircusHook (.../jest-circus/build/run.js:281:40)
    at _runTest (.../jest-circus/build/run.js:254:5)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:121:9)
    at run (.../jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../jest-runner/build/runTest.js:367:16)
    at runTest (.../jest-runner/build/runTest.js:444:34)
    at Object.worker (.../jest-runner/build/testWorker.js:106:12)

To view more test analytics, go to the Test Analytics Dashboard
Got feedback? Let us know on Github

Copy link

codecov bot commented Nov 21, 2024

Bundle Report

Changes will increase total bundle size by 820 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
app-webpack-bundle-array-push 31.98MB 820 bytes (0.0%) ⬆️

@jennmueng jennmueng marked this pull request as ready for review November 21, 2024 19:55
@jennmueng jennmueng requested a review from a team as a code owner November 21, 2024 19:55
Copy link
Member

@roaga roaga left a comment

Choose a reason for hiding this comment

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

The code looks fine I think but are there no uses of useAutofixSetup where checkWriteAccess: false? If not, then what's the optimization?

@@ -6,7 +6,7 @@ import {AutofixSetupWriteAccessModal} from 'sentry/components/events/autofix/aut
describe('AutofixSetupWriteAccessModal', function () {
it('displays help text when repos are not all installed', async function () {
MockApiClient.addMockResponse({
url: '/issues/1/autofix/setup/',
url: '/issues/1/autofix/setup/?check_write_access=true',
Copy link
Member

Choose a reason for hiding this comment

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

? after / looks weird to me lol but you're probably right

Copy link
Member Author

@jennmueng jennmueng Nov 21, 2024

Choose a reason for hiding this comment

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

it just defaults to not passing the optional query variable

@jennmueng jennmueng merged commit efa96aa into master Nov 21, 2024
43 checks passed
@jennmueng jennmueng deleted the jenn/autofix/make-write-optional branch November 21, 2024 22:18
Copy link

sentry-io bot commented Nov 23, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ TypeError: Cannot read properties of null (reading 'ok') /issues/6058468164/events/f7718e6e5f21445a907df... View Issue

Did you find this useful? React with a 👍 or 👎

iamrajjoshi pushed a commit that referenced this pull request Nov 24, 2024
Makes sure the frontend treats the `githubWriteIntegration` as optional
and optionally passes `checkWriteAccess` to true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants