@pattern-stack/codegen 0.4.3 → 0.4.4

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.4.4] — 2026-04-23
8
+
9
+ ### Fixed
10
+
11
+ - **`fix(jobs)` #197 — SEVERITY: silent pool-level outage.** `JobWorkerModule` was passing `def.queue` (e.g. `'jobs-crm-sync'`) as the worker's claim-filter pool, but the orchestrator writes the logical `poolName` (e.g. `'crm_sync'`) into `job_run.pool` from `@JobHandler.meta.pool`. As a result, **no job in any stack using `@JobHandler` was ever claimed by a worker** — the claim query never matched a row, zero exceptions were raised, and the pool sat idle. Every consumer of the jobs subsystem since pools-and-queues diverged was affected. Fixed by passing `poolName` as the worker's `pool`. If you ran 0.4.0–0.4.3 with `@JobHandler` handlers: any jobs enqueued in that window are still pending in `job_run` with `status='pending'` and will now claim on next worker tick.
12
+ - **`fix(jobs)` #197 — cross-module handler DI scope.** `moduleRef.create(HandlerClass)` only instantiates within `JobWorkerModule`'s scope, so any handler with a cross-module `@Inject` dep (e.g. a sync job injecting a factory from a feature module) crashed at claim time with "not a provider of the current module". The 0.4.3 `ModuleRef` fix was necessary but not sufficient. Switched to `moduleRef.get(HandlerClass, { strict: false })` in both the Drizzle worker and the in-memory orchestrator, which walks the whole DI graph. **New hard requirement**: handler classes MUST be registered as providers in their owning `@Module`. `@JobHandler` registers with the job registry, not with Nest DI — both registrations are required. Documented in `.claude/skills/jobs/handler-authoring.md`.
13
+
14
+ ### Added
15
+
16
+ - **`feat(events)` #198 — `type: array` payload field.** Closes a silent validation hole. Payloads with list-shaped fields had no well-typed representation; the only option was `type: json`, which emits `Record<string, unknown>` / `z.record(z.unknown())`. At publish time the runtime Zod validator rejected actual arrays, the event was dropped, and downstream `bridge_delivery` rows never landed — with no surfaced error. Now: `type: array` with a required scalar `items:` (`uuid | string | number | boolean | date`) emits `T[]` + `z.array(T)`. Nested arrays / nested json inside an array are deliberately rejected — payloads are a wire format, not an embedded schema. Consumer migration: change any list-shaped payload field from `type: json` to `type: array, items: <scalar>`, re-run `codegen events`, drop any `as unknown as Record<string, unknown>` publish-site casts.
17
+
7
18
  ## [0.4.3] — 2026-04-22
8
19
 
9
20
  ### Fixed
@@ -1184,8 +1184,9 @@ var MemoryJobOrchestrator = class {
1184
1184
  }
1185
1185
  const meta = registration.meta;
1186
1186
  const HandlerClass = registration.handlerClass;
1187
- const handler = this.moduleRef ? await this.moduleRef.create(
1188
- HandlerClass
1187
+ const handler = this.moduleRef ? this.moduleRef.get(
1188
+ HandlerClass,
1189
+ { strict: false }
1189
1190
  ) : new HandlerClass();
1190
1191
  const ctx = {
1191
1192
  input: run.input,
@@ -2026,8 +2027,9 @@ var JobWorker = class {
2026
2027
  }
2027
2028
  const meta = registryEntry.meta;
2028
2029
  const HandlerClass = registryEntry.handlerClass;
2029
- const handler = await this.moduleRef.create(
2030
- HandlerClass
2030
+ const handler = this.moduleRef.get(
2031
+ HandlerClass,
2032
+ { strict: false }
2031
2033
  );
2032
2034
  const ctx = {
2033
2035
  input: claimed.input,
@@ -2228,7 +2230,7 @@ var JobWorkerOrchestrator = class {
2228
2230
  );
2229
2231
  }
2230
2232
  const workerOptions = {
2231
- pool: def.queue,
2233
+ pool: poolName,
2232
2234
  concurrency: def.concurrency,
2233
2235
  shutdownTimeoutMs: this.options.shutdownTimeoutMs ?? DEFAULT_SHUTDOWN_TIMEOUT_MS2
2234
2236
  };
@@ -2236,7 +2238,7 @@ var JobWorkerOrchestrator = class {
2236
2238
  worker.onModuleInit();
2237
2239
  this.workers.push(worker);
2238
2240
  this.logger.log(
2239
- `JobWorker started: pool='${def.queue}' concurrency=${def.concurrency}`
2241
+ `JobWorker started: pool='${poolName}' (queue='${def.queue}') concurrency=${def.concurrency}`
2240
2242
  );
2241
2243
  }
2242
2244
  }