From 8592659432e563c2431cba585dd037cbf20f9dc0 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Sat, 9 May 2026 00:54:39 +0000 Subject: [PATCH] Test of agent capabilities: "I'd like you to take a look at the project nidus-sync. It has been developed over the past 6 months and had several different architectural approaches that have evolved over time. The git history may be especially useful to see the evolution. Write up a report of what you understand has happend, with approximate timelines. This should go in HISTORY.md. Determine which changes are incomplete - libraries or approaches that are no longer preferred, but not fully removed yet. Create another file, CLEANUP.md, which lists out cleanup efforts that should be done to completely remove these older, less-preferred parts of the code." --- CLEANUP.md | 316 +++++++++++++++++++++++++++++++++++++++++++++++++++++ HISTORY.md | 207 +++++++++++++++++++++++++++++++++++ 2 files changed, 523 insertions(+) create mode 100644 CLEANUP.md create mode 100644 HISTORY.md diff --git a/CLEANUP.md b/CLEANUP.md new file mode 100644 index 00000000..fb9f1de9 --- /dev/null +++ b/CLEANUP.md @@ -0,0 +1,316 @@ +# nidus-sync — Cleanup Tasks + +This file lists code, files, and patterns that are remnants of older architectural approaches. These should be removed to reduce complexity, maintenance burden, and confusion. + +--- + +## 1. Bob → Jet Migration (Incomplete) + +**Status:** Bob is still the primary ORM. Jet was introduced May 2026 but only covers 3 schemas partially. + +### 1a. Port remaining schemas from Bob to Jet + +Jet-based queries exist for: +- `db/query/public/` — address, communication, communication_log_entry, compliance_report_request, feature, feature_pool, job, lead, signal, site +- `db/query/publicreport/` — compliance, image, image_exif, nuisance, report, report_image, report_log, water +- `db/query/arcgis/` — account, oauth, service_feature, service_map, user, user_privileges + +Still using Bob directly (not yet ported to Jet queries): +- `platform/report/notification.go` (13 bob references) +- `platform/background/background.go` (8) +- `platform/arcgis.go` (8) +- `platform/text/send.go` (7) +- `platform/report/some_report.go` (6) +- `platform/site.go` (5) +- `platform/csv/flyover.go` (7) +- `platform/csv/pool.go` (5) +- `platform/csv/csv.go` (4) +- `platform/text/report.go` (4) +- `platform/text/phone_number.go` (3) +- `platform/publicreport/log.go` (3) +- `platform/mailer.go` (3) +- `platform/email/template.go` (2) +- `db/connection.go` (4 — bob.Tx types) +- `db/prepared.go` (2) +- `resource/review_task.go` (2) +- `rmo/status.go` (2) +- `rmo/report.go` (1) +- `rmo/mailer.go` (1) +- Plus many api/* files + +### 1b. Remove Bob-generated models after migration + +Once all queries are ported to Jet, delete the 103 `.bob.go` files in `db/models/`: +``` +db/models/*.bob.go +``` + +### 1c. Remove Bob-specific helper files + +These are Bob-specific and can be removed once Bob is fully replaced: +- `db/dberrors/` — Bob error types (still referenced) +- `db/dbinfo/` — Bob type info (still referenced) +- `db/models/bob_loaders.bob.go` +- `db/models/bob_where.bob.go` + +### 1d. Remove Bob from go.mod and dependencies + +After all Bob code is gone: +- Remove `github.com/Gleipnir-Technology/bob` from `go.mod` +- Run `go mod tidy` + +### 1e. Remove Bob codegen scripts + +- `db/bobgen.sh` +- `db/bobgen.yaml` + +### 1f. Regenerate Jet output + +The `db/jet/main.go` generator outputs to `db/gen/` but no output is currently checked in. Run the generator and ensure generated code is usable: +```bash +cd db/jet && go run . +``` + +--- + +## 2. Go HTML Templates → Vue SPA (Mostly Complete) + +**Status:** Nearly all Go template routes are commented out in `sync/routes.go` and `rmo/routes.go`. Both hosts serve Vue SPAs via `static.SinglePageApp()`. Some Go template routes remain active. + +### 2a. Remaining active Go template routes (sync) + +These routes in `sync/routes.go` still render Go templates: +- `/oauth/arcgis/begin` → `getArcgisOauthBegin` (redirect, no template but in Go) +- `/oauth/arcgis/callback` → `getArcgisOauthCallback` +- `/mailer/pool/random` → `getMailerPoolRandom` +- `/mailer/mode-1` → `getMailer1` (generates PDF) +- `/mailer/mode-2` → `getMailer2` (generates PDF) +- `/mailer/mode-3/{code}` → `getMailer3` (generates PDF) +- `/mailer/mode-1/preview` → `getMailer1Preview` +- `/mailer/mode-2/preview` → `getMailer2Preview` +- `/mailer/mode-3/{code}/preview` → `getMailer3Preview` +- `/privacy` → `getPrivacy` + +The mailer routes use `platform/pdf` which in turn uses headless Chrome (`chromedp`) to render HTML to PDF. This is legitimate server-side functionality, not just a template remnant. However, the PDF templates themselves may be candidates for migration to the Vue ecosystem. + +### 2b. Remove all commented-out routes + +Both `sync/routes.go` and `rmo/routes.go` have large blocks of commented-out route registrations. Remove these once migration is confirmed complete. + +### 2c. Remove unused Go template files + +Once all routes are ported or confirmed dead, remove the entire `html/template/` directory. The `html/` package (`html/embed.go`, `html/filesystem.go`, `html/func.go`, etc.) should also be removed once nothing references it. + +### 2d. Reduce the html/ package surface + +**Note:** The `html/` package is still actively imported by 40+ Go files. It provides: +- Template rendering (`html/embed.go`, `html/filesystem.go`) — mostly for mailer PDFs and privacy page +- `html.ContentConfig` — used extensively in sync/routes (mailer previews, admin pages) +- `html.MakeGet`, `html.MakePost` — HTTP handler wrappers (used by active `sync/` routes) +- `html.RespondError` — HTTP error responses +- Form parsing, image upload handling, URL building + +**Short-term:** Remove the template rendering portion once mailer PDFs and privacy page are migrated. +**Long-term:** The full `html/` package can be removed only after all server-rendered pages are gone and handler wrappers are replaced with the `resource/` pattern. + +--- + +## 3. esbuild (`build.js`) — Dead Build Tool + +**Status:** `build.js` is an esbuild-based build script that predates the Vite migration. It is not referenced by `package.json` scripts (those use `vite build`). It is also not referenced by any CI or Nix config. + +### 3a. Remove esbuild-related files + +- `build.js` — the esbuild build script +- Remove `pkgs.esbuild` from `flake.nix` devShell dependencies (if not used elsewhere) +- Remove esbuild-related dependencies from `package.json` if present (currently no esbuild deps are in `package.json` — they may have been already cleaned) + +--- + +## 4. Legacy Static JavaScript Files + +**Status:** `static/js/` contains 20 plain JavaScript files written as custom HTML elements and standalone scripts for the Go template era. These are referenced by old Go HTML templates but most of those templates are now unused. + +### 4a. Files in static/js/ + +``` +address-display.js +address-or-report-suggestion.js +address-suggestion.js +events.js +geocode.js +location.js +map-admin.js +map-aggregate.js +map-arcgis-tile.js +map-cell.js +map-locator.js +map-locator-ro.js +map-multipoint.js +map-proxied-arcgis-tile.js +map-routing.js +map-service-area.js +photo-upload.js +table-report.js +table-site.js +time-relative.js +user-selector.js +``` + +### 4b. Determine which are still used + +The remaining active Go templates (mailer, oauth, privacy) may reference some of these. Check each active template for `