Skip to content

Code Findings While Writing the Course

Version: 1.0 | Status: Found by reading code on 2026-09-16, not fixed | Owner: Engineering

Issues found while writing the 7-day lessons. None are patched. "Confirmed" means re-read in code by a second pass; everything else is from one reading and needs a check before acting.

Money & orders

FindingWhereStatus
With DELIVERY_OTP_ENFORCE=false (prod default), a rider can only mark an order delivered by typing the emergency OTP; orders with an OTP row are otherwise blockedinternal/order/services/delivery.go:431Confirmed
PO RecordPayment has no idempotency key; a retried partial payment records twiceinternal/procurementRead once
Voiding a payout does not free the week: ExistsForPeriod counts voided rows, so Generate skips itinternal/financeRead once
Mid-week fee change: old and new fee both match, which one pays is not deterministicinternal/financeRead once
Scheduler payouts are created by the system actor, so one super-admin can move them pending to paid aloneinternal/financeRead once
Confirming a PO never moves hospital requests to procuredinternal/procurementRead once
Webhook dedupe uses SHA-256 of body; X-Razorpay-Event-Id is read then ignoredinternal/orderRead once
Reconciler "already ran" marker is per-process memory; runs once per task when scaledinternal/orderRead once
Only checkout, walk-in and generic status change publish realtime eventsinternal/order, internal/realtimeRead once

Security & privacy

FindingWhereStatus
Audit row takes the first X-Forwarded-For value (caller-controlled); rate limiter takes the lastinternal/middleware/audit.goRead once
prescription_reviews.patient_name stored in plaintext, not covered by migration 253internal/prescriptionRead once
Schedule check covers h/h1 only, not x/narcotic; no prescription date checkinternal/prescriptionRead once — ask legal-compliance
With KYC_ENCRYPTION_KEY unset, employee Aadhaar/bank numbers silently not stored; main.go warning is staleinternal/hr, cmd/server/main.goRead once
No erasure/retention path for rider KYC or HR documents; deletion_requested_at only records the requestinternal/deliverykyc, internal/hrRead once
.env.example calls legacy R2_BUCKET_NAME bucket world-readable.env.exampleRead once
Leads UpdateStatus skips the live super-admin check that list/export dointernal/leadsRead once

Docs & tooling drift

FindingWhere
docker-compose.yml API cannot boot: default JWT_SECRET, no patient encryption keys, no Redis servicedocker-compose.yml
ops/pending-migrations/index.md says move parked files back and deploy; with prod at 295, lower numbers silently never applyops/pending-migrations/index.md
CLAUDE.md and skills/*.md describe gin, godotenv, RequireRole, date-named migrations — code uses ServeMux, viper, DB-backed permissions, numbered migrationsbackend CLAUDE.md, skills/
payment_anomaly metric filter counts every error log, not payment errorsdeploy/aws/monitoring.tf
Swagger annotations exist only in internal/dashboard/handlersinternal/*/handlers
Offer expired and review patient_responded/expired states are allowed but never setinternal/hiring, internal/prescription
Calendar OAuth comment in main.go and HIRING_CALENDAR_ENCRYPTION_KEY in .env.example are leftovers from before migration 268cmd/server/main.go, .env.example

Internal — written against the code, not the other way around.