Skip to content

Conversation

frcroth
Copy link
Contributor

@frcroth frcroth commented Aug 4, 2025

URL of deployed dev instance (used for testing):

  • https://___.webknossos.xyz

Steps to test:

  • access a dataset via zarr streaming with prefix

Issues:


(Please delete unneeded items, merge only when none are left open)

  • Added changelog entry (create a $PR_NUMBER.md file in unreleased_changes or use ./tools/create-changelog-entry.py)
  • Considered common edge cases
  • Needs datastore update after deployment

Copy link
Contributor

coderabbitai bot commented Aug 4, 2025

📝 Walkthrough

Walkthrough

This change adds support for URLs containing human-readable prefixes before resource IDs. A new parsing method extracts the ObjectId from such strings, and the path binding logic is updated to use this method, allowing URLs to include descriptive prefixes while still referencing the correct resource.

Changes

Cohort / File(s) Change Summary
ObjectId Human-Readable Parsing
util/src/main/scala/com/scalableminds/util/objectid/ObjectId.scala
Added fromHumanReadableStringSync to extract ObjectId from prefixed strings; updated path binder to use it; reformatted fromStringSync for clarity.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Assessment against linked issues

Objective Addressed Explanation
Support human-readable URIs with datasetId and prefix for Zarr streaming (#8812)

Suggested labels

backend

Poem

A rabbit hops down readable lanes,
Now URLs wear meaningful names.
With prefixes clear,
The ObjectId’s near—
No more cryptic, numbery pains!
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 27948cb and c1c688b.

📒 Files selected for processing (2)
  • unreleased_changes/8823.md (1 hunks)
  • util/src/main/scala/com/scalableminds/util/objectid/ObjectId.scala (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: in the webknossos codebase, classes extending `foximplicits` have access to an implicit conversion f...
Learnt from: frcroth
PR: scalableminds/webknossos#8236
File: webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/mesh/MeshFileService.scala:170-173
Timestamp: 2025-04-23T08:51:57.756Z
Learning: In the webknossos codebase, classes extending `FoxImplicits` have access to an implicit conversion from `Option[A]` to `Fox[A]`, where `None` is converted to an empty Fox that fails gracefully in for-comprehensions.

Applied to files:

  • util/src/main/scala/com/scalableminds/util/objectid/ObjectId.scala
📚 Learning: in scala for-comprehensions with the fox error handling monad, `fox.frombool()` expressions should u...
Learnt from: frcroth
PR: scalableminds/webknossos#8236
File: webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/mesh/NeuroglancerPrecomputedMeshFileService.scala:161-166
Timestamp: 2025-04-28T14:18:04.368Z
Learning: In Scala for-comprehensions with the Fox error handling monad, `Fox.fromBool()` expressions should use the `<-` binding operator instead of the `=` assignment operator to properly propagate error conditions. Using `=` will cause validation failures to be silently ignored.

Applied to files:

  • util/src/main/scala/com/scalableminds/util/objectid/ObjectId.scala
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build-smoketest-push
  • GitHub Check: backend-tests
  • GitHub Check: frontend-tests
🔇 Additional comments (4)
util/src/main/scala/com/scalableminds/util/objectid/ObjectId.scala (3)

22-23: LGTM!

The reformatting improves readability while maintaining the same functionality.


25-32: Well-implemented parsing logic for human-readable prefixes.

The method correctly handles the core requirement by extracting the ObjectId from after the last hyphen. Edge cases are handled appropriately:

  • Multiple hyphens in prefix: Uses lastIndexOf correctly
  • No hyphen: Falls back to entire input
  • Empty suffix after hyphen: Fails gracefully via BSON parsing validation

51-51: Perfect integration of human-readable prefix parsing.

The pathBinder update enables the core PR functionality by allowing URL paths to accept human-readable prefixed ObjectIds. This directly addresses the objective of making Zarr streaming URIs more readable.

unreleased_changes/8823.md (1)

1-2: Clear and accurate changelog entry.

The entry correctly documents the new human-readable prefix feature and is appropriately categorized under "Changed".

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch human-readable-objectid-paths

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
  • 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 explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @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.

@frcroth frcroth requested a review from fm3 August 4, 2025 15:37
Copy link
Member

@fm3 fm3 left a comment

Choose a reason for hiding this comment

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

Makes sense in principle, but is this used anywhere / do we generate such links somewhere? Also, does this apply to URI paths only or also get-parameters?

@frcroth
Copy link
Contributor Author

frcroth commented Aug 6, 2025

Makes sense in principle, but is this used anywhere / do we generate such links somewhere? Also, does this apply to URI paths only or also get-parameters?

I think @normanrz suggested this specifically for zarr routes, so it only works for URI paths because they are used for this purpose. I am not sure if these should be generated or just generally available.

@normanrz
Copy link
Member

normanrz commented Aug 6, 2025

I don't think it would hurt having it everywhere, but I think it would be sufficient to have it for the Zarr routes

@frcroth frcroth assigned frcroth and unassigned frcroth Sep 17, 2025
@fm3 fm3 self-assigned this Sep 22, 2025
@fm3 fm3 enabled auto-merge (squash) September 24, 2025 09:04
@fm3 fm3 merged commit 634dc16 into master Sep 25, 2025
5 checks passed
@fm3 fm3 deleted the human-readable-objectid-paths branch September 25, 2025 11:14
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.

Readable URIs for Zarr streaming
3 participants