Skip to content

feat(spec): IJobService.replay gains an optional options?: JobReplayOptions argument carrying force: true (#14766) - #15377

Merged
os-justin merged 2 commits into
mainfrom
claude/issue-14766-job-service-replay-force
Sep 4, 2026
Merged

os-justin merged 2 commits into
mainfrom
claude/issue-14766-job-service-replay-force

Conversation

@os-justin

Copy link
Copy Markdown
Collaborator

Fixes #14766

The contract half of the maintainer's A + a2 ruling on #14501 (#14501 remains open — its behaviour half lands there, and it is what this card unblocks). IJobService.replay in packages/spec/src/contracts/job-service.ts gains an optional third argument:

replay?(name: string, data?: unknown, options?: JobReplayOptions)   // still a Promise resolving to void

Shape: an options object, not a positional boolean

JobReplayOptions { force?: boolean } is exported from @objectstack/spec (the contracts entry). Chosen over a bare positional force?: boolean because this interface already follows the named-options convention for the same kind of knob — schedule(name, schedule, handler, options?: JobScheduleOptions) — and no spec-wide convention prefers a positional boolean: every other optional trailing argument across packages/spec/src/contracts/*.ts is an options object (analytics-service, automation-service, data-driver.beginTransaction, metadata-service.publishPackage / rollback / bulkRegister, package-service.listPackages, queue-service). replay(name, data, { force: true }) says what it does at the call site; a later knob is a second key on the interface, never a fourth positional. Omitting the argument is the pre-#14766 call exactly.

What the TSDoc declares — the text the #14501 implementer codes against

For a scheduled (cron) flow whose tick window takes a (flow, tick-window) dispatch claim in sys_flow_dispatch:

  • claim absent or failed — replay(name, data) re-runs the window (unchanged behaviour); every job that never takes a claim is this row;
  • claim succeeded — replay(name, data) is refused loudly: the promise rejects with an ADR-0112 envelope, code: 'RESOURCE_CONFLICT' (the standard-catalog member HTTP 409 derives — HttpStatusErrorCodeMap[409] in api/errors.zod.ts) and status: 409, whose message names the window asked for and the claim that refused it. Never a silent no-op, never a resolve-having-done-nothing;
  • replay(name, data, { force: true }) sends anyway (option a2). Options a1 and a3 are recorded in the doc block as considered and not taken.

Why the standard-catalog member rather than a new extension code: registering a JOB_* code in error-code-ledger.zod.ts before any producer exists is the declared-but-unproduced shape ADR-0112's 2026-08-18 amendment retired from the catalog; the 409 member is closed vocabulary already, and a consumer asserts the refusal on code + status. Should #14501 find a console needs to branch on this refusal distinctly from other 409s, an extension code is that card's to register together with its producer (raised as an open question in the dev report).

In this PR

  • the declaration + TSDoc, and the exported JobReplayOptions interface
  • job-service.test.ts: a compile-time pin block — a two-argument implementation stays assignable (additivity); { force: true } is accepted through the exported type; the third parameter is identical to JobReplayOptions | undefined (identity, not assignability); force is the only member and a boolean — plus a source-reading pin that the doc block names the three claim states, the ADR-0112 envelope with code and status, the window, the claim and the force door
  • regenerated api-surface/contracts.json and export-origins/contracts.json — exactly the two artifacts check:generated --fix proved stale; src/migrations/registry.ts and authorable-surface.base.json are untouched
  • changeset .changeset/job-service-replay-force.md, @objectstack/spec minor, stating that the refusal semantics are declared here and enforced by [finding] A schedule (cron) flow has no dispatch-claim ledger while a time_relative flow does — a re-run of a digest re-notifies #14501
  • no liveness-ledger row names replay: liveness/job.json governs JobSchema properties, and contract methods are not ledger rows — nothing to add
  • no ADR-0087 entry: additive optional parameter, nothing retired; check:migration-registry and check:adr-0087-registration --self-test are green

Out of scope, verified untouched

DbJobAdapter.replay (packages/services/service-job/src/db-job-adapter.ts) keeps compiling with no edit: pnpm --filter @objectstack/service-job typecheck against the rebuilt spec dist — os-verify-lock: VERDICT command-exit 0. No behaviour, no sys_flow_dispatch, no schedule-trigger.ts, no pin outside packages/spec.

Verification

All on head 07f86ba7f (the feature commit 1ffdfbcbc merged with origin/main dc46c4ec1; the merge brought no packages/spec change, so the spec dist built from 1ffdfbcbc is the dist these ran against; git status clean, git rev-parse --short HEAD = 07f86ba7f at the time of the final gate pass).

  • pnpm --filter @objectstack/spec build (under the shared verify lock): check-dts-emitted: @objectstack/spec - 34/34 declared declaration file(s) present. — VERDICT command-exit 0
  • pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/contracts/job-service.test.ts: Test Files 1 passed (1), Tests 16 passed (16)
  • pnpm --filter @objectstack/spec typecheck: check:test-typecheck: OK — @objectstack/spec's test layer compiles under packages/spec/tsconfig.test.json; 54 file(s) / 261 error(s) / 145 pinned signature(s) held — and tsc -p tsconfig.test.json --listFiles lists contracts/job-service.test.ts (1 hit), so the new pins are inside the measured program, not excluded from it
  • pnpm --filter @objectstack/spec check:generated: ✓ All 15 generated artifacts are up to date.
  • node scripts/pm/dispatch-gates.mjs --commands (no paths; change set derived from git, 5 paths vs merge base dc46c4ec1): 61 commands, list identical before and after the merge. 59 green with their own judgment lines (among them check:api-surface: public API surface + factory signatures unchanged ✓; check:export-origins: 5260 exports across 17 entry points resolve exactly as recorded; check:exported-any, check:dual-source-exports, check:entry-nameability, check:browser-reachable-entries, check:liveness, check:docs, check:nul-bytes, check:closing-keyword-parity, check:adr-0087-registration --self-test, check:changeset-no-major --self-test, check:empty-changeset --self-test). Not measured locally (2): pnpm check:type-check-debt and pnpm check:dual-build-cjs-loads, both exit 3 PREREQUISITE NOT MET — this gate reads built output asking for the full ./packages/* turbo build closure; that is a repo-level build CI owns, declared here as a narrowing rather than reported green.
  • Gates beyond the derived list, judged implicated by the code: 'RESOURCE_CONFLICT' literal in the TSDoc: check:error-code-provenance (OK — every registered-code stamp site is listed under its own owner key or carries a recorded waiver), pnpm check:dispatcher-error-vocabulary (exit 0), pnpm check:error-code-casing (exit 0).

Reverse verification (ablation, on the committed tree, restore anchored on HEAD with absolute paths). Mutation: the declaration narrowed back to replay?(name: string, data?: unknown); confirmed on disk by anchored counts (new signature 0, old signature 1). Direction observed: reds, exactly where predicted — tsc -p tsconfig.test.json reports 8 errors in job-service.test.ts, all inside the #14766 block (pins b and c: Expected 1-2 arguments, but got 3, Type 'true' is not assignable to type 'false' on the identity pin, Tuple type '[name: string, data?: unknown]' of length '2' has no element at index '2'), while pin (a) and every legacy case stay green; vitest: Tests 1 failed | 15 passed (16), the failure being pin (d), the source-reading pin. Restore: git checkout HEAD -- …, proven by empty git diff HEAD --stat, git hash-object = 9263c64d99fdaa91f2912e35468d1850e377fc80 = the HEAD blob, anchored counts back to 1 / 0, and a control run with 0 errors in the file. No rebuild was part of the ablation: both tsc and vitest resolve ./job-service from src/, not from dist/; the spec dist was rebuilt afterwards because the restore made src/ newer than dist/, and the dist-reading gates were re-run on that rebuild.

Implemented-by: os-dev subagent of the domain:spec seat, session session_01H2oQebDDxYKfWZusyd8GXk, branch claude/issue-14766-job-service-replay-force.

🤖 Generated with Claude Code


Generated by Claude Code

os-justin and others added 2 commits September 4, 2026 12:59
…rying force: true (#14766)

The contract half of the #14501 A+a2 ruling: `replay?(name, data?, options?: JobReplayOptions)`.
The TSDoc declares the three outcomes by claim state (absent / failed re-run the window;
succeeded is refused with an ADR-0112 envelope — RESOURCE_CONFLICT / 409 — naming the window
and the claim; `{ force: true }` sends anyway). Behaviour stays on #14501.

- exported `JobReplayOptions { force?: boolean }` (options object, the `schedule` convention)
- type-level pin block in job-service.test.ts (additivity, identity, source-reading)
- regenerated api-surface/contracts.json and export-origins/contracts.json
- changeset: @objectstack/spec minor

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H2oQebDDxYKfWZusyd8GXk
@github-actions github-actions Bot added the size/m label Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/spec, touching 3 documentable anchor(s). ⚠️ 2 changed file(s) yielded no anchor (packages/spec/api-surface/contracts.json, packages/spec/export-origins/contracts.json), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

4 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/error-catalog.mdx (via RESOURCE_CONFLICT (literal, a string literal in IJobService))
  • content/docs/api/error-handling-server.mdx (via RESOURCE_CONFLICT (literal, a string literal in IJobService))
  • content/docs/automation/jobs.mdx (via IJobService (symbol, a top-level interface))
  • content/docs/kernel/contracts/index.mdx (via IJobService (symbol, a top-level interface))
What this run could not see
  • 2 changed file(s) yielded no anchor (packages/spec/api-surface/contracts.json, packages/spec/export-origins/contracts.json) — pages documenting those are invisible to this run
  • 2 name(s) were too generic to anchor anything (single lowercase words)
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.

Coarse fallback — 128 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 27875fc7ec7c7e25f032f2417784ce6b923f3c7a → packageMentionDocs.

Which tree this was computed on

This run read content/docs from a19c86e7202fb14af55b77c43d0cc18194ea1bbd — the merge of head 07f86ba7ff8f3fd52f74be140c0ea5e3dfc30327 into base 27875fc7ec7c7e25f032f2417784ce6b923f3c7a, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin a19c86e7202fb14af55b77c43d0cc18194ea1bbd && git checkout a19c86e7202fb14af55b77c43d0cc18194ea1bbd
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 27875fc7ec7c7e25f032f2417784ce6b923f3c7a 07f86ba7ff8f3fd52f74be140c0ea5e3dfc30327 && git checkout -B drift-repro 27875fc7ec7c7e25f032f2417784ce6b923f3c7a && git merge --no-ff 07f86ba7ff8f3fd52f74be140c0ea5e3dfc30327

node scripts/docs-audit/affected-docs.mjs --json 27875fc7ec7c7e25f032f2417784ce6b923f3c7a

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 27875fc7ec7c7e25f032f2417784ce6b923f3c7a → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Sep 4, 2026
@os-justin os-justin added needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides and removed documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Sep 4, 2026 — with Claude
@os-justin os-justin removed the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Sep 4, 2026 — with Claude
@os-justin
os-justin marked this pull request as ready for review September 4, 2026 13:31
@os-justin
os-justin enabled auto-merge September 4, 2026 13:31

Copy link
Copy Markdown
Collaborator Author

Landing provenance — domain:spec seat (session session_01H2oQebDDxYKfWZusyd8GXk): Clause ② contract review PASS · ACCEPT on the card (#14766, comment 5541158797) at head 07f86ba7f; needs:contract-review cleared on the card and on this PR. Flipped ready and auto-merge armed (squash through the merge queue) at 2026-09-04T13:31Z; the queue admits it once CI on this head is green. On MERGED the seat strips pm:dispatched from #14766, probes the signature on origin/main, and posts the unlock note on #14501.


Generated by Claude Code

@os-justin
os-justin added this pull request to the merge queue Sep 4, 2026
Merged via the queue into main with commit 222dc0f Sep 4, 2026
52 checks passed
@os-justin
os-justin deleted the claude/issue-14766-job-service-replay-force branch September 4, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spec: IJobService.replay gains an optional force argument — the contract half of #14501's A+a2 ruling

1 participant