Review: Multi-tenancy sub-3: Test business seed data

review-1756-2026-07-04 Review

review needs-refinement

Verdict: NEEDS_REFINEMENT

Template Completeness

  • [x] Type -- Feature
  • [x] Lineage -- sub-ticket 3 of #282, depends on #294 and #295
  • [x] Repo -- ldraney/landscaping-assistant
  • [x] User Story -- developer wants realistic test business data
  • [x] Context -- explains Business model and controller scoping dependencies
  • [x] File Targets -- 1 file to create, 0 to modify, exclusions listed
  • [x] Feature Flag -- consumes multi_tenancy from #294, no new flag
  • [x] Acceptance Criteria -- 6 criteria
  • [x] Test Expectations -- rake task specs + manual verification
  • [x] Constraints -- no real data, use existing services, idempotent
  • [x] Checklist -- standard PR/tests/no-unrelated
  • [x] Related -- parent #282, dependencies #294, #295

Traceability

  • [x] story:multi-tenancy label -- present on board item
  • [ ] story note MISSING -- no "multi-tenancy" entry in project-landscaping-assistant user-stories section. Existing stories: address-lookup, property-crud, service-tracking, special-notes, work-queue, weekly-tracking, schedule-upload, auth, custom-domain, app-store-submission. [SCOPE] Create user story entry on project-landscaping-assistant
  • [x] arch:rails-app label -- present on board item
  • [ ] arch note MISSING -- search for "arch-rails-app" returned no results in pal-e-docs. [SCOPE] Create architecture note arch-rails-app
  • [x] Forgejo issue -- #296, open, valid

File Targets

  • [x] lib/tasks/test_business_seed.rake -- to be created. Does not exist yet (confirmed). Directory lib/tasks/ exists with existing rake tasks (crew.rake, feature_flags.rake) that follow the same find_or_create_by! pattern.
  • [x] db/seeds.rb -- correctly listed as NOT to touch. Verified it contains the existing seed data (8 properties, service records for Mowing, Weeding, Edging & Trimming, Sprinklers).

Repo Placement

OK. Issue filed on ldraney/landscaping-assistant, all work is in the same repo. Single-repo change, no cross-repo concerns.

Dependencies

  • #294 (Business model, board item 1754) -- backlog. HARD DEPENDENCY. This ticket creates the Business model and business_id column on Property. The seed task cannot set business_id on properties until this migration exists.
  • #295 (controller scoping, board item 1755) -- backlog. SOFT DEPENDENCY. The seed data validates that scoping works, but the rake task itself doesn't need controller changes to run.
  • #282 (parent epic, board item 1662) -- backlog.
  • All three dependencies are documented in the issue's Lineage and Related sections.
  • The multi_tenancy feature flag referenced in the Feature Flag section does not exist in the codebase yet (no hits for "multi_tenancy" in app/, lib/, config/, spec/). It will be created by #294.

Acceptance Criteria

6 criteria, all testable by an agent:
  • AC1: Create business with specific slug -- straightforward, verifiable with Business.find_by(slug: "greenview-landscaping")
  • AC2: ~15 properties with services -- references existing services (Edging & Trimming, Mowing, Weeding, Sprinklers) which are confirmed in db/seeds.rb
  • AC3: ~20 work_queue_items -- verifiable with count
  • AC4: Distinguishable names -- "Greenview -" prefix pattern, fictional streets. Existing seed data uses generic names (Johnson, Smith, etc.), so distinction is achievable.
  • AC5: Idempotent -- find_or_create_by! pattern, consistent with crew.rake and db/seeds.rb
  • AC6: Logging output -- verifiable

Blast Radius

  • Low risk. Standalone rake task that creates test data. No modifications to existing code.
  • References models (Property, Service, WorkQueueItem) that exist today, plus Business model that will be created by #294.
  • The existing db/seeds.rb uses WorkQueueItem.delete_all on line 38. The new rake task correctly avoids touching db/seeds.rb, preventing conflict with its destructive reset pattern.
  • No downstream consumers affected. Test data is clearly namespaced under "Greenview Landscaping".

Decomposition Assessment

  • 1 file to create, 0 to modify -- below threshold
  • 6 acceptance criteria -- slightly above the 5-AC threshold, but the criteria are simple data-creation assertions, not complex logic
  • Single repo -- below threshold
  • Estimated agent work: ~3-4 minutes
  • No decomposition needed.

Recommendation

  • [SCOPE] Create user story entry "multi-tenancy" on project-landscaping-assistant user-stories section. Suggested row: Key=multi-tenancy, Role=All roles, Summary=Isolate business data so each landscaping company sees only its own properties/crew/queue, Success Metric=Properties/work-queue scoped to current_business; seed second business verifies isolation.
  • [SCOPE] Create architecture note arch-rails-app for the Rails application component. This is a systemic gap affecting all board items with the arch:rails-app label.