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
+6 -6
View File
@@ -1,8 +1,8 @@
// Package claude is the Anthropic client and the one call every Claude
// caller here makes.
//
// Reading a job posting (posting.go), scoring a lead (score.go) and
// classifying an email (email.go) are the same shape of call: one prompt
// Reading a job posting (posting.go) and scoring a lead (score.go) are the
// same shape of call: one prompt
// asking for bare JSON, one reply to parse. That whole sequence is askJSON
// below, so a caller is a prompt, a reply struct and three error strings, and
// the handling around the call cannot drift between them.
@@ -51,7 +51,7 @@ var noEffortPrefixes = []string{"claude-haiku-4-5"}
// allowance and leave no room for the answer.
const thinkingHeadroom = 4000
// effort: every call here is extraction or classification — read something,
// effort: every call here is extraction or judgement — read something,
// return a small JSON object. "low" is the level meant for that, and it is
// set explicitly because the default differs between models.
const effort = anthropic.OutputConfigEffortLow
@@ -145,8 +145,8 @@ func askJSON[T any](ctx context.Context, c *Client, system, user string, maxToke
message, err := c.api.Messages.New(ctx, params)
if err != nil {
// The caller gave up (a cancelled sync, a run out of time). Wrapped,
// not replaced, so errors.Is(err, context.Canceled) still holds: the
// email pipeline must not count an abandoned sync against the email.
// not replaced, so errors.Is(err, context.Canceled) still holds and a
// caller can tell giving up from Claude failing on this input.
if ctx.Err() != nil {
return zero, fmt.Errorf("claude call abandoned: %w", ctx.Err())
}
@@ -161,7 +161,7 @@ func askJSON[T any](ctx context.Context, c *Client, system, user string, maxToke
// A refusal is an ordinary 200 whose content is not the answer. Say so in
// the log rather than letting it surface as an "empty" or "unparseable"
// reply, which would point at the prompt instead of at the classifier.
// reply, which would point at the prompt instead of at the model.
if message.StopReason == anthropic.StopReasonRefusal {
log.Printf("[Claude] declined the request: category=%q %s", message.StopDetails.Category, message.StopDetails.Explanation)
return zero, &ReadError{msgs.failed}