The work identified by reading the system end to end. This deck names and sizes the problems; it deliberately does not propose how to solve them. Everything here was verified against source, and the handful of things that could not be verified are marked as such rather than dropped or asserted.
All ten practitioner-facing referral emails overwrite the recipient address with the patient's before sending. The patient would receive three differently-templated emails per referral event, each carrying the other parties' names, roles, email addresses and phone numbers; the practitioners would receive nothing. This is a patient-data disclosure, not a cosmetic bug, and it sits directly in the path of the first agreed deliverable. It must be fixed before the switch is flipped, not after.
The only route to a verified practitioner account runs through the emailed verification link. No staff approval step exists anywhere. So on a production-mode deployment with email broken, no new practitioner can onboard at all, no one can reset a password, and no delegate can be invited. That reframes the email work from "nice to have before launch" to "the launch depends on it".
The React workspace application described in the documentation was deleted in April 2026, along with the entire Cypress end-to-end suite. What ships is a design-tool export, developed in place ever since. It has no router, no tests, and no error boundary. This is not a reason to rewrite it — but every estimate, every onboarding note and every reference to "the frontend" needs to point at the right thing.
The app recognises four ?type= values, and type=referral — the one the referral emails are built to send — is not among them. Combined with the fact that all ten practitioner dispatch sites pass an empty host, the "view this referral" link is broken at both ends. Deep-linking is a prerequisite for the email work, not a separate nicety.
backend/env.staging is tracked by git. The .gitignore pattern .env* does not match it, because the filename has no leading dot. It contains a Django secret key, an AWS access key ID and secret, Mailjet API key and secret, two Slack incoming webhooks, a Google Maps API key and a database password. They are in the history, so deleting the file is not sufficient — the keys need rotating.
Two notes. The client's own infrastructure summary says secrets were rotated out of this branch; it is worth confirming that these specific keys were included. And separately: the Mailjet credentials blocking our email work may simply be sitting here — worth raising with Anshul rather than assuming either way.
DEBUG = TrueConfirmed live: any 404 on the demo returns Django's debug page, which states DEBUG = True and prints the complete URLconf — 105 URL patterns, i.e. the entire API surface. django-debug-toolbar is installed. With DEBUG on, an unhandled 500 renders a full traceback including source lines and settings values.
This compounds the nginx finding: on the demo box /api/ and /medr/ sit outside the basic-auth gate, so the debug page and the Django admin login are both reachable from the open internet.
The useful deduction: DEBUG, MAILJET_SEND_EMAILS and SEND_SLACK_NOTIFICATIONS are all derived from one predicate — is_production_env(ENV_TYPE) — with DEBUG as its inverse. So seeing DEBUG = True from outside the box proves the demo runs a non-production ENV_TYPE, which proves email and Slack are both switched off there by that same single lever. We now know the demo's configuration without needing shell access to it.
And the consequence for delivery: those three behaviours are welded to one variable. Enabling email on the demo by flipping ENV_TYPE would simultaneously turn DEBUG off and turn Slack notifications on. They cannot currently be moved independently, which makes a staged rollout of the email work awkward. Decoupling the flags is a small piece of work that unblocks the rest.
Raised early because they change what deliverable 2 actually is. Each was checked by reading the code and then by executing it.
| What the brief says | What the code does | Consequence |
|---|---|---|
Users receive a 400 whose body is a raw stringified dump of internal ErrorDetail objects |
refuted Users receive {"detail": "Invalid input data."}. The base view intercepts its own HTTP handlers through a __getattribute__ override and wraps every one in the exception handler, which converts the validation error into that generic message. Confirmed by executing a real request against a real view: status 400, body {"detail":"Invalid input data."}. Removing the interception reproduces the raw dump the brief describes — so the description matches the code with one line deleted, not the code as it stands. |
Deliverable 2 is still real, but it is a different problem: not a leak of internals, but the opposite — every validation failure across the product collapses into one opaque sentence with no field-level detail. |
handle_view_unknown_exceptions is dead code, applied nowhere |
refuted It is applied to get, post, put, patch and delete on every view inheriting the base class, dynamically at attribute-access time. A search for the @ decorator syntax finds nothing, which is presumably where the impression came from — but the coverage is broader than hand-decorating, not narrower. |
No work needed to "revive" it. The behaviour it produces is the thing to improve. |
| The tests asserting "Invalid input data." fail | refuted as stated All eight of those assertions pass. The suite's overall health is a separate question with a genuine finding behind it — see D6 below. | The failing-test symptom does not trace to the error fault in the way described. |
ENV_TYPE alone; the MAILJET_SEND_EMAILS variable that appears in the env files is read by no code. Every env file in the repo says DEVELOPMENT.EMAIL_LINK_BASE_DOMAIN variable exists in the env files and is read by nothing. Verification and reset links instead take their base from the request's Origin header.EmailSent model, its migration and a complete status-transition manager exist; no code ever writes a row. Mailjet's returned message IDs are discarded and there is no inbound webhook. The de-duplication guard that reads this table is consequently a permanent no-op.{"detail": "Invalid input data."}. A user who mistypes one field in a fourteen-field referral form is told only that something is wrong.detail. Roughly forty further error toasts ignore the backend reason entirely and hardcode a generic string./ on every screen.?type= values are recognised; type=referral is not one of them, and it is exactly what the referral emails emit.popstate listener.Origin header rather than a configured domain. A request with a forged header produces an email containing a link to another domain carrying a live verification code. This becomes exploitable the moment real email is switched on.DEBUG = True, leaking the full URL map on any 404 and a full traceback on any unhandled error — through that same unauthenticated path.localStorage on a platform holding patient-identifiable data, and the client-side check tests only that a token is present, never that it is valid..gitignore excludes and no script in the repo generates. This is the documented local-run workaround, and it is worth fixing properly rather than documenting again.TypeError on every validation failure, and it is only swallowed because the app loggers are configured not to propagate to the root logger. In an environment where that configuration does not apply, pytest's own log handler re-raises instead of swallowing and 69 tests fail. The suite is green, but it is one logging-config change away from not being.Everything found, with severity and confidence. Ordered by severity. "Unverified" means it could not be settled from the repository and needs a check against the running system.
| Sev | Finding | Evidence | Area |
|---|---|---|---|
| crit | Practitioner referral emails addressed to the patient | Ten *ReferrerInput/*TargetInput classes overwrite the recipient in get_email_variables(). Independently re-derived and confirmed. | |
| crit | 18 of 24 Mailjet template IDs are placeholders | Literal integers 1–18 covering all referral and delegate email. Counted mechanically; cross-checked against the length assertion the service makes at start-up. | |
| crit | No Celery worker in either compose file | Both blocks commented out; worker command names the wrong app. Redis runs, so the queue exists with no consumer. Production state unverified — the deployed compose file is not in the repo. | infra |
| crit | Credentials committed and in git history | backend/env.staging is tracked; the .env* ignore pattern misses it. Django secret key, AWS key pair, Mailjet key/secret, two Slack webhooks, Google API key, DB password. Values not tested. | security |
| crit | Passwords and patient data written to the log | The whole request body is logged on any validation failure, across login, password and patient paths. | security |
| crit | Deploy script's database backup is an empty function | Prints a stage line and returns. Migrations then run against live data on every deploy. | ops |
| crit | Backend image cannot be built from a clean clone | Dockerfile copies a gitignored file that no script generates. | build |
| crit | Clinical letter upload is discarded | No file in the payload, no field on the serializer, no attachment model. Advertised on the landing page. | product |
| crit | Editing a referral creates a duplicate | Edit screen submits to the create endpoint; the update endpoint has no frontend caller. | product |
| crit | Admin screen is hardcoded | Three sample arrays, zero API calls, reachable from the admin sidebar. Seven real staff endpoints go unused. | product |
| crit | Public demo runs with DEBUG = True | Verified live: a 404 returns Django's debug page leaking all 105 URL patterns; debug toolbar installed; a 500 would render a full traceback with source and settings. Reachable without the demo password, since /api/ opts out of basic auth. | security |
| high | Password reset returns a 500 on ordinary bad input | Verified live: POST /user/password/reset/ with a non-email string returns HTTP 500 {"detail":"An unknown error occurred on the server."} where it should return a 400. The one user-facing path found that genuinely errors rather than validates. | UX |
| med | DEBUG, email and Slack are welded to one variable | All three derive from is_production_env(ENV_TYPE). Email cannot be enabled without also changing DEBUG and Slack behaviour, which blocks a staged rollout. | config |
| high | Referral email links are broken at both ends | Ten sites pass an empty host; the five patient templates carry no link; the app does not recognise type=referral. | |
| high | No delivery tracking | EmailSent is never written; message IDs discarded; no webhook; the de-duplication guard is a permanent no-op. | |
| high | All 15 referral subjects are identical | Rejections and did-not-attends arrive titled "You have been referred by …". | |
| high | Notification preferences are ignored | Four switches stored and editable; no dispatch site reads them. No unsubscribe link. | |
| high | Emailed links built from the Origin header | Nine call sites. A forged header yields a link to another domain carrying a live code. | security |
| high | Every validation error collapses to one message | Backend returns a single generic string; the frontend extractor reads only that key; ~40 further toasts discard it entirely. | UX |
| high | No router: no deep links, no back, no bookmarks | State-based navigation; query params stripped on mount; refresh resets to the dashboard. | frontend |
| high | Health check probes the wrong port and path | 8008 vs 8000, plus a trailing slash the route lacks. Container permanently unhealthy. | infra |
| med | Test suite is green but fragile | 539 passed / 1 skipped as committed. A malformed logger.error(dict, "\n\n") call in the shared base view is swallowed only because app loggers set propagate: False. Remove that and 69 tests fail. Fix the logging call regardless — it also destroys the diagnostic line. | CI |
| high | Repository fails its own strict type-check | The CI type-check gate does not pass on this branch. | CI |
| high | No frontend tests | The Cypress suite was deleted with the old frontend; nothing replaced it. No test script exists. | CI |
| med | Demo API and Django admin are not password-protected | Basic auth is declared after the location blocks; /api/ and /medr/ both opt out. | security |
| med | Session token in localStorage; presence-only auth check | A revoked token renders the full authenticated shell until the first API call fails. | security |
| med | Delegate permission flags are never read | Stored, surfaced and toggled; no consumer. Three are hardcoded true on creation. | product |
| med | Service-status cron never installed | Implemented; its call site is commented out. Its Slack variable name matches nothing the repo generates. | ops |
| med | "Request a demo" persists nothing | Slack only. Contrast the help-request endpoint, which does store a row. | product |
| med | Registration from a public page does nothing afterwards | Empty success callback on four pages. | frontend |
| med | Admin lands on the wrong page on first login | A stale captured value; self-corrects on refresh. | frontend |
| med | Misleading "await review" message | No review step exists; the account is already live. | UX |
| low | Successful denial shows an error toast | Success path calls the error toast. | UX |
| low | Analytics export is a stub | Returns an empty object; the button is commented out. | product |
| low | ~1,300 lines of unreachable frontend code shipped | Two unreachable pages including an 813-line design-tool component gallery, plus a fully commented-out page. | frontend |
| low | Debug prints in production paths | Request metadata, headers and body printed on every registration. | backend |
| low | Documentation drift | Frontend, directory layout, linter, CI stages and two script names all described wrongly. | docs |
| low | Probable typo in the production nginx server name | A comma where nginx expects a space, which would send the apex domain to the API block. Needs a live check. | infra |
| low | Billing screen will return a server error in November | A month-arithmetic bug in the placeholder subscription view. The placeholder is fine; the 500 is avoidable with a one-line change. | backend |
Checked, and left alone because the client has already decided them: the invite-a-practitioner flow that records no invitation; the billing placeholder; social login and magic links. Also excluded: one claim that the frontend renders mock data on many screens — that is not true. Apart from the admin screen, every page is on the live API. The sample fixtures in the repository are dead code, not something users see.
backend/env.staging; confirm with Anshul whether those are live before anyone uses them.