Skip to content

feat(billing): prorated funding and original-payer refunds - #174

Merged
tamaina merged 21 commits into
feat/billing-service-subscriptionsfrom
feat/billing-plan-transitions
Oct 16, 2026
Merged

tamaina merged 21 commits into
feat/billing-service-subscriptionsfrom
feat/billing-plan-transitions

Conversation

@tamaina

@tamaina tamaina commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

What

サービスのアップグレード時に未使用期間を日割りで充当し、元の購入・支払者・チェーン・トークンを保持します。順位を伴う変更、ダウングレード予約、zero-payable、期間分割を接続し、その原資から返金を計算する native API / Misskey UI を追加します。

返金は利用者申請→管理者承認→送信前の intent 保存→各原支払者への送金確認→全グループの fresh canonical proof 確認後の一括期間短縮です。途中の証拠消失・DB失敗では利用権を変更せず、結果不明の送信はハッシュ回収のみになります。原購入は paid のまま保持し、完了証憑を保存・ダウンロードできます。由来不明の既存購入は review_required として自動返金を拒否します。

Why

Refs #171, #8. cfw-fileup PR139 (569523a) の返金手続きと元の日割りロジックを、Misskey のネイティブ課金に接続します。

依存: #64 wallet → #103 receipt → #81 fixed service terms → この PR。比較対象を限定するため base は #81 のブランチです。develop 664f172 までの同期を含み、既存3 PR の head は変更していません。#126 P2P は独立です。原資計算と返金は同じモデルを使うため、この PR 内で別コミットにしています。

Additional info

  • backend 8 files / 36 tests PASS(isolated PostgreSQL の up/down/up、並行承認、複数 payer / chain / token、累積上限、ロール更新、rollback を含む)。既存 order DB 回帰13件 PASS。
  • frontend 6 files / 24 tests PASS、backend/frontend types PASS、backend/SDK build PASS、変更対象 lint / SPDX / locale PASS。
  • 独立 design/UI review: blocker なし。mock wallet browser で intent 順序、結果不明時の再送禁止、証憑 download を確認。実送金・署名なし。
  • migration down は実行中/完了済み返金や zero-paid データを破棄する場合 fail closed。運用で無理に戻さない設計です。
  • 残りの feat(billing): complete cfw-fileup billing procedures and prorated plan changes #171 範囲: 価格履歴/割引表示、地域・税/居住地、seller/tax snapshot、完了メール等。feat(billing): consolidate service billing and country policy #81 に存在しない税情報は生成しません。証憑は印刷可能 HTML で、cfw PDF renderer は未移植です。
  • merge / deploy / production migration / credentials / shared dependencies は実行していません。

CHANGELOG 候補: サービスのプラン変更に日割り充当を追加し、元の支払者への返金申請・管理者承認・全送金確認後の期間短縮に対応。

CI: #81 と develop 同期で失われた既存 viem@2.52.2 の importer と到達可能な lock graph を df1bce5 で復元(145行追加、既存解決値不変)。独立 commit としてこの PR に配置し、親スタックの head や共有 node_modules は変更していません。CI で判明した返金PG test探索設定と SDK JSDoc 生成空行も d2da647 で修正。MCP 専用 fixture の lock table不足は専用 settings.conf の max_locks_per_transaction=256 で修正し、正式 config 両 suite全7件PASS/SHOW256/停止を確認(製品DB設定不変、必要最小値とは未主張)。最終 head d2da647 の CI は全成功/適用外skip、独立 design/UI review は blockerなし。返金slice完了として Ready。#171 の他手続きは下記の残件として継続します。

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • Add tests
  • Storybook(native component の synthetic browser 検証・画面 fixture で確認)
  • CHANGELOG.md(依頼どおり候補のみ)

* feat(auth): add unconnected pinned OIDC token exchange transport

* fix(auth): honor trusted OIDC JWK key operations
* fix(auth): prefer TOTP after password login with explicit passkey fallback

* fix(auth): render passkey alternative with component-owned VVI labels

* feat(auth): expose proved-password factor availability without policy changes

* chore(sdk): regenerate signin factor availability API report

* test(auth): pass factor arrays intact through Vitest tables

* test(auth): assert TOTP factor availability in existing E2E flow

* chore(sdk): apply CI-generated signin factor availability types

* test(auth): preserve frozen alias proof across factor availability
* refactor(auth): name TOTP service while retaining constructor compatibility

* refactor(auth): add canonical 2FA routes with legacy policy parity

* refactor(auth): preserve portable 2FA aliases and SDK model compatibility

* fix(auth): keep canonical aliases portable and generated models stable

* chore(auth): keep API alias diff scoped to new routes

* chore(sdk): update public API report for canonical 2FA aliases

* fix(auth): accept implemented procedures when cloning API aliases

* test(auth): cover implemented procedure API alias cloning

* refactor(auth): use canonical 2FA API paths in settings callers

* test(auth): keep API alias regressions valid under NodeNext typecheck

* test(auth): restore QR caller source before frozen locale checks

* test(api): account for eight canonical 2FA operations
* feat(auth): add individual browser session persistence foundation

* test(auth): honor browser-session persistence predicates in regression fixtures

* test(auth): verify browser-session migration round trip in guarded CI fixture

* test(auth): use explicit empty connection overrides in migration fixture

* fix(auth): use typed object metadata selection for browser sessions

* test(auth): register browser session constructor wiring proof

* feat(auth): wire individually revocable browser sessions across runtime

* fix(auth): bound session input and use VVI logout labels

* chore(misskey-js): update browser session API report

* test(auth): type session fixtures and colocate VVI build proof

* fix(auth): clean up rejected and deleted browser logins locally

* test(auth): wire MCP fixture and compose all locale proof entries

* Adapt API and E2E fixtures to individual browser sessions

* Wait for federation channel acknowledgement and respect clip fixture quota

* Place federation readiness helper inside tester bind mount
Port upstream misskey-dev/misskey#17115 by @kakkokari-gtyih, pinned at 69890d54416b7c6add45aab521a98949b774dd14.

Preserve no-language before/after text, five-line context, empty lines, literal notation, HTML escaping and original-text copy in moderation logs.

Closes #139.
Closes #158. Include private authentication-context cache scope and zero discovery cache lifetime required by MCP 2026-07-28. Verified against the official schema, local regression, independent review, and exact-head CI.
Follow upstream dependency upgrades with verified fork runtime and credential compatibility. Closes #147.
Purpose-specific upstream follow-up with local validation, independent review and terminal CI. Closes #148.
Purpose-specific upstream follow-up with local validation, independent review and terminal CI. Closes #152.
Purpose-specific upstream follow-up with local validation, independent review and terminal CI. Closes #149.
Restrict local-only emoji on remote-original quotes at both boundaries; preserve both maintenance regression selections. Closes #150.
Add Deck Clip column and authorized updates, retain both dedicated lifecycle providers and validated SDK streaming contracts. Closes #151.
Fixes #169. Await the existing bounded exact local reply-count condition before consistency assertions. Preserve production code and original assertions; add actual-method synthetic regressions and maintenance CI selection.
Filter MCP event discovery using current native token/app permissions, preserving grant/account checks and subscription/delivery authorization. Add scope matrix, revocation, app permission, and account-state regression coverage.

Fixes #172.

Scoped tests: 34 pass. Changed-file lint and final CI: pass. Independent review at 84b6b7d: pass.
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🖥 Frontend Diagnostics Report

Metric @ Base @ Head Δ MAD
Requests 279
± 0
283
± 0
$\color{orange}{\text{+4}}$
$\color{orange}{\text{+1.4\%}}$
0
Encoded network 4.8 MB
± 8 B
4.8 MB
± 3 B
$\color{orange}{\text{+35 KB}}$
$\color{orange}{\text{+0.7\%}}$
9 B
Decoded body 4.5 MB
± 0 B
4.5 MB
± 0 B
$\color{orange}{\text{+33 KB}}$
$\color{orange}{\text{+0.7\%}}$
0 B
Same-origin encoded 4.6 MB
± 0 B
4.6 MB
± 0 B
$\color{orange}{\text{+35 KB}}$
$\color{orange}{\text{+0.8\%}}$
0 B
Script encoded 3.4 MB
± 0 B
3.5 MB
± 0 B
$\color{orange}{\text{+34 KB}}$
$\color{orange}{\text{+1\%}}$
0 B
Page-attributed memory 12 MB
± 23 KB
12 MB
± 20 KB
$\color{orange}{\text{+114 KB}}$
$\color{orange}{\text{+1\%}}$
30 KB

Only metrics showing significant changes are displayed.

View details

Requests by resource type
Type Requests Encoded bytes
Base Head Δ Base Head Δ
Document 2 2 0 37 KB 37 KB 0 B
Script 173 175 $\color{orange}{\text{+2}}$ 3.4 MB 3.5 MB $\color{orange}{\text{+34 KB}}$
Stylesheet 61 63 $\color{orange}{\text{+2}}$ 287 KB 287 KB $\color{orange}{\text{+840 B}}$
Fetch 22 22 0 216 KB 216 KB $\color{orange}{\text{+30 B}}$
Image 10 10 0 256 KB 256 KB 0 B
Font 2 2 0 120 KB 120 KB 0 B
Other 9 9 0 421 KB 421 KB $\color{green}{\text{-10 B}}$
V8 heap snapshot statistics
Metric @ Base @ Head Δ MAD
$\color{gray}{\rule{8pt}{8pt}}$ Total 14 MB
± 2.8 KB
14 MB
± 2.6 KB
$\color{orange}{\text{+114 KB}}$
$\color{orange}{\text{+0.8\%}}$
3.8 KB
$\color{orange}{\rule{8pt}{8pt}}$ Code 3.3 MB 3.3 MB $\text{+22 KB}$ 1.6 KB
$\color{red}{\rule{8pt}{8pt}}$ Strings 1.6 MB 1.6 MB $\text{+5.6 KB}$ 37 B
$\color{cyan}{\rule{8pt}{8pt}}$ JS arrays 131 KB 131 KB $\text{+16 B}$ 0 B
$\color{green}{\rule{8pt}{8pt}}$ Typed arrays 0 B 0 B 0 B 0 B
$\color{yellow}{\rule{8pt}{8pt}}$ System objects 0 B 0 B 0 B 0 B
$\color{violet}{\rule{8pt}{8pt}}$ Other JS objs 2.6 MB 2.6 MB $\text{+23 KB}$ 182 B
$\color{pink}{\rule{8pt}{8pt}}$ Other non-JS objs 6.1 MB 6.1 MB $\text{+65 KB}$ 13 KB

Download representative heap snapshot: base / head

📦 Bundle Stats

Chunk size diff (72 updated, 4 added, 3 removed)
Chunk Base Head Δ Δ (%)
(total) 18 MB 19 MB $\color{orange}{\text{+75 KB}}$ $\color{orange}{\text{+0.4\%}}$
../../node_modules/.pnpm/mediabunny@1.61.1/node_modules/mediabunny/dist/modules/src/index.js scripts/jLhy6JR6D-51xZQvOm.js
0 B 694 KB $\color{orange}{\text{+694 KB}}$ $\color{orange}{\text{( + )}}$
../../node_modules/.pnpm/mediabunny@1.55.4/node_modules/mediabunny/dist/modules/src/index.js scripts/jLhy6JR6D-DKpBBg2p.js
667 KB 0 B $\color{green}{\text{-667 KB}}$ $\color{green}{\text{( - )}}$
../../node_modules/.pnpm/@sentry+vue@10.72.0_vue@3.5.42_typescript@6.0.3_/node_modules/@sentry/vue/build/esm/index.js scripts/jLhy6JR6D-DYQRQcl5.js
454 KB 0 B $\color{green}{\text{-454 KB}}$ $\color{green}{\text{( - )}}$
../../node_modules/.pnpm/@sentry+vue@11.4.0_vue@3.5.43_typescript@6.0.3_/node_modules/@sentry/vue/build/esm/index.js scripts/jLhy6JR6D-ByAoHxCS.js
0 B 427 KB $\color{orange}{\text{+427 KB}}$ $\color{orange}{\text{( + )}}$
../features/moderation/frontend/pages/admin/modlog.vue scripts/jLhy6JR6D-DFKU53P4.js → scripts/jLhy6JR6D-Cww9vbz3.js
153 KB 18 KB $\color{green}{\text{-135 KB}}$ $\color{green}{\text{-88.3\%}}$
../features/auth/frontend/pages/settings/2fa.qrdialog.vue scripts/jLhy6JR6D-WvaELm2_.js → scripts/jLhy6JR6D-CzbQ6QUQ.js
5.7 KB 41 KB $\color{orange}{\text{+35 KB}}$ $\color{orange}{\text{+619.3\%}}$
virtual:vite-vue-internationalization/locale/ca-ES scripts/jLhy6JR6D-MJkqQl24.js → scripts/jLhy6JR6D-DpijGZMs.js
286 KB 289 KB $\color{orange}{\text{+3.3 KB}}$ $\color{orange}{\text{+1.1\%}}$
virtual:vite-vue-internationalization/locale/es-ES scripts/jLhy6JR6D-CD1U0IlS.js → scripts/jLhy6JR6D-D5sIoRoA.js
281 KB 285 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1.1\%}}$
virtual:vite-vue-internationalization/locale/th-TH scripts/jLhy6JR6D-C12qmGef.js → scripts/jLhy6JR6D-CjaX75ld.js
471 KB 474 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+0.7\%}}$
virtual:vite-vue-internationalization/locale/ru-RU scripts/jLhy6JR6D-BpjcNbJ-.js → scripts/jLhy6JR6D-AMkgGuJv.js
349 KB 352 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+0.9\%}}$
virtual:vite-vue-internationalization/locale/uk-UA scripts/jLhy6JR6D-C4IeGtGI.js → scripts/jLhy6JR6D-DjEEOUS4.js
341 KB 344 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+0.9\%}}$
virtual:vite-vue-internationalization/locale/vi-VN scripts/jLhy6JR6D-D5xl0B4Z.js → scripts/jLhy6JR6D-BOiyrQc-.js
283 KB 286 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1.1\%}}$
virtual:vite-vue-internationalization/locale/ar-SA scripts/jLhy6JR6D-DrTAJbdk.js → scripts/jLhy6JR6D-41hQGnS6.js
287 KB 290 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1.1\%}}$
virtual:vite-vue-internationalization/locale/nl-NL scripts/jLhy6JR6D-BxQu_HJN.js → scripts/jLhy6JR6D-Dt5RM8tc.js
264 KB 267 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1.2\%}}$
virtual:vite-vue-internationalization/locale/bn-BD scripts/jLhy6JR6D-Bicwzc0k.js → scripts/jLhy6JR6D-Bro_5WFo.js
311 KB 314 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1\%}}$
virtual:vite-vue-internationalization/locale/lo-LA scripts/jLhy6JR6D-d9JEd1cd.js → scripts/jLhy6JR6D-Bzt91M5F.js
311 KB 314 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1\%}}$
virtual:vite-vue-internationalization/locale/si-LK scripts/jLhy6JR6D-C5p2vmMX.js → scripts/jLhy6JR6D-DaugOfV0.js
311 KB 314 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1\%}}$
virtual:vite-vue-internationalization/locale/el-GR scripts/jLhy6JR6D-CiUiqmSd.js → scripts/jLhy6JR6D-CNhM_ls-.js
311 KB 314 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1\%}}$
virtual:vite-vue-internationalization/locale/fa-IR scripts/jLhy6JR6D-DDh7oM6e.js → scripts/jLhy6JR6D-ComgQ9qN.js
311 KB 314 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1\%}}$
virtual:vite-vue-internationalization/locale/jbo-EN scripts/jLhy6JR6D-ckKujBL5.js → scripts/jLhy6JR6D-DJ1Hl3kK.js
311 KB 314 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1\%}}$
virtual:vite-vue-internationalization/locale/ja-JP scripts/jLhy6JR6D-BgEquBwr.js → scripts/jLhy6JR6D-_gPaqqql.js
311 KB 314 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1\%}}$
virtual:vite-vue-internationalization/locale/ro-RO scripts/jLhy6JR6D-DoIaSZAj.js → scripts/jLhy6JR6D-CIJUOMKX.js
311 KB 314 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1\%}}$
virtual:vite-vue-internationalization/locale/tl-PH scripts/jLhy6JR6D-KyVbrc7h.js → scripts/jLhy6JR6D-EdA6EBBi.js
311 KB 314 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1\%}}$
virtual:vite-vue-internationalization/locale/ko-GS scripts/jLhy6JR6D-Bik_vJS0.js → scripts/jLhy6JR6D-_RxGEQ3U.js
311 KB 314 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1\%}}$
virtual:vite-vue-internationalization/locale/hu-HU scripts/jLhy6JR6D-CbR937TD.js → scripts/jLhy6JR6D-jEB46JTr.js
311 KB 314 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1\%}}$
virtual:vite-vue-internationalization/locale/uz-UZ scripts/jLhy6JR6D-CP22b0wV.js → scripts/jLhy6JR6D-ByERYMhK.js
310 KB 314 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1\%}}$
virtual:vite-vue-internationalization/locale/sv-SE scripts/jLhy6JR6D-BDGuVdoz.js → scripts/jLhy6JR6D-BjG2W-Pi.js
310 KB 314 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1\%}}$
virtual:vite-vue-internationalization/locale/hr-HR scripts/jLhy6JR6D-CBAZap7N.js → scripts/jLhy6JR6D-BRPbVjKp.js
310 KB 314 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1\%}}$
virtual:vite-vue-internationalization/locale/ht-HT scripts/jLhy6JR6D-Cjs_MAVG.js → scripts/jLhy6JR6D-D8m8Lhk7.js
310 KB 314 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1\%}}$
virtual:vite-vue-internationalization/locale/ja-KS scripts/jLhy6JR6D-DB-XpHUk.js → scripts/jLhy6JR6D-BgSPogl1.js
308 KB 311 KB $\color{orange}{\text{+3.2 KB}}$ $\color{orange}{\text{+1\%}}$
(other generated chunks) 2.4 MB 2.4 MB $\color{orange}{\text{+31 KB}}$ $\color{orange}{\text{+1.3\%}}$
(other) 5.5 MB 5.5 MB $\color{orange}{\text{+66 KB}}$ $\color{orange}{\text{+1.2\%}}$
Startup chunk size (1 updated, 0 added, 0 removed)
Chunk Base Head Δ Δ (%)
(total) 124 KB 125 KB $\color{orange}{\text{+1 KB}}$ $\color{orange}{\text{+0.8\%}}$
src/_boot_.ts scripts/jLhy6JR6D-BXmmHPq_.js → scripts/jLhy6JR6D-BYKDbYof.js
4.6 KB 4.7 KB $\text{+76 B}$ $\color{orange}{\text{+1.7\%}}$
(other generated chunks) 120 KB 121 KB $\text{+939 B}$ $\color{orange}{\text{+0.8\%}}$

Startup chunks are the Vite entry for src/_boot_.ts and its static imports.

Bundles Modules Entries Imports Size
Static Dynamic Rendered Gzip Brotli
Base 527 3,103 21 10,837 380 25 MB 6.3 MB 5 MB
Head 532 3,111 21 10,514 381 25 MB 6.3 MB 5 MB
Δ $\color{orange}{\text{+5}}$ $\color{orange}{\text{+8}}$ 0 $\color{green}{\text{-323}}$ $\color{orange}{\text{+1}}$ $\color{orange}{\text{+92 KB}}$ $\color{orange}{\text{+35 KB}}$ $\color{orange}{\text{+22 KB}}$
Δ (%) $\color{orange}{\text{+0.9\%}}$ $\color{orange}{\text{+0.3\%}}$ 0% $\color{green}{\text{-3\%}}$ $\color{orange}{\text{+0.3\%}}$ $\color{orange}{\text{+0.4\%}}$ $\color{orange}{\text{+0.6\%}}$ $\color{orange}{\text{+0.4\%}}$

Open treemap HTML

@tamaina
tamaina marked this pull request as ready for review October 14, 2026 16:24
@tamaina
tamaina merged commit d2da647 into feat/billing-service-subscriptions Oct 16, 2026
43 of 44 checks passed
@tamaina

tamaina commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

ユーザー承認済みの課金3本集約(#64 → #81 → #126)により、#81 に統合しました。採用先の通常pushによりGitHubが間接merge済みとして自動closeしたため、置換参照を残します。

元head d2da647f は採用先head d18e288d の祖先として通常merge履歴に保持しています。 元のコメント・検証履歴・初回失敗ログはここに残します。採用先の限定unit/SDK/専用PG/shippingを確認済みで、新headのremote CIは確認中です。採用3本はDraftを維持。develop/mainへのpush・merge、merge API/ボタンの操作、本番適用は行っていません。

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant