Skip to content

Conversation

loks0n
Copy link
Member

@loks0n loks0n commented Oct 6, 2025

What does this PR do?

(Provide a description of what this PR does.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

Summary by CodeRabbit

  • Documentation
    • Added comprehensive design documentation for folder support in storage buckets, detailing a flat, lightweight folder model without independent permissions.
    • Outlines API behaviors for creating, listing, retrieving, updating, and deleting folders, plus file association and filtering by folder.
    • Describes data considerations, indexing, migration approach for existing content, reliability and testing plans, and UI/UX implications.
    • Includes roadmap for future enhancements (nested folders, permissions, performance).
    • Confirms no breaking changes anticipated.

Copy link

coderabbitai bot commented Oct 6, 2025

Walkthrough

Adds a new design document (021-bucket-folders.md) describing folder support for storage buckets. It defines lightweight, non-nesting folders, a folders collection stored alongside files with a discriminator, and a folderId reference on files (root vs specific folder). It outlines API endpoints for folder CRUD, file endpoint adjustments to associate/filter by folder, required indexes, and a migration to annotate existing documents. It details implementation steps, delete semantics including force behavior, reliability/testing plans, UI/UX notes, documentation needs, roadmap for nesting/permissions, rationale, and open questions.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “feat: bucket folders” succinctly and accurately summarizes the core change of adding folder support to storage buckets without extraneous details, making it clear to teammates scanning the history what the primary addition is.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat-bucket-folders

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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
021-bucket-folders.md (1)

37-51: Add fence languages for API examples

Markdown linters (MD040) are flagging the unlabeled code fences in this section. Tag them with an appropriate language (e.g., http, json, or text) so automated checks pass.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between da5b3e6 and 371b619.

📒 Files selected for processing (1)
  • 021-bucket-folders.md (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
021-bucket-folders.md

10-10: Link and image reference definitions should be needed
Unused link or image reference definition: "summary"

(MD053, link-image-reference-definitions)


16-16: Link fragments should be valid

(MD051, link-fragments)


16-16: Link and image reference definitions should be needed
Unused link or image reference definition: "problem-statement"

(MD053, link-image-reference-definitions)


24-24: Link fragments should be valid

(MD051, link-fragments)


24-24: Link and image reference definitions should be needed
Unused link or image reference definition: "design-proposal"

(MD053, link-image-reference-definitions)


37-37: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


46-46: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


184-184: Link and image reference definitions should be needed
Unused link or image reference definition: "prior-art"

(MD053, link-image-reference-definitions)


196-196: Link and image reference definitions should be needed
Unused link or image reference definition: "unresolved-questions"

(MD053, link-image-reference-definitions)


205-205: Link and image reference definitions should be needed
Unused link or image reference definition: "future-possibilities"

(MD053, link-image-reference-definitions)

Comment on lines +93 to +95
- `(bucketInternalId, type, name)` - unique constraint for folder names
- `(bucketInternalId, folderId)` - list files in folder
- `(bucketInternalId, type)` - list all folders
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Unique index will break existing file uploads

The proposed unique index (bucketInternalId, type, name) applies to all documents in the bucket collection. Once the migration sets type = 'file' on every file, this index will forbid two files in the same bucket sharing the same name—something Appwrite currently allows. That’s a backward-incompatible change that will cause uploads (and even the migration itself) to fail in any bucket that already contains duplicate filenames. Please limit the uniqueness to folders only (e.g., partial index type = 'folder') or pick another discriminator so files remain unaffected.

🤖 Prompt for AI Agents
In 021-bucket-folders.md around lines 93-95, the suggested unique index
`(bucketInternalId, type, name)` would make filenames unique across all
documents once files get `type = 'file'`, breaking existing uploads; change the
index to only enforce uniqueness for folders by creating a partial/filtered
unique index that applies when `type = 'folder'` (or use a folder-specific
discriminator field), and update the migration steps to set `type` only for
folder documents (or populate the discriminator safely) so files are not
affected; ensure the migration creates the partial unique index after ensuring
all folder documents meet the constraint and include a fallback plan to detect
and resolve existing duplicate folder names before index creation.

@ChiragAgg5k ChiragAgg5k self-assigned this Oct 7, 2025
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.

2 participants