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(sanity): treat releases as inactive if releases tool not present #9001

Merged
merged 1 commit into from
Mar 21, 2025

Conversation

juice49
Copy link
Contributor

@juice49 juice49 commented Mar 20, 2025

Description

There are various parts of the codebase that rely on releases.enabled from the workspace configuration to determine whether releases—and the releases tool—are available. This check fails when releases.enabled is true, but the releases tool is later removed (e.g. in the workspace tool filter).

In this scenario, Studio crashes because ReleasesNav attempts to generate a link to the nonexistent releases tool.

This branch fixes the problem by instead basing the availability of releases on the presence of the releases tool in the workspace.

What to review

The parts of the UI that rely on this check correctly respond to the presence of the releases tool.

Testing

Tested manually by adding the following tool filter to defaultWorkspace in Test Studio:

{
  tools: (prev) => prev.filter((tool) => tool.name !== 'releases'),
}

Also verified this works as expected when removing the tool filter and setting releases.enabled to false.

Notes for release

Fixes a bug causing Studio to crash with error Unable to find matching route for state when the releases tool is not present (e.g. when the workspace tools filter removes it).

Copy link

vercel bot commented Mar 20, 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 Mar 20, 2025 0:43am
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 20, 2025 0:43am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 20, 2025 0:43am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Mar 20, 2025 0:43am
test-next-studio ⬜️ Ignored (Inspect) Mar 20, 2025 0:43am

Copy link
Contributor

No changes to documentation

Copy link
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 42.98% 55556 / 129231
🔵 Statements 42.98% 55556 / 129231
🔵 Functions 47.45% 2785 / 5869
🔵 Branches 79.55% 10422 / 13100
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/sanity/src/core/perspective/navbar/ReleasesNav.tsx 100% 50% 100% 100%
packages/sanity/src/core/releases/hooks/useReleasesToolAvailable.ts 100% 50% 100% 100%
packages/sanity/src/core/releases/plugin/ReleasesStudioLayout.tsx 40% 100% 0% 40% 7-16
packages/sanity/src/core/releases/util/releasesToolAvailable.ts 100% 100% 100% 100%
packages/sanity/src/core/scheduledPublishing/tool/Tool.tsx 19.37% 100% 0% 19.37% 36-195
Generated in workflow #32573 for commit b1c81a9 by the Vitest Coverage Report Action

Copy link
Contributor

⚡️ Editor Performance Report

Updated Thu, 20 Mar 2025 12:49:43 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 19.4 efps (52ms) 26.0 efps (39ms) -13ms (-25.2%)
article (body) 72.5 efps (14ms) 75.5 efps (13ms) -1ms (-/-%)
article (string inside object) 20.8 efps (48ms) 27.0 efps (37ms) -11ms (-22.9%)
article (string inside array) 19.2 efps (52ms) 23.8 efps (42ms) -10ms (-19.2%)
recipe (name) 47.6 efps (21ms) 47.6 efps (21ms) +0ms (-/-%)
recipe (description) 52.6 efps (19ms) 52.6 efps (19ms) +0ms (-/-%)
recipe (instructions) 99.9+ efps (5ms) 99.9+ efps (5ms) +0ms (-/-%)
synthetic (title) 16.1 efps (62ms) 16.4 efps (61ms) -1ms (-1.6%)
synthetic (string inside object) 15.9 efps (63ms) 16.9 efps (59ms) -4ms (-6.3%)

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) 52ms 79ms 92ms 305ms 1269ms 12.6s
article (body) 14ms 18ms 21ms 59ms 75ms 5.1s
article (string inside object) 48ms 49ms 52ms 138ms 725ms 8.2s
article (string inside array) 52ms 55ms 63ms 155ms 1196ms 8.6s
recipe (name) 21ms 23ms 26ms 32ms 0ms 7.6s
recipe (description) 19ms 20ms 21ms 38ms 0ms 4.7s
recipe (instructions) 5ms 6ms 7ms 8ms 0ms 3.0s
synthetic (title) 62ms 66ms 79ms 371ms 2282ms 14.8s
synthetic (string inside object) 63ms 65ms 82ms 154ms 1477ms 9.4s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 39ms 41ms 44ms 142ms 50ms 10.6s
article (body) 13ms 15ms 16ms 32ms 62ms 4.9s
article (string inside object) 37ms 39ms 41ms 308ms 141ms 6.9s
article (string inside array) 42ms 45ms 49ms 122ms 202ms 7.0s
recipe (name) 21ms 23ms 26ms 40ms 9ms 7.8s
recipe (description) 19ms 20ms 22ms 202ms 0ms 5.0s
recipe (instructions) 5ms 6ms 7ms 9ms 0ms 3.0s
synthetic (title) 61ms 63ms 69ms 141ms 1617ms 19.5s
synthetic (string inside object) 59ms 63ms 70ms 403ms 1965ms 10.3s

📚 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.

@juice49 juice49 enabled auto-merge (squash) March 20, 2025 15:03
@juice49 juice49 merged commit f02a360 into next Mar 21, 2025
63 checks passed
@juice49 juice49 deleted the fix/sapp-2527/releases-enabled-check branch March 21, 2025 09:37
bjoerge added a commit that referenced this pull request Mar 21, 2025
* next: (81 commits)
  fix(presentation): use `perspectiveStack` when resolving main document (#9005)
  fix(core): hide discard changes action when published (#9009)
  fix(sanity): treat releases as inactive if releases tool not present (#9001)
  test(e2e): add unarchive / unpublish tests to releases (#8979)
  test: adding videos to CI report artifact (#8990)
  fix(cli): use outpath as package name for apps (#9003)
  fix(core): drop explicit `withCredentials` on requests (#8996)
  chore: add presentation to regular workspace (#8997)
  fix(core): use publishedId for search intent links (#8980)
  chore: fix vitest snapshot client error (#8993)
  chore: add vitest typecheck support (#8994)
  fix(core): stickyParams for `__unsafe_disableScopedSearchParams` (#8987)
  fix: no releases screen shows the create release dialog (#8988)
  fix(presentation): previewUrl is required (#8995)
  fix(deps): update dependency @portabletext/editor to ^1.40.3 (#8992)
  fix(deps): update dependency @portabletext/block-tools to ^1.1.14 (#8991)
  feat(core): add version to documents when creating with a release pinned (#8974)
  fix(test): update flaky navbar test (#8984)
  chore: add simple e2e presentation test (#8982)
  chore(deps): update dev-non-major (#8983)
  ...
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.

None yet

2 participants