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

chore(server): refactoring id scene #1429

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

Conversation

hexaforce
Copy link
Contributor

@hexaforce hexaforce commented Feb 17, 2025

Overview

Refactoring ids

What I've done

This pull request unifies the scene IDs to the ones in ./server/pkg/id/id.go.

I removed the parts that were redefining the ID from id.go.

  • type SceneID

What I haven't done

How I tested

Which point I want you to review particularly

Since each id.go declares different ID types, they are not unified.

Example: SceneID
Each package defines SceneID separately:

server/pkg/dataset/id.go:
  8: type SceneID = id.SceneID
server/pkg/layer/id.go:
  12: type SceneID = id.SceneID
server/pkg/nlslayer/id.go:
  10: type SceneID = id.SceneID
server/pkg/plugin/id.go:
  9: type SceneID = id.SceneID
server/pkg/project/id.go:
  10: type SceneID = id.SceneID
server/pkg/property/id.go:
  15: type SceneID = id.SceneID
server/pkg/storytelling/id.go:
  8: type SceneID = id.SceneID
server/pkg/tag/id.go:
  6: type SceneID = id.SceneID

These all end up being different SceneID types.

Memo

Each package has its own id.go.

$ find . -name id.go
./server/pkg/id/id.go
./server/pkg/asset/id.go
./server/pkg/property/id.go
./server/pkg/dataset/id.go
./server/pkg/plugin/id.go
./server/pkg/nlslayer/id.go
./server/pkg/project/id.go
./server/pkg/layer/id.go
./server/pkg/storytelling/id.go
./server/pkg/scene/id.go
./server/pkg/tag/id.go

Ideal Refactoring

Ideally, we should keep only ./server/pkg/id/id.go and remove the id.go files in each package.

Summary by CodeRabbit

Summary by CodeRabbit

  • Refactor
    • Improved internal consistency by refining identifier types across core modules to enhance code clarity and maintainability.
  • Tests
    • Updated test cases to reflect the identifier improvements and ensure ongoing robustness.

These internal improvements streamline the system’s foundations without affecting end-user functionality.

@hexaforce hexaforce requested a review from pyshx as a code owner February 17, 2025 05:52
Copy link

coderabbitai bot commented Feb 17, 2025

Warning

Rate limit exceeded

@hexaforce has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 15 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between f5e2247 and 9a53f13.

📒 Files selected for processing (69)
  • server/internal/usecase/repo/container.go (2 hunks)
  • server/pkg/dataset/builder.go (2 hunks)
  • server/pkg/dataset/csvparser.go (2 hunks)
  • server/pkg/dataset/dataset.go (2 hunks)
  • server/pkg/dataset/id.go (0 hunks)
  • server/pkg/dataset/schema.go (3 hunks)
  • server/pkg/dataset/schema_builder.go (2 hunks)
  • server/pkg/layer/builder.go (2 hunks)
  • server/pkg/layer/decoding/common.go (2 hunks)
  • server/pkg/layer/decoding/czml.go (1 hunks)
  • server/pkg/layer/decoding/geojson.go (2 hunks)
  • server/pkg/layer/decoding/kml.go (1 hunks)
  • server/pkg/layer/decoding/reearth.go (2 hunks)
  • server/pkg/layer/decoding/shp.go (2 hunks)
  • server/pkg/layer/group_builder.go (2 hunks)
  • server/pkg/layer/group_test.go (2 hunks)
  • server/pkg/layer/id.go (1 hunks)
  • server/pkg/layer/initializer.go (5 hunks)
  • server/pkg/layer/item_builder.go (2 hunks)
  • server/pkg/layer/layer.go (4 hunks)
  • server/pkg/layer/layerops/initializer.go (1 hunks)
  • server/pkg/layer/layerops/initializer_test.go (2 hunks)
  • server/pkg/layer/loader.go (2 hunks)
  • server/pkg/layer/merged.go (2 hunks)
  • server/pkg/nlslayer/builder.go (2 hunks)
  • server/pkg/nlslayer/group.go (2 hunks)
  • server/pkg/nlslayer/group_builder.go (2 hunks)
  • server/pkg/nlslayer/id.go (1 hunks)
  • server/pkg/nlslayer/loader.go (2 hunks)
  • server/pkg/nlslayer/nlslayer.go (3 hunks)
  • server/pkg/nlslayer/nlslayerops/intializer.go (1 hunks)
  • server/pkg/nlslayer/simple.go (2 hunks)
  • server/pkg/nlslayer/simple_builder.go (2 hunks)
  • server/pkg/plugin/id.go (0 hunks)
  • server/pkg/plugin/manifest/convert.go (2 hunks)
  • server/pkg/plugin/manifest/convert_test.go (2 hunks)
  • server/pkg/plugin/manifest/parser.go (4 hunks)
  • server/pkg/plugin/plugin.go (2 hunks)
  • server/pkg/plugin/pluginpack/package.go (2 hunks)
  • server/pkg/project/builder.go (2 hunks)
  • server/pkg/project/id.go (0 hunks)
  • server/pkg/project/project.go (4 hunks)
  • server/pkg/property/builder.go (2 hunks)
  • server/pkg/property/builder_test.go (2 hunks)
  • server/pkg/property/id.go (0 hunks)
  • server/pkg/property/initializer.go (4 hunks)
  • server/pkg/property/property.go (2 hunks)
  • server/pkg/property/schema.go (2 hunks)
  • server/pkg/scene/builder.go (2 hunks)
  • server/pkg/scene/builder_test.go (5 hunks)
  • server/pkg/scene/id.go (0 hunks)
  • server/pkg/scene/list.go (1 hunks)
  • server/pkg/scene/list_test.go (2 hunks)
  • server/pkg/scene/scene.go (2 hunks)
  • server/pkg/scene/sceneops/dataset_migrator.go (3 hunks)
  • server/pkg/scene/sceneops/style_initializer.go (1 hunks)
  • server/pkg/scene/style.go (2 hunks)
  • server/pkg/scene/style_builder.go (2 hunks)
  • server/pkg/storytelling/id.go (1 hunks)
  • server/pkg/storytelling/story.go (3 hunks)
  • server/pkg/storytelling/story_bulider.go (2 hunks)
  • server/pkg/tag/group_builder.go (2 hunks)
  • server/pkg/tag/group_test.go (1 hunks)
  • server/pkg/tag/id.go (1 hunks)
  • server/pkg/tag/item_builder.go (2 hunks)
  • server/pkg/tag/item_test.go (2 hunks)
  • server/pkg/tag/list.go (2 hunks)
  • server/pkg/tag/loader.go (2 hunks)
  • server/pkg/tag/tag.go (3 hunks)

Walkthrough

The change refactors various parts of the codebase by updating the scene identifier type. Many method signatures, field declarations, and type aliases previously using local or alternative SceneID types have been updated to use the namespaced type id.SceneID. Additionally, import statements for "github.com/reearth/reearth/server/pkg/id" have been added where required, and some type aliases have been removed or commented out. The overall logic and functionality of the code remain unchanged.

Changes

File(s) Change Summary
server/internal/.../container.go Updated SceneFilter methods (CanRead, CanWrite) to accept id.SceneID instead of the previous scene identifier type.
server/pkg/dataset/... Modified method signatures and field types in builder, csvparser, dataset, schema, and schema_builder files to use id.SceneID; added import statement; commented out the type alias in id.go.
server/pkg/layer/... Revised parameters, field types, and return types in builder, various decoding modules (common, czml, geojson, kml, reearth, shp), group builder, initializer, item builder, layer, layerops, loader, and merged files by replacing local SceneID with id.SceneID; updated imports and removed type aliases.
server/pkg/nlslayer/... Updated parameters and return types across builder, group, group builder, loader, nlslayer, and simple modules to use id.SceneID; added necessary imports and commented out alias declarations.
server/pkg/plugin/... Changed function and method signatures in manifest (convert, convert_test, parser), plugin, and pluginpack files from plugin.SceneID to id.SceneID; added import and disabled the type alias in id.go.
server/pkg/project/... Adjusted builder and project files so that scene fields and method signatures now use id.SceneID; commented out the type alias in project/id.go.
server/pkg/property/... Altered builder, initializer, property, schema, and test files to replace local SceneID with id.SceneID; introduced import for id and removed type alias declarations.
server/pkg/scene/... Modified builder, builder_test, scene, list, sceneops (dataset_migrator, style_initializer), style, and style_builder files to update ID fields and method signatures from SceneID/ID to id.SceneID; added relevant import statements and removed alias definitions.
server/pkg/storytelling/... Updated the story field and method signatures in story and story_builder files to use id.SceneID; removed the type alias in id.go.
server/pkg/tag/... Revised group builder, group test, item builder, item test, list, loader, and tag files by replacing SceneID with id.SceneID; added import for id and commented out the type alias in id.go.

Poem

I'm a bunny hopping through the code,
Nibbling bugs where type changes abode.
id.SceneID now leads the way,
Keeping our identifiers clear each day.
With every hop and joyful bound,
I cheer the refactor all around!
🐇💻 Happy coding from this playful rabbit!


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.

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

netlify bot commented Feb 17, 2025

Deploy Preview for reearth-web canceled.

Name Link
🔨 Latest commit 9a53f13
🔍 Latest deploy log https://app.netlify.com/sites/reearth-web/deploys/67b2ff3895f87c0008f86c58

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 (4)
server/pkg/dataset/id.go (1)

8-9: Consider removing the commented-out code.

Since the codebase is transitioning to use id.SceneID directly, the commented-out type alias can be safely removed.

-// type SceneID = id.SceneID
server/pkg/property/id.go (1)

15-16: Remove commented-out type alias.

Instead of commenting out the SceneID type alias, consider removing it entirely since it's no longer needed. This improves code clarity and prevents potential confusion.

-// type SceneID = id.SceneID
server/pkg/scene/id.go (1)

8-8: Consider adding a comment explaining the transition.

While commenting out the type alias is consistent with the refactoring, adding a brief comment explaining why the alias is commented out and directing developers to use id.SceneID directly would improve code readability and maintainability.

-// type ID = id.SceneID
+// Note: Use id.SceneID directly instead of this alias as part of the scene identifier refactoring
+// type ID = id.SceneID
server/pkg/scene/sceneops/dataset_migrator.go (1)

15-15: Consider addressing the TODO comment.

The TODO comment indicates that new loader types should be defined and used instead of repos. This could be an opportunity for further improvement.

Would you like me to help create a new issue to track this TODO item or propose a solution for implementing the new loader types?

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 49554df and 594ff3c.

📒 Files selected for processing (69)
  • server/internal/usecase/repo/container.go (2 hunks)
  • server/pkg/dataset/builder.go (2 hunks)
  • server/pkg/dataset/csvparser.go (2 hunks)
  • server/pkg/dataset/dataset.go (2 hunks)
  • server/pkg/dataset/id.go (1 hunks)
  • server/pkg/dataset/schema.go (3 hunks)
  • server/pkg/dataset/schema_builder.go (2 hunks)
  • server/pkg/layer/builder.go (2 hunks)
  • server/pkg/layer/decoding/common.go (2 hunks)
  • server/pkg/layer/decoding/czml.go (1 hunks)
  • server/pkg/layer/decoding/geojson.go (2 hunks)
  • server/pkg/layer/decoding/kml.go (1 hunks)
  • server/pkg/layer/decoding/reearth.go (2 hunks)
  • server/pkg/layer/decoding/shp.go (2 hunks)
  • server/pkg/layer/group_builder.go (2 hunks)
  • server/pkg/layer/group_test.go (2 hunks)
  • server/pkg/layer/id.go (1 hunks)
  • server/pkg/layer/initializer.go (5 hunks)
  • server/pkg/layer/item_builder.go (2 hunks)
  • server/pkg/layer/layer.go (4 hunks)
  • server/pkg/layer/layerops/initializer.go (1 hunks)
  • server/pkg/layer/layerops/initializer_test.go (2 hunks)
  • server/pkg/layer/loader.go (2 hunks)
  • server/pkg/layer/merged.go (2 hunks)
  • server/pkg/nlslayer/builder.go (2 hunks)
  • server/pkg/nlslayer/group.go (2 hunks)
  • server/pkg/nlslayer/group_builder.go (2 hunks)
  • server/pkg/nlslayer/id.go (1 hunks)
  • server/pkg/nlslayer/loader.go (2 hunks)
  • server/pkg/nlslayer/nlslayer.go (3 hunks)
  • server/pkg/nlslayer/nlslayerops/intializer.go (1 hunks)
  • server/pkg/nlslayer/simple.go (2 hunks)
  • server/pkg/nlslayer/simple_builder.go (2 hunks)
  • server/pkg/plugin/id.go (1 hunks)
  • server/pkg/plugin/manifest/convert.go (2 hunks)
  • server/pkg/plugin/manifest/convert_test.go (2 hunks)
  • server/pkg/plugin/manifest/parser.go (4 hunks)
  • server/pkg/plugin/plugin.go (2 hunks)
  • server/pkg/plugin/pluginpack/package.go (2 hunks)
  • server/pkg/project/builder.go (2 hunks)
  • server/pkg/project/id.go (1 hunks)
  • server/pkg/project/project.go (4 hunks)
  • server/pkg/property/builder.go (2 hunks)
  • server/pkg/property/builder_test.go (2 hunks)
  • server/pkg/property/id.go (1 hunks)
  • server/pkg/property/initializer.go (4 hunks)
  • server/pkg/property/property.go (2 hunks)
  • server/pkg/property/schema.go (2 hunks)
  • server/pkg/scene/builder.go (2 hunks)
  • server/pkg/scene/builder_test.go (5 hunks)
  • server/pkg/scene/id.go (1 hunks)
  • server/pkg/scene/list.go (1 hunks)
  • server/pkg/scene/list_test.go (2 hunks)
  • server/pkg/scene/scene.go (2 hunks)
  • server/pkg/scene/sceneops/dataset_migrator.go (3 hunks)
  • server/pkg/scene/sceneops/style_initializer.go (1 hunks)
  • server/pkg/scene/style.go (2 hunks)
  • server/pkg/scene/style_builder.go (2 hunks)
  • server/pkg/storytelling/id.go (1 hunks)
  • server/pkg/storytelling/story.go (3 hunks)
  • server/pkg/storytelling/story_bulider.go (2 hunks)
  • server/pkg/tag/group_builder.go (2 hunks)
  • server/pkg/tag/group_test.go (1 hunks)
  • server/pkg/tag/id.go (1 hunks)
  • server/pkg/tag/item_builder.go (2 hunks)
  • server/pkg/tag/item_test.go (2 hunks)
  • server/pkg/tag/list.go (2 hunks)
  • server/pkg/tag/loader.go (2 hunks)
  • server/pkg/tag/tag.go (3 hunks)
✅ Files skipped from review due to trivial changes (5)
  • server/pkg/nlslayer/id.go
  • server/pkg/storytelling/id.go
  • server/pkg/plugin/id.go
  • server/pkg/project/id.go
  • server/pkg/tag/id.go
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: ci-server / ci-server-test
🔇 Additional comments (81)
server/pkg/scene/sceneops/style_initializer.go (1)

4-4: LGTM! The type change aligns with the refactoring objective.

The change from scene.ID to id.SceneID is consistent with the broader effort to standardize scene identifier types across the codebase.

Also applies to: 9-9

server/pkg/tag/tag.go (1)

6-6: LGTM! The type changes maintain interface compatibility.

The changes to use id.SceneID in both the struct field and interface method are consistent and maintain compatibility.

Also applies to: 17-17, 22-22, 31-31

server/pkg/scene/style.go (1)

3-3: LGTM! The type changes preserve the existing functionality.

The changes to use id.SceneID are consistent and don't affect the logic of any methods, including the Duplicate method.

Also applies to: 9-9, 47-47

server/pkg/scene/list.go (1)

3-3: LGTM! The type changes maintain slice operations compatibility.

The changes to use id.SceneID in both methods are consistent and preserve the slice allocation and filtering logic.

Also applies to: 7-7, 12-12, 19-19

server/pkg/scene/style_builder.go (1)

3-3: LGTM! The scene identifier type has been standardized.

The changes correctly update the scene identifier type to use the namespaced id.SceneID type, aligning with the broader refactoring effort to standardize scene identifiers across the codebase.

Also applies to: 38-41

server/pkg/nlslayer/builder.go (1)

3-3: LGTM! The scene identifier type has been standardized.

The changes correctly update the scene identifier type to use the namespaced id.SceneID type, aligning with the broader refactoring effort to standardize scene identifiers across the codebase.

Also applies to: 36-39

server/pkg/tag/list.go (1)

3-6: LGTM! The scene identifier type has been standardized.

The changes correctly update the scene identifier type to use the namespaced id.SceneID type, aligning with the broader refactoring effort to standardize scene identifiers across the codebase. The util.ListFilter call has been updated accordingly.

Also applies to: 22-23

server/pkg/tag/loader.go (1)

3-7: LGTM! The scene identifier type has been standardized.

The changes correctly update the scene identifier type to use the namespaced id.SceneID type, aligning with the broader refactoring effort to standardize scene identifiers across the codebase. The SceneLoader type and SceneLoaderFrom function have been updated accordingly.

Also applies to: 10-10, 47-47

server/pkg/nlslayer/nlslayerops/intializer.go (2)

5-5: LGTM!

The import statement for the id package is correctly added to support the use of id.SceneID.


10-10: LGTM!

The field type change from nlslayer.SceneID to id.SceneID aligns with the refactoring objective to standardize scene identifier types.

server/pkg/tag/group_builder.go (2)

3-4: LGTM!

The import statement for the id package is correctly added to support the use of id.SceneID.


57-57: LGTM!

The method signature change from SceneID to id.SceneID aligns with the refactoring objective to standardize scene identifier types.

server/pkg/property/builder.go (2)

3-4: LGTM!

The import statement for the id package is correctly added to support the use of id.SceneID.


44-44: LGTM!

The method signature change from SceneID to id.SceneID aligns with the refactoring objective to standardize scene identifier types.

server/pkg/layer/builder.go (1)

3-4: LGTM! Clean type refactoring.

The changes correctly update the scene identifier type to use the namespaced id.SceneID, maintaining consistency with the broader refactoring effort.

Also applies to: 31-34

server/pkg/scene/list_test.go (1)

6-7: LGTM! Test assertions correctly updated.

The test assertions have been properly updated to use id.SceneID, maintaining consistency with the type system changes.

Also applies to: 43-45

server/pkg/tag/item_builder.go (1)

3-4: LGTM! Consistent type refactoring.

The changes correctly update the scene identifier type to use id.SceneID, maintaining compatibility with the existing error handling in the Build() method.

Also applies to: 57-60

server/pkg/dataset/builder.go (1)

3-4: LGTM! Clean type refactoring.

The changes correctly update the scene identifier type to use id.SceneID, maintaining consistency with the broader refactoring effort.

Also applies to: 42-45

server/pkg/property/schema.go (1)

3-4: LGTM! Clean refactoring of scene identifier type.

The changes correctly update the Scene() method to use the standardized id.SceneID type while maintaining the existing functionality.

Also applies to: 28-30

server/pkg/layer/layerops/initializer.go (1)

6-7: LGTM! Consistent type refactoring.

The SceneID field type has been correctly updated to use id.SceneID, maintaining compatibility with the Initialize() method.

Also applies to: 13-13

server/pkg/dataset/schema_builder.go (1)

3-4: LGTM! Clean builder pattern refactoring.

The Scene() method has been correctly updated to use id.SceneID while maintaining the builder pattern and existing functionality.

Also applies to: 42-45

server/pkg/scene/builder.go (1)

6-6: LGTM!

The changes correctly implement the scene identifier refactoring by importing the id package and updating the method signature to use id.SceneID.

Also applies to: 47-47

server/pkg/layer/loader.go (1)

7-7: LGTM!

The changes correctly implement the scene identifier refactoring by:

  • Adding the required import
  • Updating the LoaderByScene type signature
  • Updating the LoaderBySceneFrom method signature

Also applies to: 12-12, 78-78

server/pkg/layer/item_builder.go (1)

3-3: LGTM!

The changes correctly implement the scene identifier refactoring by importing the id package and updating the method signature to use id.SceneID.

Also applies to: 62-62

server/pkg/layer/layerops/initializer_test.go (2)

6-7: LGTM! Import and type changes are consistent.

The addition of the id package import and the update to use id.SceneID maintain consistency with the refactoring goals.


40-40: LGTM! Type update is correct.

The sceneID field type change from *layer.SceneID to *id.SceneID aligns with the refactoring while preserving test functionality.

server/pkg/layer/id.go (1)

12-13:

❓ Verification inconclusive

Verify the removal of SceneID type alias.

The SceneID type alias has been commented out, which means all dependent packages must now use id.SceneID directly. This change aligns with the refactoring goals but could impact other packages.

Let's check for any remaining usages of the old type:


🏁 Script executed:

#!/bin/bash
# Search for any remaining references to layer.SceneID
rg "layer\.SceneID" -t go

Length of output: 176


Below is a revised review comment based on the updated findings. Since the initial ripgrep command did not search any files (likely due to the -t go filter), please run an additional verification step to ensure that no package is still using layer.SceneID.


ACTION: Verify the complete removal of the SceneID alias usage.

The type alias (SceneID) is now commented out in server/pkg/layer/id.go (lines 12-13), which means that all references should directly use id.SceneID. However, the initial ripgrep command didn’t scan any files because of the applied filter. Please re-run the search (for example, without the -t go flag or with a debug option) to confirm no remaining usages of layer.SceneID.

  • Location to Verify: server/pkg/layer/id.go (lines 12-13)
  • Action Required: Confirm that no package is still referencing layer.SceneID and, if necessary, update them to use id.SceneID.
server/pkg/nlslayer/loader.go (2)

7-7: LGTM! Type updates are consistent.

The changes to LoaderByScene type signature and the addition of the id package import maintain consistency with the refactoring goals.

Also applies to: 12-12


78-78: LGTM! Function signature update is correct.

The parameter type change in LoaderBySceneFrom function aligns with the refactoring while preserving functionality.

server/pkg/scene/scene.go (2)

13-13: LGTM! Struct field type update is correct.

The Scene struct's id field type change to id.SceneID aligns with the refactoring goals.


25-28: LGTM! Method signature and zero value updates are consistent.

The ID() method's return type update to id.SceneID and the corresponding zero value update to id.SceneID{} maintain consistency.

server/pkg/nlslayer/simple_builder.go (1)

3-4: LGTM! Type refactoring looks good.

The changes correctly implement the transition to using the namespaced id.SceneID type while maintaining the builder pattern implementation.

Also applies to: 72-75

server/pkg/layer/group_builder.go (1)

3-4: LGTM! Type refactoring looks good.

The changes align with the broader refactoring effort to use namespaced id.SceneID type while preserving the builder pattern implementation.

Also applies to: 62-65

server/pkg/plugin/pluginpack/package.go (1)

13-14:

❓ Verification inconclusive

LGTM! Type refactoring looks good.

The changes correctly implement the transition to using the namespaced id.SceneID type. The scene ID is properly passed to manifest.Parse on line 53.

Let's verify that the manifest package has been updated to accept id.SceneID:

Also applies to: 27-27


🏁 Script executed:

#!/bin/bash
# Check if manifest.Parse accepts id.SceneID
ast-grep --pattern 'func Parse($_, scene *id.SceneID, $_) ($_, error)'

Length of output: 72


LGTM — Type Refactoring Verified with Caution

The import change and the update to the PackageFromZip function (switching the parameter type to *id.SceneID) look correct, and the scene ID is being passed appropriately to manifest.Parse. However, our automated check using ast-grep did not return any output confirming that manifest.Parse’s signature has been updated to accept *id.SceneID. Please manually verify that manifest.Parse’s signature in the manifest package now accepts *id.SceneID to ensure complete consistency.

server/pkg/nlslayer/group_builder.go (1)

3-4: LGTM! Type refactoring looks good.

The changes align with the broader refactoring effort to use namespaced id.SceneID type while preserving the builder pattern implementation.

Also applies to: 72-75

server/pkg/layer/decoding/shp.go (1)

4-4:

❓ Verification inconclusive

LGTM! Consistent type refactoring.

The changes correctly update the scene identifier type to use id.SceneID. All usages of the field in methods like getLayer, Decode, etc., remain compatible with the new type.

Let's verify that all usages of SceneID have been updated in the package:

Also applies to: 17-17, 20-20


🏁 Script executed:

#!/bin/bash
# Search for any remaining references to the old SceneID type
rg -g '*.go' 'layer\.SceneID' server/pkg/layer/

Length of output: 107


Verify the refactoring for correct type usage and directory references.

The refactoring now correctly updates the scene identifier type to id.SceneID and integrates well with all related methods (e.g., getLayer, Decode). However, the automated search using the command below:

rg -g '*.go' 'layer\.SceneID' server/pkg/layer/

yielded an error indicating that the directory does not exist. Please verify manually that all legacy references to the old SceneID type (if any) have been removed or updated in the codebase. In particular, double-check the intended directory (e.g., server/pkg/layer/decoding) to ensure completeness of the refactoring.

server/pkg/nlslayer/simple.go (1)

4-4:

❓ Verification inconclusive

Verify interface compatibility with the type change.

The Scene() method's return type has been updated to id.SceneID. Since this is likely part of an interface implementation, ensure that:

  1. The interface definition has been updated
  2. All other implementations of the interface use the same return type

Let's verify the interface and implementations:

Also applies to: 31-31


🏁 Script executed:

#!/bin/bash
# Find the interface definition and all implementations
ast-grep --pattern 'interface {
  $$$
  Scene() $_ {
    $$$
  }
  $$$
}'

Length of output: 75


Interface Return Type Compatibility Verification Required

The update to the Scene() method returning id.SceneID looks aligned with the refactoring goal, but the automated interface search produced no results. Please manually verify that:

  • The interface definition containing Scene() has been updated to match the new return type (id.SceneID).
  • All implementations of the interface consistently use the updated return type.
server/pkg/plugin/manifest/parser.go (1)

13-13:

❓ Verification inconclusive

LGTM! Consistent pointer type updates.

The scene parameter type has been correctly updated to *id.SceneID across all manifest parsing functions. The pointer usage is maintained consistently.

Let's verify that all manifest-related code has been updated:

Also applies to: 23-23, 41-41, 56-56


🏁 Script executed:

#!/bin/bash
# Search for any remaining references to plugin.SceneID in manifest-related code
rg -g '*.go' 'plugin\.SceneID' server/pkg/plugin/manifest/

Length of output: 128


Let's try to verify that all references to the deprecated plugin.SceneID have been completely removed from the manifest parsing code. The earlier search command failed due to a “No such file or directory” error, which might indicate that the path needs to be adjusted or that the file structure has changed. To dig further, please run the revised script below:

Once these scripts are executed, please verify that:

  • The file under review (server/pkg/plugin/manifest/parser.go) is located correctly.
  • There are no remaining references to plugin.SceneID in any manifest-related code.

If everything checks out, the pointer type updates (to *id.SceneID) are consistent and correct. At that point, the final review comment can be updated accordingly.


Manifest Parsing Code Verification

LGTM overall—the pointer type updates to *id.SceneID in the manifest parsing functions (including changes at parser.go line 13 and the corresponding changes at lines 23, 41, and 56) are consistent with the refactoring goals. However, the search for any stray references to plugin.SceneID yielded an error due to an apparent path issue. Please verify manually (or via the revised search above) that no outdated references remain.


🏁 Script executed:

#!/bin/bash
# List all files named parser.go to confirm the file's location
fd -p 'parser.go'

# Recursively search the entire plugin package for any references to plugin.SceneID
rg -g '*.go' 'plugin\.SceneID' server/pkg/plugin/

Length of output: 128


LGTM! The pointer type updates to *id.SceneID in the manifest parsing functions appear correct and in line with the refactoring goal.

The file under review (server/pkg/plugin/manifest/parser.go) shows the change at line 13, and corresponding changes at lines 23, 41, and 56 update the scene parameter type to *id.SceneID.

However, the automated search for any lingering references to plugin.SceneID returned errors (“No such file or directory”), which might indicate that the directory structure has changed or that the target files are located elsewhere. Please manually verify that there are no outdated references to plugin.SceneID in the manifest-related code.

server/pkg/storytelling/story_bulider.go (1)

6-6:

❓ Verification inconclusive

Verify Story struct field compatibility.

The Scene method parameter type has been updated to id.SceneID. Ensure that the corresponding field in the Story struct has also been updated to maintain type consistency.

Let's verify the Story struct definition:

Also applies to: 54-54


🏁 Script executed:

#!/bin/bash
# Find the Story struct definition and its scene field
ast-grep --pattern 'type Story struct {
  $$$
  scene $_
  $$$
}'

Length of output: 67


Verify Story Struct 'scene' Field Compatibility

The Scene method parameter now uses id.SceneID. Please ensure that the corresponding field in the Story struct is updated accordingly to maintain type consistency. The initial AST-based search did not yield results. Manual verification is required—please locate the Story struct (likely in a file such as server/pkg/storytelling/story.go) and confirm that its scene field is of type id.SceneID.

server/pkg/dataset/dataset.go (1)

3-3: LGTM! Type updates are consistent.

The changes correctly update the scene identifier type to use the namespaced id.SceneID, maintaining consistency across the codebase.

Also applies to: 11-11, 21-21

server/pkg/nlslayer/group.go (1)

3-3: LGTM! Type updates are consistent.

The changes correctly update the scene identifier type to use the namespaced id.SceneID, maintaining consistency with the layerBase implementation.

Also applies to: 26-26

server/pkg/tag/item_test.go (1)

6-6: LGTM! Test updates are consistent.

The changes correctly update the test cases to use the namespaced id.SceneID, maintaining consistency with the production code.

Also applies to: 27-27

server/pkg/plugin/plugin.go (1)

6-6: LGTM! Type updates are consistent.

The changes correctly update the scene identifier pointer type to use the namespaced *id.SceneID, maintaining consistency across the codebase.

Also applies to: 34-34

server/pkg/dataset/schema.go (3)

3-7: LGTM!

The import of the id package is correctly added to support the type changes.


16-16: LGTM!

The field type is correctly updated to use the namespaced id.SceneID type.


33-33: LGTM!

The method signature is correctly updated to return the namespaced id.SceneID type.

server/pkg/layer/group_test.go (2)

3-8: LGTM!

The import of the id package is correctly added alongside the existing test dependencies.


24-24: LGTM!

The field type is correctly updated to use the namespaced id.SceneID type in the test struct.

server/pkg/tag/group_test.go (1)

29-29: LGTM!

The field type is correctly updated to use the namespaced id.SceneID type in the test struct.

server/pkg/project/builder.go (2)

3-9: LGTM!

The import of the id package is correctly added alongside the existing dependencies.


156-159: LGTM!

The method signature is correctly updated to use the namespaced id.SceneID type.

server/pkg/layer/decoding/czml.go (1)

8-8: LGTM! Type changes are consistent.

The changes to use id.SceneID instead of layer.SceneID are consistent with the refactoring effort. The functionality remains unchanged.

Also applies to: 15-15, 19-19

server/pkg/property/builder_test.go (1)

6-6: LGTM! Test cases remain valid.

The update to use id.SceneID in the test struct is consistent with the refactoring effort. All test cases, including error scenarios, remain valid and comprehensive.

Also applies to: 100-100

server/pkg/layer/layer.go (1)

7-7: LGTM! Interface and implementation remain robust.

The changes to use id.SceneID in the interface and implementation are consistent with the refactoring effort. The code maintains its robustness with proper nil checks and error handling.

Also applies to: 27-27, 83-83, 158-158

server/pkg/layer/merged.go (1)

4-4: LGTM! Merging functionality remains intact.

The update to use id.SceneID in the Merged struct is consistent with the refactoring effort. The merging logic and property handling remain comprehensive and unchanged.

Also applies to: 13-13

server/pkg/nlslayer/nlslayer.go (1)

3-4: LGTM! Consistent type usage for scene identifiers.

The changes correctly update the scene identifier type to use id.SceneID consistently across the interface and implementation.

Also applies to: 10-10, 69-69, 103-105

server/internal/usecase/repo/container.go (1)

8-8:

❓ Verification inconclusive

Verify type compatibility between scene.IDList and id.SceneID.

The changes update the parameter types to id.SceneID, but we need to verify that scene.IDList.Has() method accepts id.SceneID as a parameter.

Also applies to: 182-184, 186-188


🏁 Script executed:

#!/bin/bash
# Description: Check type compatibility between scene.IDList and id.SceneID

# Search for the definition of scene.IDList.Has method
ast-grep --pattern 'func (l IDList) Has($id) bool {
  $$$
}'

# Search for any type conversions between scene.ID and id.SceneID
rg -A 2 'type (ID|SceneID)' pkg/scene/

Length of output: 154


Manual Verification Required: Confirm Type Compatibility Between scene.IDList and id.SceneID

The initial script produced no output and encountered a “No such file or directory” error for the pkg/scene path. This suggests that the expected definitions (the scene.IDList type and its Has method) may reside in a different location, or the directory structure has changed. Please manually verify the following:

  • Locate the definition of scene.IDList and its Has method in the repository (e.g., search broadly for "func (l IDList) Has(").
  • Confirm that the Has method accepts a parameter of type id.SceneID (or that an explicit conversion is defined elsewhere).
  • Check for any type conversions between scene.ID and id.SceneID by verifying type declarations (e.g., search for "type SceneID" in the appropriate package).

Until these details are confirmed and, if necessary, corrected, it’s essential to manually verify the change to ensure type compatibility.


For further investigation, you can run these additional shell scripts from the repository root:


🏁 Script executed:

[run_scripts]
#!/bin/bash
# Search for occurrences of the IDList type and its Has method
rg -R "type IDList" .
rg -R "func (l IDList) Has(" .

# Search for the definition of SceneID in the repository (likely in the id package)
rg -R "type SceneID" .

Length of output: 1418


Action Required: Manually Verify Type Compatibility for scene.IDList and id.SceneID

The automated checks using both ast-grep and rg did not return results as expected, likely due to either directory structure differences or incorrect invocation of the search commands. Please verify the following manually:

  • Locate the declaration of scene.IDList and confirm the implementation of its Has() method.
  • Ensure that Has() either directly accepts an id.SceneID parameter or that any necessary type conversion between scene.ID and id.SceneID is handled appropriately.
  • Check for any type aliasing or explicit conversion functions that guarantee compatibility between these types.

For additional automated verification, you can try running this corrected script from the repository root:

Once these points are confirmed and, if needed, adjustments are made, this review comment can be revisited.


🏁 Script executed:

[run_scripts]
#!/bin/bash
# Search for the declaration of IDList
rg "type IDList" .

# Search for the definition of the Has method in IDList
rg "func \(l IDList\) Has(" .

# Search for the definition of SceneID (likely in the id package)
rg "type SceneID" .

Length of output: 291


Manual Verification Required: Confirm scene.IDList.Has() Method’s Parameter Type

The automated shell scripts did not yield the expected output, which may indicate that the definitions of scene.IDList and id.SceneID are located in different paths or use naming conventions not captured by our regex. Please proceed with a manual review to confirm that the Has() method on scene.IDList either directly accepts an id.SceneID parameter or that any necessary type conversion between scene.ID and id.SceneID is properly handled.

To further assist you, you may run this refined search script from the repository root:

Once you have confirmed these details manually, please update or confirm the code accordingly.


🏁 Script executed:

[run_scripts]
#!/bin/bash
# Search for the IDList type declaration:
rg -e "type IDList" .

# Search for the definition of the Has method in IDList (ensure proper escaping)
rg -e "func \\(l IDList\\) Has\\(" .

# Search for the definition of SceneID in the id package:
rg -e "type SceneID" server/pkg/id

Length of output: 272


Action Required: Manual Verification of Type Compatibility

The automated checks did not yield the expected output, suggesting that the definitions and conversions for scene.IDList and id.SceneID might not be in the anticipated locations or might require a different search pattern. Please manually verify the following:

  • Locate the Definition of scene.IDList and Its Has Method:
    Confirm where scene.IDList is declared and review the implementation of its Has() method to ensure it accepts a parameter compatible with id.SceneID.

  • Verify Type Conversion or Aliasing:
    Check if there is an explicit type conversion or alias between scene.ID and id.SceneID that ensures compatibility, particularly after the update that changes the parameter types to id.SceneID.

  • Confirm Directory Structure and Naming Conventions:
    Since the automated search for the SceneID definition in paths like server/pkg/id returned a “No such file or directory” error, please verify the correct location and usage of id.SceneID within your codebase.

Once these details are manually confirmed, you can ensure that the changes maintain correct type compatibility.

server/pkg/dataset/csvparser.go (1)

9-11: LGTM! Consistent type usage for scene identifiers.

The changes correctly update the scene identifier type to use id.SceneID in the GuessSchema method.

Also applies to: 53-53

server/pkg/storytelling/story.go (1)

10-11: LGTM! Consistent type usage for scene identifiers.

The changes correctly update the scene identifier type to use id.SceneID in both the struct field and method return type.

Also applies to: 24-24, 52-54

server/pkg/layer/decoding/geojson.go (3)

10-10: LGTM!

The import of the id package is correctly added to support the type changes.


23-23: LGTM!

The field type is correctly updated to use id.SceneID from the id package.


27-27: LGTM!

The constructor signature is correctly updated to use id.SceneID from the id package.

server/pkg/project/project.go (4)

11-11: LGTM!

The import of the id package is correctly added to support the type changes.


53-53: LGTM!

The field type is correctly updated to use id.SceneID from the id package.


135-137: LGTM!

The method signature is correctly updated to use id.SceneID from the id package.


258-260: LGTM!

The method signature is correctly updated to use id.SceneID from the id package.

server/pkg/property/initializer.go (4)

8-8: LGTM!

The import of the id package is correctly added to support the type changes.


39-62: LGTM!

The method signature is correctly updated to use id.SceneID from the id package.


65-83: LGTM!

The method signature is correctly updated to use id.SceneID from the id package.


85-91: LGTM!

The method signature is correctly updated to use id.SceneID from the id package.

server/pkg/layer/decoding/kml.go (3)

11-11: LGTM!

The import of the id package is correctly added to support the type changes.


19-19: LGTM!

The field type is correctly updated to use id.SceneID from the id package.


23-23: LGTM!

The constructor signature is correctly updated to use id.SceneID from the id package.

server/pkg/layer/decoding/reearth.go (1)

8-8: LGTM! Consistent type usage for scene identifiers.

The changes correctly update the type references from layer.SceneID to id.SceneID, aligning with the broader refactoring effort to standardize scene identifier types across the codebase.

Also applies to: 15-15, 18-18, 46-46

server/pkg/layer/initializer.go (1)

8-8: LGTM! Consistent type usage for scene identifiers.

The changes correctly update the type references from SceneID to id.SceneID in method signatures, maintaining consistency with the broader refactoring effort.

Also applies to: 97-97, 169-169, 203-203, 264-264

server/pkg/scene/builder_test.go (1)

7-7: LGTM! Test cases updated to match production code changes.

The changes correctly update the type references in test structs and test cases to use id.SceneID, ensuring test code remains aligned with the production code changes.

Also applies to: 72-72, 91-91, 214-214

server/pkg/scene/sceneops/dataset_migrator.go (1)

8-8: LGTM! Consistent type usage for scene identifiers.

The changes correctly update the type references from dataset.SceneID to id.SceneID in method signatures, maintaining consistency with the broader refactoring effort.

Also applies to: 41-41, 164-164

server/pkg/plugin/manifest/convert.go (1)

7-13: LGTM! The scene identifier type change looks good.

The change from *plugin.SceneID to *id.SceneID is consistent with the refactoring goal, and the necessary import has been added correctly.

Also applies to: 17-17

server/pkg/property/property.go (1)

8-10: LGTM! The scene identifier type changes look good.

The changes to the Property struct field and Scene() method are consistent with the refactoring goal, and the necessary import has been added correctly.

Also applies to: 14-14, 30-32

server/pkg/layer/decoding/common.go (1)

8-14: LGTM! The scene identifier type changes look good.

The changes to both MustCreateProperty and createProperty function signatures are consistent with the refactoring goal, and the necessary import has been added correctly.

Also applies to: 78-84, 86-86

server/pkg/plugin/manifest/convert_test.go (1)

6-8: LGTM! The scene identifier type changes in tests look good.

The change to the test struct field type is consistent with the refactoring goal, and the necessary import has been added correctly.

Also applies to: 62-62

@hexaforce hexaforce force-pushed the chore/refactoring-id-scene branch from c1149de to f5e2247 Compare February 17, 2025 06:55
@hexaforce hexaforce force-pushed the chore/refactoring-id-scene branch from f5e2247 to de9c5e7 Compare February 17, 2025 08:31
Copy link
Contributor

@soneda-yuya soneda-yuya left a comment

Choose a reason for hiding this comment

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

Thanks for good refactoring!
LGTM!

Copy link
Contributor

@soneda-yuya soneda-yuya left a comment

Choose a reason for hiding this comment

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

Thanks!LGTM!

@hexaforce hexaforce enabled auto-merge (squash) February 18, 2025 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants