Skip to content

feat: drive-foundation — Drive基盤 (Rust core) + 課金ポリシー土台 - #2

Merged
turtton merged 15 commits into
mainfrom
claude/g-issue-1
Aug 30, 2026
Merged

turtton merged 15 commits into
mainfrom
claude/g-issue-1

Conversation

@turtton

@turtton turtton commented Aug 30, 2026

Copy link
Copy Markdown
Member

概要

Issue #1 の drive-foundation を実装: Rust core (axum) によるポリモーフィック owner Drive CRUD + Fluxer 課金ポリシー土台 + セルフホスト構成 + CI/E2E。

スコープ

  • Rust core (core/): JWT/JWKS verify-only 認証 (RS256・iss ルーティング・kid ミス単一flightリフレッシュ)、オーナースコープ Drive CRUD (ストリーミング upload・受信バイト課金・limits 1GB/100MB/100rpm)、フラット folders (0..1 folder_id)、file_objects 派生物許容、S3 presigned GET (rewrite 対応)、公開共有 (推測不能 key + immutable cache)
  • 課金土台 (billing/): コード既定 plan + billing_rules DB オーバーライド (global/owner 層 + 式 UNIQUE index)、plan_assignments (everyone/mirror premium mode)、storage_usage 原子的 metering、payment provider 抽象化 (disabled 既定・実プロバイダは設定時に拒否)
  • Admin: sha256 ハッシュ管理の named API token (生トークンは 1 度のみ返却)、billing rules/plan/usage 管理 API
  • Ops: deploy/self-hosting/ (compose + Caddy + Containerfile + .env.example)、OpenAPI 3.1 チェックイン (CI drift 検出)、compose E2E (S1-S4)、CI workflow (lint/test/openapi-drift/e2e/image、tag 時 ghcr ビルド)

検証証跡 (全て実機)

  • cargo fmt --check / cargo check / cargo clippy --all-targets -- -D warnings: exit 0
  • cargo test: 91 passed / 0 failed (12 ignored は PG/MinIO 実接続系)
  • bash e2e/run-e2e.sh: exit 0 — S1 upload/meter/download (sha256一致)、S2 limits (413/507/429)、S3 publish/immutable-cache/unpublish/delete (usage 増減一致)、S4 admin token ライフサイクル + plan/rules 解決順
  • deploy/self-hosting smoke: Caddy 経由 /readyz 200・/docs 200・/openapi.json バイト同一、コンテナ restart 後も同一応答
  • 禁止スコープ監査: Misskey 互換 / Web UI / BFF / 実決済プロバイダ / Profile 概念なし

コミット

T1-T13 の atomic commits (scaffold → auth/storage/billing → drive/admin/public → api wiring → e2e → deploy → ci)。

Closes #1

turtton added 12 commits August 30, 2026 13:05
- workspace Cargo.toml (resolver 2) + core crate with validated dep set
- 7 sqlx migrations: folders/files/file_objects/admin_tokens/billing_rules/storage_usage/plan_assignments
- frozen contracts: config (full env parsing), error (JSON error model), state, auth/billing/drive/storage stubs
- flake.nix (rust-overlay devShell), justfile, root compose.yml (postgres16+minio+mc init)
- main.rs: rustls aws-lc-rs provider install, migrations at startup, ensure_bucket, /healthz /readyz /openapi.json /swagger-ui
- checked-in openapi.json artifact
Refs: #1
@turtton turtton added the intent-target Intent automation target — implementation worker may claim this issue. label Aug 30, 2026
@turtton turtton added the intent-pr-request-update Review requested updates to this PR; implementer must address. label Aug 30, 2026
@turtton turtton added intent-pr-approved PR is approved by intent automation review; ready to merge + close out. and removed intent-pr-request-update Review requested updates to this PR; implementer must address. labels Aug 30, 2026
@turtton
turtton merged commit 0eba3a1 into main Aug 30, 2026
10 checks passed
turtton added a commit to ShuttlePub/host that referenced this pull request Aug 30, 2026
@turtton
turtton deleted the claude/g-issue-1 branch August 30, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

intent-pr-approved PR is approved by intent automation review; ready to merge + close out. intent-target Intent automation target — implementation worker may claim this issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

drive-foundation: 連携 Drive 基盤 (Rust core) + 課金ポリシー土台

1 participant