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): update getPublishDateFromRelease, add ScheduledRelease type #7754

Open
wants to merge 3 commits into
base: corel
Choose a base branch
from

Conversation

pedrobonamin
Copy link
Contributor

Description

We had two functions with similar names doing different things:

  • getReleasePublishDate (removed). This one preferred the intended publish date instead of the publishAt
  • getPublishDateFromRelease.

This PR removes the getReleasePublishDate function and updates getPublishDateFromRelease to always return a date and assert the correct type is passed.

What to review

Testing

Notes for release

Copy link

vercel bot commented Nov 5, 2024

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 Nov 5, 2024 0:50am
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 5, 2024 0:50am
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 5, 2024 0:50am
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 5, 2024 0:50am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 5, 2024 0:50am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Nov 5, 2024 0:50am

@@ -64,28 +64,12 @@ export function getCreateVersionOrigin(documentId: string): VersionOriginTypes {
}

/** @internal */
export function getPublishDateFromRelease(release: ReleaseDocument): Date {
export function getPublishDateFromRelease(release: ScheduledRelease): Date {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the type to ScheduledRelease to assert that a date will always be returned.

Copy link
Contributor

github-actions bot commented Nov 5, 2024

No changes to documentation

Copy link
Contributor

github-actions bot commented Nov 5, 2024

Component Testing Report Updated Nov 5, 2024 12:47 PM (UTC)

✅ All Tests Passed -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 1m 13s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 14s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 43s 6 0 0
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) 29s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 16s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 3m 0s 0 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 1m 14s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 2m 52s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 49s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 14s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 41s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 29s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 57s 12 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

Copy link
Contributor

github-actions bot commented Nov 5, 2024

⚡️ Editor Performance Report

Updated Tue, 05 Nov 2024 12:49:49 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 16.3 efps (62ms) 11.3 efps (89ms) +27ms (+43.9%) 🔴
article (body) 53.5 efps (19ms) 53.6 efps (19ms) -0ms (-0.3%)
article (string inside object) 17.4 efps (58ms) 12.2 efps (82ms) +25ms (+42.6%) 🔴
article (string inside array) 14.5 efps (69ms) 10.5 efps (96ms) +27ms (+38.4%) 🔴
recipe (name) 29.4 efps (34ms) 19.6 efps (51ms) +17ms (+50.0%) 🔴
recipe (description) 33.3 efps (30ms) 21.3 efps (47ms) +17ms (+56.7%) 🔴
recipe (instructions) 99.9+ efps (6ms) 99.9+ efps (7ms) +1ms (-/-%)
synthetic (title) 13.7 efps (73ms) 5.5 efps (182ms) +109ms (+148.6%) 🔴
synthetic (string inside object) 13.9 efps (72ms) 5.6 efps (179ms) +107ms (+147.9%) 🔴

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) 62ms 67ms 83ms 226ms 720ms 13.1s
article (body) 19ms 22ms 44ms 173ms 345ms 6.4s
article (string inside object) 58ms 60ms 71ms 123ms 482ms 9.3s
article (string inside array) 69ms 75ms 86ms 270ms 1298ms 10.1s
recipe (name) 34ms 37ms 42ms 72ms 19ms 9.3s
recipe (description) 30ms 32ms 44ms 77ms 0ms 6.0s
recipe (instructions) 6ms 8ms 10ms 23ms 2ms 3.3s
synthetic (title) 73ms 85ms 113ms 463ms 2019ms 24.9s
synthetic (string inside object) 72ms 76ms 81ms 161ms 1666ms 11.0s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 89ms 99ms 296ms 480ms 5364ms 20.4s
article (body) 19ms 22ms 46ms 380ms 622ms 7.0s
article (string inside object) 82ms 93ms 258ms 427ms 4487ms 14.1s
article (string inside array) 96ms 104ms 119ms 461ms 4945ms 14.8s
recipe (name) 51ms 55ms 80ms 215ms 1872ms 12.9s
recipe (description) 47ms 52ms 71ms 208ms 1726ms 9.7s
recipe (instructions) 7ms 9ms 10ms 32ms 130ms 4.3s
synthetic (title) 182ms 193ms 492ms 1143ms 13719ms 31.6s
synthetic (string inside object) 179ms 232ms 479ms 980ms 14047ms 27.5s

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

/**
* @internal
*/
export const isScheduledRelease = (release: ReleaseDocument): release is ScheduledRelease =>
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, the naming here is vague to me, because a scheduled release to me has state of scheduled or scheduling. This is like a prescheduled release, no? I wonder if we should introduce a name like intendedScheduledRelease?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think you are right, we need to find a better name for the intended schedule releases

@@ -170,7 +170,7 @@ export const GlobalPerspectiveMenuItem = forwardRef<
</Text>
{!isPublishedPerspective(release) &&
release.metadata.releaseType !== 'undecided' &&
(release.publishAt || release.metadata.intendedPublishAt) && (
Copy link
Member

Choose a reason for hiding this comment

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

These aren't a like for like swap I don't think, since isScheduledRelease only looks at intendedPublishAt. I can't recall exactly but it might be worth verifying that when a scheduled release is actually scheduled, and it's possible to reconfirm the scheduled datetime, whether we also update the intendedPublishAt to reflex this too.
Screenshot 2024-11-05 at 13 40 15

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are we removing the intendedPublishAt when scheduling it?
It's confusing how close this names are.

Maybe we need to find a better name for the releaseType ="scheduled"

Copy link
Member

Choose a reason for hiding this comment

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

I think we leave intendedPublishAt as whatever it was, and only persist this new date into publishAt via the schedule action. We should agree either to clear it or always keep it aligned. But of course the schedule action can also be triggered outwith studio, so guaranteeing they match isn't possible

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