Crew tab: admin oversight of team members and their daily lists #117
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Type
Feature
Lineage
Child of #107 (Auth + Roles + Audit Trail). Phase 2 — builds on the Crew tab placeholder from PR #136.
Repo
ldraney/landscaping-assistantUser Story
As an admin, I want a Crew tab where I can see team members and their roles, so I can organize my crew and know who's on the team.
Context
PR #136 created the Crew tab skeleton:
CrewControllerwithrequire_role :admin, :super_admin, route at/crew, placeholder view atapp/views/crew/index.html.erb, and nav slot 5 (admin+ only). This ticket replaces the placeholder with real content.Current auth state (PR #136):
current_useris a session hash with:username,:email,:roleskeys. Usecurrent_user_has_role?("admin")for role checks — there is no ActiveRecord User model.Current nav layout (5-slot CSS grid):
Important limitation: There is no User model in the database.
current_usercomes from Keycloak session. To show crew members, the Crew tab uses a localCrewMembermodel that maps Keycloak usernames to display info. V1 does NOT link crew members to work queue items —WorkQueueItemhas no crew member association column. Per-member queue filtering is deferred to a future ticket.File Targets
Files to create:
db/migrate/YYYYMMDD_create_crew_members.rb— name, keycloak_username, role, active (boolean)app/models/crew_member.rb— represents a team memberapp/views/crew/show.html.erb— member profile (name, role, active status, Keycloak username)spec/requests/crew_spec.rb— expand existing specs (60 lines exist from PR #136)spec/models/crew_member_spec.rblib/tasks/crew.rake— seed/sync crew members (idempotent, like feature_flags:sync)Files to modify:
app/controllers/crew_controller.rb— replace placeholder with real index + show actionsapp/views/crew/index.html.erb— replace placeholder with member listconfig/routes.rb— add show action to crew resourcesapp/assets/stylesheets/application.css— crew list styles (per ~/ror-css-guide)spec/requests/role_access_spec.rb— update with crew show route access testsAcceptance Criteria
find_or_create_by!)Out of Scope
WorkQueueItemhas no crew member column — needs separate migration ticket)Test Expectations
bundle exec rspecConstraints
~/ror-css-guide(design tokens, component comments, no Tailwind, no inline styles)!important, no#idselectors in CSScurrent_useris a session hash, NOT ActiveRecord. Usecurrent_user_has_role?()helpers.Checklist
Related
docs/user-stories-auth.md— US-AUTH-11, US-AUTH-12Issue body rewritten to reflect current codebase state:
Scope Review: NEEDS_REFINEMENT
Review note:
review-1339-2026-06-06Template is complete and file targets verified, but a critical data model gap blocks two acceptance criteria.
WorkQueueItemhas no user/username/crew_member_id column (property_id,work_date,position,completedonly). AC #2 ("show their Today queue") and AC #5 ("completion count X/Y") cannot be implemented without adding ausernamecolumn migration towork_queue_items. Adddb/migrate/YYYYMMDD_add_username_to_work_queue_items.rbto File Targets, OR rewrite AC #2/AC #5 to show all work_queue_items globally (not per-member).spec/requests/role_access_spec.rbto "Files to modify" -- the new/crew/:idshow route needs role access test coverage.Scope refinement (post-review
review-1339-2026-06-06):Addressed the data model gap flagged by the reviewer:
WorkQueueItemhas no crew member association column (property_id,work_date,position,completedonly)Changes made:
spec/requests/role_access_spec.rbto "Files to modify" (already has crew tests, needs show route updates)Per-member work queue association is deferred to a future ticket that adds a crew_member column to work_queue_items.
Scope Review: READY (re-review)
Review note:
review-1339-2026-06-06-v2Previous review:
review-1339-2026-06-06(NEEDS_REFINEMENT)Both [BODY] findings from the first review are resolved:
Remaining deferred [SCOPE] items (not blocking):
Validation: FAIL
Tiers executed: Tier 1 (CI tests) + Tier 3 (production deployment & route checks)
Validation note:
validation-117-2026-06-077 checks: 0 PASS, 7 FAIL
Blocking failures:
83bfa5d) failed at theteststep —build-and-pushwas skipped, so no production image was built7e25894(from PR #156, assume_ssl). Crew member code is not deployed/auth/keycloakbut the app (since PR #151) redirects to/login:spec/requests/crew_spec.rb:93— crew show unauthenticated redirectspec/requests/role_access_spec.rb:47— role access /crew/:id redirectRequired fix: Update the two redirect expectations from
/auth/keycloakto/login, then re-trigger pipeline to build and deploy.Validation: PASS
Tiers executed: Tier 1 (code inspection) + Tier 3 (production verification)
Validation note:
validation-117-2026-06-075 checks: 5 PASS, 0 FAIL
All acceptance criteria verified in production:
/crewwith correct template (role badges, status indicators)require_role :admin, :super_adminconfirmed in controller; unauthenticated gets 302crew:syncrake task exists and usesfind_or_create_by!(idempotent)Note:
rake crew:synchas not been run yet — crew list shows empty state. Feature is fully deployed and awaiting initial data seed.