feat: add optional invitation-code registration - #6317
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds invitation-code management, atomic invitation settings, transactional registration enforcement, provider identity migration, OAuth/WeChat/Telegram integration, root-only administration APIs, audit/log redaction, and OpenAPI documentation. ChangesInvitation registration platform
Estimated code review effort: 5 (Critical) | ~120 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 11
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/default/src/features/auth/sign-up/components/sign-up-form.tsx (1)
143-150: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winAvoid side effects during the render phase.
Calling
clearLegacyInvitationCodeStorage()directly in the component body causes a side effect during rendering. React requires render functions to be pure. Move this call into theuseEffecthook that runs on mount.💡 Proposed fix to move the side effect into the effect hook
- clearLegacyInvitationCodeStorage() useEffect(() => { + clearLegacyInvitationCodeStorage() const searchParams = new URLSearchParams(window.location.search) const aff = searchParams.get('aff')?.trim() if (aff) { saveAffiliateCode(aff) } }, [])🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/default/src/features/auth/sign-up/components/sign-up-form.tsx` around lines 143 - 150, Move the clearLegacyInvitationCodeStorage() call from the SignUpForm component body into the existing mount-only useEffect alongside the affiliate-code handling, keeping rendering pure and preserving both mount-time behaviors.
🧹 Nitpick comments (4)
controller/invitation.go (1)
73-79: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse
common.DecodeJsoninstead ofc.ShouldBindJSONfor consistency with the codebase's JSON-wrapper convention.Both
AddInvitationCodes(line 75) andUpdateInvitationCode(line 116) decode request bodies viac.ShouldBindJSON, while the siblingcontroller/option.go(UpdateOption,UpdateInvitationCodeOption) consistently usescommon.DecodeJson(c.Request.Body, &request)for the same purpose in this same PR layer.♻️ Proposed fix
func AddInvitationCodes(c *gin.Context) { request := invitationCodeCreateRequest{} - if err := c.ShouldBindJSON(&request); err != nil { + if err := common.DecodeJson(c.Request.Body, &request); err != nil { common.ApiErrorI18n(c, i18n.MsgInvalidParams) return }func UpdateInvitationCode(c *gin.Context) { request := invitationCodeUpdateRequest{} - if err := c.ShouldBindJSON(&request); err != nil { + if err := common.DecodeJson(c.Request.Body, &request); err != nil { common.ApiErrorI18n(c, i18n.MsgInvalidParams) return }As per coding guidelines: "All JSON marshal and unmarshal operations in business code must use the wrappers in
common/json.go... rather than directencoding/jsoncalls."Also applies to: 114-119
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@controller/invitation.go` around lines 73 - 79, Replace direct c.ShouldBindJSON usage with common.DecodeJson(c.Request.Body, &request) in both AddInvitationCodes and UpdateInvitationCode, preserving their existing invalid-parameter error handling and request processing.Source: Coding guidelines
web/default/src/features/auth/components/oauth-providers.tsx (1)
59-61: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAvoid destructuring component props.
As per coding guidelines, avoid destructuring objects unless necessary, especially component props. Prefer direct property access (e.g.,
props.registrationMode) for clarity. Since the existing code already destructures props, you may consider refactoring the component signature to usepropsdirectly in a future cleanup to align with project standards.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/default/src/features/auth/components/oauth-providers.tsx` around lines 59 - 61, Refactor the OAuth providers component to accept a single props object instead of destructuring its parameters. Update references to registrationMode, invitationCode, and onInvitationRequired to use the props object directly, preserving the existing behavior.Source: Coding guidelines
web/default/src/features/system-settings/auth/invitation-code-section.tsx (1)
97-145: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAlign form save feedback and dirty state tracking with other sections.
The newly added
BasicAuthSectionincludessaveConfirmedstate,FormDirtyIndicator, and callsform.reset(values)upon successful save to clear the form's dirty state. Consider implementing the same pattern here for consistent UX.✨ Proposed implementation
-import { useMemo } from 'react' +import { useMemo, useState } from 'react' import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { z } from 'zod' @@ -48,6 +48,7 @@ import { SettingsSection } from '../components/settings-section' import { useResetForm } from '../hooks/use-reset-form' import { useUpdateInvitationCodeConfig } from '../hooks/use-update-invitation-code-config' +import { FormDirtyIndicator } from '../components/form-dirty-indicator' const invitationCodeSchema = z .object({ @@ -97,6 +98,7 @@ export function InvitationCodeSection(props: InvitationCodeSectionProps) { const { t } = useTranslation() const updateInvitationCodeConfig = useUpdateInvitationCodeConfig() + const [saveConfirmed, setSaveConfirmed] = useState(false) const formDefaults = useMemo<InvitationCodeFormValues>(() => { const methods = INVITATION_REGISTRATION_METHODS.filter((method) => props.defaultValues.InvitationCodeMethods.includes(method) @@ -131,6 +133,8 @@ required: values.InvitationCodeRequired, methods, }) + form.reset(values) + setSaveConfirmed(true) } catch { // The mutation owns error feedback and keeps the form unchanged. } @@ -142,7 +146,13 @@ <SettingsPageFormActions onSave={form.handleSubmit(onSubmit)} isSaving={updateInvitationCodeConfig.isPending} + saveLabel={ + saveConfirmed && !form.formState.isDirty + ? 'Saved' + : 'Save Changes' + } /> + <FormDirtyIndicator isDirty={form.formState.isDirty} /> <FormField control={form.control} name='InvitationCodeRequired'🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/default/src/features/system-settings/auth/invitation-code-section.tsx` around lines 97 - 145, The InvitationCodeSection submit flow lacks save confirmation and dirty-state reset. Add the established saveConfirmed state and FormDirtyIndicator pattern used by BasicAuthSection, and reset the form with the submitted values after updateInvitationCodeConfig.mutateAsync succeeds so a successful save clears dirty tracking; preserve the existing mutation error handling.web/classic/src/pages/Invitation/index.jsx (1)
216-224: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMagic status numbers
1/2for enable/disable.Extracting named constants (e.g.
INVITATION_STATUS_ENABLED = 1,INVITATION_STATUS_DISABLED = 2) would make these call sites self-documenting.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/classic/src/pages/Invitation/index.jsx` around lines 216 - 224, Define named constants for the enabled and disabled invitation statuses, then replace the literal 1 and 2 arguments in the updateStatus calls within the Invitation component with those constants. Keep the existing enable/disable behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@controller/invitation.go`:
- Around line 30-186: Restrict the invitation management routes to root users by
replacing AdminAuth with RootAuth in router/api-router.go. Apply the same
authorization correction to the related management routes in
controller/invitation.go (lines 30-186) and controller/option.go (lines
359-390), preserving their existing handlers and behavior.
In `@controller/option.go`:
- Around line 130-133: Update the invitation-option guard in the option handling
flow to use common.ApiErrorI18n with a dedicated i18n.Msg* key instead of
passing ErrInvitationCodeOptionRequiresAtomicUpdate directly to common.ApiError.
Preserve the existing rejection behavior while ensuring the error is localized
consistently with the other invitation-related validations.
In `@model/auth_identity.go`:
- Around line 229-268: The backfillBuiltInAuthIdentities flow should process
users in bounded batches instead of loading the full table and inserting all
identities in one transaction. Iterate through the legacy users with a stable
primary-key cursor or equivalent batching, committing each batch independently,
and have duplicate or otherwise ambiguous legacy identity conflicts be skipped
or logged without aborting the remaining backfill; preserve fatal handling for
database errors that prevent continued processing.
In `@web/classic/src/components/auth/RegisterForm.jsx`:
- Around line 464-477: Update the invitation-code field condition in the OAuth
registration form to use the per-method requirement logic, showing it only when
at least one visible OAuth method requires an invitation code rather than
relying solely on status.invitation_code_required. Reuse isInvitationRequired
with the relevant visible provider methods and keep the existing password-form
behavior unchanged.
In `@web/classic/src/i18n/locales/vi.json`:
- Line 4240: Update the Vietnamese translation for the key
“邀请码明文仅在本次生成后显示,请妥善保存。” to explicitly convey that the invitation code is shown
in plaintext and only once after generation, while retaining the instruction to
store it securely.
In `@web/classic/src/pages/Invitation/index.jsx`:
- Around line 87-156: Wrap the API request and subsequent success handling in
updateStatus, deleteOne’s Modal.confirm onOk, deleteUsed’s onOk, and createCodes
with try/catch blocks matching load()’s established error handling. On rejected
requests, call showError with the caught error details and prevent success
notifications, state updates, reloads, or unhandled promise rejections.
In `@web/default/src/features/auth/lib/invitation.test.ts`:
- Around line 19-86: Convert the tests in the “invitation code compatibility”
suite from Node’s built-in test runner to Vitest: replace the node:test imports
and assertion usage with Vitest’s describe, test, and expect APIs. Preserve all
existing test cases, inputs, and expected behavior for getInvitationCodeMethods
and isInvitationCodeRequired.
In `@web/default/src/features/auth/lib/registration.test.ts`:
- Around line 19-83: Update the registration availability tests in the public
registration availability suite to import describe, test, and expect from vitest
instead of node:test and node:assert/strict, then replace assert.equal
assertions with expect(...).toBe(...) while preserving all existing test cases
and behavior.
In `@web/default/src/features/auth/lib/storage.test.ts`:
- Around line 19-55: Replace the Node.js test imports and test API in the
clearLegacyInvitationCodeStorage test with Vitest equivalents, while preserving
the existing assertions, window mocking, and cleanup behavior.
In `@web/default/src/i18n/locales/ru.json`:
- Around line 5194-5207: Update the Russian invitation metadata translations in
the locale entries for “Created at,” “Used at,” and “Used by” to “Дата
создания,” “Дата использования,” and “Использовано пользователем” respectively;
leave the other invitation-code translations unchanged.
In `@web/default/src/routes/_authenticated/invitation-codes/index.tsx`:
- Around line 26-31: Update the access check in the invitation route’s
beforeLoad guard to require ROLE.SUPER_ADMIN instead of ROLE.ADMIN, while
preserving the existing redirect for unauthenticated or insufficiently
privileged users.
---
Outside diff comments:
In `@web/default/src/features/auth/sign-up/components/sign-up-form.tsx`:
- Around line 143-150: Move the clearLegacyInvitationCodeStorage() call from the
SignUpForm component body into the existing mount-only useEffect alongside the
affiliate-code handling, keeping rendering pure and preserving both mount-time
behaviors.
---
Nitpick comments:
In `@controller/invitation.go`:
- Around line 73-79: Replace direct c.ShouldBindJSON usage with
common.DecodeJson(c.Request.Body, &request) in both AddInvitationCodes and
UpdateInvitationCode, preserving their existing invalid-parameter error handling
and request processing.
In `@web/classic/src/pages/Invitation/index.jsx`:
- Around line 216-224: Define named constants for the enabled and disabled
invitation statuses, then replace the literal 1 and 2 arguments in the
updateStatus calls within the Invitation component with those constants. Keep
the existing enable/disable behavior unchanged.
In `@web/default/src/features/auth/components/oauth-providers.tsx`:
- Around line 59-61: Refactor the OAuth providers component to accept a single
props object instead of destructuring its parameters. Update references to
registrationMode, invitationCode, and onInvitationRequired to use the props
object directly, preserving the existing behavior.
In `@web/default/src/features/system-settings/auth/invitation-code-section.tsx`:
- Around line 97-145: The InvitationCodeSection submit flow lacks save
confirmation and dirty-state reset. Add the established saveConfirmed state and
FormDirtyIndicator pattern used by BasicAuthSection, and reset the form with the
submitted values after updateInvitationCodeConfig.mutateAsync succeeds so a
successful save clears dirty tracking; preserve the existing mutation error
handling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 30775c00-ab2e-42e7-8788-f199fc021ea0
📒 Files selected for processing (123)
common/constants.gocommon/database.gocommon/invitation.gocommon/invitation_test.gocontroller/audit.gocontroller/custom_oauth.gocontroller/custom_oauth_test.gocontroller/invitation.gocontroller/invitation_test.gocontroller/misc.gocontroller/oauth.gocontroller/oauth_invitation_test.gocontroller/option.gocontroller/option_invitation_test.gocontroller/registration_matrix_test.gocontroller/telegram.gocontroller/telegram_registration_boundary_test.gocontroller/user.gocontroller/wechat.gocontroller/wechat_invitation_test.godocs/openapi/api.jsondto/registration.goi18n/keys.goi18n/locales/en.yamli18n/locales/zh-CN.yamli18n/locales/zh-TW.yamlmiddleware/audit.gomiddleware/logger.gomiddleware/logger_test.gomodel/auth_identity.gomodel/auth_identity_test.gomodel/custom_oauth_provider.gomodel/invitation_code.gomodel/invitation_code_concurrency_test.gomodel/invitation_code_test.gomodel/locking.gomodel/main.gomodel/oauth_state_grant.gomodel/oauth_state_grant_test.gomodel/option.gomodel/option_invitation_test.gomodel/sqlite_dsn_test.gomodel/sqlite_retry.gomodel/task_cas_test.gomodel/user.gomodel/user_authentication_test.gomodel/user_oauth_binding.gorouter/api-router.gorouter/passkey_registration_boundary_test.goservice/registration.goservice/registration_test.goweb/classic/src/App.jsxweb/classic/src/components/auth/LoginForm.jsxweb/classic/src/components/auth/OAuth2Callback.jsxweb/classic/src/components/auth/RegisterForm.jsxweb/classic/src/components/layout/PageLayout.jsxweb/classic/src/components/layout/SiderBar.jsxweb/classic/src/components/settings/SystemSetting.jsxweb/classic/src/components/settings/personal/cards/NotificationSettings.jsxweb/classic/src/helpers/api.jsweb/classic/src/helpers/index.jsweb/classic/src/helpers/invitation.jsweb/classic/src/helpers/invitation.test.jsweb/classic/src/helpers/render.jsxweb/classic/src/hooks/common/useSidebar.jsweb/classic/src/i18n/locales/en.jsonweb/classic/src/i18n/locales/fr.jsonweb/classic/src/i18n/locales/ja.jsonweb/classic/src/i18n/locales/ru.jsonweb/classic/src/i18n/locales/vi.jsonweb/classic/src/i18n/locales/zh-CN.jsonweb/classic/src/i18n/locales/zh-TW.jsonweb/classic/src/pages/Invitation/index.jsxweb/classic/src/pages/Setting/Operation/SettingsSidebarModulesAdmin.jsxweb/classic/src/pages/Setting/Personal/SettingsSidebarModulesUser.jsxweb/default/src/components/layout/components/public-header.tsxweb/default/src/features/auth/api.tsweb/default/src/features/auth/components/oauth-providers.tsxweb/default/src/features/auth/constants.tsweb/default/src/features/auth/hooks/use-oauth-login.tsweb/default/src/features/auth/lib/invitation.test.tsweb/default/src/features/auth/lib/invitation.tsweb/default/src/features/auth/lib/registration.test.tsweb/default/src/features/auth/lib/registration.tsweb/default/src/features/auth/lib/storage.test.tsweb/default/src/features/auth/lib/storage.tsweb/default/src/features/auth/sign-in/index.tsxweb/default/src/features/auth/sign-up/components/sign-up-form.tsxweb/default/src/features/auth/types.tsweb/default/src/features/invitation-codes/api.tsweb/default/src/features/invitation-codes/components/create-invitation-codes-dialog.tsxweb/default/src/features/invitation-codes/components/generated-invitation-codes-dialog.tsxweb/default/src/features/invitation-codes/components/invitation-code-actions.tsxweb/default/src/features/invitation-codes/components/invitation-codes-data-view.tsxweb/default/src/features/invitation-codes/components/invitation-codes-table.tsxweb/default/src/features/invitation-codes/constants.tsweb/default/src/features/invitation-codes/index.tsxweb/default/src/features/invitation-codes/types.tsweb/default/src/features/system-settings/api.tsweb/default/src/features/system-settings/auth/basic-auth-section.tsxweb/default/src/features/system-settings/auth/index.tsxweb/default/src/features/system-settings/auth/invitation-code-section.tsxweb/default/src/features/system-settings/auth/section-registry.tsxweb/default/src/features/system-settings/hooks/use-update-invitation-code-config.tsweb/default/src/features/system-settings/hooks/use-update-option.tsweb/default/src/features/system-settings/maintenance/config.tsweb/default/src/features/system-settings/maintenance/sidebar-modules-section.tsxweb/default/src/features/system-settings/types.tsweb/default/src/hooks/use-sidebar-config.tsweb/default/src/hooks/use-sidebar-data.tsweb/default/src/i18n/locales/en.jsonweb/default/src/i18n/locales/fr.jsonweb/default/src/i18n/locales/ja.jsonweb/default/src/i18n/locales/ru.jsonweb/default/src/i18n/locales/vi.jsonweb/default/src/i18n/locales/zh-TW.jsonweb/default/src/i18n/locales/zh.jsonweb/default/src/i18n/static-keys.tsweb/default/src/lib/oauth.tsweb/default/src/routeTree.gen.tsweb/default/src/routes/(auth)/oauth.tsxweb/default/src/routes/_authenticated/invitation-codes/index.tsxweb/default/src/routes/oauth/$provider.tsx
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@model/auth_identity_migration.go`:
- Around line 79-84: Update both migration paths in
model/auth_identity_migration.go: the CreateAuthIdentityWithTx handling at lines
79-84 and AuthIdentityProviderKeyForCustomOAuth handling at lines 143-148.
Detect empty or invalid claim.Subject and binding.ProviderUserId values, skip
those legacy rows, and increment the existing skipped/conflict counter instead
of aborting InitializeAuthIdentities(); preserve returning unexpected errors.
In `@model/auth_identity.go`:
- Around line 105-117: Update the legacy backfill update in the auth identity
binding flow to match rows where provider_subject_value is either an empty
string or NULL. Preserve the existing id constraint and provider-subject
collision checks, ensuring NULL-valued legacy identities are populated with
providerSubject.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bb5f8a42-6baa-4806-8aff-ca7a3de26035
📒 Files selected for processing (32)
common/constants.gocontroller/audit.gocontroller/auth_flow_test.gocontroller/misc.gocontroller/oauth.gocontroller/oauth_invitation_test.gocontroller/option.gocontroller/registration_matrix_test.gocontroller/telegram.gocontroller/telegram_registration_boundary_test.gocontroller/telegram_test.gocontroller/user.gocontroller/wechat.godocs/openapi/api.jsonmiddleware/audit.gomodel/auth_identity.gomodel/auth_identity_migration.gomodel/auth_identity_migration_test.gomodel/auth_identity_test.gomodel/custom_oauth_provider.gomodel/external_identity_claim.gomodel/external_identity_claim_test.gomodel/invitation_code.gomodel/invitation_code_test.gomodel/main.gomodel/option.gomodel/task_cas_test.gomodel/user.gomodel/user_authentication_test.gomodel/user_oauth_binding.gorouter/api-router.gorouter/invitation_permission_test.go
💤 Files with no reviewable changes (1)
- controller/telegram_registration_boundary_test.go
🚧 Files skipped from review as they are similar to previous changes (10)
- common/constants.go
- model/user_authentication_test.go
- model/task_cas_test.go
- controller/option.go
- controller/misc.go
- controller/audit.go
- controller/user.go
- controller/wechat.go
- model/option.go
- model/auth_identity_test.go
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
web/src/i18n/locales/zh.json (1)
5224-5224: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAvoid implying that every invitation code is single-use.
“一次性邀请码” tells Chinese administrators that each code can be redeemed exactly once, while the feature supports configurable usage limits. Use wording such as “用于新用户注册的邀请码” unless all codes are guaranteed to be single-use.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/src/i18n/locales/zh.json` at line 5224, Update the Chinese translation for “Create one-time codes for new account registration” to avoid implying single-use redemption; use wording equivalent to “用于新用户注册的邀请码” while preserving the registration invitation-code meaning.web/src/i18n/locales/fr.json (1)
5219-5269: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winPreserve the “future” reference in the French validation message.
Line 5269 says the expiration date must be “later” but omits later than what, making the validation message incomplete. Use wording such as “La date d’expiration doit être dans le futur.”
Proposed wording
- "Expiration time must be in the future": "La date d'expiration doit être ultérieure" + "Expiration time must be in the future": "La date d'expiration doit être dans le futur"🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/src/i18n/locales/fr.json` around lines 5219 - 5269, Update the French translation for “Expiration time must be in the future” to explicitly state that the expiration date must be in the future, preserving the intended future-time reference in the validation message.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@web/src/i18n/locales/fr.json`:
- Around line 5219-5269: Update the French translation for “Expiration time must
be in the future” to explicitly state that the expiration date must be in the
future, preserving the intended future-time reference in the validation message.
In `@web/src/i18n/locales/zh.json`:
- Line 5224: Update the Chinese translation for “Create one-time codes for new
account registration” to avoid implying single-use redemption; use wording
equivalent to “用于新用户注册的邀请码” while preserving the registration invitation-code
meaning.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cce4fde3-e96d-4c37-833d-07da3350afb6
📒 Files selected for processing (13)
controller/user.gomodel/auth_identity.gomodel/auth_identity_migration.gomodel/auth_identity_migration_test.gomodel/auth_identity_test.gomodel/task_cas_test.goweb/src/i18n/locales/en.jsonweb/src/i18n/locales/fr.jsonweb/src/i18n/locales/ja.jsonweb/src/i18n/locales/ru.jsonweb/src/i18n/locales/vi.jsonweb/src/i18n/locales/zh-TW.jsonweb/src/i18n/locales/zh.json
🚧 Files skipped from review as they are similar to previous changes (6)
- model/task_cas_test.go
- model/auth_identity_migration_test.go
- model/auth_identity_migration.go
- controller/user.go
- model/auth_identity_test.go
- model/auth_identity.go
|
Review follow-up for the outside-diff localization notes:
|
Resolve integration conflicts in: - controller/user.go - model/main.go - model/option.go Preserve invitation registration semantics while incorporating the latest upstream DTO, GORM configuration, and option validation changes.
Important
邀请码功能默认关闭,关闭时保持现有注册行为。下述验证结果对应提交
97bd0d79,该提交已合入验证时的upstream/main@c3db4140。📝 变更描述 / Description
本 PR 为新用户注册增加可选、可按注册方式配置的邀请码验证机制:
🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
🧪 验证结果 / Validation
当前验证对象为合并提交
97bd0d79f9e75b1c09774f05be286c3690ed9b8b:go test ./... -count=1通过,relaykit子模块全量测试通过。bun test共 27 个文件、140 个测试通过;另行筛选的认证流程共 11 个文件、65 个测试也通过;typecheck和生产构建通过。/api/status返回 HTTP 200。/api/status返回 HTTP 200。$ref全部可解析,未引入 unresolved reference。ℹ️ 已知基线与覆盖边界 / Known Baselines and Coverage
-race门禁会检出logger.logHelper中的既有logCount数据竞争。在本次 Candidate/Base A/B 重复测试中,54/54 次独立运行均复现同一缺陷,相关文件逐字节一致;这不是本 PR 引入的回归。bun run lint当前未通过(386 errors / 82 warnings),bun run format:check当前也未通过(2 个文件)。这些诊断模式和两处格式问题均已存在于upstream/main;前端测试、类型检查和生产构建已通过。Combination问题在 base 和 candidate 中数量相同,属于上游基线。oauth-create-flow.test.ts未调用真实生产 API 函数。