@hadoku/jobplatform-worker 2.32.52 → 2.32.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,8 @@ export interface HasExecutionCtx {
2
2
  executionCtx?: {
3
3
  waitUntil(p: Promise<unknown>): void;
4
4
  };
5
+ /** The bindings, when the caller is a Hono context: lets a failure reach service_events. */
6
+ env?: unknown;
5
7
  }
6
8
  /**
7
9
  * Run `work` after the response.
@@ -1 +1 @@
1
- {"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../src/background.ts"],"names":[],"mappings":"AAuBA,MAAM,WAAW,eAAe;IAC/B,YAAY,CAAC,EAAE;QAAE,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;KAAE,CAAC;CACxD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAwBhG"}
1
+ {"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../src/background.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,eAAe;IAC/B,YAAY,CAAC,EAAE;QAAE,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;KAAE,CAAC;IACxD,4FAA4F;IAC5F,GAAG,CAAC,EAAE,OAAO,CAAC;CACd;AA0BD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAyBhG"}
@@ -2,6 +2,8 @@ import type { AppEnv } from '../types.js';
2
2
  export declare const TELEMETRY_SERVICE = "jobplatform";
3
3
  export interface ServiceEvent {
4
4
  level: 'info' | 'warn' | 'error';
5
+ /** Who observed it. `browser` for events relayed from the UI; the worker's own otherwise. */
6
+ source?: 'worker' | 'browser';
5
7
  /** Lands in the `event` column; keep it short and stable, it is what gets grouped by. */
6
8
  event: string;
7
9
  message: string;
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/clients/telemetry.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACjC,yFAAyF;IACzF,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,2FAA2F;AAC3F,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,IAAI,MAAM,CAEvE;AAED,4FAA4F;AAC5F,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBnF"}
1
+ {"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/clients/telemetry.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACjC,6FAA6F;IAC7F,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC9B,yFAAyF;IACzF,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,2FAA2F;AAC3F,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,IAAI,MAAM,CAEvE;AAED,4FAA4F;AAC5F,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBnF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAMN,KAAK,iBAAiB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAUzC,UAAU,UAAU;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE;QAAE,WAAW,EAAE,iBAAiB,CAAA;KAAE,CAAC;CAC9C;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,SAAqB,uCA+DrE;AAYD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,IAErC,SAAS,OAAO,EAAE,MAAM,gBAAgB,kCAChD;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,IAC1C,MAAM,MAAM,UAGpB;AAED,YAAY,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACzC,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAMN,KAAK,iBAAiB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAYzC,UAAU,UAAU;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE;QAAE,WAAW,EAAE,iBAAiB,CAAA;KAAE,CAAC;CAC9C;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,SAAqB,uCAoErE;AAYD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,IAErC,SAAS,OAAO,EAAE,MAAM,gBAAgB,kCAChD;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,IAC1C,MAAM,MAAM,UAGpB;AAED,YAAY,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACzC,cAAc,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -207,7 +207,7 @@ async function postServiceEvent(env, ev) {
207
207
  "X-User-Key": key
208
208
  },
209
209
  body: JSON.stringify({
210
- source: "worker",
210
+ source: ev.source ?? "worker",
211
211
  level: ev.level,
212
212
  type: "log",
213
213
  message: `event=${ev.event} ${ev.message}`,
@@ -216,13 +216,28 @@ async function postServiceEvent(env, ev) {
216
216
  });
217
217
  if (!res.ok) throw new Error(`monitoring-api answered ${res.status}`);
218
218
  }
219
- function runAfterResponse(c, label2, work) {
220
- const guarded = work.catch((error) => {
221
- logger.error("background work failed", {
219
+ const TELEMETRY_LABEL = "telemetry:";
220
+ function reportFailure(env, label2, message) {
221
+ const bindings = env;
222
+ if (label2.startsWith(TELEMETRY_LABEL) || !canPostTelemetry(bindings)) return Promise.resolve();
223
+ return postServiceEvent(bindings, {
224
+ level: "error",
225
+ event: "background_failed",
226
+ message: `${label2}: ${message}`,
227
+ context: { task: label2, error: message }
228
+ }).catch((err) => {
229
+ logger.error("telemetry: background failure not recorded", {
222
230
  task: label2,
223
- error: error instanceof Error ? error.message : String(error)
231
+ error: err instanceof Error ? err.message : String(err)
224
232
  });
225
233
  });
234
+ }
235
+ function runAfterResponse(c, label2, work) {
236
+ const guarded = work.catch((error) => {
237
+ const message = error instanceof Error ? error.message : String(error);
238
+ logger.error("background work failed", { task: label2, error: message });
239
+ return reportFailure(c.env, label2, message);
240
+ });
226
241
  let ctx;
227
242
  try {
228
243
  ctx = c.executionCtx;
@@ -234,6 +249,7 @@ function runAfterResponse(c, label2, work) {
234
249
  task: label2,
235
250
  hint: "the host worker must forward ctx: fetch(request, env, ctx) -> createFetchHandler(env)(request, ctx)"
236
251
  });
252
+ void reportFailure(c.env, label2, "no ExecutionContext: background work dropped");
237
253
  return;
238
254
  }
239
255
  ctx.waitUntil(guarded);
@@ -312,6 +328,72 @@ function errorHandler(err, c) {
312
328
  500
313
329
  );
314
330
  }
331
+ function recordEvent(c, ev) {
332
+ const env = c.env;
333
+ if (!canPostTelemetry(env)) return;
334
+ runAfterResponse(c, `telemetry: ${ev.event}`, postServiceEvent(env, ev));
335
+ }
336
+ const OWN_EVENT = [
337
+ /^\/ingest(\/cull|\/rebuild-rank|\/reconcile-mail)?$/,
338
+ /^\/telemetry$/,
339
+ /^\/jobs\/import$/,
340
+ /^\/jobs\/[^/]+\/(state|apply|resume|cover-letter|packet-link|application-extras)$/,
341
+ /^\/applications\/[^/]+\/(status|approve|owner)$/,
342
+ /^\/_account\/erase$/
343
+ ];
344
+ const VALUE_FIELDS = /* @__PURE__ */ new Set([
345
+ "state",
346
+ "direction",
347
+ "reason",
348
+ "axis",
349
+ "company",
350
+ "name",
351
+ "category",
352
+ "proficiency",
353
+ "ats",
354
+ "slug",
355
+ "priority",
356
+ "kind",
357
+ "track",
358
+ "is_default"
359
+ ]);
360
+ function summarize(body) {
361
+ if (!body || typeof body !== "object" || Array.isArray(body)) return {};
362
+ const values = {};
363
+ const fields = [];
364
+ for (const [k, v] of Object.entries(body)) {
365
+ fields.push(k);
366
+ if (!VALUE_FIELDS.has(k)) continue;
367
+ if (typeof v === "string") values[k] = v.slice(0, 80);
368
+ else if (typeof v === "number" || typeof v === "boolean" || v === null) values[k] = v;
369
+ }
370
+ return { fields: fields.slice(0, 30), ...values };
371
+ }
372
+ function changeEvents(base) {
373
+ return async (c, next) => {
374
+ await next();
375
+ const method = c.req.method;
376
+ if (method === "GET" || method === "HEAD" || method === "OPTIONS") return;
377
+ const path = c.req.path.startsWith(base) ? c.req.path.slice(base.length) || "/" : c.req.path;
378
+ if (OWN_EVENT.some((re) => re.test(path))) return;
379
+ const status = c.res.status;
380
+ const body = method === "DELETE" ? null : await c.req.json().catch(() => null);
381
+ const auth = c.get("authContext");
382
+ recordEvent(c, {
383
+ level: status >= 500 ? "error" : status >= 400 ? "warn" : "info",
384
+ event: "api.change",
385
+ message: `${method} ${path} ${status}`,
386
+ context: {
387
+ method,
388
+ path,
389
+ status,
390
+ user_id: auth?.userId ?? null,
391
+ tier: auth?.userType ?? "public",
392
+ ...summarize(body)
393
+ }
394
+ });
395
+ };
396
+ }
315
397
  const IC_LEVELS = ["junior", "mid", "senior", "staff", "principal", "fellow"];
316
398
  const MANAGER_LEVELS = ["manager", "senior_manager", "director", "vp", "cxo"];
317
399
  const ALL_LEVELS = [...IC_LEVELS, ...MANAGER_LEVELS];
@@ -1152,7 +1234,7 @@ const JobMatchResponseSchema = S(
1152
1234
  against: z.enum(["skills", "profile_stack", "none"])
1153
1235
  })
1154
1236
  ).openapi("JobMatchResponse");
1155
- const app$5 = new OpenAPIHono();
1237
+ const app$6 = new OpenAPIHono();
1156
1238
  const healthRoute = createRoute({
1157
1239
  method: "get",
1158
1240
  path: "/health",
@@ -1170,7 +1252,7 @@ const healthRoute = createRoute({
1170
1252
  }
1171
1253
  }
1172
1254
  });
1173
- app$5.openapi(healthRoute, (c) => {
1255
+ app$6.openapi(healthRoute, (c) => {
1174
1256
  const status = "healthy";
1175
1257
  return c.json(
1176
1258
  {
@@ -1181,7 +1263,7 @@ app$5.openapi(healthRoute, (c) => {
1181
1263
  200
1182
1264
  );
1183
1265
  });
1184
- const healthRoutes = app$5;
1266
+ const healthRoutes = app$6;
1185
1267
  const DEFAULT_BASE_URL$1 = "https://hadoku.me/contact/api/mailfeed";
1186
1268
  function baseUrl$1(env) {
1187
1269
  return (env.MAILFEED_BASE_URL ?? DEFAULT_BASE_URL$1).replace(/\/$/, "");
@@ -2728,7 +2810,7 @@ async function rankNewJobs(db) {
2728
2810
  await markRankBuilt(db, state.profile_id, profile, head2);
2729
2811
  }
2730
2812
  }
2731
- const app$4 = new OpenAPIHono();
2813
+ const app$5 = new OpenAPIHono();
2732
2814
  const CULL_DAYS = 60;
2733
2815
  const CULL_BATCH = 500;
2734
2816
  async function cullExpired(db) {
@@ -2761,15 +2843,15 @@ async function stripStaleDescriptions(db) {
2761
2843
  ).bind(cutoff, cutoff).run();
2762
2844
  return res.meta?.changes ?? 0;
2763
2845
  }
2764
- app$4.use("/ingest", requireMinTier("friend"));
2765
- app$4.use("/ingest/backfill-slugs", requireMinTier("friend"));
2766
- app$4.use("/ingest/backfill-roles", requireMinTier("friend"));
2767
- app$4.use("/ingest/backfill-geo", requireMinTier("friend"));
2768
- app$4.use("/ingest/backfill-salary", requireMinTier("friend"));
2769
- app$4.use("/ingest/cull", requireMinTier("friend"));
2770
- app$4.use("/ingest/rebuild-rank", requireMinTier("friend"));
2771
- app$4.use("/ingest/reconcile-mail", requireMinTier("friend"));
2772
- app$4.use("/directives", requireMinTier("friend"));
2846
+ app$5.use("/ingest", requireMinTier("friend"));
2847
+ app$5.use("/ingest/backfill-slugs", requireMinTier("friend"));
2848
+ app$5.use("/ingest/backfill-roles", requireMinTier("friend"));
2849
+ app$5.use("/ingest/backfill-geo", requireMinTier("friend"));
2850
+ app$5.use("/ingest/backfill-salary", requireMinTier("friend"));
2851
+ app$5.use("/ingest/cull", requireMinTier("friend"));
2852
+ app$5.use("/ingest/rebuild-rank", requireMinTier("friend"));
2853
+ app$5.use("/ingest/reconcile-mail", requireMinTier("friend"));
2854
+ app$5.use("/directives", requireMinTier("friend"));
2773
2855
  const ingestRoute = createRoute({
2774
2856
  method: "post",
2775
2857
  path: "/ingest",
@@ -2789,7 +2871,7 @@ const ingestRoute = createRoute({
2789
2871
  }
2790
2872
  });
2791
2873
  const INGEST_BATCH_CHUNK = 100;
2792
- app$4.openapi(ingestRoute, async (c) => {
2874
+ app$5.openapi(ingestRoute, async (c) => {
2793
2875
  const { jobs: received, batch_number, is_final, source, board_slug } = c.req.valid("json");
2794
2876
  const jobs = received.filter(
2795
2877
  (job) => !isTestBoardPosting(job.url, board_slug ? { ats: source, slug: board_slug } : void 0)
@@ -2866,6 +2948,21 @@ app$4.openapi(ingestRoute, async (c) => {
2866
2948
  await rankNewJobs(db);
2867
2949
  endTime(c, "rank");
2868
2950
  }
2951
+ recordEvent(c, {
2952
+ level: "info",
2953
+ event: "ingest.batch",
2954
+ message: `${source}${board_slug ? `/${board_slug}` : ""} #${batch_number}: ${accepted} new of ${received.length}`,
2955
+ context: {
2956
+ source,
2957
+ board_slug: board_slug ?? null,
2958
+ batch_number,
2959
+ is_final,
2960
+ received: received.length,
2961
+ test_board_dropped: received.length - jobs.length,
2962
+ accepted,
2963
+ already_known: jobs.length - accepted
2964
+ }
2965
+ });
2869
2966
  return c.json(
2870
2967
  {
2871
2968
  success: true,
@@ -2905,7 +3002,7 @@ const backfillRoute = createRoute({
2905
3002
  }
2906
3003
  }
2907
3004
  });
2908
- app$4.openapi(backfillRoute, async (c) => {
3005
+ app$5.openapi(backfillRoute, async (c) => {
2909
3006
  const { limit } = c.req.valid("query");
2910
3007
  const db = c.env.JOB_PLATFORM_DB;
2911
3008
  const rows = await db.prepare("SELECT id, url FROM jobs WHERE ats IS NULL OR slug IS NULL LIMIT ?").bind(limit).all();
@@ -2957,7 +3054,7 @@ const rebuildRankRoute = createRoute({
2957
3054
  }
2958
3055
  }
2959
3056
  });
2960
- app$4.openapi(rebuildRankRoute, async (c) => {
3057
+ app$5.openapi(rebuildRankRoute, async (c) => {
2961
3058
  const { profile_id } = c.req.valid("query");
2962
3059
  const db = c.env.JOB_PLATFORM_DB;
2963
3060
  const pending = profile_id ? [{ id: profile_id }] : (await db.prepare("SELECT id FROM profiles ORDER BY id").all()).results;
@@ -2982,6 +3079,12 @@ app$4.openapi(rebuildRankRoute, async (c) => {
2982
3079
  const p = await loadScorableProfile(db, id);
2983
3080
  if (!await rankIsCurrent(db, id, p)) remaining++;
2984
3081
  }
3082
+ recordEvent(c, {
3083
+ level: "info",
3084
+ event: "rank.rebuild",
3085
+ message: `profile ${target}: ${ranked} ranked, ${remaining} profiles left`,
3086
+ context: { profile_id: target, jobs_ranked: ranked, remaining }
3087
+ });
2985
3088
  return c.json(
2986
3089
  { success: true, data: { rebuilt: target, jobs_ranked: ranked, remaining } },
2987
3090
  200
@@ -3021,7 +3124,7 @@ const backfillRolesRoute = createRoute({
3021
3124
  }
3022
3125
  }
3023
3126
  });
3024
- app$4.openapi(backfillRolesRoute, async (c) => {
3127
+ app$5.openapi(backfillRolesRoute, async (c) => {
3025
3128
  const { limit, reclassify } = c.req.valid("query");
3026
3129
  const db = c.env.JOB_PLATFORM_DB;
3027
3130
  const all = reclassify === "true";
@@ -3083,7 +3186,7 @@ const backfillGeoRoute = createRoute({
3083
3186
  }
3084
3187
  }
3085
3188
  });
3086
- app$4.openapi(backfillGeoRoute, async (c) => {
3189
+ app$5.openapi(backfillGeoRoute, async (c) => {
3087
3190
  const { limit, reread, after } = c.req.valid("query");
3088
3191
  const db = c.env.JOB_PLATFORM_DB;
3089
3192
  const all = reread === "true";
@@ -3148,7 +3251,7 @@ const directivesRoute = createRoute({
3148
3251
  }
3149
3252
  }
3150
3253
  });
3151
- app$4.openapi(directivesRoute, async (c) => {
3254
+ app$5.openapi(directivesRoute, async (c) => {
3152
3255
  const db = c.env.JOB_PLATFORM_DB;
3153
3256
  const companyRows = await db.prepare("SELECT DISTINCT ats, slug FROM profile_companies ORDER BY ats, slug").all();
3154
3257
  const profileRows = await db.prepare("SELECT keywords FROM profiles").all();
@@ -3208,7 +3311,7 @@ const backfillSalaryRoute = createRoute({
3208
3311
  }
3209
3312
  }
3210
3313
  });
3211
- app$4.openapi(backfillSalaryRoute, async (c) => {
3314
+ app$5.openapi(backfillSalaryRoute, async (c) => {
3212
3315
  const { limit, cursor } = c.req.valid("query");
3213
3316
  const db = c.env.JOB_PLATFORM_DB;
3214
3317
  const rows = await db.prepare(
@@ -3255,9 +3358,15 @@ const cullRoute = createRoute({
3255
3358
  }
3256
3359
  }
3257
3360
  });
3258
- app$4.openapi(cullRoute, async (c) => {
3361
+ app$5.openapi(cullRoute, async (c) => {
3259
3362
  const culled = await cullExpired(c.env.JOB_PLATFORM_DB);
3260
3363
  const stripped = await stripStaleDescriptions(c.env.JOB_PLATFORM_DB);
3364
+ recordEvent(c, {
3365
+ level: "info",
3366
+ event: "ingest.cull",
3367
+ message: `culled ${culled}, stripped ${stripped}`,
3368
+ context: { culled, stripped }
3369
+ });
3261
3370
  return c.json(
3262
3371
  {
3263
3372
  success: true,
@@ -3324,7 +3433,7 @@ const reconcileMailRoute = createRoute({
3324
3433
  }
3325
3434
  }
3326
3435
  });
3327
- app$4.openapi(reconcileMailRoute, async (c) => {
3436
+ app$5.openapi(reconcileMailRoute, async (c) => {
3328
3437
  const { reset, ownerName } = c.req.valid("query");
3329
3438
  const who = await effectiveUserId(c, ownerName);
3330
3439
  if (isEffectiveUserError(who)) return c.json(who.error.body, who.error.status);
@@ -3332,8 +3441,28 @@ app$4.openapi(reconcileMailRoute, async (c) => {
3332
3441
  if (refused) return c.json(refused.body, refused.status);
3333
3442
  const report = await reconcileMail(c.env, who.userId, { reset: reset === "true" });
3334
3443
  if ("error" in report) {
3444
+ recordEvent(c, {
3445
+ level: "error",
3446
+ event: "mail.reconcile_failed",
3447
+ message: report.error,
3448
+ context: { user_id: who.userId, reset: reset === "true" }
3449
+ });
3335
3450
  return c.json({ success: false, error: "Bad gateway", message: report.error }, 502);
3336
3451
  }
3452
+ recordEvent(c, {
3453
+ level: report.warnings.length ? "warn" : "info",
3454
+ event: "mail.reconciled",
3455
+ message: `${report.messagesSeen} seen, ${report.confirmed} confirmed, ${report.unmatched} unmatched`,
3456
+ context: {
3457
+ user_id: who.userId,
3458
+ messages_seen: report.messagesSeen,
3459
+ confirmed: report.confirmed,
3460
+ verification_flagged: report.verificationFlagged,
3461
+ unmatched: report.unmatched,
3462
+ duplicates_flagged: report.duplicatesFlagged,
3463
+ warnings: report.warnings.slice(0, 5)
3464
+ }
3465
+ });
3337
3466
  return c.json(
3338
3467
  {
3339
3468
  success: true,
@@ -3385,7 +3514,7 @@ const reconcileViewRoute = createRoute({
3385
3514
  }
3386
3515
  }
3387
3516
  });
3388
- app$4.openapi(reconcileViewRoute, async (c) => {
3517
+ app$5.openapi(reconcileViewRoute, async (c) => {
3389
3518
  const { ownerName } = c.req.valid("query");
3390
3519
  const who = await effectiveUserId(c, ownerName);
3391
3520
  if (isEffectiveUserError(who)) return c.json(who.error.body, who.error.status);
@@ -3394,7 +3523,7 @@ app$4.openapi(reconcileViewRoute, async (c) => {
3394
3523
  const view = await reconcileView(c.env, who.userId);
3395
3524
  return c.json({ success: true, data: view }, 200);
3396
3525
  });
3397
- const ingestRoutes = app$4;
3526
+ const ingestRoutes = app$5;
3398
3527
  const DEFAULT_PROFILE = {
3399
3528
  name: "Default",
3400
3529
  keywords: ["software engineer", "ai", "ml", "platform", "backend", "distributed systems"],
@@ -3531,11 +3660,11 @@ async function extractPosting(env, url, greenhouseSlug) {
3531
3660
  }
3532
3661
  return json.data;
3533
3662
  }
3534
- const app$3 = new OpenAPIHono();
3535
- app$3.use("/profiles", requireMinTier("friend"));
3536
- app$3.use("/profiles/*", requireMinTier("friend"));
3537
- app$3.use("/profiles", requireIdentity);
3538
- app$3.use("/profiles/*", requireIdentity);
3663
+ const app$4 = new OpenAPIHono();
3664
+ app$4.use("/profiles", requireMinTier("friend"));
3665
+ app$4.use("/profiles/*", requireMinTier("friend"));
3666
+ app$4.use("/profiles", requireIdentity);
3667
+ app$4.use("/profiles/*", requireIdentity);
3539
3668
  async function requireIdentity(c, next) {
3540
3669
  if (!c.req.header("X-User-Id")?.trim()) {
3541
3670
  return c.json(
@@ -3622,7 +3751,7 @@ async function ensureDefaultProfile(db, userId) {
3622
3751
  async function ownedProfile(db, userId, id) {
3623
3752
  return db.prepare("SELECT * FROM profiles WHERE id = ? AND user_id = ?").bind(id, userId).first();
3624
3753
  }
3625
- app$3.openapi(
3754
+ app$4.openapi(
3626
3755
  createRoute({
3627
3756
  method: "get",
3628
3757
  path: "/profiles",
@@ -3646,7 +3775,7 @@ app$3.openapi(
3646
3775
  });
3647
3776
  }
3648
3777
  );
3649
- app$3.openapi(
3778
+ app$4.openapi(
3650
3779
  createRoute({
3651
3780
  method: "post",
3652
3781
  path: "/profiles",
@@ -3690,7 +3819,7 @@ app$3.openapi(
3690
3819
  return c.json({ success: true, data: { profile } }, 201);
3691
3820
  }
3692
3821
  );
3693
- app$3.openapi(
3822
+ app$4.openapi(
3694
3823
  createRoute({
3695
3824
  method: "put",
3696
3825
  path: "/profiles/{id}",
@@ -3758,7 +3887,7 @@ app$3.openapi(
3758
3887
  return c.json({ success: true, data: { profile } }, 200);
3759
3888
  }
3760
3889
  );
3761
- app$3.openapi(
3890
+ app$4.openapi(
3762
3891
  createRoute({
3763
3892
  method: "delete",
3764
3893
  path: "/profiles/{id}",
@@ -3801,7 +3930,7 @@ app$3.openapi(
3801
3930
  return c.json({ success: true, data: { deleted: true, id } }, 200);
3802
3931
  }
3803
3932
  );
3804
- app$3.openapi(
3933
+ app$4.openapi(
3805
3934
  createRoute({
3806
3935
  method: "get",
3807
3936
  path: "/profiles/{profileId}/companies",
@@ -3842,7 +3971,7 @@ app$3.openapi(
3842
3971
  );
3843
3972
  }
3844
3973
  );
3845
- app$3.openapi(
3974
+ app$4.openapi(
3846
3975
  createRoute({
3847
3976
  method: "post",
3848
3977
  path: "/profiles/{profileId}/companies",
@@ -3905,7 +4034,7 @@ app$3.openapi(
3905
4034
  );
3906
4035
  }
3907
4036
  );
3908
- app$3.openapi(
4037
+ app$4.openapi(
3909
4038
  createRoute({
3910
4039
  method: "delete",
3911
4040
  path: "/profiles/{profileId}/companies/{companyId}",
@@ -3996,7 +4125,7 @@ function deserializeProfile(r) {
3996
4125
  created_at: r.created_at
3997
4126
  };
3998
4127
  }
3999
- const profileRoutes = app$3;
4128
+ const profileRoutes = app$4;
4000
4129
  const MAX_SEARCH_WORDS = 6;
4001
4130
  const MAX_NEARBY = 80;
4002
4131
  const LIGHT_CANDIDATE_CAP = 5e4;
@@ -5177,6 +5306,12 @@ function registerStateRoutes(app2) {
5177
5306
  ).bind(id, userId, exists.prev, body.state, now, now)
5178
5307
  ]);
5179
5308
  }
5309
+ recordEvent(c, {
5310
+ level: "info",
5311
+ event: "job.state",
5312
+ message: `${id}: ${exists.prev ?? "new"} -> ${body.state}`,
5313
+ context: { job_id: id, user_id: userId, from: exists.prev, to: body.state }
5314
+ });
5180
5315
  return c.json(
5181
5316
  {
5182
5317
  success: true,
@@ -5228,6 +5363,12 @@ function registerStateRoutes(app2) {
5228
5363
  db.prepare("DELETE FROM job_events WHERE job_id = ? AND user_id = ?").bind(id, userId)
5229
5364
  ]);
5230
5365
  const deleted = (result.meta?.changes ?? 0) > 0;
5366
+ recordEvent(c, {
5367
+ level: "info",
5368
+ event: "job.state_cleared",
5369
+ message: `${id}: cleared${deleted ? "" : " (had none)"}`,
5370
+ context: { job_id: id, user_id: userId, deleted }
5371
+ });
5231
5372
  return c.json({ success: true, data: { job_id: id, deleted } }, 200);
5232
5373
  }
5233
5374
  );
@@ -5375,14 +5516,28 @@ async function readOptions(c) {
5375
5516
  function ownerNameOf(opts) {
5376
5517
  return typeof opts.ownerName === "string" ? opts.ownerName : void 0;
5377
5518
  }
5378
- async function upstreamError(res) {
5379
- const detail = await res.text();
5519
+ async function upstreamError(c, kind, jobId, res) {
5520
+ const detail = (await res.text()).slice(0, 300);
5521
+ recordEvent(c, {
5522
+ level: "warn",
5523
+ event: "tailoring.failed",
5524
+ message: `${kind} for ${jobId}: resume-api ${res.status}`,
5525
+ context: { kind, job_id: jobId, upstream_status: res.status, detail }
5526
+ });
5380
5527
  return {
5381
5528
  success: false,
5382
5529
  error: "Upstream error",
5383
- message: `resume-api ${res.status}: ${detail.slice(0, 300)}`
5530
+ message: `resume-api ${res.status}: ${detail}`
5384
5531
  };
5385
5532
  }
5533
+ function generated(c, kind, jobId, extra = {}) {
5534
+ recordEvent(c, {
5535
+ level: "info",
5536
+ event: "tailoring.generated",
5537
+ message: `${kind} for ${jobId}`,
5538
+ context: { kind, job_id: jobId, ...extra }
5539
+ });
5540
+ }
5386
5541
  function registerTailoringRoutes(app2) {
5387
5542
  app2.post("/jobs/:id/resume", gateAuthed);
5388
5543
  app2.post("/jobs/:id/cover-letter", gateAuthed);
@@ -5403,8 +5558,9 @@ function registerTailoringRoutes(app2) {
5403
5558
  ...typeof opts.profile_type === "string" ? { profile_type: opts.profile_type } : {},
5404
5559
  ...typeof opts.tailor === "boolean" ? { tailor: opts.tailor } : {}
5405
5560
  });
5406
- if (!res.ok) return c.json(await upstreamError(res), 502);
5561
+ if (!res.ok) return c.json(await upstreamError(c, "resume", id, res), 502);
5407
5562
  const data = await res.json();
5563
+ generated(c, "resume", id);
5408
5564
  return c.json({ success: true, data }, 200);
5409
5565
  });
5410
5566
  app2.post("/jobs/:id/cover-letter", async (c) => {
@@ -5423,8 +5579,9 @@ function registerTailoringRoutes(app2) {
5423
5579
  description: job.description,
5424
5580
  ...opts.tone === "formal" || opts.tone === "conversational" ? { tone: opts.tone } : {}
5425
5581
  });
5426
- if (!res.ok) return c.json(await upstreamError(res), 502);
5582
+ if (!res.ok) return c.json(await upstreamError(c, "cover_letter", id, res), 502);
5427
5583
  const data = await res.json();
5584
+ generated(c, "cover_letter", id);
5428
5585
  return c.json({ success: true, data }, 200);
5429
5586
  });
5430
5587
  app2.post("/jobs/:id/packet-link", gateAuthed);
@@ -5457,7 +5614,7 @@ function registerTailoringRoutes(app2) {
5457
5614
  job_title: job.title,
5458
5615
  ttl_days: ttlDays
5459
5616
  });
5460
- if (!res.ok) return c.json(await upstreamError(res), 502);
5617
+ if (!res.ok) return c.json(await upstreamError(c, "packet_link", id, res), 502);
5461
5618
  const variant = await res.json();
5462
5619
  if (!variant.slug) {
5463
5620
  return c.json(
@@ -5487,6 +5644,7 @@ function registerTailoringRoutes(app2) {
5487
5644
  ).bind(id, who.userId, now, variant.slug)
5488
5645
  ]);
5489
5646
  const url = `https://hadoku.me/resume?v=${encodeURIComponent(variant.slug)}`;
5647
+ generated(c, "packet_link", id, { slug: variant.slug, user_id: who.userId });
5490
5648
  return c.json({ success: true, data: { slug: variant.slug, url } }, 200);
5491
5649
  });
5492
5650
  app2.post("/jobs/:id/application-extras", gateAuthed);
@@ -5542,8 +5700,9 @@ function registerTailoringRoutes(app2) {
5542
5700
  job_location: job.location ?? void 0,
5543
5701
  workplace_type: job.workplace_type ?? void 0
5544
5702
  });
5545
- if (!res.ok) return c.json(await upstreamError(res), 502);
5703
+ if (!res.ok) return c.json(await upstreamError(c, "application_extras", id, res), 502);
5546
5704
  const data = await res.json();
5705
+ generated(c, "application_extras", id);
5547
5706
  return c.json({ success: true, data }, 200);
5548
5707
  });
5549
5708
  }
@@ -6267,6 +6426,17 @@ function registerOwnerRoutes(app2) {
6267
6426
  FROM job_states WHERE job_id = ? AND user_id = ?`
6268
6427
  ).bind(resolved.userId, now, row.job_id, row.user_id)
6269
6428
  ]);
6429
+ recordEvent(c, {
6430
+ level: "info",
6431
+ event: "application.handed_off",
6432
+ message: `${id}: to ${resolved.name}`,
6433
+ context: {
6434
+ application_id: id,
6435
+ job_id: row.job_id,
6436
+ from_user_id: row.user_id,
6437
+ to_user_id: resolved.userId
6438
+ }
6439
+ });
6270
6440
  return c.json(
6271
6441
  {
6272
6442
  success: true,
@@ -6413,7 +6583,14 @@ function registerApplicationRoutes(app2) {
6413
6583
  404
6414
6584
  );
6415
6585
  }
6586
+ const refuse = (reason) => recordEvent(c, {
6587
+ level: "warn",
6588
+ event: "application.queue_refused",
6589
+ message: `${id}: ${reason}`,
6590
+ context: { job_id: id, user_id: userId, reason }
6591
+ });
6416
6592
  if (publicUrl(job.url) === null) {
6593
+ refuse("no link");
6417
6594
  return c.json(
6418
6595
  {
6419
6596
  success: false,
@@ -6426,6 +6603,7 @@ function registerApplicationRoutes(app2) {
6426
6603
  if (!body?.force) {
6427
6604
  const delisted = await delistedReason(db, id);
6428
6605
  if (delisted) {
6606
+ refuse(`delisted: ${delisted}`);
6429
6607
  return c.json(
6430
6608
  {
6431
6609
  success: false,
@@ -6440,6 +6618,7 @@ function registerApplicationRoutes(app2) {
6440
6618
  const variantSlug = state?.variant_slug ?? "";
6441
6619
  const existing = await db.prepare("SELECT status FROM applications WHERE user_id = ? AND job_id = ?").bind(userId, id).first();
6442
6620
  if (existing?.status === "submitted" || existing?.status === "approved" && !body?.force) {
6621
+ refuse(`already ${existing.status}`);
6443
6622
  return c.json(
6444
6623
  {
6445
6624
  success: false,
@@ -6469,6 +6648,20 @@ function registerApplicationRoutes(app2) {
6469
6648
  ).bind(crypto.randomUUID(), userId, id, variantSlug, mode, now, now).run();
6470
6649
  const row = await db.prepare("SELECT * FROM applications WHERE user_id = ? AND job_id = ?").bind(userId, id).first();
6471
6650
  if (!row) throw new Error(`application row missing after upsert (job '${id}')`);
6651
+ recordEvent(c, {
6652
+ level: "info",
6653
+ event: "application.queued",
6654
+ message: `${id}: ${existing ? `re-queued from ${existing.status}` : "queued"} (${mode})`,
6655
+ context: {
6656
+ job_id: id,
6657
+ application_id: row.id,
6658
+ user_id: userId,
6659
+ mode,
6660
+ force: Boolean(body?.force),
6661
+ previous: existing?.status ?? null,
6662
+ on_behalf: who.onBehalfOf ?? null
6663
+ }
6664
+ });
6472
6665
  return c.json({ success: true, data: { application: toApplication(row) } }, 200);
6473
6666
  }
6474
6667
  );
@@ -6597,6 +6790,17 @@ function registerApplicationRoutes(app2) {
6597
6790
  const db = c.env.JOB_PLATFORM_DB;
6598
6791
  const existing = await db.prepare("SELECT * FROM applications WHERE id = ? AND user_id = ?").bind(id, userId).first();
6599
6792
  if (!existing) {
6793
+ recordEvent(c, {
6794
+ level: "warn",
6795
+ event: "application.status_unknown",
6796
+ message: `${id}: ${body.status} for an application not found`,
6797
+ context: {
6798
+ application_id: id,
6799
+ user_id: userId,
6800
+ status: body.status,
6801
+ error: body.error ?? null
6802
+ }
6803
+ });
6600
6804
  return c.json(
6601
6805
  {
6602
6806
  success: false,
@@ -6614,6 +6818,20 @@ function registerApplicationRoutes(app2) {
6614
6818
  approved_fingerprint = ?, updated_at = ?
6615
6819
  WHERE id = ?`
6616
6820
  ).bind(body.status, body.error ?? null, evidence, approvedFingerprint, now, id).run();
6821
+ recordEvent(c, {
6822
+ level: body.status === "failed" ? "warn" : "info",
6823
+ event: "application.status",
6824
+ message: `${id}: ${existing.status} -> ${body.status}${body.error ? ` (${body.error.slice(0, 120)})` : ""}`,
6825
+ context: {
6826
+ application_id: id,
6827
+ job_id: existing.job_id,
6828
+ user_id: userId,
6829
+ from: existing.status,
6830
+ to: body.status,
6831
+ error: body.error ?? null,
6832
+ on_behalf: who.onBehalfOf ?? null
6833
+ }
6834
+ });
6617
6835
  return c.json(
6618
6836
  {
6619
6837
  success: true,
@@ -6675,6 +6893,12 @@ function registerApplicationRoutes(app2) {
6675
6893
  );
6676
6894
  }
6677
6895
  if (existing.status !== "filled") {
6896
+ recordEvent(c, {
6897
+ level: "warn",
6898
+ event: "application.approve_refused",
6899
+ message: `${id}: is ${existing.status}, not filled`,
6900
+ context: { application_id: id, user_id: userId, status: existing.status }
6901
+ });
6678
6902
  return c.json(
6679
6903
  {
6680
6904
  success: false,
@@ -6686,6 +6910,12 @@ function registerApplicationRoutes(app2) {
6686
6910
  }
6687
6911
  const fingerprint = parseEvidence(existing.evidence)?.fingerprint;
6688
6912
  if (typeof fingerprint !== "string" || fingerprint.length === 0) {
6913
+ recordEvent(c, {
6914
+ level: "warn",
6915
+ event: "application.approve_refused",
6916
+ message: `${id}: filled without a fingerprint`,
6917
+ context: { application_id: id, user_id: userId, status: existing.status }
6918
+ });
6689
6919
  return c.json(
6690
6920
  {
6691
6921
  success: false,
@@ -6700,6 +6930,12 @@ function registerApplicationRoutes(app2) {
6700
6930
  `UPDATE applications SET status = 'approved', approved_fingerprint = ?,
6701
6931
  updated_at = ? WHERE id = ?`
6702
6932
  ).bind(fingerprint, now, id).run();
6933
+ recordEvent(c, {
6934
+ level: "info",
6935
+ event: "application.approved",
6936
+ message: `${id}: approved`,
6937
+ context: { application_id: id, job_id: existing.job_id, user_id: userId }
6938
+ });
6703
6939
  return c.json(
6704
6940
  {
6705
6941
  success: true,
@@ -7487,6 +7723,18 @@ function registerImportRoute(app2) {
7487
7723
  const who = await effectiveUserId(c, ownerName);
7488
7724
  if (isEffectiveUserError(who)) return c.json(who.error.body, who.error.status);
7489
7725
  const db = c.env.JOB_PLATFORM_DB;
7726
+ const report = (outcome, extra = {}) => recordEvent(c, {
7727
+ level: outcome.startsWith("refused") || outcome.startsWith("failed") ? "warn" : "info",
7728
+ event: "job.import",
7729
+ message: `${outcome}: ${url ?? "(typed by hand, no url)"}`,
7730
+ context: {
7731
+ outcome,
7732
+ url: url ?? null,
7733
+ manual: Boolean(manual),
7734
+ user_id: who.userId,
7735
+ ...extra
7736
+ }
7737
+ });
7490
7738
  let row = url === void 0 ? null : await db.prepare(`SELECT ${JOB_COLS} FROM jobs WHERE url = ?`).bind(url).first();
7491
7739
  let created = false;
7492
7740
  if (!row && manual) {
@@ -7530,6 +7778,7 @@ function registerImportRoute(app2) {
7530
7778
  if (!row) {
7531
7779
  if (url === void 0) throw new Error("import: no url and no manual entry");
7532
7780
  if (isTestBoardPosting(url)) {
7781
+ report("refused: test board");
7533
7782
  return c.json(
7534
7783
  failure(422, "That board holds LinkedIn's ATS test postings, not real jobs."),
7535
7784
  422
@@ -7541,18 +7790,22 @@ function registerImportRoute(app2) {
7541
7790
  } catch (err) {
7542
7791
  if (!(err instanceof ScraperClientError)) throw err;
7543
7792
  if (err.status === 404) {
7793
+ report("refused: not found", { message: err.message });
7544
7794
  return c.json(
7545
7795
  { success: false, error: "Not found", message: err.message },
7546
7796
  404
7547
7797
  );
7548
7798
  }
7549
7799
  if (err.status === 400 || err.status === 422) {
7800
+ report("refused: unreadable", { message: err.message });
7550
7801
  return c.json(failure(422, err.message), 422);
7551
7802
  }
7803
+ report("failed: scraper", { status: err.status, message: err.message });
7552
7804
  return c.json(failure(502, `Could not read that posting: ${err.message}`), 502);
7553
7805
  }
7554
7806
  const job = IngestJobSchema.safeParse(extracted.job);
7555
7807
  if (!job.success) {
7808
+ report("failed: unstorable posting", { message: job.error.message.slice(0, 200) });
7556
7809
  return c.json(
7557
7810
  failure(
7558
7811
  502,
@@ -7562,6 +7815,7 @@ function registerImportRoute(app2) {
7562
7815
  );
7563
7816
  }
7564
7817
  if (isTestBoardPosting(job.data.url, { ats: extracted.ats, slug: extracted.board_slug })) {
7818
+ report("refused: test board");
7565
7819
  return c.json(
7566
7820
  failure(422, "That board holds LinkedIn's ATS test postings, not real jobs."),
7567
7821
  422
@@ -7583,6 +7837,7 @@ function registerImportRoute(app2) {
7583
7837
  const prev = await db.prepare("SELECT state FROM job_states WHERE job_id = ? AND user_id = ?").bind(row.id, who.userId).first();
7584
7838
  if (prev) {
7585
7839
  const kept = JobStateSchema.safeParse(prev.state);
7840
+ report("already tracked", { job_id: row.id, created });
7586
7841
  return c.json(
7587
7842
  {
7588
7843
  success: true,
@@ -7608,6 +7863,7 @@ function registerImportRoute(app2) {
7608
7863
  ON CONFLICT (job_id, user_id) DO NOTHING`
7609
7864
  ).bind(row.id, who.userId, state, now)
7610
7865
  ]);
7866
+ report(created ? "imported" : "tracked existing", { job_id: row.id, created, state });
7611
7867
  return c.json(
7612
7868
  {
7613
7869
  success: true,
@@ -7814,29 +8070,29 @@ ${job.description}`);
7814
8070
  }
7815
8071
  );
7816
8072
  }
8073
+ const app$3 = new OpenAPIHono();
8074
+ registerFeedRoute(app$3);
8075
+ registerPreflightRoute(app$3);
8076
+ registerPacketsRoute(app$3);
8077
+ registerDetailRoute(app$3);
8078
+ registerStateRoutes(app$3);
8079
+ registerPipelineRoutes(app$3);
8080
+ registerFeedbackRoutes(app$3);
8081
+ registerTailoringRoutes(app$3);
8082
+ registerApplicationRoutes(app$3);
8083
+ registerVerificationRoutes(app$3);
8084
+ registerFillRoutes(app$3);
8085
+ registerBlockedRoutes(app$3);
8086
+ registerInsightsRoute(app$3);
8087
+ registerLocationsRoute(app$3);
8088
+ registerImportRoute(app$3);
8089
+ registerUserSkillRoutes(app$3);
8090
+ registerAnswerRoutes(app$3);
8091
+ registerOwnerRoutes(app$3);
8092
+ const jobRoutes = app$3;
7817
8093
  const app$2 = new OpenAPIHono();
7818
- registerFeedRoute(app$2);
7819
- registerPreflightRoute(app$2);
7820
- registerPacketsRoute(app$2);
7821
- registerDetailRoute(app$2);
7822
- registerStateRoutes(app$2);
7823
- registerPipelineRoutes(app$2);
7824
- registerFeedbackRoutes(app$2);
7825
- registerTailoringRoutes(app$2);
7826
- registerApplicationRoutes(app$2);
7827
- registerVerificationRoutes(app$2);
7828
- registerFillRoutes(app$2);
7829
- registerBlockedRoutes(app$2);
7830
- registerInsightsRoute(app$2);
7831
- registerLocationsRoute(app$2);
7832
- registerImportRoute(app$2);
7833
- registerUserSkillRoutes(app$2);
7834
- registerAnswerRoutes(app$2);
7835
- registerOwnerRoutes(app$2);
7836
- const jobRoutes = app$2;
7837
- const app$1 = new OpenAPIHono();
7838
- app$1.use("/companies/*", requireMinTier("friend"));
7839
- app$1.openapi(
8094
+ app$2.use("/companies/*", requireMinTier("friend"));
8095
+ app$2.openapi(
7840
8096
  createRoute({
7841
8097
  method: "post",
7842
8098
  path: "/companies/match",
@@ -7877,7 +8133,7 @@ app$1.openapi(
7877
8133
  }
7878
8134
  }
7879
8135
  );
7880
- app$1.openapi(
8136
+ app$2.openapi(
7881
8137
  createRoute({
7882
8138
  method: "post",
7883
8139
  path: "/companies/probe",
@@ -7918,7 +8174,7 @@ app$1.openapi(
7918
8174
  }
7919
8175
  }
7920
8176
  );
7921
- const companyRoutes = app$1;
8177
+ const companyRoutes = app$2;
7922
8178
  const ERASED_TABLES = [
7923
8179
  // A profile's children first, found through the profile while it still exists.
7924
8180
  {
@@ -7955,8 +8211,8 @@ async function eraseUser(db, userId) {
7955
8211
  });
7956
8212
  return erased;
7957
8213
  }
7958
- const app = new OpenAPIHono();
7959
- app.post("/_account/erase", async (c) => {
8214
+ const app$1 = new OpenAPIHono();
8215
+ app$1.post("/_account/erase", async (c) => {
7960
8216
  const auth = c.get("authContext");
7961
8217
  if (!tierAtLeast(auth, "member")) {
7962
8218
  return c.json(
@@ -7972,14 +8228,95 @@ app.post("/_account/erase", async (c) => {
7972
8228
  );
7973
8229
  }
7974
8230
  const erased = await eraseUser(c.env.JOB_PLATFORM_DB, userId);
8231
+ recordEvent(c, {
8232
+ level: "info",
8233
+ event: "account.erased",
8234
+ message: `${Object.values(erased).reduce((n, k) => n + k, 0)} rows`,
8235
+ context: { user_id: userId, erased }
8236
+ });
7975
8237
  return c.json({ success: true, erased }, 200);
7976
8238
  });
7977
- const accountRoutes = app;
8239
+ const accountRoutes = app$1;
8240
+ const TELEMETRY_MAX_EVENTS = 25;
8241
+ const PropValue = z.union([z.string().max(200), z.number(), z.boolean(), z.null()]);
8242
+ const ClientEvent = z.object({
8243
+ event: z.string().regex(/^[a-z][a-z0-9_.]{1,47}$/).openapi({ description: "Stable dotted name, e.g. ui.click, api.error, ui.error" }),
8244
+ level: z.enum(["info", "warn", "error"]).default("info"),
8245
+ /** The browser's clock when it happened, ms since the epoch. */
8246
+ at: z.number().int().nonnegative(),
8247
+ props: z.record(z.string().max(40), PropValue).refine((p) => Object.keys(p).length <= 12, "at most 12 props").default({})
8248
+ });
8249
+ const TelemetryBody = z.object({
8250
+ app: z.enum(["jobplatform", "jobpulse"]),
8251
+ /** Random per page load: groups one visit's events. Not an identity. */
8252
+ session: z.string().regex(/^[A-Za-z0-9_-]{8,40}$/),
8253
+ events: z.array(ClientEvent).min(1).max(TELEMETRY_MAX_EVENTS)
8254
+ });
8255
+ const app = new OpenAPIHono();
8256
+ app.openapi(
8257
+ createRoute({
8258
+ method: "post",
8259
+ path: "/telemetry",
8260
+ tags: ["Telemetry"],
8261
+ summary: "Relay UI events to service_events",
8262
+ description: "Batches of browser events (clicks, client-side API failures, render errors), forwarded one row each to monitoring-api as source=browser. Open to every tier; identity comes from the edge, never the body.",
8263
+ request: { body: { content: { "application/json": { schema: TelemetryBody } } } },
8264
+ responses: {
8265
+ 202: {
8266
+ description: "Accepted for forwarding",
8267
+ content: {
8268
+ "application/json": {
8269
+ schema: z.object({
8270
+ success: z.literal(true),
8271
+ data: z.object({ accepted: z.number() })
8272
+ })
8273
+ }
8274
+ }
8275
+ }
8276
+ }
8277
+ }),
8278
+ async (c) => {
8279
+ const { app: appName, session, events } = c.req.valid("json");
8280
+ const env = c.env;
8281
+ if (canPostTelemetry(env)) {
8282
+ const auth = c.get("authContext");
8283
+ const userId = await maybeUserId(c);
8284
+ const tier = auth.userType ?? "public";
8285
+ runAfterResponse(
8286
+ c,
8287
+ "telemetry: browser relay",
8288
+ Promise.all(
8289
+ events.map(
8290
+ (ev) => postServiceEvent(env, {
8291
+ source: "browser",
8292
+ level: ev.level,
8293
+ event: ev.event,
8294
+ message: describe(appName, ev.event, ev.props),
8295
+ context: {
8296
+ ...ev.props,
8297
+ app: appName,
8298
+ session,
8299
+ user_id: userId,
8300
+ tier,
8301
+ client_at: new Date(ev.at).toISOString()
8302
+ }
8303
+ })
8304
+ )
8305
+ )
8306
+ );
8307
+ }
8308
+ return c.json({ success: true, data: { accepted: events.length } }, 202);
8309
+ }
8310
+ );
8311
+ function describe(appName, event, props) {
8312
+ const what = props.label ?? props.path ?? props.message ?? "";
8313
+ return `${appName} ${String(what)}`.trim().slice(0, 200);
8314
+ }
7978
8315
  function createJobPlatformHandler(basePath = "/jobplatform/api") {
7979
- const app2 = new OpenAPIHono({
8316
+ const app$12 = new OpenAPIHono({
7980
8317
  defaultHook: wrappedValidationHook
7981
8318
  }).basePath(basePath);
7982
- app2.use(
8319
+ app$12.use(
7983
8320
  "*",
7984
8321
  cors({
7985
8322
  origin: DEFAULT_HADOKU_ORIGINS,
@@ -7989,15 +8326,17 @@ function createJobPlatformHandler(basePath = "/jobplatform/api") {
7989
8326
  maxAge: 86400
7990
8327
  })
7991
8328
  );
7992
- app2.use("*", timing({ totalDescription: "worker" }));
7993
- app2.use("*", createEdgeAuth());
7994
- app2.route("/", healthRoutes);
7995
- app2.route("/", ingestRoutes);
7996
- app2.route("/", profileRoutes);
7997
- app2.route("/", jobRoutes);
7998
- app2.route("/", companyRoutes);
7999
- app2.route("/", accountRoutes);
8000
- app2.doc(
8329
+ app$12.use("*", timing({ totalDescription: "worker" }));
8330
+ app$12.use("*", createEdgeAuth());
8331
+ app$12.use("*", changeEvents(basePath));
8332
+ app$12.route("/", healthRoutes);
8333
+ app$12.route("/", ingestRoutes);
8334
+ app$12.route("/", profileRoutes);
8335
+ app$12.route("/", jobRoutes);
8336
+ app$12.route("/", companyRoutes);
8337
+ app$12.route("/", app);
8338
+ app$12.route("/", accountRoutes);
8339
+ app$12.doc(
8001
8340
  "/openapi.json",
8002
8341
  createOpenAPIDocConfig({
8003
8342
  title: "Job Platform API",
@@ -8015,9 +8354,9 @@ function createJobPlatformHandler(basePath = "/jobplatform/api") {
8015
8354
  })
8016
8355
  );
8017
8356
  const { notFoundHandler } = createErrorHandlers("wrapped");
8018
- app2.notFound(notFoundHandler);
8019
- app2.onError(errorHandler);
8020
- return app2;
8357
+ app$12.notFound(notFoundHandler);
8358
+ app$12.onError(errorHandler);
8359
+ return app$12;
8021
8360
  }
8022
8361
  function createFetchHandler(env) {
8023
8362
  const app2 = createJobPlatformHandler();
@@ -0,0 +1,37 @@
1
+ /**
2
+ * One `service_events` row per operation whose OUTCOME a request row cannot show.
3
+ *
4
+ * edge-router already logs every call to this worker (`request_logs`: method,
5
+ * path, status, user, time). What it cannot see is what the call DID: how many
6
+ * postings a batch added, which state a click set, which way an application
7
+ * moved. Those are posted here, after the response, as `service=jobplatform`
8
+ * rows named `<area>.<verb>` (`ingest.batch`, `job.state`, `application.status`).
9
+ *
10
+ * Fire and forget by design: telemetry never fails or slows the operation it
11
+ * describes. A post that fails is logged by runAfterResponse; it is not retried.
12
+ */
13
+ import { type HasExecutionCtx } from './background.js';
14
+ import { type ServiceEvent } from './clients/telemetry.js';
15
+ export declare function recordEvent(c: HasExecutionCtx, ev: ServiceEvent): void;
16
+ interface ChangeContext extends HasExecutionCtx {
17
+ req: {
18
+ method: string;
19
+ path: string;
20
+ json(): Promise<unknown>;
21
+ };
22
+ res: {
23
+ status: number;
24
+ };
25
+ get(key: 'authContext'): {
26
+ userId?: string | null;
27
+ userType?: string;
28
+ } | undefined;
29
+ }
30
+ /**
31
+ * Every POST / PUT / PATCH / DELETE without an event of its own gets one
32
+ * `api.change` row: which route, what it answered, who, and the shape of what
33
+ * they sent. Mounted once, so a route added later is covered without touching it.
34
+ */
35
+ export declare function changeEvents(base: string): (c: ChangeContext, next: () => Promise<void>) => Promise<void>;
36
+ export {};
37
+ //# sourceMappingURL=opEvents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opEvents.d.ts","sourceRoot":"","sources":["../src/opEvents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAsC,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG/F,wBAAgB,WAAW,CAAC,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,YAAY,GAAG,IAAI,CAItE;AAmDD,UAAU,aAAc,SAAQ,eAAe;IAC9C,GAAG,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;KAAE,CAAC;IAChE,GAAG,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACxB,GAAG,CAAC,GAAG,EAAE,aAAa,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACnF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,IAC1B,GAAG,aAAa,EAAE,MAAM,MAAM,OAAO,CAAC,IAAI,CAAC,KAAG,OAAO,CAAC,IAAI,CAAC,CAwBzE"}
@@ -21,7 +21,7 @@
21
21
  * Verification codes are 4 of the 7 messages currently in scope and their
22
22
  * values are in bodies this code receives. A code mail sets state; its contents
23
23
  * are never parsed, stored, logged or displayed. See
24
- * docs/DECISION-mail-reconciler.md — the short version is that the dashboard is
24
+ * hadoku_site/docs/requests/hadoku-jobplatform/DECISION-mail-reconciler.md — the short version is that the dashboard is
25
25
  * one click from a runner whose whole job is typing values into ATS forms, and
26
26
  * not holding the value is the version of that boundary which cannot rot.
27
27
  */
@@ -1 +1 @@
1
- {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/routes/account.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,mFAAmF;AACnF,eAAO,MAAM,aAAa,EAAE,SAAS;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EA2BlE,CAAC;AAEF;;;GAGG;AACH,wBAAsB,SAAS,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAO/F;AAyBD,eAAO,MAAM,aAAa,oCAAM,CAAC"}
1
+ {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/routes/account.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD,mFAAmF;AACnF,eAAO,MAAM,aAAa,EAAE,SAAS;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EA2BlE,CAAC;AAEF;;;GAGG;AACH,wBAAsB,SAAS,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAO/F;AA+BD,eAAO,MAAM,aAAa,oCAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ingest.d.ts","sourceRoot":"","sources":["../../src/routes/ingest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAEhE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAkB9E,UAAU,YAAY;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE;QAAE,WAAW,EAAE,iBAAiB,CAAA;KAAE,CAAC;CAC9C;AA09BD,eAAO,MAAM,YAAY,oCAAM,CAAC"}
1
+ {"version":3,"file":"ingest.d.ts","sourceRoot":"","sources":["../../src/routes/ingest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAEhE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAmB9E,UAAU,YAAY;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE;QAAE,WAAW,EAAE,iBAAiB,CAAA;KAAE,CAAC;CAC9C;AAygCD,eAAO,MAAM,YAAY,oCAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"applications.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/applications.ts"],"names":[],"mappings":"AAeA,OAAO,EAKN,KAAK,OAAO,EAEZ,MAAM,aAAa,CAAC;AAwCrB,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAUhF;AAiHD,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CA8f5D"}
1
+ {"version":3,"file":"applications.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/applications.ts"],"names":[],"mappings":"AAeA,OAAO,EAKN,KAAK,OAAO,EAEZ,MAAM,aAAa,CAAC;AAyCrB,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAUhF;AAiHD,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAkkB5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"importUrl.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/importUrl.ts"],"names":[],"mappings":"AA0CA,OAAO,EAKN,KAAK,OAAO,EACZ,MAAM,aAAa,CAAC;AAyErB;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM1D;AAoCD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAmOtD"}
1
+ {"version":3,"file":"importUrl.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/importUrl.ts"],"names":[],"mappings":"AA0CA,OAAO,EAKN,KAAK,OAAO,EACZ,MAAM,aAAa,CAAC;AA0ErB;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM1D;AAoCD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAyPtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"owner.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/owner.ts"],"names":[],"mappings":"AAWA,OAAO,EAA2B,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAsItD"}
1
+ {"version":3,"file":"owner.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/owner.ts"],"names":[],"mappings":"AAWA,OAAO,EAA2B,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAGpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAiJtD"}
@@ -9,7 +9,7 @@ export interface TrackingRow {
9
9
  export declare const TRACKING_COLS = "notes, priority, follow_up_at, contact_name, contact_email";
10
10
  export declare function toTracking(r: TrackingRow): {
11
11
  notes: string | null;
12
- priority: 3 | 2 | 1 | null;
12
+ priority: 2 | 1 | 3 | null;
13
13
  follow_up_at: string | null;
14
14
  contact_name: string | null;
15
15
  contact_email: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/state.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAEpE;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CA2JtD"}
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/state.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAGpE;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAuKtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"tailoring.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/tailoring.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAqD,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAmG9F,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAoO1D"}
1
+ {"version":3,"file":"tailoring.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/tailoring.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAqD,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAsI9F,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAwO1D"}
@@ -13,7 +13,7 @@
13
13
  * - Never a service identity, and never `ownerName`. The runner holds a
14
14
  * service key; keeping codes out of its reach is what keeps this a display
15
15
  * for a human rather than a pipeline that answers the board's check itself.
16
- * docs/DECISION-mail-reconciler.md §1 explains why that line matters.
16
+ * hadoku_site/docs/requests/hadoku-jobplatform/DECISION-mail-reconciler.md §1 explains why that line matters.
17
17
  *
18
18
  * Read live from the feed and never stored, like every other mail body.
19
19
  */
@@ -0,0 +1,30 @@
1
+ /**
2
+ * POST /telemetry: what a visitor did in the UI, relayed to monitoring-api's
3
+ * `service_events`.
4
+ *
5
+ * A browser holds no key, so it cannot post to `/health/api/telemetry` itself
6
+ * (hadoku_site docs/child-apps/TELEMETRY.md). It posts batches here, and this
7
+ * route forwards each event as its own row (`source=browser`,
8
+ * `service=jobplatform`) over the EDGE binding as this worker's service
9
+ * identity. Read back with
10
+ * `GET /health/api/service-events?service=jobplatform&source=browser`.
11
+ *
12
+ * Open to every tier, signed out included: the app is publicly browsable and
13
+ * a signed-out visitor's clicks are as much the record as anyone's. What keeps
14
+ * an open write path small is the schema: at most 25 events a request, short
15
+ * names, short values, a dozen props each. Identity is never taken from the
16
+ * body: the user id and tier are the ones the edge verified for this request.
17
+ */
18
+ import { OpenAPIHono } from '@hono/zod-openapi';
19
+ import type { HadokuAuthContext } from '@wolffm/worker-utils';
20
+ import type { AppEnv } from '../types.js';
21
+ interface RouteContext {
22
+ Bindings: AppEnv;
23
+ Variables: {
24
+ authContext: HadokuAuthContext;
25
+ };
26
+ }
27
+ export declare const TELEMETRY_MAX_EVENTS = 25;
28
+ declare const app: OpenAPIHono<RouteContext, {}, "/">;
29
+ export { app as telemetryRoutes };
30
+ //# sourceMappingURL=telemetry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/routes/telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAK1C,UAAU,YAAY;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE;QAAE,WAAW,EAAE,iBAAiB,CAAA;KAAE,CAAC;CAC9C;AAED,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAyBvC,QAAA,MAAM,GAAG,oCAAkC,CAAC;AAqE5C,OAAO,EAAE,GAAG,IAAI,eAAe,EAAE,CAAC"}
package/dist/schemas.d.ts CHANGED
@@ -449,8 +449,8 @@ export declare const SetJobFeedbackSchema: z.ZodObject<{
449
449
  vote: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>;
450
450
  reasons: z.ZodDefault<z.ZodArray<z.ZodEnum<{
451
451
  stack: "stack";
452
- location: "location";
453
452
  company: "company";
453
+ location: "location";
454
454
  pay: "pay";
455
455
  domain: "domain";
456
456
  level: "level";
@@ -4,7 +4,7 @@
4
4
  * Greenhouse holds an application until a code it emails is typed into the
5
5
  * form. The owner asked (2026-10-04) to read that code on the dashboard rather
6
6
  * than open an inbox — they own both the mail service and the dashboard — which
7
- * supersedes the "never displayed" line in docs/DECISION-mail-reconciler.md.
7
+ * supersedes the "never displayed" line in hadoku_site/docs/requests/hadoku-jobplatform/DECISION-mail-reconciler.md.
8
8
  * What still holds, and is enforced in routes/jobs/verification.ts: this route
9
9
  * gives the code to a signed-in human only, never a service identity.
10
10
  *
@@ -20,7 +20,7 @@
20
20
  -- the common case, not the edge case.
21
21
  --
22
22
  -- There is deliberately NO column for the code itself. See
23
- -- docs/DECISION-mail-reconciler.md: a code mail sets state and its contents are
23
+ -- hadoku_site/docs/requests/hadoku-jobplatform/DECISION-mail-reconciler.md: a code mail sets state and its contents are
24
24
  -- never parsed, stored, logged or displayed. Adding a column here would be the
25
25
  -- first half of answering an anti-bot challenge on the owner's behalf.
26
26
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hadoku/jobplatform-worker",
3
- "version": "2.32.52",
4
- "gitHead": "f93fb39cff4c4dec41ff248ce574a956138a5733",
3
+ "version": "2.32.54",
4
+ "gitHead": "02e4811fa6c58c1212def37f5240c00f0c5fb84d",
5
5
  "description": "Job listings aggregation and tracking dashboard - Worker package",
6
6
  "license": "MIT",
7
7
  "type": "module",