Skip to content

Conversation

fm3
Copy link
Member

@fm3 fm3 commented Sep 23, 2025

Saw a raw SQL error after trying to insert two meshfiles with the same name. Should be checked first.

Steps to test: edit a datasource-properties.json to contain two meshfiles of the same name in the same layer. Should be reported as error in dashboard, datasource should be unusable

@fm3 fm3 self-assigned this Sep 23, 2025
Copy link
Contributor

coderabbitai bot commented Sep 23, 2025

📝 Walkthrough

Walkthrough

Adds attachment support to the StaticLayer trait, a duplicate-name detection flag to DataLayerAttachments, and a validation rule ensuring attachments in each layer have unique names per category.

Changes

Cohort / File(s) Summary of Changes
Models: Static/data layers
webknossos-datastore/app/com/scalableminds/webknossos/datastore/models/datasource/DataLayer.scala
Added new public abstract member def attachments: Option[DataLayerAttachments] to StaticLayer.
Models: Attachments
webknossos-datastore/app/com/scalableminds/webknossos/datastore/models/datasource/DataLayerAttachments.scala
Added lazy val containsDuplicateNames: Boolean to detect duplicate names within meshes, agglomerates, and connectomes.
Validation service
webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/DataSourceValidation.scala
Added validation that ensures layer attachments have unique names per category by checking !_.containsDuplicateNames on attachments.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

bug

Suggested reviewers

  • frcroth
  • MichaelBuessemeyer

Poem

I twitch my whiskers, hop through layers neat,
New attachments found where data and names meet.
I count each mesh and agglomerate with care,
No duplicates hiding—none left to spare.
A happy thump: the datastore’s tidy, fair. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly and concisely summarizes the primary change — adding a validation to enforce distinct attachment names during datasource validation — and directly matches the implemented checks in DataSourceValidation and DataLayerAttachments, so it is specific and relevant to the changeset.
Description Check ✅ Passed The description explains the reported SQL error caused by duplicate meshfile names, states the intended behavior, and provides testing steps that match the added validation logic, so it is directly related to the changeset and sufficiently informative for this check.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch validate-distinct-attachment-names

📜 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 a74df1f and ccf0166.

📒 Files selected for processing (1)
  • webknossos-datastore/app/com/scalableminds/webknossos/datastore/models/datasource/DataLayerAttachments.scala (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • webknossos-datastore/app/com/scalableminds/webknossos/datastore/models/datasource/DataLayerAttachments.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). (2)
  • GitHub Check: build-smoketest-push
  • GitHub Check: backend-tests

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

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: 2

🧹 Nitpick comments (1)
webknossos-datastore/app/com/scalableminds/webknossos/datastore/models/datasource/DataLayer.scala (1)

86-87: Remove redundant abstract attachments declaration in StaticLayer.

DataLayer already declares def attachments: Option[DataLayerAttachments]. Re-declaring it in StaticLayer adds noise without benefit.

Apply:

-  def attachments: Option[DataLayerAttachments]
-
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 86ba40d and a74df1f.

📒 Files selected for processing (3)
  • webknossos-datastore/app/com/scalableminds/webknossos/datastore/models/datasource/DataLayer.scala (1 hunks)
  • webknossos-datastore/app/com/scalableminds/webknossos/datastore/models/datasource/DataLayerAttachments.scala (1 hunks)
  • webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/DataSourceValidation.scala (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/DataSourceValidation.scala (1)
webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/editablemapping/EditableMappingLayer.scala (1)
  • attachments (103-103)
webknossos-datastore/app/com/scalableminds/webknossos/datastore/models/datasource/DataLayer.scala (1)
webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/editablemapping/EditableMappingLayer.scala (1)
  • attachments (103-103)
⏰ 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

Copy link
Contributor

@MichaelBuessemeyer MichaelBuessemeyer left a comment

Choose a reason for hiding this comment

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

Awesome, thanks for fixing this 🎉

@fm3 fm3 merged commit 87219e0 into master Sep 25, 2025
7 of 8 checks passed
@fm3 fm3 deleted the validate-distinct-attachment-names branch September 25, 2025 07:40
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.

2 participants