Skip to content

feat: update file metadata and relocate versioned S3 content - #154

Merged
PANiXiDA merged 30 commits into
developmentfrom
feature/update-file
Nov 22, 2026
Merged

PANiXiDA merged 30 commits into
developmentfrom
feature/update-file

Conversation

@PANiXiDA

@PANiXiDA PANiXiDA commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Adds PUT /api/v1/files/{id} for replacing name, type, owner and folder together. Both the current and requested scope require update permission; personal files require an owner, avatars forbid one. Null or omitted optional fields clear their values.

When type or owner changes, the requested metadata and Relocating status are saved with one shared OperationAttemptId. Downloads and access checks use the new metadata immediately, while StorageKey and VersionId retain the previous active content until an exact-version S3 copy is verified. The destination key is derived from the current type, owner and unchanged file ID. No separate relocation fields or JSON state are stored. The database migration renames the existing content_update_attempt_id column to operation_attempt_id.

The existing reconciliation worker resumes interrupted copies using operation-attempt-id metadata. Mutations are blocked during relocation. Storage failures during relocation discovery, copying and verification are logged per file and returned as failures so reconciliation continues with other files. Cancellation and errors during transactional completion still propagate. Folder placement is validated under the hierarchy lock before saving the requested metadata; deleted-folder reconciliation handles a destination deleted while copying. Cleanup of the retired key is scheduled in the same transaction as completion with its former active version as a boundary, delayed according to FileManager:Relocation:CleanupDelay (seven days by default) to cover existing download URLs. The handler buffers the ordered version listing before deleting, preserves newer and active content, removes older versions, and deletes the boundary last. A missing boundary is a no-op; listing and deletion failures propagate for retries. Cleanup always deletes explicit version IDs.

Pending uploads and files above the current 5 GiB single-copy limit cannot change scope. Name and folder changes do not copy S3 content. Content type, size and active storage version remain storage-managed.

Uses Core Application 6.5.1 and S3 1.4.1. Content updates and copies share FileOperationAttemptId, the aggregate's OperationAttemptId property, and FileMetadataNames.OperationAttemptId. No legacy-marker fallback is needed under the agreed assumption that there are no existing files.

FileStorageVersionService.FindAsync shares current and historical version lookup between relocation and content-update recovery; each caller supplies its existing acceptance policy. Storage key construction is encapsulated in FileStorageKey.

FileRelocationOptions is a plain Application class with a section name and seven-day default. Infrastructure binds it, registers the typed instance and validates positive cleanup delays at startup through FileRelocationOptionsValidator; Application adds no configuration or options package references. The architecture convention now permits Application options with a registered validator in the same module's Infrastructure Options/<Name>/ directory, while preserving the existing placement and startup-validation checks for Infrastructure options.

Validation: all CI checks pass, including formatting, architecture tests and Helm checks. FileManager: 885 unit, 172 integration and 551 functional tests. PostgreSQL coverage verifies persisted requested metadata, the shared operation marker and the active-version switch; real-S3 coverage verifies recovery after a lost copy response, downloads during relocation and eventual cleanup after target-folder deletion. S3 integration coverage also verifies bounded history cleanup, preservation of a newer active version, and chronological pagination with delete markers and a new upload between pages on the CI SeaweedFS backend. SonarQube reports 0 new issues, 97.8% new-code coverage and 0% new-code duplication.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 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-22T09:42:30.197356Z 6b70ce8 Manual request
ℹ️ 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.

@PANiXiDA PANiXiDA changed the title feat: add full file metadata update feat: update file metadata and relocate versioned S3 content Nov 21, 2026
@PANiXiDA

Copy link
Copy Markdown
Contributor Author

@codex

@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: 636f36cd27

ℹ️ 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".

@panixida-sonarqube

Copy link
Copy Markdown

@PANiXiDA

Copy link
Copy Markdown
Contributor Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 6b70ce8633

ℹ️ 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".

@PANiXiDA
PANiXiDA merged commit bc1c7e2 into development Nov 22, 2026
39 checks passed
@PANiXiDA
PANiXiDA deleted the feature/update-file branch November 22, 2026 09:43
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