Fix accepted → declined transition and update service-requests doc #209
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "206-fix-decline-transitions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
declinedtoVALID_TRANSITIONS["accepted"]so customers can back out after accepting a quotedocs/service-requests.mdto reflect thatacceptedis implemented (was incorrectly noted as "planned for #179")accepted → declinedassertion changed from "rejects" to "allows"Note:
quoted → declinedwas already implemented — initial bug report over-stated the scope. Onlyaccepted → declinedwas missing.Changes
app/models/service_request.rb: added"declined"toVALID_TRANSITIONS["accepted"]spec/models/service_request_spec.rb: changedaccepted → declinedtest from "rejects" to "allows"docs/service-requests.md: updated status note to list all 7 statuses includingaccepted, updated ER diagram status fieldTest Plan
bundle exec rspec spec/models/service_request_spec.rb— 52 examples, 0 failuresaccepted → declinedbeing blockedReview Checklist
Related Notes
ldraney/landscaping-assistant #206— the Forgejo issue this PR fixesldraney/landscaping-assistant #122— ServiceRequest model (parent ticket)ldraney/landscaping-assistant #176— Property detail projects display (downstream)Closes #206
PR #209 Review
DOMAIN REVIEW
Stack: Ruby on Rails model + RSpec + Markdown docs. State machine pattern using a
VALID_TRANSITIONShash with custom validation.Model change (service_request.rb):
The fix is correct. Adding
"declined"toVALID_TRANSITIONS["accepted"]fills the only gap in the decline path. Every other non-terminal state (requested,quoted) already allowsdeclinedas an exit. Theacceptedstate was the sole exception, meaning a customer who accepted a quote had no way to back out without admin intervention at the database level. The fix is minimal and precisely scoped.Spec change (service_request_spec.rb):
The existing test at line 189 is correctly flipped from
expect(request).not_to be_validtoexpect(request).to be_valid. The test description is updated to match. This is the right approach -- the spec already existed to assert the old behavior, so flipping the assertion is cleaner than deleting and re-adding.Doc change (service-requests.md):
The stale note claiming
acceptedwas "planned for #179" is correctly updated to reflect that it is implemented. The ER diagram status field now lists all 7 statuses.BLOCKERS
None.
NITS
Mermaid state diagram missing
accepted --> declinedarrow. ThestateDiagram-v2block (lines 10-22 ofdocs/service-requests.md) does not include anaccepted --> declinedtransition. The PR adds the transition to the model and updates the ER diagram status enum, but the state diagram still omits this edge. Since the doc's purpose is to visualize the state machine, this is an inconsistency worth fixing. Consider addingaccepted --> declined : Client backs outbetween lines 18 and 19.PR body test plan has unchecked items. Two test plan items are marked
[ ]-- "Verify no other specs rely onaccepted -> declinedbeing blocked" and "No regressions in service request transition logic." These appear to be manual verification items. If they have been verified, check them off before merge for traceability.SOP COMPLIANCE
206-fix-decline-transitionsis clear)Closes #206present in PR bodyPROCESS OBSERVATIONS
quoted -> declinedwas already working and onlyaccepted -> declinedwas missing is helpful context for future readers.VERDICT: APPROVED