Review: Feature: Days/Weeks/Crew controller team scoping (crew grouping 3/4)

review-1576-2026-06-23 Review

review ready

Verdict: READY

Template Completeness

  • [x] Type — Feature
  • [x] Lineage — Child of #260 (Epic), sub-ticket 3 of 4, depends on sub-ticket 2
  • [x] Repo — ldraney/landscaping-assistant
  • [x] User Story — crew lead/admin scoped views
  • [x] Context — explains relationship to sub-ticket 2
  • [x] File Targets — 3 files to modify, 2 exclusions
  • [x] Feature Flag — none (correct: scoping change, no user-visible toggle)
  • [x] Acceptance Criteria — 7 items
  • [x] Test Expectations — 3 controller tests + run command
  • [x] Constraints — references current_team helper pattern
  • [x] Checklist — standard 3-item
  • [x] Related — parent epic + dependency

Traceability

  • [x] story:auth label — "auth" story found in project-landscaping-assistant user-stories table: "Log in with Keycloak, see role-appropriate tabs and features"
  • [x] story note verified — auth entry exists in project-landscaping-assistant user-stories section
  • [x] arch:rails-app label — component is the Rails application
  • [ ] arch note MISSING — no arch-rails-app note found in pal-e-docs. This is acceptable: arch:rails-app is the primary app itself, not a separable component. Documenting it as an architecture note would add no value beyond what the project page already covers.
  • [x] Forgejo issue — https://forgejo.tail5b443a.ts.net/ldraney/landscaping-assistant/issues/264, state: open

File Targets

  • [x] app/controllers/days_controller.rb — verified: exists (127 lines). Queries WorkQueueItem unscoped in show (line 9-12), add_to_queue (line 36, 52, 56), and load_previously (line 103-108). All need current_team scoping as described.
  • [x] app/controllers/weeks_controller.rb — verified: exists (85 lines). Queries WorkQueueItem unscoped in index (line 12-14) and toggle_assign (line 54, 68). Both need current_team scoping as described.
  • [x] app/controllers/crew_controller.rb — verified: exists (11 lines). Queries CrewMember.active.by_name unscoped in index (line 5). Needs current_team scoping as described.
  • [x] app/controllers/work_queue_items_controller.rb — verified: correctly excluded. Sub-ticket 2 covers this (issue #263).
  • [x] app/services/schedule_digester.rb — verified: correctly excluded. Sub-ticket 4 covers this (issue #265).

Repo Placement

OK. Issue filed on ldraney/landscaping-assistant, all file targets are in the same repo. No cross-repo work needed.

Dependencies

  • Sub-ticket 1 (#262) — Team model + migration. Must be merged first so team_id FK exists on crew_members and work_queue_items. Currently in backlog. Board item #1574.
  • Sub-ticket 2 (#263) — current_team helper in ApplicationController + WorkQueueItemsController scoping. Must be merged first so current_team helper is available. Currently in backlog. Board item #1575.
  • Both dependencies are documented in the issue (Lineage section and Related section). Dependency chain is clear: #262 → #263 → #264.
  • No in_progress items block this ticket.

Acceptance Criteria

All 7 AC are verifiable by an agent:
  • AC 1-3 (days controller scoping): testable via controller specs — mock current_team, create items for multiple teams, assert only matching team's items returned
  • AC 4-5 (weeks controller scoping): same pattern
  • AC 6 (crew controller scoping): same pattern with CrewMember
  • AC 7 (rspec passes): run command provided
Test expectations match AC well: 3 controller test files for the 3 controllers. Existing spec files found at spec/requests/days_spec.rb, spec/requests/weeks_spec.rb, and spec/requests/crew_spec.rb — agent will modify these.

Blast Radius

  • uploads_controller.rb — also creates WorkQueueItems via ScheduleDigester (line 92). Correctly excluded: sub-ticket 4 handles schedule_digester.rb scoping. uploads_controller delegates to the service, so scoping there will cover it.
  • sessions_controller.rb — creates CrewMember records on login (line 33). Not affected: it creates the record, not queries scoped data. Team assignment will be handled by sub-ticket 1's migration (default team backfill).
  • application_controller.rb — current_crew_member helper (line 48). Not affected: this ticket consumes current_team, doesn't modify ApplicationController.
  • No sibling controllers query WorkQueueItem or CrewMember beyond what's documented.

Decomposition Assessment

3 file targets in 1 repo, 7 acceptance criteria, estimated agent work under 5 minutes. The changes follow a repetitive pattern (add .where(team_id: current_team.id) to each query). No decomposition needed.

Recommendation

No action needed. Scope is solid, all file targets verified, traceability complete, dependencies documented, fits in a single agent pass.