Skip to content

Commit 10dbccc

Browse files
committed
docs(returnhub): update documentation for feature-complete baseline
1 parent 5ee466a commit 10dbccc

14 files changed

Lines changed: 119 additions & 70 deletions

README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
ReturnHub is a Django 5 application for managing online-retail return cases across customer, merchant, ops, and admin roles. The project combines server-rendered workflow surfaces with DRF APIs, a service-layer workflow core, persisted audit events, and artifact-backed escalation-risk scoring.
44

5-
## Current state
5+
## Feature-complete state
66

7-
The repository currently includes:
7+
Core ReturnHub development is complete as of April 23, 2026. The repository now represents a feature-complete portfolio baseline for the returns workflow product, including:
88

99
- Django 5.1 + Django REST Framework on Python 3.12
1010
- PostgreSQL-backed local development through Docker Compose
1111
- seeded demo users, groups, profiles, and 32 stable return cases
1212
- public landing and role-entry pages
1313
- authenticated console dashboards for admin, ops, customer, and merchant users
14+
- customer and merchant case-list portals with stable pagination and role-bound access
1415
- a standalone ops queue at `/ops/` with filtering, ordering, summary cards, and shared pagination
1516
- an ops case-detail workspace at `/ops/{case_id}/` with inline status changes, follow-up requests, internal notes, timeline, risk panel, and evidence list
1617
- a shared case detail route at `/cases/{case_id}/` with role-aware document visibility and inline uploads
@@ -101,6 +102,10 @@ Authenticated console routes:
101102

102103
Workflow routes:
103104

105+
- `/customer/`
106+
- `/customer/{case_id}/`
107+
- `/merchant/`
108+
- `/merchant/{case_id}/`
104109
- `/ops/`
105110
- `/ops/{case_id}/`
106111
- `/cases/{case_id}/`
@@ -121,7 +126,7 @@ Live application routes exposed by `config/urls.py`:
121126
- `GET /api/returns/{case_id}/audit-export/`
122127
- `GET /api/analytics/returns/?from=YYYY-MM-DD&to=YYYY-MM-DD`
123128

124-
Behavioral rules currently enforced in code:
129+
Behavioral rules enforced in code:
125130

126131
- customers and admins can create return cases
127132
- ops and admins can update status, set priority, and add internal notes
@@ -159,6 +164,8 @@ The project includes:
159164
- a committed model registry at `ml/registry/model_registry.json`
160165
- training, retraining, and dataset-generation management commands
161166

167+
The ML layer is production-path ready for this baseline: scoring is artifact-backed when the active model can be loaded, degrades safely to placeholder scoring when artifacts are unavailable, persists `RiskScore`, and emits `risk_scored` audit events.
168+
162169
Current committed active model:
163170

164171
- version: `retrain_baseline-logreg-v1-seed-7-rows-500`
@@ -201,7 +208,7 @@ Shared local password:
201208

202209
- `ChangeMe123!`
203210

204-
Preferred seed command for current manual verification and multi-surface demos:
211+
Preferred seed command for manual verification and multi-surface demos:
205212

206213
- `docker compose exec -T web python manage.py seed_returnhub_demo`
207214

@@ -264,13 +271,17 @@ docker compose exec -T web python manage.py retrain_baseline_model --seed 7 --ro
264271

265272
## Documentation map
266273

267-
- `README.md`: project overview and current-state summary
274+
- `README.md`: project overview and feature-complete baseline summary
268275
- `RUNBOOK.md`: bootstrap and manual verification flow
269276
- `docs/api/returns-workflow.md`: returns API behavior and permissions
270277
- `docs/api/ops-queue-contract.md`: shared queue filter, ordering, and pagination contract
271278
- `docs/ml/baseline-escalation-risk.md`: training, inference, and artifact flow
272279
- `docs/ml/model-registry.md`: registry structure and active-model metadata
280+
- `docs/ml/operations.md`: ML operational readiness, scoring, and fallback behavior
273281
- `docs/ui/product-ui-brief.md`: product-surface intent and route map
274282
- `docs/ui/design-system.md`: tokens, layout patterns, and component rules
275283
- `docs/ui/evidence-states.md`: case detail and document-upload state handling
276-
- `docs/sprint-runbook/sprint-6/sprint-6-multi-surface-verification.md`: current multi-surface verification flow
284+
- `docs/ui/visual-regression-checklist.md`: manual visual and responsive regression pass
285+
- `docs/deployment.md`: production-like Docker, Gunicorn, Nginx, and PostgreSQL deployment path
286+
- `docs/DEMO_SCRIPT.md`: deterministic feature-complete product walkthrough
287+
- `docs/sprint-runbook/sprint-6/sprint-6-multi-surface-verification.md`: archived multi-surface verification flow retained for sprint evidence

RUNBOOK.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# ReturnHub Runbook
22

3-
This runbook takes the project from clean clone to a verified local environment and checks the routes, workflows, APIs, ML artifacts, and proof commands that currently match the repository.
3+
This runbook takes the project from clean clone to a verified local environment and checks the routes, workflows, APIs, ML artifacts, and proof commands that match the feature-complete ReturnHub baseline.
44

5-
## Sprint 7 walkthrough intent
5+
## Feature-complete walkthrough intent
66

7-
This runbook covers the operational commands and checks needed to run, inspect, and verify ReturnHub after Sprint 7. It is intentionally practical. It assumes a working development or production-like environment and focuses on the tasks an operator, reviewer, or hiring manager might perform during a walkthrough.
7+
This runbook covers the operational commands and checks needed to run, inspect, and verify the completed core ReturnHub product as of April 23, 2026. It is intentionally practical. It assumes a working development or production-like environment and focuses on the tasks an operator, reviewer, or hiring manager might perform during a walkthrough.
88

99
Common operator commands:
1010

@@ -40,6 +40,7 @@ This runbook verifies:
4040
- Docker-based local setup with PostgreSQL
4141
- Django migrations and deterministic demo data
4242
- public and authenticated UI routes
43+
- customer and merchant case-list portals
4344
- ops queue and ops case-detail workflows
4445
- shared case-detail document upload flow
4546
- returns, documents, queue, risk, audit-export, and analytics APIs
@@ -187,6 +188,21 @@ Expected behavior:
187188
- customer sees recent linked cases
188189
- merchant sees recent linked cases
189190

191+
## Customer and merchant portal verification
192+
193+
Open as the matching seeded users:
194+
195+
- `customer.one` -> `http://127.0.0.1:8000/customer/`
196+
- `merchant.one` -> `http://127.0.0.1:8000/merchant/`
197+
198+
Verify:
199+
200+
- list pages render with linked cases only
201+
- pagination uses a page size of `15`
202+
- page 2 remains reachable in the seeded dataset
203+
- detail routes at `/customer/<case_id>/` and `/merchant/<case_id>/` enforce role ownership
204+
- unrelated customer or merchant actors receive a branded `403`
205+
190206
## Ops queue verification
191207

192208
Open:
@@ -239,7 +255,7 @@ Verify the page renders:
239255
Expected behavior:
240256

241257
- the route is `ops:case-detail`
242-
- the page renders current workflow state and ownership context
258+
- the page renders workflow state and ownership context
243259
- the page includes documents, notes, timeline, and risk sections
244260
- sparse cases show stable empty states such as `No documents yet`, `No notes yet`, `No timeline events yet`, and `No score yet`
245261

@@ -414,7 +430,7 @@ Check the committed active-model registry.
414430
docker compose exec -T web python manage.py shell -c "from pathlib import Path; print(Path('ml/registry/model_registry.json').read_text())"
415431
```
416432

417-
Expected current active model metadata:
433+
Expected active model metadata:
418434

419435
- version: `retrain_baseline-logreg-v1-seed-7-rows-500`
420436
- model type: `logistic_regression`

docs/DEMO_SCRIPT.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
## Goal
55

6-
This script provides a deterministic walkthrough of the current multi-surface ReturnHub product after Sprint 7. It is designed for a five to eight minute demo and follows the repo's current Docker-based workflow, seeded data, and live routes.
6+
This script provides a deterministic walkthrough of the feature-complete multi-surface ReturnHub product as of April 23, 2026. It is designed for a five to eight minute demo and follows the repo's Docker-based workflow, seeded data, and live routes.
77

88
## Pre-demo preparation
99

@@ -102,6 +102,12 @@ Narration:
102102
- Ops sees queue-oriented operational context.
103103
- Customer and merchant consoles show role-specific linked case views.
104104

105+
Optional route callout:
106+
107+
- `customer.one` can also open `http://127.0.0.1:8000/customer/`
108+
- `merchant.one` can also open `http://127.0.0.1:8000/merchant/`
109+
- these list portals provide role-bound case browsing with stable pagination
110+
105111
### 4. Walk through the ops queue
106112

107113
Open:
@@ -237,7 +243,7 @@ Suggested pacing for a five to eight minute walkthrough:
237243

238244
## Optional proof commands
239245

240-
For a more evidence-driven walkthrough, use the current runbook:
246+
For a more evidence-driven walkthrough, use the runbook:
241247

242248
- [RUNBOOK.md](../RUNBOOK.md)
243249

docs/api/ops-queue-contract.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- path: docs/api/ops-queue-contract.md -->
22
# Ops Queue Contract
33

4-
This document describes the queue contract currently shared by the server-rendered ops surface at `/ops/` and the DRF queue endpoint at `/api/returns/queue/`.
4+
This document describes the queue contract shared by the feature-complete server-rendered ops surface at `/ops/` and the DRF queue endpoint at `/api/returns/queue/`.
55

66
## Supported query parameters
77

@@ -88,7 +88,7 @@ Pagination links preserve active filters except for `page`.
8888

8989
## Response shape
9090

91-
The API queue response currently returns:
91+
The API queue response returns:
9292

9393
- `count`
9494
- `next`

docs/api/returns-workflow.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- path: docs/api/returns-workflow.md -->
22
# Returns Workflow API
33

4-
This document describes the return-case API behavior implemented in the current repository.
4+
This document describes the return-case API behavior implemented for the feature-complete ReturnHub baseline.
55

66
## Runtime routes
77

@@ -17,7 +17,7 @@ The live application exposes these routes:
1717
- `GET /api/returns/{case_id}/risk/`
1818
- `GET /api/returns/{case_id}/audit-export/`
1919

20-
The repository also contains compatibility wrappers in `api/` and canonical route modules in `returns/api/`; both are aligned around the same workflow services.
20+
The repository also contains compatibility wrappers in `api/` and canonical route modules in `returns/api/`; both are aligned around the same workflow services. The server-rendered customer, merchant, ops, and shared case-detail pages use the same service-layer behavior where applicable.
2121

2222
## Create case
2323

docs/deployment.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ hosting platform abstraction. The goal is to make one clear operator path that
88
can be followed locally, in staging, or in a VM-based deployment with minimal
99
translation.
1010

11+
The deployment target is the feature-complete ReturnHub baseline: public role
12+
entry pages, authenticated dashboards, customer and merchant portals, ops queue
13+
and case workspace, returns APIs, analytics, audit export, and persisted
14+
escalation-risk scoring.
15+
1116
This repository defaults to `config.settings.dev` when
1217
`DJANGO_SETTINGS_MODULE` is unset. Production deployment should override that
1318
explicitly in the deployment platform, not through ad hoc shell exports.

docs/ml/baseline-escalation-risk.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!-- path: docs/ml/baseline-escalation-risk.md -->
22
# Baseline Escalation Risk
33

4-
This document describes the ML flow currently implemented for return-case escalation scoring.
4+
This document describes the ML flow implemented for feature-complete ReturnHub return-case escalation scoring.
55

6-
## Current approach
6+
## Implemented approach
77

88
The project uses a logistic-regression baseline with:
99

@@ -20,7 +20,7 @@ Training and inference share the feature contract in:
2020
- `ml/contracts/return_case_features.json`
2121
- `ml/features.py`
2222

23-
The current implementation includes signals derived from:
23+
The implementation includes signals derived from:
2424

2525
- item category
2626
- delivery-to-return timing
@@ -35,7 +35,7 @@ The current implementation includes signals derived from:
3535

3636
Training data is synthetic and deterministic.
3737

38-
Current dataset flows:
38+
Dataset flows:
3939

4040
- `ml/datasets/synthetic.py` generates seeded rows
4141
- `ml/datasets/dataset.py` exposes the dataset wrapper
@@ -67,7 +67,7 @@ Retraining wrapper:
6767
docker compose exec -T web python manage.py retrain_baseline_model --seed 7 --rows 500
6868
```
6969

70-
Current committed active version:
70+
Committed active version:
7171

7272
```text
7373
retrain_baseline-logreg-v1-seed-7-rows-500
@@ -86,14 +86,14 @@ Per model version:
8686
- `<model_version>.pkl`
8787
- `<model_version>.json`
8888

89-
Committed example artifacts currently present:
89+
Committed example artifacts:
9090

9191
- `ml_artifacts/retrain_baseline-logreg-v1-seed-7-rows-500.pkl`
9292
- `ml_artifacts/retrain_baseline-logreg-v1-seed-7-rows-500.json`
9393

9494
## Metadata contract
9595

96-
Training metadata currently includes:
96+
Training metadata includes:
9797

9898
- `model_version`
9999
- `feature_contract_version`
@@ -115,7 +115,7 @@ Runtime scoring path:
115115
3. `ml/features.extract_case_features(...)` builds the feature vector.
116116
4. The model returns a probability.
117117
5. The score is quantized to two decimal places.
118-
6. Labels are mapped with current thresholds:
118+
6. Labels are mapped with these thresholds:
119119
- `>= 0.75` -> `high`
120120
- `>= 0.45` -> `medium`
121121
- otherwise -> `low`
@@ -128,7 +128,7 @@ If the active artifact cannot be loaded safely, scoring falls back to the placeh
128128

129129
The returns domain stores one `RiskScore` per case and updates that row on rescore.
130130

131-
Rescoring currently happens on:
131+
Rescoring happens on:
132132

133133
- case creation
134134
- status update
@@ -138,15 +138,15 @@ Each rescore emits a `risk_scored` audit event.
138138

139139
## Dependencies
140140

141-
ML-related runtime packages currently listed in the repository:
141+
ML-related runtime packages listed in the repository:
142142

143143
- `pandas`
144144
- `scikit-learn`
145145
- `joblib`
146146

147147
## Test coverage
148148

149-
Relevant tests currently cover training, scoring, registry access, artifacts, features, and dataset generation, including:
149+
Relevant tests cover training, scoring, registry access, artifacts, features, and dataset generation, including:
150150

151151
- `tests/test_baseline_training.py`
152152
- `tests/test_ml_training.py`

docs/ml/model-registry.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Path:
1111
ml/registry/model_registry.json
1212
```
1313

14-
Current structure:
14+
Structure:
1515

1616
```json
1717
{
@@ -25,7 +25,7 @@ Current structure:
2525
}
2626
```
2727

28-
## Current active model
28+
## Active model
2929

3030
- version: `retrain_baseline-logreg-v1-seed-7-rows-500`
3131
- model type: `logistic_regression`

0 commit comments

Comments
 (0)