Validation: Add Greenview Landscaping test business seed data (#296)

validation-296-2026-07-26 Doc

validation pass

Verdict: PASS

Ticket

ldraney/landscaping-assistant#296 — Add Greenview Landscaping test business seed data. Idempotent rake task creates a second business with users, properties, and work queue items for multi-tenancy isolation testing.
Merged PR: #318

Environment

Production: landscaping-assistant.app (k3s cluster, namespace landscaping-assistant)
Pod: landscaping-assistant-7d5669d55d-575pl, status Running, 0 restarts
Image: harbor.tail5b443a.ts.net/landscaping-assistant/app:a0baf9ca04aaa3fea2d5b259a9b325198c9abb76 (matches HEAD of main)

Tiers Executed

Tier 1 (local tests) + Tier 3 (production deployment check) per arch:rails-app label.

Checks

# Criterion How Verified Result Evidence
1 rake test_data:seed creates Greenview Landscaping business (slug: greenview-landscaping) RSpec: "creates the Greenview Landscaping business" PASS Test passes. Code uses <code>find_or_create_by!(slug: "greenview-landscaping")</code>
2 Creates ~15 properties with client_name, mixed addresses, special_notes, services RSpec: "creates ~15 properties with business_id set" + "creates properties with mixed address completeness" PASS 15 properties confirmed. Mix of full addresses with GPS, partial addresses, GPS-only pins.
3 Creates ~20 work_queue_items spread across current week with varied completion states RSpec: "creates work queue items across the current week" + "creates work queue items with varied completion states" PASS 18 items created across Mon-Fri. Mix of completed, in-progress, pending, and completed_by_other.
4 Fake names/addresses clearly distinguishable from real data RSpec: "creates properties clearly distinguishable from real data" PASS All property names prefixed "Greenview - ". Addresses in Lakewood/Golden/Arvada CO area.
5 Creates 1 admin, 1 lead, 2 members for Greenview RSpec: "creates 4 crew members with distinct fake names" PASS greenview-admin (Taylor Green), greenview-lead (Jordan Rivers), greenview-member (Morgan Fields), greenview-member2 (Casey Brooks)
6 Creates UserBusiness records with appropriate roles and approved status RSpec: "creates UserBusiness records with approved status" PASS 4 UserBusiness records: admin, crew_lead, crew_member, crew_member. All status=approved.
7 Fake user names clearly distinguishable from real crew Code review PASS Names (Taylor Green, Jordan Rivers, etc.) and usernames (greenview-*) are clearly distinct from production users.
8 Outputs Keycloak account creation commands RSpec: "logs creation counts" PASS Output includes Keycloak account setup section with usernames, roles, and password instructions.
9 Task is idempotent using find_or_create_by! pattern RSpec: "is idempotent — safe to run multiple times" PASS Second run creates 0 duplicates. All entities use <code>find_or_create_by!</code>.
10 Task logs what it created RSpec: "logs creation counts" PASS Output shows counts for businesses, crew members, UserBusinesses, properties, work queue items.
11 Properties have business_id set to Greenview business RSpec: "creates ~15 properties with business_id set" PASS All 15 properties have non-nil business_id. Code also ensures business_id on existing records (line 92).
12 CI pipeline green Woodpecker pipeline #804 PASS All 6 steps green: clone, database, bundle-install, lint, test, build-and-push.
13 Production pod running and healthy kubectl get pods -n landscaping-assistant PASS Pod Running, 0 restarts. Image tag matches HEAD a0baf9c.
14 Production routes healthy curl smoke test on all routes PASS / (302), /login (200), /up (200), /privacy (200). Auth-protected routes correctly return 302.
15 Production visual check Browser screenshot of login page PASS Login page renders correctly with app branding.

Regression Check

Production routes: All 9 critical routes respond with expected status codes. No broken routes introduced.
Health check: /up returns 200.
Login flow: Login page loads and renders correctly.
Existing seed data: db/seeds.rb is untouched per acceptance criteria. Rake task is a standalone file under lib/tasks/.

Discovered Issues

Local test environment issue (non-blocking): Test "does not modify existing seed data properties" fails locally (expects business_id = nil, gets 1) but passes in CI. This appears to be caused by the local Docker test database retaining data migration state from 20260705000003_add_business_id_to_properties.rb, which assigns all null-business properties to D&T Lawn Rangers during migration. CI uses db:schema:load (no data migration side effects), while the local Docker database uses db:migrate. Not a code regression — a test environment hygiene issue. Full CI suite passes (pipeline #804, test step exit_code 0).
Local Keycloak test config (pre-existing): 407/598 tests fail locally due to follow_redirect! -> /auth/keycloak/callback RuntimeError. This is a pre-existing local Keycloak test configuration issue unrelated to PR #318.