Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix: allow review diffs for registered projects #4733

ClosedStiensWout(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/4733/headopened View on GitHub

Summary

  • allow review diff previews for exact workspace roots of active registered projects
  • retain the existing configured-cwd and managed-worktree boundaries for all other paths
  • stop retrying failed diff previews against the server process cwd, which could silently render an unrelated empty result

Root cause

Packaged desktop servers use the user's home directory as ServerConfig.cwd. ReviewService only trusted that directory and T3's managed worktree directory, so in-place projects on another drive or outside the home directory were rejected before VCS detection. The web client then retried against ServerConfig.cwd, hiding the authorization error behind an empty diff from the wrong directory.

Impact

Working-tree and branch scopes now query the registered project's repository while preserving the arbitrary-cwd guard for unregistered paths. If validation genuinely fails, the original error remains visible instead of being replaced by an unrelated fallback result.

Closes #4022.

Validation

  • vp test run apps/server/src/review/ReviewService.test.ts (4 tests passed, including the outside-configured-root regression)
  • vp run --filter t3 typecheck
  • vp run --filter @t3tools/web typecheck
  • vp lint --report-unused-disable-directives apps/server/src/review/ReviewService.ts apps/server/src/review/ReviewService.test.ts apps/web/src/components/DiffPanel.tsx
  • vp fmt apps/server/src/review/ReviewService.ts apps/server/src/review/ReviewService.test.ts apps/web/src/components/DiffPanel.tsx --check
  • git diff --check
  • live isolated server started with an unrelated configured cwd and accepted registration of an external dirty Git fixture; browser interaction could not be completed because the T3 collaborative preview reported that no automation host was available

Current main compatibility

  • based on 3c50a648
  • focused regression tests and targeted package type checks passed
  • targeted formatting and lint passed
  • git diff --check passed

Note

Medium Risk Touches review path authorization and removes a client workaround; behavior change is intentional but affects who can request diffs and what errors users see.

Overview Review diff previews can use the exact workspace root of an active registered project, even when that path is outside ServerConfig.cwd or the managed worktrees directory. ReviewService.assertWorkspaceBoundCwd still rejects arbitrary unregistered paths.

On the web side, DiffPanel no longer retries branch/working-tree diff previews against the server process cwd after a “configured workspace root” failure. That fallback could show an empty diff from the wrong repo instead of the real error.

Tests mock ProjectionSnapshotQuery and cover the registered-project-root allow path.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit d06bf6d40184fc83b3460ed014fd1a6fcf1e93b3. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Allow review diffs for registered projects outside configured workspace

  • ReviewService.assertWorkspaceBoundCwd now consults ProjectionSnapshotQuery.getActiveProjectByWorkspaceRoot when a cwd falls outside the configured workspace and worktrees directories, treating a matching registered project root as valid.
  • DiffPanel.tsx removes the fallback retry logic that reissued diffPreview with serverConfig.cwd on workspace root errors — the server-side fix makes this unnecessary.
  • Behavioral Change: getDiffPreview now accepts cwds that match a registered project root, expanding the set of valid inputs beyond the previously configured workspace boundaries.
Macroscope summarized d06bf6d.
    1. Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: cbf0624a-53b5-42b0-b5db-5fd09c1137c9

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. Approvability

      Verdict: Needs human review

      This PR modifies path validation logic in assertWorkspaceBoundCwd to expand which directories are allowed for review diffs. Changes that modify validation/authorization boundaries warrant human review to ensure the expanded access is intentional and appropriate.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).

Sign in to join this conversation.