Skip to content

feat(account): add invite rewards center - #362

Merged
huyanxius merged 17 commits into
1024XEngineer:mainfrom
huyanxius:feat/359-invite-rewards-ui-clean
Aug 18, 2026
Merged

feat(account): add invite rewards center#362
huyanxius merged 17 commits into
1024XEngineer:mainfrom
huyanxius:feat/359-invite-rewards-ui-clean

Conversation

@huyanxius

@huyanxius huyanxius commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

本 PR 在账号中心提供邀请奖励入口,并将前端注册、邀请码与奖励提示完整对齐已合并的后端契约。

Why

后端 #357 已调整邀请注册规则,但前端仍保留已删除的补填接口、旧奖励文案和强制邀请码注册逻辑,导致页面承诺与实际发放不一致。

Changes

  • 展示当前邀请码、当前码注册次数、30 天有效期与复制邀请链接入口。
  • 明示好友注册共得 500 积分,邀请人每日前 3 位各得 200 积分。
  • 删除登录后补填邀请码入口及 /quota/invite/redeem 前端适配。
  • 恢复公开注册;无邀请码注册不发送 invite_code,邀请链接仍自动携带邀请码。
  • 更新验证码登录和工作台提示气泡的奖励说明。
  • 删除仓库内的 PR 预览图片,保留产品实际使用的人物素材。

Implementation

  • InviteCode 映射后端 expires_atused_count 仅表示当前邀请码的成功注册次数。
  • 注册请求仅在邀请链接存在邀请码时发送 invite_code;邀请码与验证码格式继续由后端统一校验。
  • 有效期按 UTC 日期展示,避免客户端时区造成日期偏移。

Verification

  • npm test -- src/app/layout/app-header.test.tsx src/entities/quota/api.test.ts src/entities/user/api.test.ts src/features/account-panel/index.test.tsx src/features/quota/index.test.ts src/pages/account/index.test.tsx src/pages/invite/index.test.tsx:7 个文件、88 项测试通过。
  • npm run format:check -- <14 touched files>:通过。
  • npm run lint -- <14 touched files>:通过。
  • npm run build:通过。
  • 真实本地前后端联调:邀请码、有效期、当前码注册次数与复制入口正常,补填入口不存在。

Scope

  • 本 PR 不包含注册界面手工填写邀请码。
  • 本 PR 不修改后端奖励算法。

Related Issues

Closes #359
Refs #357

Users need a visible place to share their stable invite code and understand the reward rules.

Add the account-center invite section, real quota API adapters, invitation registration handoff, and the 200-point backend reward default.

Keep invite redemption feedback and balance refresh covered by focused frontend and backend tests.
Reviewers need stable visual evidence for the new account-center invitation surface.

Add desktop and mobile captures of the invitation reward section from the local authenticated browser.

Keep the evidence alongside the feature so the PR can link directly to both responsive states.
@github-actions

This comment was marked as outdated.

The invitation center PR should not assert behavior owned by the separate workspace hint PR.

Remove the hint-specific assertion from the account-center branch while retaining the quota mock shape needed by the new API types.

Leave hint behavior coverage isolated to the dedicated hint branch.
@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.00000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
frontend/src/pages/invite/index.tsx 93.61% 0 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

完整检查了邀请奖励配置、quota/auth API 映射、邀请注册链接、账号中心入口,以及补填后余额刷新。页面与依赖 PR #357 的接口契约整体一致,但奖励额度的部署配置仍会覆盖本次新默认值,导致界面承诺与实际到账不一致。固定 SHA 范围的前端、后端检查均为成功;本地依赖未安装,因此未重复执行测试套件。

Comment thread backend/packages/framework/src/windup_framework/config/quota.py
Acceptance found that deployments could still override the reward to 50 and contextual links could not open the invite section directly.

Set the deployment template to 200, support the invite section query, and replace an unusable clipboard recovery message.

Keep responsive evidence extensions consistent with their actual image format.
Codecov identified the production default adapter wrappers as the only uncovered invite API lines.

Exercise code lookup, generation, and redemption through the environment-backed default quota adapter.

Verify the real request URLs while preserving authorization coverage.
@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
windup Ready Ready Preview Aug 18, 2026 6:23am

@huyanxius

Copy link
Copy Markdown
Collaborator Author

⚠️ @huyanxius,此 PR 尚未关联 issue。请在 PR 描述中使用 Closes #123 等关闭关键字,或通过 Development 侧栏关联对应 issue。

@fennoai 我已关联 issue,为什么 CI 会误判?

@fennoai

fennoai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

结论

这不是当前状态的误判,而是旧告警没有被撤回

  • PR 创建于 2026-08-17 15:21:43 UTC;首次 Check linked issue 随即运行,并在 15:22:08 UTC 留下告警。当时 GitHub 的 closingIssuesReferences 没有识别到关闭关联。
  • 该检查只认 GitHub GraphQL 的 closingIssuesReferences.github/scripts/check-pr-issue.cjs:7),普通提及或 Refs #357 不算关闭关联;Closes #359 才算。
  • 当前重新查询结果为 totalCount: 1,明确关联到 feat(frontend): 增加邀请奖励页与可分享注册链接 #359,所以现在已经识别正确。
  • 脚本发现关联后会直接返回(.github/scripts/check-pr-issue.cjs:20),但不会删除或更新之前带 marker 的告警评论;因此旧评论仍留在对话中,看起来像持续误判。
  • 缺少关联本身只会发评论并调用 core.warning,不会让 job 失败。首次检查实际上是 success;最新一次 16:07 UTC 的检查也是 success。中间 16:03 UTC 的失败不是“未关联 issue”分支造成的。

建议后续改进检查脚本:关联恢复后,自动删除旧告警或把它更新为“已解决”,并补一条对应测试。本次仅排查,未修改代码。

View job run

@huyanxius

Copy link
Copy Markdown
Collaborator Author

⚠️ @huyanxius,此 PR 尚未关联 issue。请在 PR 描述中使用 Closes #123 等关闭关键字,或通过 Development 侧栏关联对应 issue。

已关联

@huyanxius
huyanxius requested a review from minorcell August 18, 2026 02:00
Comment thread .env.example Outdated
xiaocheny214 added a commit to xiaocheny214/DireSoul that referenced this pull request Aug 18, 2026
邀请奖励页和工作台提示已分别由 1024XEngineer#3621024XEngineer#363 承担,本 PR 只保留后端接口与 OpenAPI。
Comment thread .github/assets/invite-rewards/invite-rewards-mobile.jpg Outdated
Comment thread .github/assets/invite-rewards/invite-rewards-desktop.jpg Outdated
Comment thread backend/packages/framework/src/windup_framework/config/quota.py
Comment thread frontend/src/features/account-panel/index.tsx Outdated
Comment thread frontend/src/features/account-panel/index.tsx Outdated
@huyanxius

Copy link
Copy Markdown
Collaborator Author

@fennoai 去除下本 PR 的两张预览截图,这两张图不进仓库

@fennoai

fennoai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

已完成

View job run

Frontend regex checks duplicated backend-owned verification and invitation rules.

Remove client-side format gates while preserving invite-code normalization and input hints.

Invalid values now reach the backend and surface its authoritative error response.
The review fix changes invalid-format handling from a local rejection to an API request.

Cover verification-code submission, invite-link entry, and normalized invite redemption.

These cases prevent frontend regex gates from being reintroduced.
minorcell pushed a commit that referenced this pull request Aug 18, 2026
* feat(auth): 用邀请码重新开放注册

公开注册仍关闭自动建号,改为邀请码门槛,并补齐查看、轮换和补填邀请码接口。

Closes #355

* test: 补齐邀请码注册与兑换的失败路径覆盖

覆盖空邀请码、发码碰撞、兑换接口以及账号中心邀请码加载/生成失败。

* fix(account): 兑换邀请码后刷新积分余额和流水

兑换成功只改了提示,同页余额与流水会停在旧数据。

* revert(frontend): 把邀请码 UI 交还给账号中心与工作台 PR

邀请奖励页和工作台提示已分别由 #362#363 承担,本 PR 只保留后端接口与 OpenAPI。

* fix(quota): 轮换邀请码加行锁,重复兑换改为业务错误

冷启动不加兑换次数上限。并发轮换用 FOR UPDATE 串行化;invitee 唯一约束冲突返回已填写过邀请码。邀请双方奖励默认改为 200,与账号中心 PR 对齐。

* fix(auth): 邀请码校验对齐邀请链接字符集

注册不再返回「请填写邀请码」:前端从链接传入 invite_code,空码和非法字符统一为邀请码无效。

* feat(auth): 邀请码选填,验证码登录可建号

注册无邀请码只发注册赠送;有有效邀请码再发双方奖励。login-by-code 对未知邮箱建号。注册赠送默认改为 300,邀请奖励保持 200。

* feat(auth): 邀请码仅注册可用,改为 TTL 与只增不删

去掉登录后补填;邀请码 30 天过期,轮换插入新行并截断旧码有效期。

* feat(quota): 邀请人每日最多 3 次邀请奖励

未过期邀请码仍可继续被使用并写入关系;邀请人每个 UTC 日最多入账 600 分,超出只跳过邀请人奖励。

* chore(openapi): 按导出脚本排序 InviteCodeOut 字段
@huyanxius

Copy link
Copy Markdown
Collaborator Author

@fennoai 解决冲突

@fennoai

fennoai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

已完成

View job run

# Conflicts:
#	.env.example
#	backend/packages/framework/src/windup_framework/config/quota.py
The frontend still exposed the removed invite redemption endpoint.

Map invite expiry data and remove redemption from the quota API.

Invite consumers now match the merged backend contract.
The account panel still required an invite link to start registration.

Allow public signup and omit invite_code when no link code exists.

Login and registration copy now reflect the merged reward behavior.
The invite surfaces described rewards without the daily cap or expiry.

Show final reward rules, current-code usage, and UTC expiry.

The removed redemption flow no longer appears in the account page.
Quota test doubles still modeled the removed redemption endpoint.

Add expiry fields and remove obsolete redemption expectations.

Contract regressions now fail at the frontend API boundary.
Public registration and invite expiry behavior lacked regression coverage.

Assert omitted invite payloads, signup entry, and backend error display.

The account flow now guards both invited and direct registration.
Invite page and header tests still asserted the previous reward model.

Cover daily limits, expiry, usage count, and removed redemption UI.

Visible reward copy now stays aligned across both entry points.
PR preview screenshots must not live in the source repository.

Delete the desktop and mobile review-only JPEG assets.

The product illustration remains available to the frontend bundle.
@huyanxius
huyanxius requested a review from minorcell August 18, 2026 06:08
@minorcell

minorcell commented Aug 18, 2026

Copy link
Copy Markdown
Member

结论

这不是当前状态的误判,而是旧告警没有被撤回

  • PR 创建于 2026-08-17 15:21:43 UTC;首次 Check linked issue 随即运行,并在 15:22:08 UTC 留下告警。当时 GitHub 的 closingIssuesReferences 没有识别到关闭关联。
  • 该检查只认 GitHub GraphQL 的 closingIssuesReferences.github/scripts/check-pr-issue.cjs:7),普通提及或 Refs #357 不算关闭关联;Closes #359 才算。
  • 当前重新查询结果为 totalCount: 1,明确关联到 feat(frontend): 增加邀请奖励页与可分享注册链接 #359,所以现在已经识别正确。
  • 脚本发现关联后会直接返回(.github/scripts/check-pr-issue.cjs:20),但不会删除或更新之前带 marker 的告警评论;因此旧评论仍留在对话中,看起来像持续误判。
  • 缺少关联本身只会发评论并调用 core.warning,不会让 job 失败。首次检查实际上是 success;最新一次 16:07 UTC 的检查也是 success。中间 16:03 UTC 的失败不是“未关联 issue”分支造成的。

建议后续改进检查脚本:关联恢复后,自动删除旧告警或把它更新为“已解决”,并补一条对应测试。本次仅排查,未修改代码。

View job run

@fennoai 可以提交个 fix 的 pr; 应对此种情况;

pr body 关联之后更新原先的提示或者标记过时。

或许有更好的策略。

@fennoai

fennoai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

已提交修复

已创建独立 fix PR:huyanxius/Windup#16

  • 当 PR 已通过 closingIssuesReferences 关联 issue 时,脚本会找到旧的缺失关联告警并更新为“已解决”。
  • 活跃告警和已解决告警使用不同 marker,避免旧的已解决评论阻止未来真正需要的告警。
  • 增加 4 个回归场景:旧告警更新、无关联创建告警、活跃告警去重、已解决告警后重新创建。
  • 提交:4333035 fix: resolve stale linked issue warnings
  • 针对性测试:node --test .github/scripts/check-pr-issue.test.cjs,4/4 通过。
  • PR 架构 follow-up:Project 级统一风格上下文(下发所有角色生成)· Refs #3 #16 当前无冲突;完整 CI 将由 GitHub 继续运行。

View job run

@huyanxius

Copy link
Copy Markdown
Collaborator Author

@fennoai 为什么 backendCI 会 fail

@fennoai

fennoai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

结论

Backend CI 失败的直接原因是其中的 lint-and-test job 在 2026-08-18 06:04 UTCPytest 步骤退出码为 1

  • Install dependencies:通过
  • Ruff:通过
  • OpenAPI contract drift:通过
  • Import-linter:通过
  • Pytest:失败
  • Upload coverage:通过

这次 PR 相对固定基准 1c8ee09...0682338 没有任何 backend/ 净差异,改动全部在前端;基准提交 1c8ee09 的 Backend CI(run #752)是成功的,而且该 PR 之前的提交也曾通过 Backend CI(run #754)。因此目前证据更支持后端测试偶发失败或测试不稳定,而不是本 PR 引入了后端代码回归。GitHub check 元数据只暴露了“Pytest exit code 1”,没有具体失败测试;本次未读取 CI 日志,因此不能臆测具体测试名称。

另外,codecov/patch 的失败是独立问题:补丁覆盖率为 88.00%,目标是 88.13%,不是 Backend CI 失败原因。建议先重新运行 Backend CI;若仍失败,需要查看 Pytest 日志中的首个失败用例再针对性修复。

View job run

Patch coverage missed direct signup and reduced-motion behavior.

Exercise registration without an invite and immediate panel dismissal.

The account flow now covers both conditional branches in CI.
Patch coverage missed malformed data and competing error states.

Exercise expiry fallback, generic failures, and copy-error priority.

Invite error handling now reaches the required branch coverage.
@huyanxius
huyanxius merged commit b9b590c into 1024XEngineer:main Aug 18, 2026
7 checks passed
@minorcell

Copy link
Copy Markdown
Member

结论

这不是当前状态的误判,而是旧告警没有被撤回

  • PR 创建于 2026-08-17 15:21:43 UTC;首次 Check linked issue 随即运行,并在 15:22:08 UTC 留下告警。当时 GitHub 的 closingIssuesReferences 没有识别到关闭关联。
  • 该检查只认 GitHub GraphQL 的 closingIssuesReferences.github/scripts/check-pr-issue.cjs:7),普通提及或 Refs #357 不算关闭关联;Closes #359 才算。
  • 当前重新查询结果为 totalCount: 1,明确关联到 feat(frontend): 增加邀请奖励页与可分享注册链接 #359,所以现在已经识别正确。
  • 脚本发现关联后会直接返回(.github/scripts/check-pr-issue.cjs:20),但不会删除或更新之前带 marker 的告警评论;因此旧评论仍留在对话中,看起来像持续误判。
  • 缺少关联本身只会发评论并调用 core.warning,不会让 job 失败。首次检查实际上是 success;最新一次 16:07 UTC 的检查也是 success。中间 16:03 UTC 的失败不是“未关联 issue”分支造成的。

建议后续改进检查脚本:关联恢复后,自动删除旧告警或把它更新为“已解决”,并补一条对应测试。本次仅排查,未修改代码。
View job run

pr body 关联之后更新原先的提示或者标记过时。

或许有更好的策略。

@fennoai

不是提交到 huyanxius,而是基于 1024XEngineer/main 提交大 1024XEngineer/main;

@fennoai

fennoai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

已更正并提交到上游

已按你的要求,基于最新 1024XEngineer/Windup:mainb9b590c)创建上游 fix PR:

  • 1024XEngineer/Windup#386
  • head:1024XEngineer:fennoai/fix-pr-issue-warning-upstream
  • base:1024XEngineer:main
  • 提交:a8a96ed fix: resolve stale linked issue warnings

修复内容:关联 issue 后自动把旧告警更新为“已解决”;活跃/已解决告警使用不同 marker,确保以后如果再次取消关联,仍能重新告警;增加 4 个回归测试。

验证:node --test .github/scripts/check-pr-issue.test.cjs,4/4 通过;PR 当前无冲突,mergeable: true,其余合并要求等待 CI/分支规则完成。

之前创建在 huyanxius/Windup#16 未在本次操作中关闭;上游 #386 是应采用的 PR。

View job run

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.

feat(frontend): 增加邀请奖励页与可分享注册链接

3 participants