Review: Add business code and subscription fields to Business model

review-1905-2026-07-25 Review

review ready

Verdict: READY

Re-review: Previous verdict was NEEDS_REFINEMENT (2 issues). Both resolved. Upgrading to READY.

Template Completeness

  • [x] Type -- Feature
  • [x] Lineage -- References #307, SaaS onboarding sprint
  • [x] Repo -- ldraney/landscaping-assistant
  • [x] User Story -- "As a platform owner..."
  • [x] Context -- Design decisions documented (join_code format, subscription_status enum, defaults)
  • [x] File Targets -- Modify and Do NOT touch sections present
  • [x] Feature Flag -- "None -- existing multi_tenancy flag gates the broader feature"
  • [x] Acceptance Criteria -- 7 criteria
  • [x] Test Expectations -- 6 test cases + run command
  • [x] Constraints -- 4 constraints (patterns, collision resistance, no new gems, reversible migration)
  • [x] Checklist -- Standard checklist
  • [x] Related -- Project, dependencies, design doc

Traceability

  • [x] story:multi-tenancy label -- "Business model with row-level property isolation" found in project-landscaping-assistant user-stories section
  • [x] story:saas label -- "SaaS subscription, business codes for crew onboarding, admin approval of join requests, Apple IAP billing" found in project-landscaping-assistant user-stories section (FIXED since prior review)
  • [x] arch:rails-app label -- arch-rails-app note exists (active, architecture type)
  • [x] Forgejo issue -- ldraney/landscaping-assistant#308, state: open

File Targets

  • [x] app/models/business.rb -- verified: exists (250 bytes), has name/slug validations + has_many :user_businesses and :properties. Matches ticket claim of "simple ActiveRecord validations, no concerns"
  • [x] db/migrate/YYYYMMDD_add_business_code_fields.rb -- new file to create. Correct convention. Existing migration 20260705000001_create_businesses.rb confirms businesses table exists with name and slug columns only. No join_code or subscription columns yet.
  • [x] spec/models/business_spec.rb -- verified: exists (2.3k), has existing validation and association tests. New test cases will be added alongside.
  • [x] Do NOT touch list verified: app/models/user_business.rb exists, db/seeds.rb has 0 Business references, controllers/views/routes excluded. (FIXED since prior review: db/seeds.rb removed from modify targets, correctly placed in Do NOT touch with rationale.)

Repo Placement

OK -- all file targets are in ldraney/landscaping-assistant, matching the Forgejo issue repo. Single-repo, no cross-repo concerns.

Dependencies

  • Depends on #294 (Business model creation) -- board item #1754, column: done. Dependency satisfied.
  • #295 (multi-tenancy scoping) -- board item #1755, column: needs_approval. Not a dependency. Both touch Business model but no conflict -- #295 adds scoping logic, this ticket adds new columns.
  • #296 (test business seed data) -- board item #1756, column: todo. Not a dependency; ticket correctly excludes db/seeds.rb.
  • Blocks #309 (join form) -- board item #1906, backlog. Needs join_code field.
  • Blocks #310 (admin approval) -- board item #1907, backlog. Needs subscription fields.
  • Blocks #312 (Keycloak registration field) -- board item #1909, backlog.
Dependency chain is clean. Upstream dependency (#294) complete. Downstream tickets correctly wait in backlog.

Acceptance Criteria

All 7 criteria are machine-verifiable via RSpec:
  • AC 1-3: join_code auto-generation, format validation, uniqueness constraint -- unit tests
  • AC 4-5: subscription_status inclusion validation and default -- unit tests
  • AC 6: generate_join_code method return value -- method-level unit test
  • AC 7: migration column specification -- schema inspection
Run command valid: docker compose run --rm web bundle exec rspec spec/models/business_spec.rb. No missing criteria. Scope correctly limited to data layer.

Blast Radius

  • No existing code references join_code, subscription_status, subscription_expires_at, or apple_original_transaction_id anywhere in the codebase
  • Business model referenced only by user_business.rb (excluded) and property.rb (belongs_to, unaffected by new columns)
  • No controllers, views, or routes affected -- data-layer-only as stated
  • multi_tenancy flag exists in worktree (being added by #295). Ticket correctly says no new flag needed for this data-layer change
  • No similar patterns in sibling models needing the same treatment

Decomposition Assessment

  • File targets: 3 files in 1 repo -- within limits (threshold: >3 across >2 repos)
  • Acceptance criteria: 7 -- above the >5 indicator, but all AC are tightly cohesive single-model validations and one migration. No cross-system complexity.
  • Estimated agent time: ~3 minutes (one migration, one model edit, one spec update)
  • No decomposition needed.

Recommendation

No action needed. Both issues from the prior NEEDS_REFINEMENT review have been resolved:
  • [SCOPE] story:saas entry missing -- now present in project-landscaping-assistant user-stories table
  • [BODY] db/seeds.rb file target incorrect -- removed from modify targets, correctly listed in Do NOT touch section