docs: service request architecture with mermaid diagrams #182
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "service-request-docs"
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
docs/service-requests.md— focused architecture doc for the service request workflowChanges
docs/service-requests.md(new): standalone reference for agents building #123, #176, #179, #180Test Plan
Review Checklist
Related Notes
docs/user-stories-auth.mdinto a standalone agent-readable referencePR #182 Review
DOMAIN REVIEW
Domain: Documentation (Markdown + Mermaid diagrams). Ruby on Rails codebase context.
This is a single new file
docs/service-requests.md(171 lines) serving as an architecture reference for the service request workflow. The doc contains four mermaid diagrams (stateDiagram-v2, erDiagram, two flowcharts), a role access matrix, and cross-references to five tickets.1. Data Model vs Codebase -- "as built" framing needs caution
The ERD section is titled "Data Model (as built)" which is a strong claim. Verification against the current
db/schema.rbon main reveals several discrepancies:service_requeststable: Not present indb/schema.rb. PR #178 ("Add ServiceRequest model with status transition validation") shows as closed, and theServiceRequestmodel file does not exist atapp/models/service_request.rbon this checkout. If #178 was merged, the local main may be stale -- but the doc's "as built" label should only apply to what is actually on main.owner_subon properties: The doc's PROPERTY entity showsowner_sub("Keycloak UUID of owning client"). Thedb/schema.rbhas no such column. Git status shows two related migrations were deleted (add_owner_username_to_propertiesandrename_owner_username_to_owner_sub), suggesting this column was reverted. Ifowner_subdoes not exist on main, the ERD is inaccurate.monthly_priceon services: The doc's SERVICE entity showsdecimal monthly_price. The actualservicestable only hasnameand timestamps -- no price column.crew_memberstable: The doc's CREW_MEMBER entity implies this table exists. The model fileapp/models/crew_member.rbdoes exist with validations, butdb/schema.rbhas nocrew_memberstable. Same stale-checkout caveat applies.property_commentstable: The doc's PROPERTY_COMMENT entity implies this table exists. Neither the model file nor the schema table exist on this checkout.Recommendation: Either (a) rename the section to "Data Model (target)" or "Data Model (as of PR #178)" to avoid the "as built" claim if the tables are not yet on main, or (b) verify that PR #178 actually delivered all five entities shown in the ERD and update the doc to match exactly what shipped. The doc's note about
acceptedbeing planned for #179 is good -- apply the same honesty to the rest of the ERD.2. Status Transitions
The doc lists 6 statuses:
requested, quoted, paid, scheduled, completed, declined. It also shows anacceptedstate in the state diagram with a note thatacceptedis planned for #179. This is well-handled -- the note clearly delineates current vs planned. However, since I cannot verify the model'svalidates :status, inclusion:on this checkout, the 6-status claim is unverifiable from here.3. Mermaid Diagram Syntax
All four diagrams use valid mermaid syntax:
stateDiagram-v2-- valid state transitions, proper[*]start/end markerserDiagram-- valid entity definitions with PK/FK annotations, proper relationship notation (||--o{,}o--o{)flowchart TDblocks -- valid node syntax, decision diamonds, proper arrow notationOne minor note: the
erDiagramuses the}o--o{(many-to-many) notation forPROPERTY }o--o{ SERVICE : "subscribed via property_services"which correctly represents the join table relationship. Good.4. Cross-Reference Accuracy
Verified against the Forgejo issue list:
docs/user-stories-auth.mdas "#123 -- Client request UI (My Property view)". Consistent.docs/user-stories-auth.mdas "#125 -- Stripe integration (payment links + webhook)". Consistent.5. Role Access Matrix
The matrix has 5 columns: Client, Member, Lead, Admin. Compared against
docs/user-stories-auth.mdrole permission matrix:super_admincolumn. The user-stories doc includes Super Admin as a separate column. The service-requests doc collapses it, which is fine for a focused doc but should be noted.The matrix omits Member/Lead from "View own property's requests" (showing
--). If leads and members can also be clients of the business they work for (as stated indocs/user-stories-auth.md), they would view requests through their client role, not their crew role. The--is technically correct (they don't have member/lead-specific access) but could confuse readers.BLOCKERS
None. This is a documentation-only PR -- no code changes, no security implications, no test requirements.
NITS
"as built" label is premature -- The ERD section title "Data Model (as built)" implies these tables are on main right now. If PR #178 landed the
service_requestsandcrew_memberstables, this is fine. Butproperty_comments(ticket #180) is open and not built yet. The ERD showsPROPERTY_COMMENTas if it exists. Consider labeling it "Data Model (current + planned)" or adding a note to the PROPERTY_COMMENT entity indicating it is planned (#180), similar to howacceptedstatus is labeled as planned for #179.monthly_priceon SERVICE -- The actualservicestable has nomonthly_pricecolumn. If this is planned, label it. If it was added by a recent PR, verify.owner_subon PROPERTY -- Same concern. If this column was reverted (the deleted migrations suggest it was), remove it from the ERD or label it as planned.Super Admin omitted from role matrix -- Minor, but the user-stories doc distinguishes Super Admin. A footnote like "Super Admin has all Admin permissions" would close the gap.
Stripe section references #125 -- The doc's header "Related tickets" at the top references #122, #123, #176, #179, #180 but not #125. Since the Stripe section explicitly depends on #125, consider adding it to the top-level references for completeness.
SOP COMPLIANCE
service-request-docsis descriptive; parent issue is #181. Strictly, the convention is{issue-number}-{kebab-case}(e.g.,181-service-request-docs). The branch omits the issue number prefix.Closes #181.docs:convention.PROCESS OBSERVATIONS
property_commentsormonthly_pricedo not exist yet, an agent could write code referencing nonexistent tables. Label planned items clearly.service-request-docsinstead of181-service-request-docs. Minor, but consistency helps when correlating branches to issues in CI logs.VERDICT: APPROVED
The doc is well-structured, the mermaid syntax is valid, cross-references are accurate for the tickets that are verifiable, and the role matrix is reasonable. The "as built" labeling concern is a nit, not a blocker -- the doc explicitly notes which features are planned vs current in the status lifecycle section, and should apply the same discipline to the ERD. No code changes means no test or security concerns.