Replace first/last name with single Name field on profile edit #227
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/single-name-field"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
firstNamefield — no schema change neededCloses #226
Changes
app/views/profile/edit.html.erb-- removed first_name + last_name inputs, replaced with singlenameinput reading fromfirstNameapp/controllers/profile_controller.rb-- changed params fromfirst_name/last_nametoname, removedlast_namefrom Keycloak update call, updated validation message to "Name is required"spec/requests/profile_spec.rb-- updated all param references fromfirst_name/last_nametoname, updated validation expectation textTest Plan
bundle exec rspec spec/requests/profile_spec.rb— 34 examples, 0 failuresReview Checklist
Related Notes
ldraney/landscaping-assistant #226— the Forgejo issue this PR implementslandscaping-assistant— project this work belongs toPR #227 Review
DOMAIN REVIEW
Tech stack: Ruby on Rails (ERB views, request specs, controller with Keycloak integration)
Controller changes (
app/controllers/profile_controller.rb):params[:first_name]/params[:last_name]correctly replaced withparams[:name]last_name:kwarg removed fromkc.update_usercall -- onlyfirst_name:is sent nowparams[:name]for both:display_nameand:first_nameView changes (
app/views/profile/edit.html.erb):namefieldforattribute,nameattribute, andidattribute all consistently use "name"valuestill reads from@user_data["firstName"](Keycloak's attribute) -- correct, since Keycloak stores it asfirstNamerequiredattribute and*indicator retained on the single fieldSpec changes (
spec/requests/profile_spec.rb):first_name:/last_name:params toname:paramsession[:user][:first_name]now expected to equal "Updated Name" (full name string)Codebase impact: Exhaustive search confirms zero remaining references to
last_nameorlastNameoutside the three changed files. No orphaned code.BLOCKERS
1. Stale
lastNamedata in Keycloak (data integrity concern)The PR removes
last_name:from thekc.update_usercall but does not explicitly clear it (e.g.,last_name: ""). Existing users who previously saved a last name will retain that stale value in Keycloak'slastNameattribute forever. This is not a crash risk, but it is a data cleanliness issue.Severity assessment: This is a NIT, not a true blocker -- the
lastNamefield is simply no longer displayed or used by the application. However, if any future Keycloak-side reporting or external integration readslastName, it will contain stale data. Recommend addinglast_name: ""to the update call to explicitly clear it, or documenting the decision to leave it.No true blockers found.
NITS
Session key mismatch --
session[:user][:first_name]now stores a full name (e.g., "Updated Name"). The key name:first_nameis misleading when it holds a combined name. Consider renaming to:namefor consistency. Low priority since it is internal-only, but future developers will be confused bysession[:user][:first_name]containing "Jane Doe".Stale Keycloak
lastName-- As noted above, consider sendinglast_name: ""in theupdate_usercall to explicitly clear the field for users who previously had a last name saved. One-line addition to the controller.Test naming -- The spec description at line 205 tests session update with
name: "Updated Name"and assertssession[:user][:first_name]equals"Updated Name". A comment or more descriptiveitblock noting the intentional key reuse would help readability.SOP COMPLIANCE
Closes #226links to parent issuePROCESS OBSERVATIONS
firstNameattribute is reused as the storage backend, so no schema migration is needed.:first_namenow holds a semantically different value. If there is any developer documentation describing session structure, it should be updated.VERDICT: APPROVED
Clean, well-scoped PR. Tests are comprehensive. The stale
lastNameand session key naming are nits worth addressing in a follow-up but do not block this merge.