fix(storage): tolerate headbucket 403 on s3-compatible providers#255
Open
fix(storage): tolerate headbucket 403 on s3-compatible providers#255
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
修复 #237:当
storage.provider=s3且使用阿里云 OSS、腾讯云 COS 等 S3 兼容存储时,HeadBucket返回403不再导致 SkillHub 在启动期硬失败。变更内容
后端实现
S3StorageService.ensureBucketExists(),将HeadBucket的403视为兼容性探测失败并记录 warning,继续启动。404/NoSuchBucket的缺桶语义,在auto-create-bucket=true时继续自动创建 bucket。S3Exception继续抛出,避免吞掉真实故障。S3Client/S3Presigner。前端实现
测试覆盖
server/skillhub-storage/src/test/java/com/iflytek/skillhub/storage/S3StorageServiceTest.java,覆盖HeadBucket的200/403/404/500和auto-create-bucket分支。LocalFileStorageServiceTest,确认存储模块现有逻辑不回归。质量门禁
make test-backend-app通过cd server && JDK_JAVA_OPTIONS="-XX:+EnableDynamicAgentLoading" ./mvnw -pl skillhub-storage test -Dtest=S3StorageServiceTest,LocalFileStorageServiceTest通过make typecheck-web/make lint-web/make test-frontend/ Playwright E2E 不适用make generate-api不适用安全考虑
本次变更不涉及安全敏感内容。未新增鉴权逻辑、敏感数据处理或外部输入面;仅调整对象存储启动期探测策略。
相关 Issue
Closes #237
测试说明
本地验证步骤
SKILLHUB_STORAGE_PROVIDER=s3和一组 OSS/COS/S3 兼容存储参数。S3StorageService初始化阶段:当HeadBucket返回403时,服务应记录 warning 并继续启动。HeadBucket阻断。SKILLHUB_STORAGE_S3_AUTO_CREATE_BUCKET=true且 bucket 不存在,验证404/NoSuchBucket时仍会创建 bucket。回归测试范围
skillhub-storage模块的 S3 兼容存储初始化流程auto-create-bucket的缺桶处理逻辑截图/录屏(如有 UI 变更)
无 UI 变更。