Remove the email pipeline
Test and publish / test (push) Successful in 1m59s
Test and publish / publish (push) Successful in 1m41s

The mailbox sync (Microsoft Graph and IMAP), its Claude classifier, the
/email routes and the Settings page's email section are taken out while
the pipeline is unused. The last commit with it is tagged
email-pipeline-last; reverting this commit brings it back.

The status rules the capture path shares (statusOrder, StatusAdvances,
NormalizeStatus) move to job_status.go with their tests. ProcessedEmail
stays in the migration, marked dormant, so its history survives for a
restored pipeline. golang.org/x/oauth2 is no longer needed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-14 22:48:07 +01:00
co-authored by Claude Opus 5.5
parent 6b14a96261
commit b7021ca117
32 changed files with 199 additions and 2284 deletions
+13 -9
View File
@@ -1,10 +1,9 @@
# Job tracker
A private tracker for job applications, served at `/jobs/` on adam-french.co.uk. It has four parts:
A private tracker for job applications, served at `/jobs/` on adam-french.co.uk. It has three parts:
- **Applications** (`/jobs/`): the list, the pipeline view and the Quick Reference snippets.
- **Leads inbox** (`/jobs/leads`): postings the server finds on Greenhouse, Lever and Ashby boards and in Adzuna and Reed searches, scored by Claude against a search profile.
- **Email pipeline**: reads the mailbox (Microsoft Graph or IMAP), has Claude classify recruitment mail, and creates or advances applications.
- **Capture userscript** (`web/public/job-capture.user.js`): adds the posting open in the browser.
It was split out of the `web_server` repo, where it lived inside the site's Go backend, Python service and Vue app. It is now one Go binary that serves its own Vue SPA. It runs as one container behind the site's nginx and borrows the site's login.
@@ -14,11 +13,11 @@ It was split out of the `web_server` repo, where it lived inside the site's Go b
```
cmd/jobtracker/ main: reads the environment, wires everything, registers routes
internal/auth/ is this request the admin? (asks the site backend)
internal/claude/ the three Claude calls: read a posting, score a lead, classify an email
internal/claude/ the two Claude calls: read a posting, score a lead
internal/graph/ gqlgen GraphQL: schema/*.graphql is the source of truth
internal/handlers/ REST: capture routes, capture token, email controls, SPA file server
internal/handlers/ REST: capture routes, capture token, SPA file server
internal/models/ GORM models (six tables)
internal/services/ lead pipeline, job sources, email sync (Graph + IMAP), upsert, status vocabulary
internal/services/ lead pipeline, job sources, upsert, status vocabulary
web/ Vue 3 + Vite SPA, built for base /jobs/
```
@@ -32,8 +31,6 @@ Everything is served under `BASE_PATH` (`/jobs`). nginx proxies the prefix throu
| `POST /jobs/api/graphql` | `@admin` on every field | everything the pages show and edit |
| `/jobs/api/capture`, `/capture/status`, `/capture/extract` | bearer capture token | the userscript |
| `/jobs/api/admin/capture-token` (GET/POST/DELETE) | admin | the token, from the Settings page |
| `GET /jobs/api/email/status`, `POST /jobs/api/email/sync` | admin | email controls on the Settings page |
| `GET /jobs/api/email/callback` | open (Microsoft redirects here) | Graph OAuth |
| `GET /jobs/api/health` | open | healthcheck: process up and database reachable |
## Auth
@@ -115,6 +112,8 @@ The Pi also has to be logged in to pull the image. The `docker login` in step 4
### One-off cutover from the old in-backend tracker
This was written while the tracker still had its email pipeline. Steps 4 and 5's Microsoft Graph parts (`msgraph_token.json`, the Entra redirect URI) no longer apply.
Do the registry setup above first: step 6 needs the image.
Run these on the Pi, in this order:
@@ -148,9 +147,14 @@ Run these on the Pi, in this order:
The old tables stay in the site database until they are dropped by hand. GORM never drops anything, so this is safe until you are sure.
## The email pipeline (removed)
The tracker used to read the mailbox (Microsoft Graph or IMAP), have Claude classify recruitment mail, and create or advance applications. It was taken out while it is not in use. The last commit that has it is tagged `email-pipeline-last`; reverting the commit that removed it brings it back.
Its `processed_emails` table is still migrated and still holds its history, so a restored pipeline does not process old mail again. Once the removal is deployed, the `EMAIL_*`, `MSGRAPH_*` and `IMAP_*` variables can come out of the site's `jobs` service, and `msgraph_token.json` out of `jobs-data`.
## Things that are easy to get wrong
- **The status vocabulary has copies.** `enum JobStatus` (GraphQL) and `services.statusOrder` are tied by a test, and so are `claude.EmailStatuses` and the classifier prompt. Two copies are not checked and must be edited by hand: `web/src/views/jobStatus.js` and `STATUS_LABELS` in the userscript.
- **The status vocabulary has copies.** `enum JobStatus` (GraphQL) and `services.statusOrder` are tied by a test. Two copies are not checked and must be edited by hand: `web/src/views/jobStatus.js` and `STATUS_LABELS` in the userscript.
- **Bump the userscript's `@version` on every edit**, or installed copies never update.
- **The Graph OAuth `state` is a fixed string** (carried over unchanged from the old backend), and `/email/callback` is open. A forged callback can only link a mailbox the attacker controls, but a per-request nonce, like the site's Spotify flow uses, would close that.
- **`BASE_PATH` and Vite's `base` must agree.** The SPA's asset URLs and router base are fixed at build time.