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

Update Repo queries to use GQL #2943

Merged
merged 12 commits into from
Jul 5, 2024

Conversation

rohitvinnakota-codecov
Copy link
Contributor

@rohitvinnakota-codecov rohitvinnakota-codecov commented Jun 12, 2024

  • useEraseRepoContent
  • useRegenerateRepoUploadToken
  • useEncodeSecretString

Tested all 3 on staging

Screenshot 2024-07-04 at 2 23 14 PM Screenshot 2024-07-04 at 2 24 06 PM Screenshot 2024-07-04 at 2 24 37 PM

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@codecov-staging
Copy link

codecov-staging bot commented Jun 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2943      +/-   ##
==========================================
+ Coverage   98.35%   98.36%   +0.01%     
==========================================
  Files         888      891       +3     
  Lines       13162    13266     +104     
  Branches     3481     3475       -6     
==========================================
+ Hits        12945    13049     +104     
  Misses        213      213              
  Partials        4        4              
Files Coverage Δ
...b/DangerZone/EraseRepoContent/EraseRepoContent.jsx 100.00% <100.00%> (ø)
...eralTab/Tokens/RepoUploadToken/RepoUploadToken.jsx 100.00% <100.00%> (ø)
...ingsTab/tabs/YamlTab/SecretString/SecretString.jsx 100.00% <100.00%> (ø)
...abs/YamlTab/SecretString/useGenerateSecretSring.js 100.00% <100.00%> (ø)
src/services/repo/useEncodeString.tsx 100.00% <100.00%> (ø)
src/services/repo/useEraseRepoContent.tsx 100.00% <100.00%> (ø)
...s/repoUploadToken/useRegenerateRepoUploadToken.tsx 100.00% <100.00%> (ø)

... and 26 files with indirect coverage changes

Components Coverage Δ
Assets 53.84% <ø> (ø)
Layouts 97.23% <ø> (+0.05%) ⬆️
Pages 99.16% <100.00%> (+<0.01%) ⬆️
Services 99.47% <100.00%> (+<0.01%) ⬆️
Shared 99.68% <ø> (-0.01%) ⬇️
UI 94.59% <ø> (+<0.01%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 198ee9a...036eaf9. Read the comment docs.

@codecov-qa
Copy link

codecov-qa bot commented Jun 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.36%. Comparing base (198ee9a) to head (036eaf9).
Report is 5 commits behind head on main.

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2943      +/-   ##
==========================================
+ Coverage   98.35%   98.36%   +0.01%     
==========================================
  Files         888      891       +3     
  Lines       13162    13266     +104     
  Branches     3435     3545     +110     
==========================================
+ Hits        12945    13049     +104     
  Misses        213      213              
  Partials        4        4              
Files Coverage Δ
...b/DangerZone/EraseRepoContent/EraseRepoContent.jsx 100.00% <100.00%> (ø)
...eralTab/Tokens/RepoUploadToken/RepoUploadToken.jsx 100.00% <100.00%> (ø)
...ingsTab/tabs/YamlTab/SecretString/SecretString.jsx 100.00% <100.00%> (ø)
...abs/YamlTab/SecretString/useGenerateSecretSring.js 100.00% <100.00%> (ø)
src/services/repo/useEncodeString.tsx 100.00% <100.00%> (ø)
src/services/repo/useEraseRepoContent.tsx 100.00% <100.00%> (ø)
...s/repoUploadToken/useRegenerateRepoUploadToken.tsx 100.00% <100.00%> (ø)

... and 26 files with indirect coverage changes

Components Coverage Δ
Assets 53.84% <ø> (ø)
Layouts 97.23% <ø> (+0.05%) ⬆️
Pages 99.16% <100.00%> (+<0.01%) ⬆️
Services 99.47% <100.00%> (+<0.01%) ⬆️
Shared 99.68% <ø> (-0.01%) ⬇️
UI 94.59% <ø> (+<0.01%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 198ee9a...036eaf9. Read the comment docs.

Copy link

codecov-public-qa bot commented Jun 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.36%. Comparing base (198ee9a) to head (036eaf9).
Report is 5 commits behind head on main.

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2943      +/-   ##
==========================================
+ Coverage   98.35%   98.36%   +0.01%     
==========================================
  Files         888      891       +3     
  Lines       13162    13266     +104     
  Branches     3499     3540      +41     
==========================================
+ Hits        12945    13049     +104     
  Misses        213      213              
  Partials        4        4              
Files Coverage Δ
...b/DangerZone/EraseRepoContent/EraseRepoContent.jsx 100.00% <100.00%> (ø)
...eralTab/Tokens/RepoUploadToken/RepoUploadToken.jsx 100.00% <100.00%> (ø)
...ingsTab/tabs/YamlTab/SecretString/SecretString.jsx 100.00% <100.00%> (ø)
...abs/YamlTab/SecretString/useGenerateSecretSring.js 100.00% <100.00%> (ø)
src/services/repo/useEncodeString.tsx 100.00% <100.00%> (ø)
src/services/repo/useEraseRepoContent.tsx 100.00% <100.00%> (ø)
...s/repoUploadToken/useRegenerateRepoUploadToken.tsx 100.00% <100.00%> (ø)

... and 26 files with indirect coverage changes

Components Coverage Δ
Assets 53.84% <ø> (ø)
Layouts 97.23% <ø> (+0.05%) ⬆️
Pages 99.16% <100.00%> (+<0.01%) ⬆️
Services 99.47% <100.00%> (+<0.01%) ⬆️
Shared 99.68% <ø> (-0.01%) ⬇️
UI 94.59% <ø> (+<0.01%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 198ee9a...036eaf9. Read the comment docs.

Copy link

codecov bot commented Jun 12, 2024

Test Failures Detected: Due to failing tests, we cannot provide coverage reports at this time.

❌ Failed Test Results:

Completed 4764 tests with 1 failed, 4763 passed and 0 skipped.

View the full list of failed tests

SecretString

  • Class name: SecretString when the user clicks on Create New Secret String button when user clicks on Generate button renders the new token
    Test name: SecretString when the user clicks on Create New Secret String button when user clicks on Generate button renders the new token

    TestingLibraryElementError: Unable to find an element with the text: New secret string. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

    Ignored nodes: comments, script, style
    <body
    class=""
    >
    <div>
    <div
    class="m-4 flex flex-col gap-4 sm:mx-0"
    >
    <div
    class="flex flex-col gap-2"
    >
    <div
    class="text-lg font-semibold"
    >
    Secret string
    </div>
    <p />
    <hr />
    </div>
    <div
    class="flex flex-col gap-2 border-2 border-ds-gray-primary p-4"
    >
    <div
    class="flex flex-col gap-4"
    >
    <p>
    Secret strings are encrypted values used instead of plain text data that may be sensitive to eyes. The resulting string can be made public and used in your codecov YAML.
    </p>
    <div>
    <button
    class="
    flex items-center gap-1
    rounded py-1 px-4
    transition-colors duration-150 motion-reduce:transition-none

    focus:outline-none focus:ring

    disabled:cursor-not-allowed
    disabled:text-ds-gray-quaternary disabled:border-ds-gray-tertiary disabled:bg-ds-gray-primary
    justify-center font-semibold
    text-ds-gray-octonary bg-ds-gray-primary border-ds-gray-quaternary
    border-solid border shadow

    hover:bg-ds-gray-secondary
    "
    data-cy="show-modal"
    data-marketing="show-modal"
    data-testid="show-modal"
    disabled=""
    >
    Create New Secret String
    </button>
    </div>
    </div>
    </div>
    </div>
    </div>
    </body>
    at Object.getElementError (.../gazebo/gazebo/node_modules/@.../dom/dist/config.js:37:19)
    at allQuery (.../gazebo/gazebo/node_modules/@.../dom/dist/query-helpers.js:76:38)
    at query (.../gazebo/gazebo/node_modules/@.../dom/dist/query-helpers.js:52:17)
    at getByText (.../gazebo/gazebo/node_modules/@.../dom/dist/query-helpers.js:95:19)
    at Object.<anonymous> (.../YamlTab/SecretString/SecretString.spec.jsx:150:34)
    at runNextTicks (node:internal/process/task_queues:60:5)
    at listOnTimeout (node:internal/timers:540:9)
    at processTimers (node:internal/timers:514:7)

@codecov-staging
Copy link

codecov-staging bot commented Jun 12, 2024

Bundle Report

Changes will increase total bundle size by 18.88kB ⬆️

Bundle name Size Change
gazebo-staging-array-push 6.75MB 18.88kB ⬆️

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Jun 12, 2024

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
9fab890 Wed, 12 Jun 2024 19:22:59 GMT Expired Expired
6a0ee64 Thu, 13 Jun 2024 16:42:54 GMT Expired Expired
7668c6e Thu, 13 Jun 2024 19:01:59 GMT Expired Expired
6294155 Thu, 13 Jun 2024 19:26:20 GMT Expired Expired
6294155 Thu, 13 Jun 2024 19:27:30 GMT Expired Expired
1ca458f Thu, 13 Jun 2024 20:36:58 GMT Expired Expired
bbdd5ee Thu, 04 Jul 2024 17:11:33 GMT Expired Expired
bbdd5ee Thu, 04 Jul 2024 17:20:05 GMT Expired Expired
e50bed6 Thu, 04 Jul 2024 17:42:39 GMT Expired Expired
036eaf9 Thu, 04 Jul 2024 19:39:51 GMT Cloud Enterprise

Copy link

codecov bot commented Jun 13, 2024

Bundle Report

Changes will increase total bundle size by 18.88kB ⬆️

Bundle name Size Change
gazebo-production-array-push 6.75MB 18.88kB ⬆️

@rohitvinnakota-codecov
Copy link
Contributor Author

@ai-review-prompt-prod

Copy link

codecov-ai bot commented Jun 27, 2024

Currently I only review Open Pull Requests that are not in the draft state. Please try again when your PR is ready to be reviewed.

@rohitvinnakota-codecov rohitvinnakota-codecov marked this pull request as ready for review June 27, 2024 15:06
@rohitvinnakota-codecov
Copy link
Contributor Author

@ai-review-prompt-prod

@eliatcodecov
Copy link
Contributor

@ai-review-prompt-prod one more try. (sorry for the PR spam)

@eliatcodecov
Copy link
Contributor

@ai-review-prompt-prod 🙏

@eliatcodecov
Copy link
Contributor

@ai-review-prompt-prod trying new approach. Ignore this.

Comment on lines 70 to 78
console.log('ASFS')
mutate()
if (isLoading) {
// https://cathalmacdonnacha.com/mocking-error-empty-and-loading-states-with-msw
return res(ctx.status(200), ctx.data(mockResponse), ctx.delay(100))
}
)
if (failedMutation) {
console.log('SAKF')
return res(ctx.status(200), ctx.data(mockErrorResponse))
Copy link

Choose a reason for hiding this comment

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

The console.log statements should be removed as they are not necessary for the test and can clutter the output.

Suggested change
console.log('ASFS')
mutate()
if (isLoading) {
// https://cathalmacdonnacha.com/mocking-error-empty-and-loading-states-with-msw
return res(ctx.status(200), ctx.data(mockResponse), ctx.delay(100))
}
)
if (failedMutation) {
console.log('SAKF')
return res(ctx.status(200), ctx.data(mockErrorResponse))
deleted console.log('ASFS'
deleted console.log('SAKF'

Copy link
Contributor

@eliatcodecov eliatcodecov Jun 28, 2024

Choose a reason for hiding this comment

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

Well, we got a suggestion. Wasn't very good though 😬

@rohitvinnakota-codecov rohitvinnakota-codecov changed the title [draft WIP] update Repo queries to use GQL Update Repo queries to use GQL Jul 4, 2024
Comment on lines +81 to +82
// https://cathalmacdonnacha.com/mocking-error-empty-and-loading-states-with-msw
return res(ctx.status(200), ctx.data(mockResponse), ctx.delay(100))
Copy link
Contributor

Choose a reason for hiding this comment

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

yooo this is cool

}

function RepoUploadToken({ uploadToken }) {
const [showModal, setShowModal] = useState(false)
const { regenerateToken, isLoading } = useRegenerateToken()
const { mutate, isLoading } = useRegenerateToken()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const { mutate, isLoading } = useRegenerateToken()
const { mutate, isLoading } = useRegenerateRepoUploadToken()

And remove function on line 16.

})
},
onSuccess: ({ data }) => {
const error = data?.encodeSecretString?.error
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think it's worth validating these responses with zod schemas?

Copy link
Contributor

Choose a reason for hiding this comment

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

I could see either way - curious your thoughts though. Not sure what we do for other mutations.

Copy link
Contributor

@spalmurray-codecov spalmurray-codecov left a comment

Choose a reason for hiding this comment

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

looks good, couple comments. Gonna test preview deploy now

disappearAfter: TOAST_DURATION,
})
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I was expecting a success toast here. Any reason why not have it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The repo token text updates in place, so there is visual indication that it succeeded

@rohitvinnakota-codecov
Copy link
Contributor Author

@ai-review-prompt-prod

Copy link

codecov-ai bot commented Jul 4, 2024

I've reviewed this Pull Request and have no helpful feedback.

@rohitvinnakota-codecov rohitvinnakota-codecov added this pull request to the merge queue Jul 5, 2024
Merged via the queue into main with commit 4a04934 Jul 5, 2024
61 checks passed
@rohitvinnakota-codecov rohitvinnakota-codecov deleted the rvinnakota/update-repo-queries branch July 5, 2024 14:21
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.

4 participants