Skip to content

fix(file-doc): stop the permission resend loop and restore the 10 MB proxy body limit - #9057

Merged
waleedlatif1 merged 3 commits into
stagingfrom
fix/live-doc-permission-loop-and-proxy-limit
Oct 15, 2026
Merged

waleedlatif1 merged 3 commits into
stagingfrom
fix/live-doc-permission-loop-and-proxy-limit

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Changes only flag-gated Project file paths (behind the projects flag).

  • Project file reads and writes that do not charge storage hold the Project lock shared; storage-charging operations (create, update_content, upload_complete, versions.revert, extract_archive) declare chargesStorage and take it exclusively up front, so a shared hold is never upgraded. Lifecycle, payer transfer, retention, and account deletion stay exclusive and still exclude every file operation.
  • The Project file authorizer holds the organization's permission-group lock shared (acquirePermissionGroupOrgReadLock): group writes, workspace creation, and OAuth refresh still wait for it and the capability decision stays current through commit, but file operations no longer serialize on it. The 5s lock_timeout now bounds only the acquisition and the caller's setting is restored.
  • Project storage accounting locks the payer row last and only for a non-zero delta (the global order: Project → owner row → directory → files → payer); the Project row lock taken at prepare keeps the payer identity fixed. Zero-delta writes read usage unlocked.
  • readProjectFileContent and version content reads drop an unused preflight transaction (prepareFromSnapshot); their snapshot use case authorizes, and the final transaction still revalidates after the storage read.
  • Collaborative-document seed/persist retry only on moved revisions (ProjectFileRevisionConflictError) or cached-history conflicts; Project lock timeouts and lifecycle conflicts surface immediately instead of being retried and reported as a document conflict. Persist reads at most the largest editable file size.
  • Archive/restore find files with cached document state in one query instead of locking and decoding every file, and post-commit retirements run at most 8 at a time.
  • Project file id/root-name reference lookups no longer load the whole folder tree.
  • Removes the blanket knip ignores over the Project file contracts: unused aliases are deleted or un-exported; the four files still holding exports consumed only by stacked PRs keep a per-file ignore naming them.

Expected conflicts for the stacked Project file PRs: knip.jsonc (#9018 adds entries; its new project-file*.ts contract files lose the glob ignore), projects/files/application/authorization.ts (#9018 exports helpers), billing/storage/tracking.ts and projects/membership.ts (#9034).

Type of Change

  • Bug fix

Testing

  • New integration checks in projects/files/__integration__/authorization.integration.ts: concurrent reads and a folder create proceed while a read holds the Project, lock_timeout is restored, and exclusive Project and permission-group holders still wait; a storage-charging write still excludes shared holders
  • New projects/files/application/documents.test.ts: lock conflicts are surfaced, revision conflicts still retry (verified red on the old predicate)
  • biome on changed files; type-check, audits, and integration suites run 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 14, 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 15, 2026 12:09am UTC

Request Review

@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 26 files

Turn on auto-fix | Re-trigger cubic

Comment thread scripts/generate-cli-docs.ts
@greptile-apps

greptile-apps Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[High impact] This PR appears safe to merge; no actionable new issues were found.

Summary

This PR stops repeated document permission messages and update resends. It restores the default 10 MiB proxy limit while letting Project document snapshots bypass that buffer.

  • The relay sends write-permission updates only when access changes.
  • Workspace snapshots can persist even when the stream has no author.
  • Read-only members can view files locally after a join denial.
  • Snapshot persists bypass the 10 MiB proxy body limit.
  • V2 file downloads keep the file's stored name and content type.
  • V2 version lists use the shared file-version serializer.
  • Project-file tools stay out of CLI and MCP listings.

No actionable new issues were found in the changes since the previous review. No previous review threads were supplied.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Sweep[Permission sweep] --> Publisher[Shared permission publisher]
  Frame[Incoming document frame] --> Publisher
  Publisher --> Changed{Write access changed?}
  Changed -->|Yes| Notify[Notify client]
  Changed -->|No| Skip[Send nothing]
Loading

Reviews (3) · Last reviewed commit: "fix(file-doc): reschedule an unattribute..." · Reviewed by Greptile

…eep capability through the per-socket de-dup
@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 15, 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 29 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 15, 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 30 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 3ba393d into staging Oct 15, 2026
53 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/live-doc-permission-loop-and-proxy-limit branch October 15, 2026 00:19

This branch was previously deployed

1 inactive deployment
Preview — 1eb5758e Deployed Oct 15, 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