Skip to content

Remove stored meshes feature from backend and postgres #8554

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 12, 2025

Conversation

fm3
Copy link
Member

@fm3 fm3 commented Apr 24, 2025

User-supplied meshes stored in postgres were already inaccessible since #6960 removed the frontend code two years ago.

This PR removes the relevant code as well and drops the mesh data from postgres.

This does not change how meshfiles or ad-hoc meshing is handled.

Steps to test:

  • CI should be enough

Issues:


@fm3 fm3 requested a review from frcroth April 24, 2025 13:23
@fm3 fm3 self-assigned this Apr 24, 2025
Copy link
Contributor

coderabbitai bot commented Apr 24, 2025

📝 Walkthrough

Walkthrough

The changes remove all backend support for persistent mesh storage and management. This includes deletion of mesh-related controller logic, model definitions, database schema, SQL migrations, route configurations, and message keys. Migration scripts are added for both dropping and recreating the relevant tables and views, ensuring clean schema evolution and reversibility.

Changes

Files/Paths Change Summary
app/controllers/MeshController.scala, app/models/mesh/Mesh.scala Removed all mesh-related backend logic, including the controller, models, services, and DAOs for mesh management.
conf/webknossos.latest.routes Deleted all route definitions for mesh CRUD and data endpoints.
conf/messages Removed all message keys related to mesh operations and errors.
tools/postgres/schema.sql Dropped the webknossos.meshes table and webknossos.meshes_ view; updated schema version.
conf/evolutions/132-remove-stored-meshes.sql Added migration script to drop mesh table and view, and update schema version to 132.
conf/evolutions/reversions/132-remove-stored-meshes.sql Added migration script to recreate mesh table and view, and revert schema version to 131.
MIGRATIONS.unreleased.md Updated migration guide to document the new Postgres evolution script for removing stored meshes.

Assessment against linked issues

Objective Addressed Explanation
Remove backend support for persistent mesh import of "ordinary" STL files (#5633)
Remove mesh storage, editing, and related database schema (#5633)
Remove mesh-related API endpoints and backend logic (#5633)
Remove mesh-related error messages and user-facing strings (#5633)

Suggested labels

bug

Poem

A mesh once lived in backend land,
With tables, routes, and code so grand.
But now it's gone, with schema clean,
No more STL imports seen!
The bunny hops with glee so bright—
The mesh is gone, the code feels light!
🐇✨

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


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

Support

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

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

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 (2)
conf/evolutions/131-remove-stored-meshes.sql (2)

1-1: Enforce pre-migration schema version
The DO block correctly asserts that the current schema version is 130 before applying this evolution, preventing out-of-order or duplicate migrations.


3-4: Use IF EXISTS for idempotence
Dropping the view and table without IF EXISTS may cause failures if they’ve already been removed. Consider:

-DROP VIEW webknossos.meshes_;
-DROP TABLE webknossos.meshes;
+DROP VIEW IF EXISTS webknossos.meshes_;
+DROP TABLE IF EXISTS webknossos.meshes;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 636412e and 6977d6f.

📒 Files selected for processing (7)
  • MIGRATIONS.unreleased.md (1 hunks)
  • app/controllers/MeshController.scala (0 hunks)
  • app/models/mesh/Mesh.scala (0 hunks)
  • conf/evolutions/131-remove-stored-meshes.sql (1 hunks)
  • conf/evolutions/reversions/131-remove-stored-meshes.sql (1 hunks)
  • conf/webknossos.latest.routes (0 hunks)
  • tools/postgres/schema.sql (1 hunks)
💤 Files with no reviewable changes (3)
  • conf/webknossos.latest.routes
  • app/controllers/MeshController.scala
  • app/models/mesh/Mesh.scala
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: backend-tests
  • GitHub Check: build-smoketest-push
  • GitHub Check: frontend-tests
🔇 Additional comments (7)
conf/evolutions/131-remove-stored-meshes.sql (1)

6-6: Bump schema version forward
Updating releaseInformation to 131 aligns the database state with this new evolution.

MIGRATIONS.unreleased.md (1)

13-13: Document new Postgres evolution
Including 131-remove-stored-meshes.sql under “Postgres Evolutions” ensures it’s applied for fresh deployments.

tools/postgres/schema.sql (1)

24-24: Initialize to new baseline version
Adjusting the inserted schemaVersion to 131 makes sure clean installs start at the correct migration level.

conf/evolutions/reversions/131-remove-stored-meshes.sql (4)

1-1: Verify pre-reversion schema version
The assertion ensures the schema is at 131 before running the rollback, preventing misaligned downgrades.


4-12: Recreate meshes table schema
The table definition, including its columns, defaults, and checks, matches the original schema prior to removal.


14-18: Re-establish view and foreign key
Recreating webknossos.meshes_ and re-adding the FK constraint restores the data model for stored meshes.


19-19: Revert schema version back
Downgrading releaseInformation to 130 correctly resets the migration state after undoing the table removal.

Copy link
Member

@frcroth frcroth left a comment

Choose a reason for hiding this comment

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

Please also remove the unused messages from conf/messages

@fm3 fm3 requested a review from frcroth April 29, 2025 09:55
@fm3 fm3 enabled auto-merge (squash) May 12, 2025 07:48
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 (3)
conf/evolutions/reversions/132-remove-stored-meshes.sql (3)

1-1: Use RAISE EXCEPTION for robust version check
PL/pgSQL ASSERT statements are only active when the server is built with assertions enabled (--enable-cassert). To ensure this check always fires, replace it with an explicit IF … RAISE EXCEPTION block.

Suggested diff:

-do $$ begin ASSERT (select schemaVersion from webknossos.releaseInformation) = 132, 'Previous schema version mismatch'; end; $$ LANGUAGE plpgsql;
+do $$ 
+begin
+  IF (SELECT schemaVersion FROM webknossos.releaseInformation) <> 132 THEN
+    RAISE EXCEPTION 'Previous schema version mismatch: expected 132, found %', (SELECT schemaVersion FROM webknossos.releaseInformation);
+  END IF;
+end; 
+$$ LANGUAGE plpgsql;

14-14: Avoid SELECT * in view definitions
Using SELECT * can lead to unexpected results if columns are later added or reordered. Consider listing columns explicitly in the view to guarantee stability over schema changes.


19-19: Scope the schemaVersion update to the expected row
Although there’s typically only one row, adding a WHERE clause guards against unexpected updates if the table ever contains multiple entries:

Proposed diff:

-UPDATE webknossos.releaseInformation SET schemaVersion = 131;
+UPDATE webknossos.releaseInformation
+  SET schemaVersion = 131
+  WHERE schemaVersion = 132;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between eac7109 and 47a685e.

📒 Files selected for processing (1)
  • conf/evolutions/reversions/132-remove-stored-meshes.sql (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: build-smoketest-push
  • GitHub Check: frontend-tests
  • GitHub Check: backend-tests
🔇 Additional comments (2)
conf/evolutions/reversions/132-remove-stored-meshes.sql (2)

4-12: Verify table definition matches original schema
Ensure that every column, constraint name, data type (especially the data column) and default value here exactly mirrors what existed before the drop. Also confirm that the webknossos.VECTOR3 type remains defined and wasn’t removed in the apply migration; otherwise this reversion will fail at runtime.


16-17: Double-check foreign key constraints
Confirm that the DEFERRABLE setting and constraint name (annotation_ref) exactly match the original table’s constraint. If the apply script used a different deferral or validity mode, this may cause downstream consistency issues.

@fm3 fm3 merged commit c17b29a into master May 12, 2025
5 checks passed
@fm3 fm3 deleted the remove-stored-meshes branch May 12, 2025 08:05
Comment on lines +12 to +13
<<<<<<< HEAD

Copy link
Member

Choose a reason for hiding this comment

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

😬

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops. I’ll repair it in #8559

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.

Remove or fix persistent mesh import of "ordinary" STL files
2 participants