Skip to content
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

feat(server): remove unnecessary code [VIZ-BE-582] #1458

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

hexaforce
Copy link
Contributor

@hexaforce hexaforce commented Feb 27, 2025

Overview

Remove any unnecessary code that is not currently being used

What I've done

1.Deleted all of the following packages:

  • server/pkg/dataset/*
  • server/pkg/layer/*
  • server/pkg/tag/*
    ※ This includes the removal of loaders, interfaces, and other related components.

2.Deleted the following MongoDocuments:

  • All Datasets
  • All DatasetSchemas
  • All Tags
  • All Layers
  • SceneClusterDocument
  • PropertyLinkDocument

3.Deleted the following IDs:

  • Dataset
  • DatasetField
  • DatasetSchema
  • Cluster
  • Layer
  • Tag

Note: This also includes refactoring the affected areas due to the above modifications.

4.fixed the FE GraphQL.

5.removed all old layers and Infoboxes from the FE.

What I haven't done

  • There are still some removable components in the property package.
  • The removal of Infobox components is incomplete.

How I tested

Which point I want you to review particularly

Memo

Summary by CodeRabbit

  • New Features

    • Added a Makefile target to clear Go caches, simplifying development routines.
  • Refactor

    • Simplified our GraphQL API by removing legacy layer, infobox, and dataset fields.
    • Eliminated outdated data loaders, converters, and resolvers for layers, properties, tags, and datasets, streamlining internal architecture.
    • Updated plugin and scene logic by discarding deprecated dataset functionalities.
    • Removed references to linked datasets and their schemas across multiple models, reducing complexity.
    • Removed dataset schema and dataset functionalities, enhancing overall code simplicity.
  • Chores

    • Removed export endpoints, HTTP handlers, and redundant tests related to layers and datasets.

Copy link

coderabbitai bot commented Feb 27, 2025

Walkthrough

This pull request introduces a new Makefile target called run-clear-cache that runs Go’s cache cleaning commands. In addition, a large-scale refactoring was performed: several GraphQL schemas, resolvers, and dataloader functions dealing with layers, infoboxes, and properties were removed; HTTP routes for exporting layers and datasets were deleted; and entire legacy modules and interfaces related to datasets, layers, tags, and their supporting infrastructure (both memory and Mongo implementations) have been removed. The overall changes streamline the codebase by eliminating deprecated and unused functionality.

Changes

File(s) Change Summary
server/Makefile Added new target run-clear-cache to execute go clean -cache -modcache -testcache -fuzzcache, updated help text and .PHONY declaration.
server/gql/*.graphql (layer.graphql, property.graphql, storytelling.graphql) Removed definitions and fields related to Layer, including types, interfaces, and fields in Property and StoryPage.
server/internal/adapter/gql/gqldataloader/*, server/internal/adapter/gql/loader_layer.go, server/internal/adapter/gql/resolver_layer.go Deleted generation of layer-related dataloaders and removed resolvers for layers, infoboxes, and associated fields.
server/internal/adapter/gql/resolver_Storytelling.go, server/internal/adapter/gql/resolver_property.go Removed methods that fetched or processed layers in storytelling and property resolvers.
server/internal/app/app.go, server/internal/app/private.go, server/internal/adapter/http/dataset.go Removed HTTP routes and handler functions for exporting layers and datasets.
server/internal/infrastructure/memory/*, server/internal/infrastructure/mongo/* Removed repository components and methods related to DatasetSchema, Dataset, Layer, and Tag from both the in‑memory and Mongo implementations.
server/internal/usecase/interactor/* Eliminated interactor methods and types related to layer, dataset, tag, and merged property operations; simplified error handling (e.g. plugin errors).
server/internal/usecase/interfaces/* Deleted Dataset and Layer interfaces and related parameter types, fields, and error variables.
server/internal/usecase/repo/* Removed repository interface fields for DatasetSchema, Dataset, Layer, and Tag from the container and their associated loader functions.
server/pkg/dataset/* Deleted numerous files (e.g. builder.go, csvparser.go, dataset.go, export.go, schema.go, etc.) that implemented dataset parsing, building, exporting, and internal data structures.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant M as Makefile
    participant C as Go Toolchain

    U->>M: Run `make run-clear-cache`
    M->>C: Execute command "go clean -cache -modcache -testcache -fuzzcache"
    C-->>M: Cache cleared confirmation
    M-->>U: Output confirmation message
Loading

Possibly related PRs

Suggested reviewers

  • soneda-yuya
  • mkumbobeaty
  • pyshx

Poem

I'm a little bunny, swift and keen,
Hop and skip through all unseen.
Cache is cleared with a magic command,
Old code hops away from our land.
In fields of refactored lines we play,
Cheery codes leap into a bright new day! 🐇✨


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

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.

@hexaforce hexaforce self-assigned this Feb 27, 2025
@github-actions github-actions bot requested a review from m-abe-dev February 27, 2025 08:56
Copy link

netlify bot commented Feb 27, 2025

Deploy Preview for reearth-web canceled.

Name Link
🔨 Latest commit 2e47348
🔍 Latest deploy log https://app.netlify.com/sites/reearth-web/deploys/67c17f489d0d1f000824cf2f

@hexaforce hexaforce changed the title Feat/remove layer tag dataset3 feat(): remove layer tag dataset3 Feb 27, 2025
@hexaforce hexaforce changed the title feat(): remove layer tag dataset3 feat(server): remove layer tag dataset3 Feb 27, 2025
@hexaforce hexaforce changed the title feat(server): remove layer tag dataset3 feat(server): remove layer tag dataset Feb 27, 2025
@hexaforce hexaforce changed the title feat(server): remove layer tag dataset feat(server): remove layer tag dataset [VIZ-BE-582] Feb 27, 2025
@hexaforce hexaforce changed the title feat(server): remove layer tag dataset [VIZ-BE-582] feat(server): remove unnecessary code [VIZ-BE-582] Feb 27, 2025
Copy link

@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)
server/internal/adapter/gql/loader_property.go (1)

57-57: Consider removing the stub method or clarifying its usage.

The FetchMerged method now returns nil, nil and provides no functionality. If it’s not needed elsewhere, removing it entirely can reduce confusion and maintenance overhead.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a8820f and e0fd0df.

⛔ Files ignored due to path filters (5)
  • server/go.sum is excluded by !**/*.sum
  • server/pkg/layer/decoding/shapetest/shapes.zip is excluded by !**/*.zip
  • web/src/services/gql/__gen__/fragmentMatcher.json is excluded by !**/__gen__/**
  • web/src/services/gql/__gen__/gql.ts is excluded by !**/__gen__/**
  • web/src/services/gql/__gen__/graphql.ts is excluded by !**/__gen__/**
📒 Files selected for processing (107)
  • server/Makefile (3 hunks)
  • server/e2e/gql_storytelling_test.go (0 hunks)
  • server/e2e/seeder.go (0 hunks)
  • server/go.mod (0 hunks)
  • server/gql/layer.graphql (0 hunks)
  • server/gql/property.graphql (0 hunks)
  • server/gql/storytelling.graphql (0 hunks)
  • server/internal/adapter/gql/gqldataloader/dataloader.go (0 hunks)
  • server/internal/adapter/gql/gqldataloader/layergrouploader_gen.go (0 hunks)
  • server/internal/adapter/gql/gqldataloader/layeritemloader_gen.go (0 hunks)
  • server/internal/adapter/gql/gqldataloader/layerloader_gen.go (0 hunks)
  • server/internal/adapter/gql/gqlmodel/convert_layer.go (0 hunks)
  • server/internal/adapter/gql/gqlmodel/convert_property.go (2 hunks)
  • server/internal/adapter/gql/gqlmodel/convert_storytelling.go (0 hunks)
  • server/internal/adapter/gql/gqlmodel/models.go (0 hunks)
  • server/internal/adapter/gql/gqlmodel/models_gen.go (0 hunks)
  • server/internal/adapter/gql/gqlmodel/scalar_id.go (0 hunks)
  • server/internal/adapter/gql/loader.go (0 hunks)
  • server/internal/adapter/gql/loader_layer.go (0 hunks)
  • server/internal/adapter/gql/loader_property.go (1 hunks)
  • server/internal/adapter/gql/resolver_Storytelling.go (0 hunks)
  • server/internal/adapter/gql/resolver_layer.go (0 hunks)
  • server/internal/adapter/gql/resolver_mutation_property.go (0 hunks)
  • server/internal/adapter/gql/resolver_property.go (0 hunks)
  • server/internal/adapter/gql/resolver_query.go (0 hunks)
  • server/internal/adapter/http/dataset.go (0 hunks)
  • server/internal/app/app.go (0 hunks)
  • server/internal/app/private.go (0 hunks)
  • server/internal/infrastructure/memory/container.go (0 hunks)
  • server/internal/infrastructure/memory/dataset.go (0 hunks)
  • server/internal/infrastructure/memory/dataset_schema.go (0 hunks)
  • server/internal/infrastructure/memory/layer.go (0 hunks)
  • server/internal/infrastructure/memory/layer_test.go (0 hunks)
  • server/internal/infrastructure/memory/property.go (1 hunks)
  • server/internal/infrastructure/memory/tag.go (0 hunks)
  • server/internal/infrastructure/memory/tag_test.go (0 hunks)
  • server/internal/infrastructure/mongo/container.go (0 hunks)
  • server/internal/infrastructure/mongo/dataset.go (0 hunks)
  • server/internal/infrastructure/mongo/dataset_schema.go (0 hunks)
  • server/internal/infrastructure/mongo/layer.go (0 hunks)
  • server/internal/infrastructure/mongo/layer_test.go (0 hunks)
  • server/internal/infrastructure/mongo/mongodoc/dataset.go (0 hunks)
  • server/internal/infrastructure/mongo/mongodoc/dataset_schema.go (0 hunks)
  • server/internal/infrastructure/mongo/mongodoc/layer.go (0 hunks)
  • server/internal/infrastructure/mongo/mongodoc/property.go (0 hunks)
  • server/internal/infrastructure/mongo/mongodoc/scene.go (0 hunks)
  • server/internal/infrastructure/mongo/mongodoc/tag.go (0 hunks)
  • server/internal/infrastructure/mongo/mongodoc/tag_test.go (0 hunks)
  • server/internal/infrastructure/mongo/property.go (0 hunks)
  • server/internal/infrastructure/mongo/tag.go (0 hunks)
  • server/internal/usecase/gateway/container.go (0 hunks)
  • server/internal/usecase/gateway/datasouce.go (0 hunks)
  • server/internal/usecase/interactor/common.go (1 hunks)
  • server/internal/usecase/interactor/dataset.go (0 hunks)
  • server/internal/usecase/interactor/layer.go (0 hunks)
  • server/internal/usecase/interactor/layer_test.go (0 hunks)
  • server/internal/usecase/interactor/nlslayer.go (10 hunks)
  • server/internal/usecase/interactor/plugin.go (0 hunks)
  • server/internal/usecase/interactor/plugin_upload.go (1 hunks)
  • server/internal/usecase/interactor/plugin_upload_test.go (1 hunks)
  • server/internal/usecase/interactor/project.go (2 hunks)
  • server/internal/usecase/interactor/property.go (0 hunks)
  • server/internal/usecase/interactor/scene.go (1 hunks)
  • server/internal/usecase/interactor/scene_plugin.go (3 hunks)
  • server/internal/usecase/interactor/scene_plugin_test.go (2 hunks)
  • server/internal/usecase/interactor/storytelling.go (2 hunks)
  • server/internal/usecase/interactor/storytelling_test.go (0 hunks)
  • server/internal/usecase/interactor/tag.go (0 hunks)
  • server/internal/usecase/interfaces/common.go (0 hunks)
  • server/internal/usecase/interfaces/dataset.go (0 hunks)
  • server/internal/usecase/interfaces/layer.go (0 hunks)
  • server/internal/usecase/interfaces/property.go (0 hunks)
  • server/internal/usecase/interfaces/scene.go (0 hunks)
  • server/internal/usecase/interfaces/tag.go (0 hunks)
  • server/internal/usecase/repo/container.go (0 hunks)
  • server/internal/usecase/repo/dataset.go (0 hunks)
  • server/internal/usecase/repo/dataset_schema.go (0 hunks)
  • server/internal/usecase/repo/layer.go (0 hunks)
  • server/internal/usecase/repo/property.go (0 hunks)
  • server/internal/usecase/repo/tag.go (0 hunks)
  • server/pkg/dataset/builder.go (0 hunks)
  • server/pkg/dataset/csvparser.go (0 hunks)
  • server/pkg/dataset/csvparser_test.go (0 hunks)
  • server/pkg/dataset/dataset.go (0 hunks)
  • server/pkg/dataset/dataset_test.go (0 hunks)
  • server/pkg/dataset/diff.go (0 hunks)
  • server/pkg/dataset/export.go (0 hunks)
  • server/pkg/dataset/export_test.go (0 hunks)
  • server/pkg/dataset/field.go (0 hunks)
  • server/pkg/dataset/graph_iterator.go (0 hunks)
  • server/pkg/dataset/graph_iterator_test.go (0 hunks)
  • server/pkg/dataset/graph_loader.go (0 hunks)
  • server/pkg/dataset/id.go (0 hunks)
  • server/pkg/dataset/list.go (0 hunks)
  • server/pkg/dataset/list_test.go (0 hunks)
  • server/pkg/dataset/loader.go (0 hunks)
  • server/pkg/dataset/schema.go (0 hunks)
  • server/pkg/dataset/schema_builder.go (0 hunks)
  • server/pkg/dataset/schema_field.go (0 hunks)
  • server/pkg/dataset/schema_field_builder.go (0 hunks)
  • server/pkg/dataset/schema_field_diff.go (0 hunks)
  • server/pkg/dataset/schema_graph_iterator.go (0 hunks)
  • server/pkg/dataset/schema_graph_iterator_test.go (0 hunks)
  • server/pkg/dataset/schema_list.go (0 hunks)
  • server/pkg/dataset/schema_list_test.go (0 hunks)
  • server/pkg/dataset/schema_test.go (0 hunks)
  • server/pkg/dataset/value.go (0 hunks)
⛔ Files not processed due to max files limit (38)
  • server/pkg/dataset/value_optional.go
  • server/pkg/dataset/value_optional_test.go
  • server/pkg/dataset/value_test.go
  • server/pkg/id/id.go
  • server/pkg/layer/builder.go
  • server/pkg/layer/decoding/common.go
  • server/pkg/layer/decoding/common_test.go
  • server/pkg/layer/decoding/czml.go
  • server/pkg/layer/decoding/czml_test.go
  • server/pkg/layer/decoding/decoder.go
  • server/pkg/layer/decoding/format.go
  • server/pkg/layer/decoding/geojson.go
  • server/pkg/layer/decoding/geojson_test.go
  • server/pkg/layer/decoding/kml.go
  • server/pkg/layer/decoding/kml_test.go
  • server/pkg/layer/decoding/reearth.go
  • server/pkg/layer/decoding/reearth_test.go
  • server/pkg/layer/decoding/shp.go
  • server/pkg/layer/decoding/shp_test.go
  • server/pkg/layer/encoding/common.go
  • server/pkg/layer/encoding/common_test.go
  • server/pkg/layer/encoding/czml.go
  • server/pkg/layer/encoding/czml_test.go
  • server/pkg/layer/encoding/encoder.go
  • server/pkg/layer/encoding/exporter.go
  • server/pkg/layer/encoding/geojson.go
  • server/pkg/layer/encoding/geojson_test.go
  • server/pkg/layer/encoding/kml.go
  • server/pkg/layer/encoding/kml_test.go
  • server/pkg/layer/encoding/shp.go
  • server/pkg/layer/encoding/shp_test.go
  • server/pkg/layer/group.go
  • server/pkg/layer/group_builder.go
  • server/pkg/layer/group_builder_test.go
  • server/pkg/layer/group_test.go
  • server/pkg/layer/id.go
  • server/pkg/layer/id_list.go
  • server/pkg/layer/id_list_test.go
💤 Files with no reviewable changes (94)
  • server/internal/usecase/gateway/container.go
  • server/internal/adapter/gql/gqlmodel/convert_storytelling.go
  • server/gql/property.graphql
  • server/internal/usecase/interactor/storytelling_test.go
  • server/pkg/dataset/diff.go
  • server/e2e/gql_storytelling_test.go
  • server/internal/adapter/gql/gqlmodel/scalar_id.go
  • server/internal/usecase/repo/property.go
  • server/internal/infrastructure/mongo/property.go
  • server/go.mod
  • server/internal/adapter/gql/resolver_mutation_property.go
  • server/internal/infrastructure/mongo/mongodoc/scene.go
  • server/internal/infrastructure/memory/layer_test.go
  • server/e2e/seeder.go
  • server/internal/infrastructure/mongo/layer_test.go
  • server/pkg/dataset/csvparser_test.go
  • server/internal/usecase/interfaces/common.go
  • server/pkg/dataset/export.go
  • server/internal/usecase/gateway/datasouce.go
  • server/gql/storytelling.graphql
  • server/internal/usecase/interactor/plugin.go
  • server/internal/app/private.go
  • server/internal/usecase/repo/container.go
  • server/internal/adapter/gql/resolver_query.go
  • server/internal/infrastructure/memory/tag_test.go
  • server/pkg/dataset/graph_iterator_test.go
  • server/pkg/dataset/list_test.go
  • server/internal/usecase/interfaces/property.go
  • server/internal/usecase/repo/tag.go
  • server/pkg/dataset/loader.go
  • server/internal/adapter/gql/resolver_property.go
  • server/internal/infrastructure/memory/container.go
  • server/pkg/dataset/schema_graph_iterator_test.go
  • server/internal/adapter/gql/loader.go
  • server/internal/adapter/gql/resolver_Storytelling.go
  • server/internal/usecase/repo/dataset.go
  • server/internal/usecase/interactor/layer_test.go
  • server/internal/adapter/gql/resolver_layer.go
  • server/internal/adapter/gql/gqldataloader/dataloader.go
  • server/pkg/dataset/dataset_test.go
  • server/internal/adapter/gql/gqlmodel/models.go
  • server/pkg/dataset/graph_iterator.go
  • server/internal/usecase/repo/layer.go
  • server/pkg/dataset/schema_field_diff.go
  • server/internal/adapter/http/dataset.go
  • server/internal/adapter/gql/gqlmodel/convert_layer.go
  • server/pkg/dataset/schema_list.go
  • server/internal/usecase/interfaces/tag.go
  • server/internal/infrastructure/mongo/mongodoc/property.go
  • server/internal/infrastructure/mongo/mongodoc/tag_test.go
  • server/pkg/dataset/schema_field_builder.go
  • server/internal/usecase/interactor/property.go
  • server/internal/app/app.go
  • server/pkg/dataset/schema_test.go
  • server/pkg/dataset/schema_field.go
  • server/pkg/dataset/builder.go
  • server/internal/usecase/interfaces/scene.go
  • server/pkg/dataset/schema_graph_iterator.go
  • server/pkg/dataset/export_test.go
  • server/gql/layer.graphql
  • server/pkg/dataset/schema_list_test.go
  • server/internal/usecase/interfaces/dataset.go
  • server/pkg/dataset/schema_builder.go
  • server/internal/usecase/interactor/tag.go
  • server/internal/infrastructure/memory/dataset_schema.go
  • server/internal/infrastructure/memory/dataset.go
  • server/pkg/dataset/dataset.go
  • server/internal/usecase/repo/dataset_schema.go
  • server/internal/adapter/gql/gqldataloader/layergrouploader_gen.go
  • server/pkg/dataset/field.go
  • server/pkg/dataset/csvparser.go
  • server/internal/infrastructure/mongo/mongodoc/dataset.go
  • server/internal/adapter/gql/gqldataloader/layerloader_gen.go
  • server/internal/adapter/gql/gqlmodel/models_gen.go
  • server/internal/usecase/interfaces/layer.go
  • server/internal/infrastructure/mongo/dataset.go
  • server/internal/infrastructure/mongo/dataset_schema.go
  • server/internal/infrastructure/mongo/mongodoc/dataset_schema.go
  • server/pkg/dataset/schema.go
  • server/pkg/dataset/list.go
  • server/internal/infrastructure/mongo/mongodoc/tag.go
  • server/internal/infrastructure/mongo/mongodoc/layer.go
  • server/internal/usecase/interactor/dataset.go
  • server/pkg/dataset/value.go
  • server/internal/infrastructure/mongo/container.go
  • server/internal/infrastructure/mongo/layer.go
  • server/internal/adapter/gql/loader_layer.go
  • server/internal/infrastructure/mongo/tag.go
  • server/internal/infrastructure/memory/layer.go
  • server/pkg/dataset/graph_loader.go
  • server/pkg/dataset/id.go
  • server/internal/usecase/interactor/layer.go
  • server/internal/adapter/gql/gqldataloader/layeritemloader_gen.go
  • server/internal/infrastructure/memory/tag.go
✅ Files skipped from review due to trivial changes (1)
  • server/internal/usecase/interactor/plugin_upload_test.go
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: ci-server / ci-server-test
  • GitHub Check: Redirect rules - reearth-web
  • GitHub Check: Header rules - reearth-web
  • GitHub Check: Pages changed - reearth-web
🔇 Additional comments (33)
server/internal/usecase/interactor/scene_plugin_test.go (2)

72-72: Consistent error reference update.

The error reference has been correctly updated from interfaces.ErrPluginNotFound to ErrPluginNotFound as part of the code cleanup. This is in line with the PR objective of removing unnecessary code and dependencies.


79-79: Consistent error reference update.

The error reference has been updated from interfaces.ErrPluginNotFound to ErrPluginNotFound, matching the same change in line 72. This maintains consistency in error handling throughout the file.

server/internal/usecase/interactor/scene_plugin.go (2)

45-45: Error handling refactored to use local error constant.

The code has been updated to use ErrPluginNotFound directly instead of interfaces.ErrPluginNotFound. This change aligns with the PR objective of removing unnecessary code and simplifying dependencies.

Ensure that ErrPluginNotFound is properly defined in this package and that all other references throughout the codebase have been updated consistently.

Also applies to: 50-50, 53-53, 110-110, 192-192


82-158: Layer operations removed from plugin uninstallation.

The code for plugin uninstallation has been simplified by removing layer operations, which is consistent with the PR objective of eliminating unused layer-related code. The current implementation now focuses only on handling properties and widgets.

The refactoring streamlines the codebase while maintaining the core functionality. Make sure that any UI components or client code that might have depended on layer operations during plugin uninstallation have been updated accordingly.

server/internal/usecase/interactor/nlslayer.go (12)

38-54: Good addition of local error variables

These error variables were likely moved from the removed interfaces package. The addition is well-structured with consistent formatting and follows Go's error handling best practices.


246-302: Simplified error handling in Remove method

The removal of the interfaces.ErrCannotRemoveLayerToLinkedLayerGroup check simplifies the control flow in this method while maintaining the core functionality.


388-388: Error variable migration from interfaces package

Replaced interfaces.ErrInfoboxAlreadyExists with the locally defined error variable.


446-446: Error variable migration from interfaces package

Replaced interfaces.ErrInfoboxNotFound with the locally defined error variable.


478-478: Error variable migration from interfaces package

Replaced interfaces.ErrPluginNotFound with the locally defined error variable.


489-489: Error variable migration from interfaces package

Replaced interfaces.ErrExtensionNotFound with the locally defined error variable.


523-523: Error variable migration from interfaces package

Replaced interfaces.ErrInfoboxNotFound with the locally defined error variable.


531-531: Error variable migration from interfaces package

Replaced interfaces.ErrExtensionTypeMustBeBlock with the locally defined error variable.


601-601: Error variable migration from interfaces package

Replaced interfaces.ErrInfoboxNotFound with the locally defined error variable.


648-648: Error variable migration from interfaces package

Replaced interfaces.ErrInfoboxNotFound with the locally defined error variable.


774-774: Error variable migration from interfaces package

Replaced interfaces.ErrSketchNotFound with the locally defined error variable.


840-840: Error variable migration from interfaces package

Replaced interfaces.ErrSketchNotFound with the locally defined error variable.

server/Makefile (3)

23-23: Good addition to help text.

Thank you for adding a helpful description for the run-clear-cache target. This improves the discoverability of the new Makefile command.


93-95: Command properly clears Go caches.

go clean -cache -modcache -testcache -fuzzcache is a comprehensive approach to clearing caches, ensuring a fresh build environment.


116-116: Properly included in .PHONY list.

Adding run-clear-cache to .PHONY clarifies that this target is not associated with any file, preventing potential naming conflicts.

server/internal/adapter/gql/gqlmodel/convert_property.go (2)

337-339: Ensure the logic aligns with merged property requirements.

These lines drop additional fields and set Groups to nil. Confirm that Groups will be populated by the resolver or other logic, and verify removing any references to datasets or older fields does not break the property resolution flow.


349-351: Schema reference updated.

This change substitutes older references with SchemaID, OriginalID, and ParentID gleaned from m.Schema. It looks consistent with the removal of dataset coupling. Keep an eye on any place that depends on the old dataset or layer references.

server/internal/infrastructure/memory/property.go (1)

78-78:

✅ Verification successful

Simplified property filtering logic

The condition for including properties in the FindLinkedAll method has been simplified to only check if the property's scene matches the provided scene ID. According to the PR summary, this is part of removing unused dataset-related functionality.

To ensure this change doesn't impact existing code, verify that no consumers of this method depend on the previous behavior that apparently included additional checks for linked fields:


🏁 Script executed:

#!/bin/bash
# Search for usages of FindLinkedAll to verify impact
rg "FindLinkedAll" --type go

Length of output: 422


Property Filtering Simplification Verified

The simplified condition in the memory implementation now solely checks for a matching scene ID (if p.Scene() == s), aligning with the cleanup of unused dataset-related checks as mentioned in the PR summary. A search for FindLinkedAll usages (found in server/internal/usecase/repo/property.go and server/internal/infrastructure/mongo/property.go) did not reveal any dependency on the previously extra linked field validations.

No further action is required.

server/internal/usecase/interactor/project.go (3)

35-48: Good removal of unused dependencies.
These fields cleanly replace old references to dataset/layer/tag repos with the appropriate new repos. No immediate concerns regarding type safety or null references.


52-65: No issues found with the constructor.
All fields are properly initialized, and references to old dataset/layer/tag repositories are fully removed.


482-484: SceneDeleter initialization is concise.
The references to Scene, SceneLock, and Property align with the rest of the refactoring.

server/internal/usecase/interactor/common.go (1)

143-146: Proper cleanup of SceneDeleter fields.
Removing unused references to layers/datasets keeps the codebase aligned with the stated objectives of this PR.

server/internal/usecase/interactor/scene.go (2)

743-744: Updated error reference.
Switching to ErrPluginNotFound improves consistency with distinct error definitions.


749-750: Updated error reference.
Using ErrExtensionNotFound is consistent with the new error conventions.

server/internal/usecase/interactor/storytelling.go (3)

1128-1128: Error constant refactoring is consistent.

The change from interfaces.ErrPluginNotFound to ErrPluginNotFound is part of the larger codebase cleanup, moving error definitions to a more appropriate location. This aligns with the PR's objective of removing unnecessary code and dependencies.


1139-1139: Error constant refactoring is consistent.

Similar to the previous change, replacing interfaces.ErrExtensionNotFound with ErrExtensionNotFound is consistent with the PR's refactoring goals, moving error definitions from the interfaces package.


366-370: Simplification of builder initialization confirms removal of unused dependencies.

This code confirms the successful removal of unnecessary loaders from the builder.New() call (specifically the layer, dataset, and tag loaders mentioned in the PR description). The implementation now uses only the property and NLS layer loaders that are necessary for the current functionality.

server/internal/usecase/interactor/plugin_upload.go (2)

295-297:

❓ Verification inconclusive

Confirm simplified block deletion aligns with overall refactoring.

Similar to the layer deletion function above, this function has been simplified to a stub that returns an empty property ID slice. This appears consistent with the PR's goal of removing unnecessary code.

Since both of these methods previously returned property IDs that would be deleted, make sure that plugin migration still functions correctly without these deletions occurring.


🏁 Script executed:

#!/bin/bash
# Check if there are any calls to these methods elsewhere in the codebase
rg "deleteLayersByPluginExtension|deleteBlocksByPluginExtension" --type go --files-with-matches server/

Length of output: 157


Action Required: Verify Plugin Migration Integrity with Simplified Deletion Stubs

The simplified implementation of deleteBlocksByPluginExtension—returning an empty property ID slice—is consistent with the refactoring direction demonstrated by the similar handling of deleteLayersByPluginExtension. Our search confirms these methods are only referenced within the server/internal/usecase/interactor/plugin_upload.go file, indicating no hidden external dependencies.

Please ensure that the plugin migration process remains robust. In particular, verify that the removal of these deletion operations does not unintentionally affect plugin data cleanup during migration.


291-293:

❓ Verification inconclusive

Confirm simplified layer deletion aligns with overall refactoring.

The layer deletion functionality has been completely removed, leaving just an empty stub. This change aligns with the PR objective to remove unused layer-related code. Since the property IDs returned by this method are still used in the migrateScenePlugin function, verify that returning an empty slice won't cause issues with plugin migration workflows.


🏁 Script executed:

#!/bin/bash
# Check for any remaining references to layerRepo in this package
rg "layerRepo\." --type go server/internal/usecase/interactor/

Length of output: 3825


Layer Deletion Refactoring – Verify Empty Return Is Handled in Migration

The simplified deletion function now just returns an empty slice, which appears aligned with the goal of removing unused layer deletion code. Our search shows that the remaining layer‐related operations (via the nlslayerRepo) are confined to other files (e.g. in nlslayer.go) and no other part of the interactor package explicitly expects non‐empty property ID results. However, since the property IDs from this method are passed into the migrateScenePlugin workflow, please ensure that the migration logic correctly handles an empty slice (for instance, by safely iterating over it or skipping deletion steps when no IDs are returned).

• Confirm that migrateScenePlugin (or any caller) does not assume a non‑empty slice and that its behavior remains correct without further layer deletions.
• Validate via tests or manual review that no unintended side effects occur in the migration workflow.

Copy link

@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: 1

🔭 Outside diff range comments (2)
server/internal/adapter/gql/gqlmodel/models_gen.go (2)

1542-1571: 🛠️ Refactor suggestion

Remove unused NodeType enum values

The enum values NodeTypeDatasetSchema, NodeTypeDataset, NodeTypeLayerGroup, and NodeTypeLayerItem are still defined, even though the corresponding types have been removed from the codebase. This could lead to confusion or errors if these node types are referenced elsewhere.

type NodeType string

const (
	NodeTypeAsset          NodeType = "ASSET"
	NodeTypeUser           NodeType = "USER"
	NodeTypeTeam           NodeType = "TEAM"
	NodeTypeProject        NodeType = "PROJECT"
	NodeTypePlugin         NodeType = "PLUGIN"
	NodeTypeScene          NodeType = "SCENE"
	NodeTypePropertySchema NodeType = "PROPERTY_SCHEMA"
	NodeTypeProperty       NodeType = "PROPERTY"
-	NodeTypeDatasetSchema  NodeType = "DATASET_SCHEMA"
-	NodeTypeDataset        NodeType = "DATASET"
-	NodeTypeLayerGroup     NodeType = "LAYER_GROUP"
-	NodeTypeLayerItem      NodeType = "LAYER_ITEM"
)

var AllNodeType = []NodeType{
	NodeTypeAsset,
	NodeTypeUser,
	NodeTypeTeam,
	NodeTypeProject,
	NodeTypePlugin,
	NodeTypeScene,
	NodeTypePropertySchema,
	NodeTypeProperty,
-	NodeTypeDatasetSchema,
-	NodeTypeDataset,
-	NodeTypeLayerGroup,
-	NodeTypeLayerItem,
}

func (e NodeType) IsValid() bool {
	switch e {
-	case NodeTypeAsset, NodeTypeUser, NodeTypeTeam, NodeTypeProject, NodeTypePlugin, NodeTypeScene, NodeTypePropertySchema, NodeTypeProperty, NodeTypeDatasetSchema, NodeTypeDataset, NodeTypeLayerGroup, NodeTypeLayerItem:
+	case NodeTypeAsset, NodeTypeUser, NodeTypeTeam, NodeTypeProject, NodeTypePlugin, NodeTypeScene, NodeTypePropertySchema, NodeTypeProperty:
		return true
	}
	return false
}

1073-1085: 💡 Verification agent

🧩 Analysis chain

Consider refactoring StoryPage structure field names

The StoryPage structure still has LayersIds and SwipeableLayersIds fields that reference layers, even though layer-related code is being removed. Consider renaming these fields to reflect their new purpose or remove them if they're no longer needed.


🏁 Script executed:

#!/bin/bash
# Search for usage of StoryPage's layer-related fields
echo "Checking usage of LayersIds and SwipeableLayersIds..."
rg -A 5 "\\.LayersIds|\\.SwipeableLayersIds" --type go

Length of output: 2131


Action Required: Refactor StoryPage Layer Field Usage

The StoryPage struct still defines LayersIds and SwipeableLayersIds, and our search indicates that these fields are still actively referenced in the generated GraphQL code (e.g., in server/internal/adapter/gql/generated.go for nil checks and return values). If layer-related functionality is being removed, either update the field names to reflect their new purpose or remove them entirely. Please ensure that any changes are coordinated with the generated code to prevent inconsistencies.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e0fd0df and f0cea2b.

⛔ Files ignored due to path filters (2)
  • web/src/services/gql/__gen__/gql.ts is excluded by !**/__gen__/**
  • web/src/services/gql/__gen__/graphql.ts is excluded by !**/__gen__/**
📒 Files selected for processing (13)
  • server/e2e/gql_custom_property_test.go (0 hunks)
  • server/e2e/gql_project_export_import_test.go (0 hunks)
  • server/gql/property.graphql (0 hunks)
  • server/gql/storytelling.graphql (0 hunks)
  • server/gql/workspace.graphql (0 hunks)
  • server/gqlgen.yml (0 hunks)
  • server/internal/adapter/gql/gqlmodel/convert_storytelling.go (1 hunks)
  • server/internal/adapter/gql/gqlmodel/convert_workspace.go (0 hunks)
  • server/internal/adapter/gql/gqlmodel/convert_workspace_test.go (0 hunks)
  • server/internal/adapter/gql/gqlmodel/models.go (0 hunks)
  • server/internal/adapter/gql/gqlmodel/models_gen.go (3 hunks)
  • server/internal/adapter/gql/loader_property.go (0 hunks)
  • server/internal/adapter/gql/resolver_property.go (1 hunks)
💤 Files with no reviewable changes (10)
  • server/internal/adapter/gql/gqlmodel/convert_workspace.go
  • server/internal/adapter/gql/loader_property.go
  • server/e2e/gql_custom_property_test.go
  • server/internal/adapter/gql/gqlmodel/convert_workspace_test.go
  • server/gql/workspace.graphql
  • server/gql/storytelling.graphql
  • server/gqlgen.yml
  • server/internal/adapter/gql/gqlmodel/models.go
  • server/e2e/gql_project_export_import_test.go
  • server/gql/property.graphql
🚧 Files skipped from review as they are similar to previous changes (1)
  • server/internal/adapter/gql/gqlmodel/convert_storytelling.go
🔇 Additional comments (4)
server/internal/adapter/gql/resolver_property.go (2)

98-103:

❓ Verification inconclusive

Simplified Groups method returns nil for cases that previously fetched data

The Groups method now simply returns nil, nil when obj.Groups is nil, whereas previously it attempted to fetch and process merged property groups. This change is consistent with removing layer functionality, but ensure that any front-end code relying on this resolver has been updated to handle the absence of this data.


🏁 Script executed:

#!/bin/bash
# Search for GraphQL queries that expect merged property groups
echo "Searching for GraphQL queries that might be affected by this change..."
rg -t js -t ts "MergedPropertyGroup" --glob '!node_modules'

Length of output: 16736


Attention: Check Front-End Handling for Nil MergedPropertyGroup Data

The updated Groups resolver in server/internal/adapter/gql/resolver_property.go (lines 98–103) now returns nil, nil when obj.Groups is nil, instead of processing group data as it did previously. The GraphQL fragments and types in files like web/src/services/gql/fragments/property.ts and the generated files under web/src/services/gql/__gen__ still reference MergedPropertyGroup. Please verify that the front-end code consuming this resolver is updated to gracefully handle a nil response or an empty array for merged property groups. Consider checking that:

  • Queries expecting merged property group details (e.g., through fragments such as MergedPropertyGroupCommonFragment and MergedPropertyGroupFragment) correctly handle cases where group data is absent.
  • Downstream UI logic is robust against receiving nil instead of a populated group list.

43-45:

❓ Verification inconclusive

Verify downstream impact of simplifying the Merged method

The Merged method has been significantly simplified to just return nil, nil, removing all previous layer-related functionality. This aligns with the PR's goal of removing the layer package, but verify that any GraphQL clients expecting merged property data have been updated accordingly to handle this change.


🏁 Script executed:

#!/bin/bash
# Search for GraphQL queries that expect merged property data
echo "Searching for GraphQL queries that might be affected by this change..."
rg -t js -t ts "MergedProperty" --glob '!node_modules'

Length of output: 17815


Action Required: Confirm Client Handling of Null Merged Property
The Merged resolver has been simplified to return nil, nil, effectively removing its prior merging logic. The downstream GraphQL clients still reference various MergedProperty fragments and types across the codebase. Please ensure that:

  • Client queries and fragments (e.g. in web/src/services/api/propertyApi/utils.ts, web/src/services/gql/fragments/property.ts, and the generated files in web/src/services/gql/__gen__) are updated to gracefully handle a null merged property.
  • Any potential runtime dependencies on non-null merged property data are refactored to avoid errors, now that the field will consistently be empty.
server/internal/adapter/gql/gqlmodel/models_gen.go (2)

414-422: LGTM: MergedProperty structure appropriately modified

The MergedProperty structure has been properly refactored to remove fields related to layers, which aligns with the PR objective of removing unnecessary layer-related code.


1061-1068: LGTM: StoryBlock structure properly maintained

The StoryBlock structure has been correctly preserved while other unnecessary components have been removed.

Comment on lines 395 to 400
type LinkDatasetToPropertyValueInput struct {
PropertyID ID `json:"propertyId"`
SchemaGroupID *ID `json:"schemaGroupId,omitempty"`
ItemID *ID `json:"itemId,omitempty"`
FieldID ID `json:"fieldId"`
DatasetSchemaIds []ID `json:"datasetSchemaIds"`
DatasetSchemaFieldIds []ID `json:"datasetSchemaFieldIds"`
DatasetIds []ID `json:"datasetIds,omitempty"`
PropertyID ID `json:"propertyId"`
SchemaGroupID *ID `json:"schemaGroupId,omitempty"`
ItemID *ID `json:"itemId,omitempty"`
FieldID ID `json:"fieldId"`
}
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Consider removing LinkDatasetToPropertyValueInput structure

This PR aims to remove unnecessary code related to datasets, yet this input structure remains. If datasets are being completely removed, this structure might be unnecessary.


🏁 Script executed:

#!/bin/bash
# Check if this struct is still being referenced elsewhere in the codebase
echo "Checking references to LinkDatasetToPropertyValueInput..."
rg -l "LinkDatasetToPropertyValueInput" | grep -v "models_gen.go"

Length of output: 355


Action: Review the usage of LinkDatasetToPropertyValueInput across the codebase

The structure is still in use—references were found in:

  • web/src/services/gql/__gen__/graphql.ts
  • server/gql/property.graphql
  • server/internal/adapter/gql/resolver_mutation_property.go
  • server/internal/adapter/gql/generated.go

If the goal is to completely remove dataset-related code, please ensure that all consumers of this input structure are updated or removed accordingly to avoid breaking changes. If these references are still needed, please retain the structure.

Copy link

@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)
server/internal/adapter/gql/gqlmodel/models_gen.go (1)

1564-1564:

❓ Verification inconclusive

Consider removing unused layer-related node types.
If NodeTypeLayerGroup and NodeTypeLayerItem are no longer relevant due to the code removals, please remove them from this enum to keep it clean and consistent. Otherwise, confirm they are still in use:

If no references exist besides this line, you can safely remove them:

- case NodeTypeAsset, NodeTypeUser, NodeTypeTeam, NodeTypeProject, NodeTypePlugin, NodeTypeScene, NodeTypePropertySchema, NodeTypeProperty, NodeTypeLayerGroup, NodeTypeLayerItem:
+ case NodeTypeAsset, NodeTypeUser, NodeTypeTeam, NodeTypeProject, NodeTypePlugin, NodeTypeScene, NodeTypePropertySchema, NodeTypeProperty:

🏁 Script executed:

#!/bin/bash
# Checking references for NodeTypeLayerGroup and NodeTypeLayerItem across the codebase
rg -A 5 "NodeTypeLayerGroup"
rg -A 5 "NodeTypeLayerItem"

Length of output: 2690


Action Required: Verify and Remove Unused Layer Node Types
The repository search indicates that both NodeTypeLayerGroup and NodeTypeLayerItem are referenced only within the generated file (server/internal/adapter/gql/gqlmodel/models_gen.go). If these types are no longer needed—especially given recent code removals—they can be safely removed to clean up the enum.

Next Steps:

  • Confirm external dependencies: Double-check that removing these types does not affect external clients or API contracts.
  • If removal is safe, update the file by:
    • Removing NodeTypeLayerGroup and NodeTypeLayerItem from the enum declaration (e.g., in the AllNodeType slice).
    • Removing them from the switch statement in the IsValid() method.

Diff Example:

- case NodeTypeAsset, NodeTypeUser, NodeTypeTeam, NodeTypeProject, NodeTypePlugin, NodeTypeScene, NodeTypePropertySchema, NodeTypeProperty, NodeTypeLayerGroup, NodeTypeLayerItem:
+ case NodeTypeAsset, NodeTypeUser, NodeTypeTeam, NodeTypeProject, NodeTypePlugin, NodeTypeScene, NodeTypePropertySchema, NodeTypeProperty:
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f0cea2b and be74251.

⛔ Files ignored due to path filters (1)
  • web/src/services/gql/__gen__/graphql.ts is excluded by !**/__gen__/**
📒 Files selected for processing (5)
  • server/gql/_shared.graphql (1 hunks)
  • server/gql/property.graphql (0 hunks)
  • server/gqlgen.yml (0 hunks)
  • server/internal/adapter/gql/gqlmodel/models_gen.go (3 hunks)
  • server/internal/adapter/gql/resolver_mutation_property.go (0 hunks)
💤 Files with no reviewable changes (3)
  • server/internal/adapter/gql/resolver_mutation_property.go
  • server/gqlgen.yml
  • server/gql/property.graphql
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: deploy-server / deploy_test
  • GitHub Check: Redirect rules - reearth-web
  • GitHub Check: Header rules - reearth-web
  • GitHub Check: Pages changed - reearth-web
🔇 Additional comments (4)
server/gql/_shared.graphql (2)

18-29: Removal of Deprecated Enum Values

The NodeType enum no longer includes the DATASET_SCHEMA and DATASET values. This update aligns with the PR objectives to eliminate unused code and simplify the server-side schema. Please verify that downstream systems, such as GraphQL resolvers and front-end queries, do not depend on these removed values.


40-45: Improved Formatting on Pagination Input

The change from input Pagination{ to input Pagination { enhances readability and consistency with the rest of the schema formatting. This is a simple, non-functional cosmetic improvement.

server/internal/adapter/gql/gqlmodel/models_gen.go (2)

408-414: Looks good.
These fields within MergedProperty appear to be valid references to remaining property functionality. They do not seem tied to the removed dataset/layer code, so there is no immediate concern here.


1054-1060: No issues found.
The updated fields in StoryBlock look consistent with the new plugin-based architecture and do not appear to be referencing any removed dataset or layer components.

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