Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(core): update events api routes and config flags, fix events sorting #8369

Merged
merged 3 commits into from
Jan 28, 2025

Conversation

pedrobonamin
Copy link
Contributor

@pedrobonamin pedrobonamin commented Jan 22, 2025

Description

This PR updates the events api routes that we were using.
The routes now will be:

  • Documents events: data/history/{datasetName}/events/documents/{ids}
  • Release events data/history/{datasetName}/events/releases/{id}

It also modifies the config flag we have added for the events api and enables it by default for documents events for all the studios.
It's kept as a flag in case we need to turn it off.

Releases events are not ready to be used by everyone yet, so a new flag has been added to handle this. It will be enabled by default in the playground studio.

It also updates the sort algorithm for the events, given the timestamp validation is not the only check necessary, because edit and publish events now have the same timestamp and the order was incorrect.

What to review

Testing

Notes for release

@pedrobonamin pedrobonamin requested a review from a team as a code owner January 22, 2025 15:50
@pedrobonamin pedrobonamin requested review from ricokahler and removed request for a team January 22, 2025 15:50
Copy link

vercel bot commented Jan 22, 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 Jan 27, 2025 4:33pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 27, 2025 4:33pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 27, 2025 4:33pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Jan 27, 2025 4:33pm
test-next-studio ⬜️ Ignored (Inspect) Jan 27, 2025 4:33pm

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Jan 22, 2025

Component Testing Report Updated Jan 27, 2025 4:35 PM (UTC)

❌ Failed Tests (1) -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 1m 4s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 12s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ❌ Failed (Inspect) 1m 20s 5 0 1
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 51s 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) 14s 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 32s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 2m 4s 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

Copy link
Contributor

github-actions bot commented Jan 22, 2025

⚡️ Editor Performance Report

Updated Mon, 27 Jan 2025 18:44:11 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 23.3 efps (43ms) 23.8 efps (42ms) -1ms (-2.3%)
article (body) 68.0 efps (15ms) 67.6 efps (15ms) +0ms (-/-%)
article (string inside object) 27.0 efps (37ms) 26.3 efps (38ms) +1ms (+2.7%)
article (string inside array) 23.8 efps (42ms) 22.5 efps (45ms) +3ms (+6.0%)
recipe (name) 47.6 efps (21ms) 47.6 efps (21ms) +0ms (-/-%)
recipe (description) 55.6 efps (18ms) 55.6 efps (18ms) +0ms (-/-%)
recipe (instructions) 99.9+ efps (5ms) 99.9+ efps (5ms) +0ms (-/-%)
synthetic (title) 19.2 efps (52ms) 19.2 efps (52ms) +0ms (-/-%)
synthetic (string inside object) 19.6 efps (51ms) 20.0 efps (50ms) -1ms (-2.0%)

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) 43ms 53ms 68ms 416ms 815ms 10.7s
article (body) 15ms 17ms 21ms 99ms 220ms 5.2s
article (string inside object) 37ms 38ms 48ms 319ms 349ms 6.7s
article (string inside array) 42ms 44ms 46ms 76ms 9ms 6.5s
recipe (name) 21ms 22ms 27ms 43ms 0ms 7.4s
recipe (description) 18ms 19ms 22ms 39ms 0ms 4.6s
recipe (instructions) 5ms 6ms 7ms 17ms 0ms 3.1s
synthetic (title) 52ms 54ms 58ms 92ms 696ms 12.3s
synthetic (string inside object) 51ms 55ms 62ms 479ms 1075ms 8.3s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 42ms 64ms 71ms 476ms 784ms 10.5s
article (body) 15ms 17ms 23ms 159ms 214ms 5.2s
article (string inside object) 38ms 41ms 45ms 137ms 140ms 6.9s
article (string inside array) 45ms 47ms 53ms 234ms 306ms 7.2s
recipe (name) 21ms 24ms 27ms 42ms 0ms 6.9s
recipe (description) 18ms 20ms 22ms 39ms 0ms 4.5s
recipe (instructions) 5ms 6ms 8ms 10ms 0ms 3.1s
synthetic (title) 52ms 53ms 66ms 129ms 467ms 12.1s
synthetic (string inside object) 50ms 52ms 66ms 275ms 603ms 8.2s

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

@pedrobonamin pedrobonamin changed the title feat(core): update events api routes and config flags feat(core): update events api routes and config flags, fix events sorting Jan 28, 2025
Copy link
Contributor

@juice49 juice49 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 to me!

// @ts-expect-error enabled is a legacy option we want to warn beta testers in case they have enabled it.
if (innerConfig.beta?.eventsAPI?.enabled) {
throw new Error(
`The \`beta.eventsAPI.enabled\` option has been removed. Use \`beta.eventsAPI.${opts.key}\` instead.`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice to warn these folks 👍.

expandedEvents: EditDocumentVersionEvent[]
}): DocumentGroupEvent[] {
const eventsWithRemoteEdits = [...remoteEdits, ...events, ...expandedEvents].sort(
// Sort by timestamp, newest first unless is an edit event that has a corresponding publish event
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch and nice test coverage.

@pedrobonamin pedrobonamin merged commit f62873e into corel Jan 28, 2025
58 checks passed
@pedrobonamin pedrobonamin deleted the corel-363 branch January 28, 2025 12:25
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants