Skip to content

feat: Identify compatible legacy projects automatically - #1801

Merged
hatayama merged 3 commits into
feature/v2-cli-delegation-integrationfrom
feat/v2-project-detection
Jul 16, 2026
Merged

feat: Identify compatible legacy projects automatically#1801
hatayama merged 3 commits into
feature/v2-cli-delegation-integrationfrom
feat/v2-project-detection

Conversation

@hatayama

@hatayama hatayama commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Refs: V3 dispatcher to V2 CLI delegation — To-Do 2–4

Summary

  • Identifies pinless projects that use the compatible legacy package generation.
  • Gives actionable guidance instead of reporting a generic missing configuration error.

User Impact

  • Users receive clear Node.js and fallback command guidance when invoking the new launcher on a legacy project.

Changes

  • Read the installed package metadata rather than inferring its version from cache directory names.
  • Preserve normal runner resolution whenever a project pin is present or no legacy package is installed.

Verification

  • scripts/check-go-cli.sh (pass)
  • go test ./dispatcher/internal/dispatcher -run TestDetectV2DispatcherProject -count=1 (pass)

Review in cubic

Identify pinless projects from the installed package metadata so the dispatcher can guide users to the compatible CLI instead of reporting a misleading missing-pin failure.
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@hatayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6d32cb0d-eca4-4d4a-92cf-18a57fe49aac

📥 Commits

Reviewing files that changed from the base of the PR and between d220727 and ce19226.

📒 Files selected for processing (2)
  • cli/dispatcher/internal/dispatcher/dispatcher_v2_detect.go
  • cli/dispatcher/internal/dispatcher/dispatcher_v2_detect_test.go
📝 Walkthrough

Walkthrough

The dispatcher detects pinless Unity projects using dispatcher V2, resolves their package version from package cache or lock data, and exits with structured Node.js and npx guidance. Tests cover detection, exclusions, fallback resolution, error output, and updated shared-input stamps.

Changes

Dispatcher V2 detection and guidance

Layer / File(s) Summary
V2 project detection and version resolution
cli/dispatcher/internal/dispatcher/dispatcher_v2_detect.go
Checks dispatcher pins and manifest dependencies, resolves versions from package cache or lock data, and validates the V2 major version.
Dispatcher pre-flight error handling
cli/common/errors/error_envelope.go, cli/dispatcher/internal/dispatcher/run_dispatcher.go
Adds the V2_PROJECT_DETECTED error code and stops dispatcher execution with Node.js 22+ and npx fallback actions.
Detection and guidance validation
cli/dispatcher/internal/dispatcher/dispatcher_v2_detect_test.go, cli/*/shared-inputs-stamp.json
Tests cache detection, package-lock fallback, pin and dependency exclusions, structured error output, and updates shared-input hashes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant RunDispatcher
  participant Detector
  participant UnityProject
  participant stderr
  User->>RunDispatcher: run dispatcher command
  RunDispatcher->>Detector: inspect project root
  Detector->>UnityProject: read pins, manifest, cache, or lock
  UnityProject-->>Detector: package metadata
  Detector-->>RunDispatcher: V2 status and version
  RunDispatcher->>stderr: write structured guidance
  RunDispatcher-->>User: exit code 1
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: automatic detection of compatible legacy projects.
Description check ✅ Passed The description directly matches the changeset and explains the new detection and guidance behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/v2-project-detection

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

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cli/dispatcher/internal/dispatcher/dispatcher_v2_detect.go`:
- Around line 109-125: Replace filepath.Glob in dispatcherV2PackageCacheVersion
with component-wise os.ReadDir traversal so projectRoot brackets and other glob
metacharacters are treated literally; locate the dispatcher package cache
directory, filter entries matching the dispatcher package name and package.json
target, and inspect each candidate. When readDispatcherPackageVersion fails for
an individual cache entry, skip it and continue checking remaining entries
instead of returning the error; preserve the existing matching-version return
and no-match behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7a948079-b62e-4300-abb8-c649fdd38899

📥 Commits

Reviewing files that changed from the base of the PR and between e8155f9 and e5a1844.

📒 Files selected for processing (6)
  • cli/common/errors/error_envelope.go
  • cli/dispatcher/internal/dispatcher/dispatcher_v2_detect.go
  • cli/dispatcher/internal/dispatcher/dispatcher_v2_detect_test.go
  • cli/dispatcher/internal/dispatcher/run_dispatcher.go
  • cli/dispatcher/shared-inputs-stamp.json
  • cli/project-runner/shared-inputs-stamp.json

Comment thread cli/dispatcher/internal/dispatcher/dispatcher_v2_detect.go
hatayama added 2 commits July 16, 2026 13:55
Keep the package metadata fallback safe by verifying both compatible and incompatible locked versions when the cache is unavailable.
Scan cache directory entries directly so project path characters and stale cache metadata cannot prevent compatible project detection.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
cli/dispatcher/internal/dispatcher/dispatcher_v2_detect_test.go (1)

147-147: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use a raw string literal with fmt.Sprintf for better readability.

Building JSON strings via concatenation and escaped quotes can be hard to read and error-prone. Consider using a raw string literal (backticks) with fmt.Sprintf to make the JSON structure clearer.

♻️ Proposed refactor
-	content := "{\n  \"dependencies\": {\n    \"" + dispatcherUnityPackageName + "\": {\n      \"version\": \"" + version + "\"\n    }\n  }\n}\n"
+	content := fmt.Sprintf(`{
+  "dependencies": {
+    "%s": {
+      "version": "%s"
+    }
+  }
+}
+`, dispatcherUnityPackageName, version)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cli/dispatcher/internal/dispatcher/dispatcher_v2_detect_test.go` at line 147,
Update the test JSON setup around content to use fmt.Sprintf with a
backtick-delimited raw string literal, substituting dispatcherUnityPackageName
and version through format placeholders. Preserve the existing JSON structure
and resulting content while removing manual concatenation and escaped quotes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@cli/dispatcher/internal/dispatcher/dispatcher_v2_detect_test.go`:
- Line 147: Update the test JSON setup around content to use fmt.Sprintf with a
backtick-delimited raw string literal, substituting dispatcherUnityPackageName
and version through format placeholders. Preserve the existing JSON structure
and resulting content while removing manual concatenation and escaped quotes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 57f8c7ee-0d38-4f97-a492-aab29532338c

📥 Commits

Reviewing files that changed from the base of the PR and between e5a1844 and d220727.

📒 Files selected for processing (1)
  • cli/dispatcher/internal/dispatcher/dispatcher_v2_detect_test.go

@hatayama
hatayama merged commit c6f0af7 into feature/v2-cli-delegation-integration Jul 16, 2026
2 checks passed
@hatayama
hatayama deleted the feat/v2-project-detection branch July 16, 2026 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant