Split the job tracker out of web_server into its own app
Test and publish / test (push) Successful in 6m39s
Test and publish / publish (push) Failing after 0s

The applications tracker, leads inbox, email pipeline and capture userscript
move here from web_server's backend, Python service and Vue app, as one Go
binary that serves its own Vue SPA under /jobs/.

- The Go services, resolvers and tests move over almost unchanged.
- The three Claude calls are ported from Python to Go (internal/claude),
  with the same prompts, per-model request shaping and error messages.
- There is no login: internal/auth asks the site backend's
  /auth/validate-admin with the visitor's cookies, and relays refreshed
  cookies back.
- A Settings page replaces the admin-panel capture token card and adds the
  Microsoft sign-in link and a manual email sync.
- The userscript is 2.0.0, at /jobs/, and migrates a saved API base.
- Dockerfile, a standalone compose with Postgres, Makefile, and a Gitea CI
  workflow that tests and publishes the image.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-14 16:24:16 +01:00
co-authored by Claude Opus 5.5
commit 67cb8137f9
88 changed files with 22715 additions and 0 deletions
@@ -0,0 +1,38 @@
# Reusable snippets for filling in application forms. Private, like the
# applications themselves, so the query is @admin as well as the mutations.
type JobAppReference {
id: ID!
createdAt: Time!
updatedAt: Time!
category: String!
label: String!
value: String!
sortOrder: Int!
}
input CreateJobAppReferenceInput {
category: String!
label: String!
value: String!
sortOrder: Int
}
input UpdateJobAppReferenceInput {
category: String
label: String
value: String
sortOrder: Int
}
extend type Query {
jobAppReferences: [JobAppReference!]! @admin
}
extend type Mutation {
createJobAppReference(input: CreateJobAppReferenceInput!): JobAppReference! @admin
updateJobAppReference(id: ID!, input: UpdateJobAppReferenceInput!): JobAppReference! @admin
# Errors on an id that does not exist, like the other deletes; the Boolean
# is only ever true.
deleteJobAppReference(id: ID!): Boolean! @admin
}
@@ -0,0 +1,82 @@
# Job application tracker. Rows come from these mutations, automatically from
# the email sync pipeline (internal/services/email_sync.go), from the browser
# capture userscript (internal/handlers/handle_job_capture.go), or from
# promoting a lead (job_lead.graphql). These are private data, so the queries
# here are @admin as well as the mutations.
#
# description is the captured posting text. It can run to tens of kilobytes,
# so the tracker's list query leaves it out and asks for it per row.
# The lifecycle of an application, in the order the email pipeline and the
# capture endpoint are allowed to advance it. The values are lowercase on
# purpose: they are exactly the strings stored in the status column and ranked
# in services.statusOrder (internal/services/email_sync.go), and a test there
# fails if this list and that map ever differ. Adding a status means adding
# it in both places, and to the tracker page and the capture userscript.
#
# It is bound to a custom marshaller (services/job_status.go, via gqlgen.yml)
# rather than a generated Go type: input is strict, so a mutation carrying a
# status outside this list is refused, while output passes a legacy stored
# value through so one old row cannot fail the whole jobApplications query.
#
# On the wire it is still a JSON string ("applied"), as it was when the field
# was a String, both in variables and in responses.
enum JobStatus {
saved
applied
screening
assessment
interviewing
offer
rejected
withdrawn
}
type JobApplication {
id: ID!
createdAt: Time!
updatedAt: Time!
jobTitle: String!
company: String!
location: String
url: String
status: JobStatus!
notes: String
appliedAt: Time
description: String
}
input CreateJobApplicationInput {
jobTitle: String!
company: String!
location: String
url: String
status: JobStatus!
notes: String
appliedAt: Time
description: String
}
input UpdateJobApplicationInput {
jobTitle: String
company: String
location: String
url: String
status: JobStatus
notes: String
appliedAt: Time
description: String
}
extend type Query {
jobApplications: [JobApplication!]! @admin
jobApplication(id: ID!): JobApplication @admin
}
extend type Mutation {
createJobApplication(input: CreateJobApplicationInput!): JobApplication! @admin
updateJobApplication(id: ID!, input: UpdateJobApplicationInput!): JobApplication! @admin
# Errors on an id that does not exist, like the other deletes; the Boolean
# is only ever true.
deleteJobApplication(id: ID!): Boolean! @admin
}
+145
View File
@@ -0,0 +1,145 @@
# Job leads: postings found automatically, as opposed to applications being
# tracked (job_application.graphql). The fetcher in
# internal/services/job_leads.go polls each JobSource, files what it finds as
# JobLead rows and has Claude score them against the JobSearchProfile. A lead
# reaches the tracker only when it is promoted from the leads page.
#
# All of it is private, so every field here is @admin, queries included.
# One place to poll. `kind` is one of greenhouse, lever, ashby (a company's
# board: `token` is its slug and `label` the company name) or adzuna, reed (a
# keyword search: `query` and `location`, with `label` only a display name).
# It is a String rather than an enum because the resolver validates it and
# the list is the fetcher's to extend (services/job_sources.go).
#
# The last* fields are written by the fetcher, never by a mutation.
type JobSource {
id: ID!
createdAt: Time!
updatedAt: Time!
kind: String!
label: String!
token: String!
query: String!
location: String!
enabled: Boolean!
lastFetchedAt: Time
lastCount: Int!
lastError: String!
}
input CreateJobSourceInput {
kind: String!
label: String!
token: String
query: String
location: String
enabled: Boolean
}
input UpdateJobSourceInput {
kind: String
label: String
token: String
query: String
location: String
enabled: Boolean
}
# description is the posting's full text, tens of kilobytes on some boards,
# so the list query on the leads page leaves it out and asks per row — the
# same arrangement as JobApplication.description.
#
# state is new, dismissed or promoted. score (0-100) and scoreReasons are
# null until Claude has scored the lead, which only happens to matched ones.
type JobLead {
id: ID!
createdAt: Time!
sourceKind: String!
jobTitle: String!
company: String!
location: String!
url: String!
description: String!
postedAt: Time
lastSeenAt: Time!
matched: Boolean!
state: String!
score: Int
scoreReasons: String
scoredAt: Time
jobAppId: ID
}
# The single row a lead is judged against. profile is free text sent to
# Claude with each posting; the three keyword lists hold one entry per line
# and drive the pre-filter; minScore is the inbox's display threshold.
type JobSearchProfile {
updatedAt: Time!
profile: String!
includeKeywords: String!
excludeKeywords: String!
locations: String!
minScore: Int!
}
input UpdateJobSearchProfileInput {
profile: String
includeKeywords: String
excludeKeywords: String
locations: String
minScore: Int
}
# lastRunAt and lastError describe the most recent run in this backend
# process; both reset when it restarts.
type JobLeadSyncStatus {
running: Boolean!
lastRunAt: Time
lastError: String!
}
extend type Query {
jobSources: [JobSource!]! @admin
# state filters to one of new, dismissed, promoted; omitted returns all.
# Leads that failed the pre-filter are left out unless includeUnmatched.
jobLeads(state: String, includeUnmatched: Boolean): [JobLead!]! @admin
jobLead(id: ID!): JobLead @admin
jobSearchProfile: JobSearchProfile! @admin
jobLeadSyncStatus: JobLeadSyncStatus! @admin
}
extend type Mutation {
createJobSource(input: CreateJobSourceInput!): JobSource! @admin
updateJobSource(id: ID!, input: UpdateJobSourceInput!): JobSource! @admin
# Errors on an id that does not exist, like the other deletes; the Boolean
# is only ever true. The source's leads are kept.
deleteJobSource(id: ID!): Boolean! @admin
dismissJobLead(id: ID!): JobLead! @admin
# Puts a dismissed lead back in the inbox. A promoted lead cannot be
# restored: its application exists, and is managed on the tracker.
restoreJobLead(id: ID!): JobLead! @admin
# Adds the lead to the tracker as a saved application — or, if the posting
# is already tracked, links to that row instead of making a second — and
# returns the lead, now promoted, with jobAppId set.
promoteJobLead(id: ID!): JobLead! @admin
updateJobSearchProfile(input: UpdateJobSearchProfileInput!): JobSearchProfile! @admin
# Starts a fetch-and-score run in the background and returns at once: true
# if it started, false if one was already running. Poll jobLeadSyncStatus
# to see it finish.
runJobLeadSync: Boolean! @admin
# Scores every matched lead that has no score yet, without polling any
# source. Background and polled like runJobLeadSync, and refused (false)
# while either is running.
scoreJobLeads: Boolean! @admin
# Scores every matched inbox lead again, scored or not, for after the
# profile or the model has changed. A lead keeps its old score until its
# new one arrives. Background and polled like the two above, and refused
# (false) while any of the three is running.
rescoreJobLeads: Boolean! @admin
}
+30
View File
@@ -0,0 +1,30 @@
# Root of the GraphQL schema.
#
# Query and Mutation are declared here with no fields; every other file in this
# directory adds to them with `extend type Query` / `extend type Mutation`.
# That is what lets the schema be split one file per domain, matching the
# one-file-per-domain resolver layout (gqlgen.yml uses layout: follow-schema).
#
# Time is mapped to Go's time.Time by gqlgen's default scalar handling and is
# serialised as RFC 3339.
#
# These files are the source of truth: after editing one, run `make generate`
# to regenerate internal/graph/generated.go and internal/graph/model/models_gen.go.
# Note that `#` comments like this one are invisible to clients; a `"""` block
# would become a schema description and show up in introspection.
scalar Time
# Authorisation. There is no middleware in front of /graphql that refuses a
# request, so a field is PUBLIC unless it carries this. It is implemented in
# internal/graph/directives.go and runs before the field's resolver:
#
# @admin the request must come from the site's admin, as decided by
# internal/auth (error: "admin access required")
#
# Every query and mutation in this app is admin-only, and
# internal/graph/directives_test.go fails if one is not.
directive @admin on FIELD_DEFINITION
type Query
type Mutation