38686-vm/docs/plans/parked-work.md
Konrad du Plessis 5162db966a docs: production fully deployed at 1d224bc + capture deploy-ordering lesson
Production caught up — all 14 pending commits live after a
second service restart (the first restart ran before the code
reached the target commit; DEBUG=False's cached template loader
held the old templates until restarted again).

CLAUDE.md:
- 'What's mid-flight' breadcrumb: no longer says pending deploy;
  now states production is at 1d224bc and fully live.
- Flatlogic Deployment section: new '⚠ DEPLOY ORDERING' bullet
  documenting that production runs DEBUG=False → cached template
  loader → restart MUST come after the pull, and template-only
  changes still need a restart (unlike DEBUG=True local dev).
  Includes the symptom ('git log shows right commit but page
  looks old') and the fix (restart again).
- Bumped the {# #} bit-us count + added a grep sanity-check
  one-liner (from the prior commit, retained).

parked-work.md: 'Pending pull-and-restart' section replaced with
'Production status — fully caught up'.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 11:29:26 +02:00

187 lines
9.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Parked / deferred work
> Updated 15 May 2026. A small index of features that are designed,
> half-built, blocked on input, or pending an operator step. When a
> fresh session opens, glance here first to see what's already on
> the workbench.
---
## Production status — ✅ fully caught up (15 May 2026)
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.
**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.
---
## Blocked on Konrad's input
### Phase A.2 — Manual JournalEntry web UI
**Status:** Designed in the Site Work Logging brainstorm. Model
class drafted in the design doc (not yet in `core/models.py`).
Not yet built.
**Blocked on:** Q7 from the original brainstorm — "Who is Vi?" The
answer drives whether `JournalEntry` needs a `recipient` or
`audience` field (i.e. is this a public log, or does it have
specific addressees like a client). **Default if unanswered:** no
recipient field — entries are all-admin-readable.
**Scope when unblocked:** ~1 hour of work. Manual entry form at
`/journal/new/`, list at `/journal/`, edit at `/journal/<id>/edit/`.
Admin-only views. Lives on `ai-dev` (no webhook involvement).
### Phase B — Letterly inbound webhook (`integrations` branch)
**Status:** Designed in the Site Work Logging brainstorm. Belongs
on the `integrations` branch, **not** `ai-dev`.
**Blocked on:** Q5 from the original brainstorm — Konrad needs to
share a sample Letterly webhook payload. Need to know:
- Does it include the recording user (so we can map to a Django User)?
- Does it include project / location metadata, or just the transcript?
- Does it include an audio URL for link-back?
- Does Letterly support custom fields (so a deep-link from
`/site-report/<id>/edit/` could embed a `work_log_id` that the
webhook reads back)?
**Scope when unblocked:** ~3-4 hours including tests + one-off
Letterly account setup. Adds a `@csrf_exempt` view at
`/webhooks/letterly/`, `JournalEntry` row creation, HMAC body
verification, shared-secret URL token.
---
## Small polish follow-ups from the Absences feature
> All 7 cleared on 15 May 2026 (commit `d1d3e15`). Kept the section
> header in place because more polish items will accumulate from
> future code reviews — when they do, append here. The shipped items
> are summarized under "Recently shipped" below.
---
## Defaulted (not blocking — flag if you disagree)
From Q9, Q4 of the Site Work Logging brainstorm:
- **Q9 — photos on site reports.** Deferred to v2 of SiteReport.
Construction supervisors often want to attach a phone photo of
"plinths cast today" but it adds ~50 LOC + storage handling +
thumbnail rendering. v1 ships without.
- **Q4 — per-project metric templates.** Same metric set for all
projects in v1. If/when a non-solar-farm project lands and the
metrics diverge wildly, we add a `MetricTemplate` model. YAGNI
for now — `core/site_report_schema.py` is one Python file edit.
---
## Recently shipped (for context, so a fresh session knows what just landed)
- **Dashboard + report numbers audit** (commits `18c75b2``c02edce`,
15 May 2026): Konrad spotted that the home dashboard's "Paid This
Month" actually showed the last 60 days. A thorough audit found
17 more issues across the home dashboard, payroll dashboard, and
report. All 18 fixed in 7 commits: calendar-month math, outstanding
totals aligned between dashboards, `Project.name` dedupe (was
silently merging same-named projects), `timezone.localdate()`
replacing `timezone.now().date()` (SAST drift fix), off-by-one
on "last 7 / 60 days" windows, dead `year_projects`/`year_teams`
context removed, `_company_cost_velocity` rewritten as single SQL
aggregate, signed/coloured adjustment amounts on report tables
(Bonus vs Deduction now visually distinct), "Outstanding Now"
hero card subline now shows scope when filters active, dual
daily_rate code paths documented in CLAUDE.md. 160 → 173 tests
(+13 regression).
- **Absence-feature polish pass** (commit `d1d3e15`, 15 May 2026):
Seven small cleanups in one focused commit. (1) Deleted unused
`AbsenceQuickForm` (Round C made it obsolete). (2) Extracted
`_build_team_workers_map(user)` helper using `Prefetch(..., to_attr=...)`,
fixing N+1 on both `attendance_log` and `absence_log` (one query
instead of one-per-team). (3) `absence_list` now calls the existing
`_user_can_log_absences` helper. (4) Removed undefined
`var(--badge-neutral-bg)` CSS wrapper — fallback hex was always
winning anyway. (5) `conflicting_worklogs()` rewritten as a single
query with Python-side pair-set filtering — 25-query → 2-query for
a 5×5 form. (6) Extracted `_apply_absence_filters(qs, request)`
shared by `absence_list` + `absence_export_csv` so adding a filter
param now touches one place, not two. (7) `site_report_detail.html`
paid-check icon uses `text-success` instead of background-color
variable as foreground (WCAG contrast fix). 157/157 tests still
green.
- **Day name in Work Log Payroll modal header** (commit `70fa085`,
15 May 2026): The modal opened from /history/ now shows
"Friday, 15 May 2026" instead of "2026-05-15". Pure server-side
`strftime` on the already-loaded `log.date` — zero overhead.
- **Team filters on `/workers/` and `/history/`** (commits `4b57cff`,
`398a5b2`, 15 May 2026): Both pages now have a Team dropdown in
their filter row. `/workers/?team=<id>` filters by Team.workers
M2M membership (who's CURRENTLY on the team); `/history/?team=<id>`
filters by WorkLog.team FK (logs TAGGED with the team when
created — different semantics, intentional). Both accept
`team=none` for the "no team assigned" / "ad-hoc work log" case.
CSV export at `/history/export/` honours the same param.
+8 regression tests.
- **Absences UX polish** (commits `4368e53`, `02c6d4d`, 15 May 2026):
Two production-found bugs fixed. (1) Absence-form team filter was
hiding ALL workers when a team was selected — switched the JS to
read `<input name="workers">[value]` directly instead of going
through `data-worker-id` (proven attendance-form pattern). (2)
Reasons multi-checkbox dropdown on `/absences/` was rendering
behind the table — lifted the filter card with
`position: relative; z-index: 10` so the whole card sits above
its sibling table card in the stacking order. See the Coding
Style section in CLAUDE.md for both gotchas.
- **Worker Absences feature** (commits `bf6f0a5``27fe05e`,
14 May 2026): Complete absence-tracking system. 8 reason choices,
optional project FK (auto-attributes paid-absence Bonus
adjustments to the project), date-range logging with weekend
toggles, supervisor scoping (admin sees all; supervisors see
their teams). Standalone `/absences/log/` form + "Submit + Log
Absences" shortcut on attendance form. List/edit/delete + CSV
export. Worker-detail "Absences" tab with YTD totals. Dashboard
alert card "X absent in last 7 days". Bidirectional cascade with
PayrollAdjustment via `_sync_absence_payroll_adjustment` helper
(single-chokepoint design, transaction.atomic-wrapped). 12
commits pushed to `origin/ai-dev`. Test count: 85 → 149 (+64
tests). Migrations `0013_add_site_report`, `0014_add_absence`,
`0015_absence_project` are LIVE on production as of late 14 May
2026.
- **Phase A.1 — SiteReport** (commit `864ae72`, 14 May 2026):
Model, migration `0013_add_site_report.py`, form, two-step flow
from attendance log, 16 new tests. `CLAUDE.md` updated with model
summary + `site_report_schema.py` pattern section.
- **Pastel soft-fill payroll action buttons** (commit `6c6ade9`,
24 Apr 2026): unified Worker Lookup / Batch Pay / Add Adjustment
/ Price Overtime treatment.
- **Path A display-only rename** (UX Polish Pass, Apr 2026):
"New Loan" / "Advance Payment" / "Advance Repayment" display as
"Loan" / "Advance" / "Advance Repaid" — but **DB values are
unchanged**. See "UI-vs-DB naming drift" section in `CLAUDE.md`
before writing any filter/comparison on `PayrollAdjustment.type`.
---
## Original Site Work Logging brainstorm
The full Q1-Q13 question list and design rationale lives in
`~/.claude/plans/prancy-painting-brook.md` (local — deliberately
not committed to the repo, since the parts that matter have been
absorbed into `CLAUDE.md` and this file). If Konrad answers Q5 or
Q7 later, refer back to that file for the original framing.