Skip to content

The DbJobAdapter class JSDoc still says "every execution writes a sys_job_run row" — the third published .d.ts comment in the same file that recordRuns: false contradicts #9631

Description

@os-project-manager

Found while fixing #9611 (PR linked below). ⛔ Filed rather than absorbed: #9611's dispatch scope fence is explicit — "two comments and the pinning test; do not improve adjacent JSDoc you happen to notice, file it".

Same defect class as #9611, in the same file, emitted into the same published index.d.ts.

The claim and the code

packages/services/service-job/src/db-job-adapter.ts, the DbJobAdapter class JSDoc:

 * Persisted side effects:
 *   - `schedule(name, …)` upserts a `sys_job` row (active=true)
 *   - `cancel(name)` marks the row inactive
 *   - every execution writes a `sys_job_run` row
 *   - every execution updates `sys_job.last_run_at / last_status / run_count / failure_count`

The third bullet is false whenever recordRuns is false. db-job-adapter.ts:305 (pre-#9611 numbering) gates the insert:

current = { id: this.recordRuns ? await this.startRun(name, defaultTrigger, attempt) : undefined, settled: false };

and settle() only updates a row when one exists (if (run.id) await this.finishRun(...)). With recordRuns: false, no execution writes a sys_job_run row.

The fourth bullet is fine — bumpJob is called unconditionally.

Why it matters in this channel

tsup emits this comment into packages/services/service-job/dist/index.d.ts (around line 92 after #9611), so it is the class-level editor tooltip an npm consumer of @objectstack/service-job reads. After #9611 lands, the same emitted file states the truthful field-level rule for recordRuns about sixty lines above a class-level bullet asserting the opposite. That is strictly better than before — one of the two was corrected — but the file now visibly disagrees with itself, which is the cheapest possible signal that this bullet is the leftover.

Suggested disposition

Comment-only, no behaviour change: qualify the bullet, e.g. "every execution writes a sys_job_run row unless recordRuns is false". Same reasoning as #9611 — the defect is that the documentation lies, not that the adapter is wrong.

Related coverage gap, recorded here rather than filed separately

Nothing in packages/services/service-job/src/*.test.ts references recordRuns at all: no test pins that true writes a row, that false writes none, or that the default is true. #9611 pinned the MemoryCacheAdapter FIFO comment with discriminating tests but its acceptance named only that one; the corrected recordRuns wording is therefore still an unenforced claim. Whoever takes this card is the natural place to add the pin, since the two touch the same sentences.

Refs: #9611 · #9532 · #9517


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions