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

fix(core): add permission limitation for create release #8623

Merged
merged 7 commits into from
Feb 14, 2025
Merged

Conversation

RitaDias
Copy link
Contributor

@RitaDias RitaDias commented Feb 13, 2025

Description

Prevent create release

  • In Global Menu
  • In document headers
  • In the release list
image image image

Discard version discard

  • Prevent discard version in document header
image

What to review

Anything could be improved?

Testing

The existing test should be enough.
Can manually test by following the screenshots

Notes for release

Discard version and create releases action menus and buttons for releases now respect permissions.

Copy link

vercel bot commented Feb 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2025 2:16pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2025 2:16pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2025 2:16pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Feb 14, 2025 2:16pm
test-next-studio ⬜️ Ignored (Inspect) Feb 14, 2025 2:16pm

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Feb 13, 2025

⚡️ Editor Performance Report

Updated Fri, 14 Feb 2025 14:22:12 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 27.0 efps (37ms) 25.6 efps (39ms) +2ms (+5.4%)
article (body) 73.0 efps (14ms) 77.8 efps (13ms) -1ms (-/-%)
article (string inside object) 27.0 efps (37ms) 27.4 efps (37ms) -1ms (-1.4%)
article (string inside array) 24.4 efps (41ms) 24.4 efps (41ms) +0ms (-/-%)
recipe (name) 52.6 efps (19ms) 52.6 efps (19ms) +0ms (-/-%)
recipe (description) 62.5 efps (16ms) 58.8 efps (17ms) +1ms (+6.3%)
recipe (instructions) 99.9+ efps (5ms) 99.9+ efps (5ms) +0ms (-/-%)
synthetic (title) 20.0 efps (50ms) 20.4 efps (49ms) -1ms (-2.0%)
synthetic (string inside object) 20.2 efps (50ms) 21.3 efps (47ms) -3ms (-5.1%)

efps — editor "frames per second". The number of updates assumed to be possible within a second.

Derived from input latency. efps = 1000 / input_latency

Detailed information

🏠 Reference result

The performance result of sanity@latest

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 37ms 41ms 56ms 477ms 755ms 10.2s
article (body) 14ms 15ms 23ms 101ms 219ms 5.1s
article (string inside object) 37ms 39ms 44ms 143ms 127ms 6.6s
article (string inside array) 41ms 42ms 45ms 145ms 265ms 7.1s
recipe (name) 19ms 20ms 24ms 37ms 0ms 7.2s
recipe (description) 16ms 17ms 19ms 28ms 0ms 4.4s
recipe (instructions) 5ms 6ms 8ms 10ms 0ms 3.0s
synthetic (title) 50ms 51ms 58ms 218ms 553ms 12.6s
synthetic (string inside object) 50ms 55ms 62ms 207ms 908ms 8.3s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 39ms 43ms 66ms 435ms 334ms 10.5s
article (body) 13ms 15ms 19ms 137ms 207ms 5.5s
article (string inside object) 37ms 40ms 45ms 81ms 114ms 6.5s
article (string inside array) 41ms 43ms 47ms 60ms 139ms 6.8s
recipe (name) 19ms 21ms 26ms 41ms 0ms 7.2s
recipe (description) 17ms 18ms 19ms 34ms 0ms 4.3s
recipe (instructions) 5ms 6ms 7ms 21ms 0ms 3.1s
synthetic (title) 49ms 52ms 62ms 355ms 823ms 12.5s
synthetic (string inside object) 47ms 51ms 92ms 537ms 982ms 8.4s

📚 Glossary

column definitions

  • benchmark — the name of the test, e.g. "article", followed by the label of the field being measured, e.g. "(title)".
  • latency — the time between when a key was pressed and when it was rendered. derived from a set of samples. the median (p50) is shown to show the most common latency.
  • p75 — the 75th percentile of the input latency in the test run. 75% of the sampled inputs in this benchmark were processed faster than this value. this provides insight into the upper range of typical performance.
  • p90 — the 90th percentile of the input latency in the test run. 90% of the sampled inputs were faster than this. this metric helps identify slower interactions that occurred less frequently during the benchmark.
  • p99 — the 99th percentile of the input latency in the test run. only 1% of sampled inputs were slower than this. this represents the worst-case scenarios encountered during the benchmark, useful for identifying potential performance outliers.
  • blocking time — the total time during which the main thread was blocked, preventing user input and UI updates. this metric helps identify performance bottlenecks that may cause the interface to feel unresponsive.
  • test duration — how long the test run took to complete.

Copy link
Contributor

github-actions bot commented Feb 13, 2025

Component Testing Report Updated Feb 14, 2025 2:23 PM (UTC)

❌ Failed Tests (2) -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 1m 10s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 12s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ❌ Failed (Inspect) 1m 57s 4 0 2
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 54s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 26s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 15s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 27s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 1m 7s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 38s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 2m 5s 21 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 13s 3 9 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 26s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 1m 45s 21 0 0
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 0s 0 3 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 0s 0 3 0

fix(core): add permission limitation for create release in releases overview
Copy link
Contributor

github-actions bot commented Feb 14, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 42.71% 54276 / 127064
🔵 Statements 42.71% 54276 / 127064
🔵 Functions 48.08% 2785 / 5792
🔵 Branches 79.28% 10524 / 13273
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/sanity/src/core/i18n/bundles/studio.ts 100% 100% 100% 100%
packages/sanity/src/core/perspective/navbar/ReleasesList.tsx 96.26% 88% 100% 96.26% 131-136
packages/sanity/src/core/releases/components/dialog/CreateReleaseDialog.tsx 78.5% 100% 100% 78.5% 55-62, 76-90
packages/sanity/src/core/releases/components/documentHeader/VersionChip.tsx 77.7% 35.48% 15.38% 77.7% 56, 128-130, 135-136, 145-146, 154, 164-165, 175-188, 248-255, 260-270
packages/sanity/src/core/releases/components/documentHeader/contextMenu/VersionContextMenu.tsx 100% 89.09% 100% 100%
packages/sanity/src/core/releases/tool/overview/ReleasesOverview.tsx 95.79% 86.25% 75% 95.79% 96, 130-131, 149, 165, 256-258, 265-269
packages/sanity/src/core/releases/util/const.ts 100% 100% 100% 100%
packages/sanity/src/ui-components/menuGroup/MenuGroup.tsx 100% 83.33% 100% 100%
Generated in workflow #30408 for commit a6c94fc by the Vitest Coverage Report Action

Copy link
Member

@jordanl17 jordanl17 left a comment

Choose a reason for hiding this comment

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

Looking good @RitaDias - just added in a couple of comments. Would be interested to know what you think on managing the permission state inside useReleasePermissions

jordanl17
jordanl17 previously approved these changes Feb 14, 2025
Copy link
Member

@jordanl17 jordanl17 left a comment

Choose a reason for hiding this comment

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

Thanks

@RitaDias RitaDias merged commit 70a58cb into next Feb 14, 2025
62 checks passed
@RitaDias RitaDias deleted the sapp-2112-2 branch February 14, 2025 14:25
...useActiveReleasesMockReturn,
data: [activeASAPRelease, activeScheduledRelease, activeUndecidedRelease],
})
mockUseReleasePermissions.mockReturnValue({
Copy link
Member

Choose a reason for hiding this comment

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

Ahh nice!

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.

2 participants