Skip to content

Sync Community Edition storage, bulk selection, and evolution updates - #241

Merged
Luhaozhu merged 1 commit into
sync/ce-20261124-forms-and-reviewfrom
sync/ce-20261125-storage-and-evolution
Nov 27, 2026
Merged

Luhaozhu merged 1 commit into
sync/ce-20261124-forms-and-reviewfrom
sync/ce-20261125-storage-and-evolution

Conversation

@Luhaozhu

Copy link
Copy Markdown
Contributor

Purpose and behavior

  • Before: The upload gateway used a fixed size limit. My Space and private knowledge bases did not report their storage usage, and the My Space list lacked a mobile selection control for bulk deletion.
  • After: The backend applies configured per-file and storage limits, and supported upload routes report why an upload was rejected. My Space and private knowledge bases show usage when a quota applies. My Space supports mobile selection and confirms a combined file and folder deletion once. The evolution capability governs access to long-term memory and evolution settings.

Change walkthrough

  • Flow: Upload requests pass through src/frontend/default.conf.template and src/backend/api/middleware/logging.py to the file and knowledge upload routes. src/backend/core/auth/capabilities.py resolves limits, and the space and private knowledge quota modules measure usage. src/frontend/src/components/myspace/SpaceFileBrowser.tsx and DocumentList.tsx render usage and route selected items through the bulk-delete confirmation. The account capability payload drives the evolution UI and corresponding API checks.
  • Decisions: The gateway delegates upload limits to the authenticated application while the JSON request-size check remains in place. Sandbox mount verification uses the current grant snapshot and keeps network checks outside the database lock. This PR builds on Sync Community Edition task evaluation and shared forms #240 so the shared forms and evaluation changes stay in their existing review. The combined diff against public main covers 191 files. This PR adds changes in 73 files on top of Sync Community Edition task evaluation and shared forms #240.

Risk and compatibility

  • Risk: high
  • Boundaries: The changes affect upload routing, private knowledge document storage, account capability resolution, project-folder protection and sandbox mount recovery. Community Edition retains personal storage and excludes enterprise permission administration, team data access and the enterprise role migration.
  • Human review: Review unlimited and explicit quota settings, bulk folder deletion, and the interaction between changing space grants and restarting a sandbox.

Verification

  • Evidence: Release derivation passed the required-runtime, forbidden-file, binary, brand, license, and isolated import/OpenAPI/ORM checks. The Community frontend build passed with Node 22. Four account-capability tests passed, and the Git diff passed whitespace checks against both Sync Community Edition task evaluation and shared forms #240 and public main.
  • Limits: Interactive mobile selection, large-file stress testing and a live Community Edition desktop upgrade were outside these checks.

Recovery

  • Steps: Revert the sync commit to restore the previous application and gateway behavior. Back up browser and server data before any destructive file or database recovery. Reverting the code does not restore user-deleted files.

Review follow-up

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T09:33:42.727159Z 891e438 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Copy link
Copy Markdown

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: 891e4383ce

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +157 to +158
space.copy_from("personal", space_path(filename), artifact.storage_key, artifact.size_bytes,
check_quota=False)

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 Keep the quota check and space copy under the same account lock

Two concurrent /v1/file/upload requests can exceed the new My Space quota despite the owner lock. store_bytes_as_artifact() commits by default, releasing lock_folder_owner before the working copy reaches My Space. A second request can therefore measure usage before the first request's copy completes and pass its quota check; both then call copy_from(..., check_quota=False). For example, two 8 MB uploads into an empty space with a 10 MB quota can both succeed. Serialize the usage check through the working-copy write under the same account lock used by other space writes, and test concurrent uploads whose combined size exceeds the quota.

Useful? React with 👍 / 👎.

Comment on lines +135 to +136
const rejected = kind === 'personal' ? storageRejection(files, usage) : null;
if (rejected) { void message.error(rejected); return; }

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 Account for overwritten files in the upload quota preflight

When uploading over an existing My Space file, this preflight counts the entire incoming file as additional storage and can reject a replacement that the backend correctly permits. With a 100 MB quota and 90 MB used, replacing an existing 20 MB file with another 20 MB file is rejected as needing 20 MB with only 10 MB remaining, although usage would remain 90 MB. The upload loop writes to the existing path, and SpaceFiles._file_target() explicitly subtracts the replaced object's size. Account for replacement sizes in the client check, or defer quota validation to the server when a batch may overwrite existing files.

Useful? React with 👍 / 👎.

@Luhaozhu
Luhaozhu merged commit e51f985 into sync/ce-20261124-forms-and-review Nov 27, 2026
6 checks passed
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