Review: Properties tab: add sort toggle (alphabetical / proximity)
Verdict: APPROVED
Re-review after label fix:
story:property-management changed to story:property-crud. Previous review slug: review-1468-2026-07-26 (r1, NEEDS_REFINEMENT).Template Completeness
- [x] Type — Feature
- [x] Lineage — Standalone, follow-up to PR #207
- [x] Repo — ldraney/landscaping-assistant
- [x] User Story — proper As/I want/So that format
- [x] Context — explains PR #207 replaced alphabetical with proximity-only, motivates toggle
- [x] File Targets — 4 modify, 2 do-not-touch
- [x] Feature Flag — "none" (UI sort toggle, not new workflow — acceptable)
- [x] Acceptance Criteria — 5 criteria
- [x] Test Expectations — 3 expectations with run command
- [x] Constraints — 3 constraints (no Tailwind, no cookies, preserve filter controller)
- [x] Checklist — present
- [x] Related — present
Traceability
- [x] story:property-crud label — present on board item
- [x] story note verified — "property-crud" found in project-landscaping-assistant user-stories table ("Add/edit/delete client properties", success metric: "Full CRUD with search and filter")
- [x] arch:rails-app label — present on board item
- [x] arch note verified — arch-rails-app note exists in pal-e-docs (active)
- [x] Forgejo issue — ldraney/landscaping-assistant#225, state: open
File Targets
- [x]
app/controllers/properties_controller.rb— verified: line 13 has@properties = Property.by_proximity(property_scope.includes(:services)), the exact line needing conditional sort logic - [x]
app/views/properties/manage.html.erb— verified: exists, has filter chips area (service-filters div) as a natural home for the sort toggle - [x]
app/assets/stylesheets/application.css— verified: existing CSS patterns (filter-chip, btn-toggle, toggle-switch) provide reusable patterns - [x]
spec/requests/properties_spec.rb— verified: existing tests for GET /properties/manage with sort ordering tests at lines 22 and 44 - [x]
app/models/property.rb(do-not-touch) — verified:by_proximityclass method exists at line 26, no model changes needed - [x]
app/controllers/weeks_controller.rb(do-not-touch) — verified: uses by_proximity at line 10, correctly excluded as separate concern
Repo Placement
OK. Issue filed on ldraney/landscaping-assistant. All file targets are in that repo. No cross-repo concerns.
Dependencies
No blocking dependencies. Item is in backlog (sprint:3). Only active item is #1926 (keycloak/email infra) — unrelated. PR #207 (proximity sort) is already merged — this ticket builds on it.
Acceptance Criteria
5 criteria, all verifiable by an agent:
- AC1 (alphabetical default) — testable via request spec checking order
- AC2 (visible toggle) — testable via response body inspection
- AC3 (URL query param) — testable via
?sort=proximityparam - AC4 (uses existing by_proximity) — testable by verifying sort order matches model method
- AC5 (filters still work) — testable via request spec with combined params
3 test expectations with exact run command (
bundle exec rspec spec/requests/properties_spec.rb). Complete and actionable.Blast Radius
weeks_controller.rbline 10 also usesProperty.by_proximity— explicitly excluded from scope, correct.days_controller.rbline 16 usesorder(:client_name)for alphabetical — serves as reference pattern for the default sort.work_queue_items_controller.rbline 358 usesArel.sql("LOWER(client_name)")— matches AC #1's "case-insensitive" requirement, serves as reference.- No downstream consumers affected — UI-only change on Properties manage view.
Decomposition Assessment
4 file targets in 1 repo. 5 acceptance criteria. Estimated agent work under 5 minutes — simple controller conditional, HTML toggle element, minor CSS, spec additions. No decomposition needed.
Recommendation
No action needed.