Skip to content

fix(files): resolve v2 file paths only on the v2 surface, through the canonical resolver - #9531

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/v2-file-path-optin-bounded
Oct 31, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/v2-file-path-optin-bounded

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #9504, rebuilt on #9527 (authorize the workspace before an unresolved path answers):

  • resolveActiveWorkspaceFileContext is shared by ~26 callers, so turning files/… strings into ids there widened every internal surface: an internal caller passing a file name that starts with files/ as an id resolved it as a path. It now takes an explicit acceptVfsPath flag, which only the three v2 routes (describe, rename, delete) set. Every other caller keeps id-only semantics.
  • Paths resolve through the existing resolveFileReference (folder-first, owner-scoped, at most two rows) instead of the bespoke getWorkspaceFileByVfsPath, which is deleted. One resolver now serves workspace and project files. Its ambiguity conflict maps onto fix(files): authorize the workspace before resolving a files/ path #9527's UnresolvedWorkspaceFileVfsPathError, so a member still gets "pass the file id instead" and a non-member the same refusal as for any other path.
  • A bare files/ names nothing and is no longer treated as a path; the contract rejects it like any other malformed reference.
  • The three use-case inputs share one WorkspaceFileTargetInput; restore's lifecycle resolver takes only the fields it reads.
  • Contract text, OpenAPI, CLI client and CLI docs regenerated.

Type of Change

  • Bug fix

Testing

  • file-path-references.integration.ts against disposable Postgres via bun run test:integration: 13/13. New cases: a caller that didn't opt in resolves no path; a bare files/; a non-member's personal key on a workspace with personal keys off gets the same answer for an ambiguous, a missing and an existing path
  • Red proofs: without the opt-in check, "did not opt in" fails; letting the resolver's conflict out pre-authorization fails the member, non-member, delegation and personal-key cases
  • v2 file route tests and lib/workspace-files/application: 245 pass
  • check:openapi, check:cli-api, check:api-validation:strict, check:comment-hygiene, check:test-patterns; rest in CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 31, 2026 9:24pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues remain.

Summary

Limits file-path lookup to the three opted-in v2 routes and uses resolveFileReference for those lookups.

  • Three v2 file routes resolve paths while other callers keep id-only lookups.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[File reference] --> B{Path lookup enabled?}
  B -->|No| C[Load by id]
  B -->|Yes| D[Resolve path in asserted workspace]
  D -->|Found| C
  D -->|Workspace-dependent error| E[Check workspace access]
  E -->|Denied| F[Return access refusal]
  E -->|Allowed| G[Return lookup error]
  C --> H[Check file access]
  H --> I[Run file operation]
Loading

Reviews (8) · Last reviewed commit: "fix(files): every refusal a path lookup ..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 9 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 9 files

Confidence score: 5/5

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

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 9 files

Confidence score: 5/5

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

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 14 files

Confidence score: 5/5

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

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 15 files

Confidence score: 5/5

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

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 force-pushed the fix/v2-file-path-optin-bounded branch from a3aa8c6 to 1fcf99d Compare October 31, 2026 19:16
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 15 files

Confidence score: 5/5

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

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 16 files

Confidence score: 5/5

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

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 7ca3f1a into staging Oct 31, 2026
71 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/v2-file-path-optin-bounded branch October 31, 2026 21:38

This branch was previously deployed

1 inactive deployment
Preview — 12be2c5d Deployed Oct 31, 2026 by vercel[bot]
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