Skip to content

feat: Log GutenbergKit errors#21621

Merged
dcalhoun merged 3 commits into
trunkfrom
feat/log-gutenberg-kit-errors
Jan 28, 2025
Merged

feat: Log GutenbergKit errors#21621
dcalhoun merged 3 commits into
trunkfrom
feat/log-gutenberg-kit-errors

Conversation

@dcalhoun
Copy link
Copy Markdown
Member

@dcalhoun dcalhoun commented Jan 27, 2025

Log GutenbergKit errors to the observability platform.

Related:

To Test:

  1. Checkout this WP-Andsroid branch.
  2. Clone the sibling GBK branch.
  3. Modify local-builds.gradle to point GutenbergKit to your local clone of the GBK repository.
  4. Referencing GBK documentation, start the GBK project server and configuring environment variables.
  5. Run the WP-Android app.
  6. Introduce an intentional error in GBK (example diff below).
  7. Verify the error arrives in relevant Sentry project.
Example error diff

diff --git a/src/components/editor/index.jsx b/src/components/editor/index.jsx
index 582d33c..6aa5d48 100644
--- a/src/components/editor/index.jsx
+++ b/src/components/editor/index.jsx
@@ -67,6 +67,7 @@ export default function Editor({ post, children }) {

	return (
		<div className="gutenberg-kit-editor-interface">
+			{intentionalReferenceError}
			<EditorLoadNotice className="gutenberg-kit-editor-interface__load-notice" />
			<BlockEditorProvider
				value={postBlocks}

Regression Notes

  1. Potential unintended areas of impact
    Regressions in Gutenberg Mobile or Aztec editors.
  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    Manually tested.
  3. What automated tests I added (or what prevented me from doing so)
    Deemed unnecessary for the experimental editor.

PR Submission Checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Testing Checklist (strike-out the not-applying and unnecessary ones):

  • WordPress.com sites and self-hosted Jetpack sites.
  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • Talkback.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • Large and small screen sizes. (Tablet and smaller phones)
  • Multi-tasking: Split screen and Pop-up view. (Android 10 or higher)

@dangermattic
Copy link
Copy Markdown
Collaborator

dangermattic commented Jan 27, 2025

1 Warning
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Jan 27, 2025

Project dependencies changes

The following changes in project dependencies were detected (configuration wordpressVanillaReleaseRuntimeClasspath):

list
Upgraded Dependencies
org.wordpress.gutenbergkit:android:trunk-fb31301ea6a94376237947afb4242f75c074f43c, (changed from trunk-cc52214a50893b41898607ac0bff7f2787b085bb)
tree
 +--- project :libs:editor
-|    +--- org.wordpress.gutenbergkit:android:trunk-cc52214a50893b41898607ac0bff7f2787b085bb
-|    |    +--- androidx.core:core-ktx:1.13.1 (*)
-|    |    +--- androidx.appcompat:appcompat:1.7.0 (*)
-|    |    +--- com.google.android.material:material:1.12.0 (*)
-|    |    +--- androidx.webkit:webkit:1.11.0 -> 1.12.1 (*)
-|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.0 -> 1.9.10 (*)
+|    +--- org.wordpress.gutenbergkit:android:trunk-fb31301ea6a94376237947afb4242f75c074f43c
+|    |    +--- androidx.core:core-ktx:1.13.1 (*)
+|    |    +--- androidx.appcompat:appcompat:1.7.0 (*)
+|    |    +--- com.google.android.material:material:1.12.0 (*)
+|    |    +--- androidx.webkit:webkit:1.11.0 -> 1.12.1 (*)
+|    |    +--- com.google.code.gson:gson:2.8.9 -> 2.11.0
+|    |    |    \--- com.google.errorprone:error_prone_annotations:2.27.0
+|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.0 -> 1.9.10 (*)
-|    \--- com.google.code.gson:gson:2.11.0
-|         \--- com.google.errorprone:error_prone_annotations:2.27.0
+|    \--- com.google.code.gson:gson:2.11.0 (*)
-\--- org.wordpress.gutenbergkit:android:trunk-cc52214a50893b41898607ac0bff7f2787b085bb (*)
+\--- org.wordpress.gutenbergkit:android:trunk-fb31301ea6a94376237947afb4242f75c074f43c (*)

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Jan 27, 2025

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr21621-e3e4508
Commite3e4508
Direct Downloadwordpress-prototype-build-pr21621-e3e4508.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Jan 27, 2025

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr21621-e3e4508
Commite3e4508
Direct Downloadjetpack-prototype-build-pr21621-e3e4508.apk
Note: Google Login is not supported on these builds.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 39.44%. Comparing base (650d069) to head (e3e4508).
Report is 10 commits behind head on trunk.

Additional details and impacted files
@@           Coverage Diff           @@
##            trunk   #21621   +/-   ##
=======================================
  Coverage   39.44%   39.44%           
=======================================
  Files        2119     2119           
  Lines       99485    99485           
  Branches    15308    15308           
=======================================
  Hits        39246    39246           
  Misses      56760    56760           
  Partials     3479     3479           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +2547 to +2570
val stackTraceElements = exception.stackTrace.map { stackTrace ->
JsExceptionStackTraceElement(
stackTrace.fileName,
stackTrace.lineNumber,
stackTrace.colNumber,
stackTrace.function
)
}

val jsException = JsException(
exception.type,
exception.message,
stackTraceElements,
exception.context,
exception.tags,
exception.isHandled,
exception.handledBy
)

val callback = object : JsExceptionCallback {
override fun onReportSent(success: Boolean) {
// Do nothing
}
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I dislike placing all of this GBK-specific logic in this file. I imagine it would require a larger refactor to avoid this, and I feel less confident envisioning what that might resemble. As one may notice, this addition mimics similar logic around it.

I welcome any thoughts of simple improvements, as well as long-term refactor ideas for decoupling the various editors. Transparently, the current Android editor logic is very confusing to me.

@dcalhoun dcalhoun marked this pull request as ready for review January 27, 2025 22:32
@dcalhoun dcalhoun requested a review from nbradbury January 27, 2025 22:32
@nbradbury

This comment was marked as resolved.

@nbradbury nbradbury self-assigned this Jan 28, 2025
Copy link
Copy Markdown
Contributor

@nbradbury nbradbury left a comment

Choose a reason for hiding this comment

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

@dcalhoun I verified that this is working as expected. Feel free to merge when ready! :shipit:

@dcalhoun dcalhoun enabled auto-merge (squash) January 28, 2025 18:25
@sonarqubecloud
Copy link
Copy Markdown

@dcalhoun dcalhoun merged commit 00b17b3 into trunk Jan 28, 2025
@dcalhoun dcalhoun deleted the feat/log-gutenberg-kit-errors branch January 28, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gutenberg Editing and display of Gutenberg blocks. [Type] Enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants