Skip to content

feat: support STORAGE_PATH_PREFIX for global storage key namespacing#35320

Open
GareArc wants to merge 2 commits intomainfrom
feat/storage-path-prefix
Open

feat: support STORAGE_PATH_PREFIX for global storage key namespacing#35320
GareArc wants to merge 2 commits intomainfrom
feat/storage-path-prefix

Conversation

@GareArc
Copy link
Copy Markdown
Contributor

@GareArc GareArc commented Apr 16, 2026

Summary

  • Add STORAGE_PATH_PREFIX config field to StorageConfig
  • Apply prefix in Storage wrapper for all operations (save, load, download, exists, delete, scan)
  • Strip prefix from scan() results to prevent double-prefixing for callers
  • Aliyun OSS disables its own folder prefix when STORAGE_PATH_PREFIX is set (priority: global > backend-specific)
  • Path traversal prevention: reject .. segments in prefix

resolve ENG-44

Test plan

  • Verify storage operations work with empty prefix (default, backward compatible)
  • Verify all object keys prefixed when STORAGE_PATH_PREFIX is set
  • Verify Aliyun OSS does not double-prefix (folder disabled when global prefix set)
  • Verify scan() returns paths without the prefix
  • Verify .. in prefix raises ValueError

Add STORAGE_PATH_PREFIX config field and apply prefix in Storage wrapper
for all operations (save, load, download, exists, delete, scan).
Scan strips prefix from results to prevent double-prefixing.
Aliyun OSS disables its own folder prefix when STORAGE_PATH_PREFIX is set.
@GareArc GareArc requested a review from QuantumGhost as a code owner April 16, 2026 09:29
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Apr 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 38.84% 38.84% 0.00%
Strict coverage 35.93% 35.93% 0.00%
Typed symbols 18,442 18,442 0
Untyped symbols 31,388 31,388 0
Modules 2542 2542 0

@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 45.45455% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.82%. Comparing base (7f4bf19) to head (04472cb).
⚠️ Report is 251 commits behind head on main.

Files with missing lines Patch % Lines
api/extensions/ext_storage.py 40.00% 10 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #35320      +/-   ##
==========================================
+ Coverage   83.89%   84.82%   +0.92%     
==========================================
  Files        4189     4274      +85     
  Lines      177118   194564   +17446     
  Branches    35433    36555    +1122     
==========================================
+ Hits       148597   165038   +16441     
- Misses      25630    26421     +791     
- Partials     2891     3105     +214     
Flag Coverage Δ
api 84.16% <45.45%> (+1.79%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant