feat(account): add invite rewards center - #362
Conversation
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.
This comment was marked as outdated.
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 Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
@fennoai 我已关联 issue,为什么 CI 会误判? |
结论这不是当前状态的误判,而是旧告警没有被撤回:
建议后续改进检查脚本:关联恢复后,自动删除旧告警或把它更新为“已解决”,并补一条对应测试。本次仅排查,未修改代码。 |
已关联 |
邀请奖励页和工作台提示已分别由 1024XEngineer#362、1024XEngineer#363 承担,本 PR 只保留后端接口与 OpenAPI。
|
@fennoai 去除下本 PR 的两张预览截图,这两张图不进仓库 |
已完成
|
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.
* 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 字段
|
@fennoai 解决冲突 |
已完成
|
# 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.
@fennoai 可以提交个 fix 的 pr; 应对此种情况; pr body 关联之后更新原先的提示或者标记过时。 或许有更好的策略。 |
已提交修复已创建独立 fix PR:huyanxius/Windup#16
|
|
@fennoai 为什么 backendCI 会 fail |
结论
这次 PR 相对固定基准 另外, |
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,而是基于 1024XEngineer/main 提交大 1024XEngineer/main; |
已更正并提交到上游已按你的要求,基于最新
修复内容:关联 issue 后自动把旧告警更新为“已解决”;活跃/已解决告警使用不同 marker,确保以后如果再次取消关联,仍能重新告警;增加 4 个回归测试。 验证: |
本 PR 在账号中心提供邀请奖励入口,并将前端注册、邀请码与奖励提示完整对齐已合并的后端契约。
Why
后端 #357 已调整邀请注册规则,但前端仍保留已删除的补填接口、旧奖励文案和强制邀请码注册逻辑,导致页面承诺与实际发放不一致。
Changes
/quota/invite/redeem前端适配。invite_code,邀请链接仍自动携带邀请码。Implementation
InviteCode映射后端expires_at,used_count仅表示当前邀请码的成功注册次数。invite_code;邀请码与验证码格式继续由后端统一校验。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
Related Issues
Closes #359
Refs #357