Repository navigation
feat(spec): IJobService.replay gains an optional options?: JobReplayOptions argument carrying force: true (#14766) - #15377
Conversation
…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
…b-service-replay-force
📓 Docs Drift CheckThis PR changes 1 package(s): 4 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 128 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # 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
|
|
Landing provenance — Generated by Claude Code |
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.replayinpackages/spec/src/contracts/job-service.tsgains an optional third argument:Shape: an options object, not a positional boolean
JobReplayOptions { force?: boolean }is exported from@objectstack/spec(thecontractsentry). Chosen over a bare positionalforce?: booleanbecause 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 acrosspackages/spec/src/contracts/*.tsis 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 insys_flow_dispatch:replay(name, data)re-runs the window (unchanged behaviour); every job that never takes a claim is this row;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]inapi/errors.zod.ts) andstatus: 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 inerror-code-ledger.zod.tsbefore 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 oncode+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
JobReplayOptionsinterfacejob-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 toJobReplayOptions | undefined(identity, not assignability);forceis the only member and a boolean — plus a source-reading pin that the doc block names the three claim states, the ADR-0112 envelope withcodeandstatus, the window, the claim and theforcedoorapi-surface/contracts.jsonandexport-origins/contracts.json— exactly the two artifactscheck:generated --fixproved stale;src/migrations/registry.tsandauthorable-surface.base.jsonare untouched.changeset/job-service-replay-force.md,@objectstack/specminor, stating that the refusal semantics are declared here and enforced by [finding] Aschedule(cron) flow has no dispatch-claim ledger while atime_relativeflow does — a re-run of a digest re-notifies #14501replay:liveness/job.jsongovernsJobSchemaproperties, and contract methods are not ledger rows — nothing to addcheck:migration-registryandcheck:adr-0087-registration --self-testare greenOut 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 typecheckagainst the rebuilt spec dist —os-verify-lock: VERDICT command-exit 0. No behaviour, nosys_flow_dispatch, noschedule-trigger.ts, no pin outsidepackages/spec.Verification
All on head
07f86ba7f(the feature commit1ffdfbcbcmerged withorigin/maindc46c4ec1; the merge brought nopackages/specchange, so the spec dist built from1ffdfbcbcis the dist these ran against;git statusclean,git rev-parse --short HEAD=07f86ba7fat 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 0pnpm --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— andtsc -p tsconfig.test.json --listFileslistscontracts/job-service.test.ts(1 hit), so the new pins are inside the measured program, not excluded from itpnpm --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 basedc46c4ec1): 61 commands, list identical before and after the merge. 59 green with their own judgment lines (among themcheck: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-debtandpnpm check:dual-build-cjs-loads, both exit 3PREREQUISITE NOT MET — this gate reads built outputasking for the full./packages/*turbo build closure; that is a repo-level build CI owns, declared here as a narrowing rather than reported green.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
HEADwith absolute paths). Mutation: the declaration narrowed back toreplay?(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.jsonreports 8 errors injob-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 emptygit 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-servicefromsrc/, not fromdist/; the spec dist was rebuilt afterwards because the restore madesrc/newer thandist/, and the dist-reading gates were re-run on that rebuild.Implemented-by:
os-devsubagent of thedomain:specseat, sessionsession_01H2oQebDDxYKfWZusyd8GXk, branchclaude/issue-14766-job-service-replay-force.🤖 Generated with Claude Code
Generated by Claude Code