diff --git a/CLAUDE.md b/CLAUDE.md index 7ba9937..16bb392 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -3,21 +3,14 @@ ## What's mid-flight — read this first **Parked / deferred work:** see `docs/plans/parked-work.md`. -**Production status (15 May 2026):** migrations `0013_add_site_report`, -`0014_add_absence`, `0015_absence_project` are deployed; `/history/` -is no longer crashing on the production VM. The Worker Absences -feature shipped on 14 May 2026 (commits `bf6f0a5` → `27fe05e` on -`ai-dev`). **13 subsequent commits** of UX polish + cleanup + -dashboard/report number audit (team filters, dropdown stacking fix, -day-name in payroll modal, calendar-month math, outstanding totals -aligned, `Project.name` dedupe, `timezone.localdate()`, -`_company_cost_velocity` SQL-aggregated, signed adjustment amounts, -hero-card scope sublines) are on `ai-dev` HEAD but not yet on -production — needs a `git pull` + `sudo systemctl restart -django-dev.service` whenever convenient (no migrations or -collectstatic required for any of them). See -`docs/plans/parked-work.md` "Pending pull-and-restart" table for -the full commit list. +**Production status (15 May 2026):** ✅ fully caught up. Production +is deployed at `origin/ai-dev` HEAD `1d224bc` — SiteReport + +Absences feature, all UX polish, team filters, the 18-finding +dashboard/report number audit, and template-comment fixes are all +LIVE. Nothing pending deploy. (Deploy-ordering lesson from this +day is captured in the "DEPLOY ORDERING" bullet of the +Flatlogic/AppWizzy Deployment section — restart must come AFTER +the code is pulled, because `DEBUG=False` caches templates.) Phase A.2 (manual JournalEntry UI) and Phase B (Letterly inbound webhook) from the Site Work Logging design are parked pending Q5 / Q7 @@ -863,6 +856,7 @@ Gemini/shell — the user cannot modify via Flatlogic's web editor because - **Migrations**: Sometimes run automatically during rebuild, but NOT always reliable. If you get "Unknown column" errors after pulling latest, visit `/run-migrate/` in the browser to apply pending migrations manually. This endpoint runs `python manage.py migrate` on the production MySQL database. - **Static files**: Flatlogic's rebuild does NOT auto-run `collectstatic`. After CSS/JS changes have Gemini run `python3 manage.py collectstatic --noinput` + restart the service, otherwise Apache keeps serving the previously-collected copy. - **Service**: The Django app runs as `django-dev.service` (systemd). Gemini restarts it via `sudo systemctl restart django-dev.service`. It runs `python manage.py runserver 0.0.0.0:8000` — a **development server**, not gunicorn/uwsgi (Flatlogic default, works fine at this scale). +- **⚠ DEPLOY ORDERING — pull THEN restart, not the reverse.** Production runs `DEBUG=False`, so Django uses the **cached template loader**: every `.html` template is compiled into memory once at process start and is NEVER re-read from disk until the process restarts. Symptom of getting this wrong: "I pulled the code, `git log` shows the right commit, but the page still looks old." Cause: the `restart` happened *before* the code reached the target commit (e.g. Flatlogic auto-pulled afterward, or Gemini pulled after restarting). **Fix: restart AGAIN, after confirming `git log --oneline -1` is at the target commit.** Correct deploy order is ALWAYS: (1) `git fetch github ai-dev && git reset --hard github/ai-dev`, (2) `/run-migrate/` if there are new migrations, (3) `collectstatic` if `static/` changed, (4) `sudo systemctl restart django-dev.service` **last**. Template-only changes still need the restart (cached loader) — unlike local dev where `DEBUG=True` re-reads templates per request. Bit us 15 May 2026: 14 commits of template fixes were "invisible" on prod until a second restart. `git reset --hard github/ai-dev` (not `git pull`) is preferred because the VM accumulates Flatlogic-editor autosave commits that make a plain pull conflict. - **CDN**: All production traffic goes through Cloudflare. Response headers show `cf-ray`/`cf-cache-status`. Static assets are cached at the edge for 4h — see "Static Assets & Cache-Busting" section for how the `deployment_timestamp` token breaks stale caches. - **Never edit `ai-dev` directly on GitHub** — Flatlogic pushes overwrite it - **Gemini gotcha**: Flatlogic's Gemini AI reads `__pycache__/*.pyc` and gets confused. Tell it: "Do NOT read .pyc files. Only work with .py source files." diff --git a/docs/plans/parked-work.md b/docs/plans/parked-work.md index 62ddb1d..6768c7a 100644 --- a/docs/plans/parked-work.md +++ b/docs/plans/parked-work.md @@ -7,36 +7,24 @@ --- -## ⚠ Pending pull-and-restart on production +## Production status — ✅ fully caught up (15 May 2026) -**Status:** The big absences/SiteReport deploy (migrations -`0013`/`0014`/`0015` + collectstatic + service restart) was -completed on 14 May 2026 — `/history/` no longer crashes, -`/absences/*` is reachable, badge CSS is collected. ✓ +Production (`https://foxlog.flatlogic.app/`) is deployed at +`origin/ai-dev` HEAD **`1d224bc`**. Everything is live: SiteReport ++ Absences feature, all UX polish, the team filters, the +dashboard/report number audit (18 findings), and the +template-comment + subline-clarity fixes. -Since that deploy, four small commits have shipped to `origin/ai-dev` -that are NOT yet on production: - -| Commit | What it does | -|---|---| -| `4368e53` | Fixes the absence-form team filter (workers were all disappearing when a team was selected — read input.value instead of data-attr) | -| `02c6d4d` | Fixes the Reasons multi-checkbox dropdown stacking-context bug on `/absences/` (lifted the filter card above the table card) | -| `4b57cff` | Adds a Team filter to `/workers/` | -| `398a5b2` | Adds a Team filter to `/history/` (and CSV export) | -| `70fa085` | Shows day name in Work Log Payroll modal header ("Friday, 15 May 2026") | -| `d1d3e15` | 7 absence-feature polish follow-ups (dead code removal, N+1 fixes, DRY helpers, WCAG icon contrast) | -| `18c75b2` | Dashboard "Paid This Month" now actually uses calendar month (was 60-day rolling) | -| `2e6b78d` → `c02edce` | Dashboard + report numbers audit fixes — 18 findings, 6 commits: outstanding-total alignment, project-name dedupe, timezone.localdate(), off-by-one date windows, dead context removal, SQL-aggregate cost velocity, clearer labels, signed adjustment amounts, daily_rate documentation | - -**To deploy these:** -- No migrations needed (pure template + view changes; no schema changes). -- No `collectstatic` needed (no new CSS or JS files). -- Just: ask Gemini in Flatlogic to `git pull origin ai-dev` and then `sudo systemctl restart django-dev.service`. - -That's the whole sequence. Production should pick up all four -improvements instantly. Rollback is `git reset --hard ` -on the VM if anything looks wrong (no data migrations were involved, -so rollback is safe). +**Deploy-ordering lesson learned (now in CLAUDE.md):** production +runs `DEBUG=False` → Django's cached template loader holds compiled +templates in memory until the process restarts. The 14 commits of +template fixes were briefly "invisible" because the service was +restarted *before* the code reached the target commit. The fix was +simply to restart AGAIN once `git log` confirmed the right commit. +Correct order is always: `git reset --hard github/ai-dev` → migrate +(if needed) → collectstatic (if `static/` changed) → restart +**last**. See the "DEPLOY ORDERING" bullet in CLAUDE.md's +Flatlogic Deployment section. ---