Skip to content

Conversation

fm3
Copy link
Member

@fm3 fm3 commented Feb 5, 2025

Log the whole error chain when bucket loading fails.

Motivated by https://scm.slack.com/archives/C02H5T8Q08P/p1738766627989389?thread_ts=1738766454.436339&cid=C02H5T8Q08P

Also fixes #8379

@fm3 fm3 added the backend label Feb 5, 2025
@fm3 fm3 requested a review from frcroth February 5, 2025 15:30
@fm3 fm3 self-assigned this Feb 5, 2025
Copy link
Contributor

coderabbitai bot commented Feb 5, 2025

📝 Walkthrough

Walkthrough

This pull request refactors error handling and logging across multiple components. The changes centralize error formatting by introducing a new method, formatFailureChain, and removing redundant formatting methods. Several methods have their visibility restricted, and method signatures were updated to include implicit parameters for improved contextual error reporting. In addition, a configuration property was enabled and minor import adjustments and constant removals were made.

Changes

Files Change Summary
webknossos-datastore/.../DatasetErrorLoggingService.scala, app/models/annotation/AnnotationUploadService.scala, util/src/main/scala/com/scalableminds/util/mvc/ExtendedController.scala, util/src/main/scala/com/scalableminds/util/mvc/Formatter.scala, webknossos-datastore/.../DataSourceController.scala, webknossos-datastore/.../ExploreRemoteLayerService.scala Refactored error handling to use a unified formatFailureChain method; updated method signatures with implicit MessagesProvider; modified pattern matching and method visibility for error logging.
util/src/main/scala/com/scalableminds/util/tools/Fox.scala Removed the failureChainAsString method to consolidate error formatting.
app/controllers/Controller.scala Removed the badRequestLabel constant, affecting predefined error messaging.
conf/application.conf Enabled the editableMappingsEnabled feature by changing the value from false to true.
webknossos-datastore/.../AdHocMeshServiceHolder.scala Reordered import statements by moving the javax.inject.Inject import upward.

Assessment against linked issues

Objective (from #8379) Addressed Explanation
Unify formatChain methods (#8379)

Possibly related PRs

  • Log data loading errors in conversion / mapping application #8202: The changes in the main PR, specifically the modifications to the DatasetErrorLoggingService class and the introduction of the withErrorLogging method, are directly related to the enhancements in error logging discussed in the retrieved PR.
  • Re-Add debug logging for ds listing #8251: The changes in the main PR, particularly the introduction of the formatFailureChain method for error handling, are directly related to the modifications in the retrieved PR, which also utilizes formatFailureChain for improved error message formatting in the DataSourceController.
  • Remove debug logging for dataset listing #8256: The changes in the main PR, particularly the introduction of the formatFailureChain method for improved error logging, are directly related to the modifications in the retrieved PR, which also focuses on enhancing error messaging and handling within the DatasetController.

Suggested labels

bug

Suggested reviewers

  • normanrz

Poem

I'm a rabbit with a clever twist,
Hoping our errors are now dismissed.
With chains of failure neatly cleared,
And logs that now are well-engineered.
A joyful hop—in code we persist!
🐇✨
Keep on coding with a happy kiss.

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ce3d0a and 929e37f.

⛔ Files ignored due to path filters (1)
  • frontend/javascripts/test/snapshots/public-test/test-bundle/test/backend-snapshot-tests/misc.e2e.js.snap is excluded by !**/*.snap
📒 Files selected for processing (2)
  • frontend/javascripts/test/snapshots/public-test/test-bundle/test/backend-snapshot-tests/misc.e2e.js.md (1 hunks)
  • util/src/main/scala/com/scalableminds/util/tools/Fox.scala (0 hunks)
💤 Files with no reviewable changes (1)
  • util/src/main/scala/com/scalableminds/util/tools/Fox.scala
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: circleci_build
🔇 Additional comments (1)
frontend/javascripts/test/snapshots/public-test/test-bundle/test/backend-snapshot-tests/misc.e2e.js.md (1)

75-75: Snapshot Update for Feature Toggle: editableMappingsEnabled

The snapshot correctly reflects the recent change by setting editableMappingsEnabled to true, which aligns with the modifications made in the configuration (conf/application.conf). Please ensure that this update is verified against the actual application behavior during bucket loading and feature toggle evaluations, to maintain consistency across tests and runtime configurations.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

exportTiffMaxEdgeLengthVx = 8192
defaultToLegacyBindings = false
editableMappingsEnabled = false
editableMappingsEnabled = true
Copy link
Member Author

Choose a reason for hiding this comment

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

unrelated to this pr. I talked to @normanrz and we agreed to include this here. will be disabled selectively in docker.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
webknossos-datastore/app/com/scalableminds/webknossos/datastore/controllers/DataSourceController.scala (1)

748-748: LGTM! Consider extracting the error formatting parameters to constants.

The change enhances error logging by including stack traces and messages provider, which aligns with the PR objective. However, the hardcoded parameters could be extracted to constants for better maintainability.

Apply this diff to extract the parameters to constants:

+  private val ErrorLoggingConfig = {
+    val IncludeStackTraces = true
+  }
+
   def exploreRemoteDataset(): Action[ExploreRemoteDatasetRequest] = {
     // ...
-              reportMutable += s"Error when exploring as layer set: ${formatFailureChain(f, includeStackTraces = true, messagesProviderOpt = Some(request.messages))}"
+              reportMutable += s"Error when exploring as layer set: ${formatFailureChain(f, includeStackTraces = ErrorLoggingConfig.IncludeStackTraces, messagesProviderOpt = Some(request.messages))}"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a0f8b1d and bc37af9.

📒 Files selected for processing (11)
  • app/controllers/Controller.scala (0 hunks)
  • app/models/annotation/AnnotationUploadService.scala (4 hunks)
  • conf/application.conf (1 hunks)
  • util/src/main/scala/com/scalableminds/util/mvc/ExtendedController.scala (1 hunks)
  • util/src/main/scala/com/scalableminds/util/mvc/Formatter.scala (2 hunks)
  • util/src/main/scala/com/scalableminds/util/tools/Fox.scala (0 hunks)
  • webknossos-datastore/app/com/scalableminds/webknossos/datastore/controllers/DataSourceController.scala (1 hunks)
  • webknossos-datastore/app/com/scalableminds/webknossos/datastore/explore/ExploreRemoteLayerService.scala (8 hunks)
  • webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/AdHocMeshServiceHolder.scala (1 hunks)
  • webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/BinaryDataServiceHolder.scala (1 hunks)
  • webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/DatasetErrorLoggingService.scala (4 hunks)
💤 Files with no reviewable changes (2)
  • app/controllers/Controller.scala
  • util/src/main/scala/com/scalableminds/util/tools/Fox.scala
✅ Files skipped from review due to trivial changes (2)
  • webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/BinaryDataServiceHolder.scala
  • webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/AdHocMeshServiceHolder.scala
🚧 Files skipped from review as they are similar to previous changes (1)
  • webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/DatasetErrorLoggingService.scala
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: circleci_build
🔇 Additional comments (4)
util/src/main/scala/com/scalableminds/util/mvc/Formatter.scala (1)

84-112: LGTM! Well-structured implementation of failure chain formatting.

The implementation is clean, modular, and provides good flexibility with optional parameters for stack traces and server time. The helper functions make the code more maintainable and easier to understand.

util/src/main/scala/com/scalableminds/util/mvc/ExtendedController.scala (1)

43-47: LGTM! Good refactoring to use the new formatFailureChain method.

The implementation is cleaner and the parameter name chainBox better describes its type. The MessagesProvider is correctly passed to the new method.

app/models/annotation/AnnotationUploadService.scala (1)

34-36: LGTM! Good integration of the Formatter trait.

The implementation correctly extends the Formatter trait and properly uses the new formatFailureChain method with the MessagesProvider.

Also applies to: 60-61

webknossos-datastore/app/com/scalableminds/webknossos/datastore/explore/ExploreRemoteLayerService.scala (1)

54-55: LGTM! Good integration of error chain formatting.

The implementation correctly extends the Formatter trait and properly uses the new formatFailureChain method for error reporting. The MessagesProvider parameter is consistently added to all necessary methods.

Also applies to: 176-176

@fm3 fm3 merged commit 7333c22 into master Feb 11, 2025
3 checks passed
@fm3 fm3 deleted the chunk-error-format-chain branch February 11, 2025 13:49
@coderabbitai coderabbitai bot mentioned this pull request Aug 12, 2025
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unify formatChain methods

2 participants