Skip to content

fix: wire account override to /files page#1650

Open
recoup-coding-agent wants to merge 1 commit intotestfrom
fix/files-email-override
Open

fix: wire account override to /files page#1650
recoup-coding-agent wants to merge 1 commit intotestfrom
fix/files-email-override

Conversation

@recoup-coding-agent
Copy link
Copy Markdown
Collaborator

@recoup-coding-agent recoup-coding-agent commented Apr 7, 2026

Summary

  • Wires useAccountOverride() into useSandboxes and useSandboxFileContent hooks
  • Passes the resolved accountIdOverride as account_id query param to both GET /api/sandboxes and GET /api/sandboxes/file
  • Includes accountIdOverride in react-query cache key for proper re-fetching when override changes

Context

Part of REC-53: the /files page showed the logged-in user's files even when the email override was active. The AccountOverrideProvider already resolved the email to accountId, but the sandbox hooks were not consuming the override. Now they do.

Depends on: recoupable/api#410

Test plan

  • Navigate to /files?email=someone@example.com — should show override account's files
  • Navigate to /files without override — should show own files
  • CI build

🤖 Generated with Claude Code


Summary by cubic

Fixes the /files page to respect the email-based account override by passing the resolved account_id to sandbox API calls. Addresses REC-53 so files and file contents reflect the overridden account, not the logged-in user.

  • Bug Fixes

    • Wired useAccountOverride() into useSandboxes and useSandboxFileContent.
    • Added account_id query param to GET /api/sandboxes and GET /api/sandboxes/file.
    • Included accountIdOverride in react-query keys to trigger refetch on change.
  • Dependencies

Written for commit 00173bd. Summary will update on new commits.

Uses useAccountOverride() in sandbox hooks to pass the resolved
accountIdOverride as account_id query param to the API. This ensures
the /files page shows the overridden account's files when using the
email query param override.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
recoup-chat Ready Ready Preview Apr 7, 2026 2:12pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2026

Warning

Rate limit exceeded

@recoup-coding-agent has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 16 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 8 minutes and 16 seconds.

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 255a5cd0-8286-401c-961e-5598dcbeb955

📥 Commits

Reviewing files that changed from the base of the PR and between 04f4dfe and 00173bd.

📒 Files selected for processing (4)
  • hooks/useSandboxFileContent.ts
  • hooks/useSandboxes.ts
  • lib/sandboxes/getFileContents.ts
  • lib/sandboxes/getSandboxes.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/files-email-override

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 and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 00173bdb7e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


const query = useQuery({
queryKey: ["sandboxes"],
queryKey: ["sandboxes", accountIdOverride],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Delay sandbox query until account override is resolved

This query now keys on accountIdOverride, but it is still enabled whenever authenticated is true, so /files?email=... will fire an initial request with accountIdOverride === null while AccountOverrideProvider is still resolving the override. In that window, the page can render the signed-in user’s file tree before re-fetching the override account, which shows incorrect data and can expose the wrong account context briefly; gate the query on override-resolution state (or provider loading state) to avoid the initial null-account fetch.

Useful? React with 👍 / 👎.

}

return getFileContents(accessToken, path);
return getFileContents(accessToken, path, accountIdOverride);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reset file preview state when override account changes

After wiring accountIdOverride into getFileContents, this hook still retains prior selectedPath and mutation data across account switches, so changing override (or clearing it) can leave SandboxFilePreview showing content fetched for the previous account until another file is clicked. Since this path is now account-scoped, clear/reset mutation state on override change (or key mutation state by account) to prevent stale cross-account previews.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Modifies API request parameters and includes a cross-repository dependency (recoupable/api#410), which requires verification that the backend is ready.

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