Konrad-approved design to fully remove the SiteReport / "Log Today's Work" feature (drop core_sitereport, no backup, revert post-attendance to redirect-home). Capture doc preserves the schema-as-Python pattern, the flow, recovery pointers, and rebuild guidance. Local-only; the removal itself is HARD-STOPPED before push. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7.7 KiB
Remove "Log Today's Work" / SiteReport — Design
Date: 17 May 2026
Status: Approved by Konrad on 17 May 2026; ready for implementation plan.
Branch: ai-dev (origin HEAD aaca0b3 at design time — production
caught up & verified). HARD STOP before push — destructive
migration on the daily-use attendance path; Konrad verifies locally
first.
Goal (one sentence)
Completely remove the optional post-attendance SiteReport ("Log Today's Work") feature — model, table, code, UI, routes, tests, docs — with no remnants and nothing broken, reverting the post-attendance flow to its pre-SiteReport behaviour, and preserve the design thinking in a capture doc for a future from-scratch rebuild.
Why
Konrad wants to rethink site-progress logging from scratch separately. The work mix is shifting ("we might start piling and not cast so many plinths anymore") so the metric set and the whole scope are genuinely uncertain — half-fitting code is worse than a clean slate. The feature was lightly used; Konrad explicitly accepted irreversible loss of any existing SiteReport data (no backup) when choosing the removal path.
Decision (from the brainstorm)
Konrad chose "Drop the table — no backup": a real migration
(0018_delete_sitereport) drops core_sitereport on deploy; no
production backup is taken. Full removal, no orphaned model/table.
§1 — Behavioural change (the only user-visible effect)
core/views.py::attendance_log POST, currently ~lines 750-785: after a
successful submit it return redirect('site_report_edit', work_log_id=created_log_ids[-1]). After removal: just
return redirect('home') — the existing green "Successfully created N
work log(s)." toast still fires. This reverts to the original
pre-SiteReport behaviour.
- The
next_action == 'log_absences'branch (the "Submit + Log Absences" shortcut) is untouched — unrelated to SiteReport. - The now-dead
created_log_idslist (= []+.append()) and the Round-C comment's "log_only → Site Report flow" wording are cleaned up so no dead plumbing remains.dates_to_log[-1](used by the absences branch) is unaffected.
§2 — Code / model / template removal (no remnants)
Delete entire files:
core/site_report_schema.pycore/templates/core/site_report_edit.htmlcore/templates/core/site_report_detail.html
Edit:
core/models.py— delete theSiteReportclass + its doc-header block.core/forms.py— deleteSiteReportFormand thefrom .site_report_schema import …line (and the form's surrounding doc-header comment).core/views.py— delete_can_access_site_report,site_report_edit,site_report_detail; remove theSiteReport,SiteReportForm,site_report_schemaimports; dropselect_related('site_report')inwork_history(use plainWorkLog.objects/ keep other select_related args intact); remove the SiteReport redirect block + deadcreated_log_idsplumbing inattendance_log(per §1).core/urls.py— delete the twopath('site-report/…')routes.core/admin.py— delete the@admin.register(SiteReport)block and theSiteReportimport.core/templates/core/work_history.html— delete the report indicator / link block ({% if log.site_report %}… thesite_report_detail/site_report_editanchors, ~lines 462-471).
Migration: after the model is gone, run python manage.py makemigrations core → it generates 0018_delete_sitereport
(DeleteModel, depends on 0017_alter_payrolladjustment_type). Do not
hand-write it — let the autodetector emit the correct
RemoveField/DeleteModel ordering. makemigrations --check must be
clean afterwards.
§3 — Tests
Delete the 5 SiteReport-only classes in core/tests.py:
SiteReportModelTests, SiteReportFormTests, SiteReportEditViewTests,
SiteReportDetailViewTests, AttendanceLogRedirectsToSiteReportTests,
plus the from core.models import SiteReport /
from core.forms import SiteReportForm lines (~1629-1630) and the
section header comment block (~1624-1631).
The one cross-reference — test_log_only_explicit_value_still_goes_to_site_report
(~line 2873, inside the absences-shortcut test class) — asserts the OLD
contract. Rewrite it (rename to e.g.
test_plain_submit_redirects_home) to assert the NEW contract: a plain
attendance POST (no next_action / next_action='log_only') → HTTP
302 to /. This keeps regression coverage of the reverted flow rather
than deleting coverage outright.
Full suite must stay green at the new count (209 minus the deleted SiteReport tests, ± the rewritten one). The exact expected number is computed and pinned in the plan.
§4 — Docs
- CLAUDE.md: delete the entire "SiteReport metric schema
(Apr 2026)" section; the Key Models
SiteReportbullet; the/site-report/<id>/edit/and/site-report/<id>/URL-routes table rows; and any two-step-flow / "auto-redirected here after /attendance/log/ POST" mentions. Add a one-line pointer under the relevant area: SiteReport removed 17 May 2026 — see capture doc. (The production breadcrumb was already flipped to ✅ in commitaaca0b3.) - docs/plans/parked-work.md: the "Post-Attendance Flow v2"
entry (under "⏸ Paused — ready to execute") is now obsolete — it
reworked the very flow being deleted. Replace it with a short
"SiteReport removed; future rebuild parked" pointer to the capture
doc. Keep the
2026-05-15-post-attendance-flow-v2-*design/plan files on disk (prior thinking worth mining) — the capture doc marks them superseded. - New capture doc
docs/plans/2026-05-17-site-report-removed-capture.md(written now, in this design step) — preserves the institutional knowledge for the future rebuild (see that file).
§5 — Process / scope
- Done already (separate, pushed): the production-caught-up
breadcrumb flip (commit
aaca0b3). - This removal: writing-plans → subagent-driven execution → HARD STOP before any push. Konrad runs the local verification, then pushes.
- Deploy (when Konrad later approves): pull →
python3 manage.py migrate(applies0018, dropscore_sitereport) → restart. Nocollectstatic(nostatic/change — pure code/template/model deletion). Restart still required (DEBUG=False template cache). - No backup of SiteReport data (Konrad's explicit choice — accepted irreversible loss).
Local verification (Konrad — HARD STOP gate)
- Submit
/attendance/log/→ lands straight on the dashboard/with the green "Successfully created N work log(s)." toast — no "Log Today's Work" page. - "Submit + Log Absences" button still jumps to
/absences/log/prefilled (unchanged). GET /site-report/1/edit/andGET /site-report/1/→ 404 (routes gone).- Django admin (
/admin/) shows no SiteReport model. python manage.py makemigrations --check→ clean (no pending);python manage.py migrateapplies0018_delete_sitereportwith no errors;core_sitereporttable is gone.- Full test suite green.
grep -ri "sitereport\|site_report\|site-report" core/→ only inert historical migration files0013/0014match (expected — immutable history, not a code remnant); zero matches in models/views/forms/urls/admin/templates/tests.
Then — and only then — Konrad pushes; deploy as in §5.
Out of scope (deliberately)
- No replacement site-progress feature now (that's the future separate rethink — captured, not built).
- Absences shortcut, Manager/Salaried, pay-type filter, Salary auto-scope, Pay Salary quick action — all untouched.
- The historical migrations
0013/0014are NOT edited (immutable Django history; "no remnants" means no live code/model/UI, not rewriting migration history).