Conversation
…atch({executor}), action handler
A batch job's trigger_type, input codec, detection, and insert path come
from one definition so they can never drift. Authors keep the standard
event-module format: batchJob() fills the detector and job-input-mapper
slots; createBatchJob() is the sanctioned write path (same codec, legacy
delay_key dedup semantics); batch({executor}) builds the canonical
batch_jobs store so services stop hand-rolling store plumbing;
batchJobsActionHandler() exposes creation via a Hasura action limited to
the service's own definitions.
20 new tests; api-surface snapshot updated for the new exports; guide's
batch panel documents the pattern with the real prod 'ar' example.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… any rejection, 500 only for insert failures Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
robnewton
marked this pull request as draft
July 28, 2026 18:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the definition-first batch job API designed with Rob (2026-07-20 design thread), keeping the standard event-module format — no new module shape, no per-service store plumbing.
batchJob({ triggerType, input? })— one definition holds the trigger_type string and an optional input codec (zod-compatibleparse, no zod dependency) and derives the two standard slots:detector— INSERT of that trigger_type onbatch_jobs, plus the UPDATE→pendingreplay pathinput— ajob()input mapper that parses the row'sinputjsonb so the job'sctx.inputis typed and validatedcreateBatchJob(executor, def, input, opts?)— the sanctioned write path. Validates through the same codec before any write, stamps the trigger_type, insertsstatus: 'pending', and reproduces the legacy dedup semantics (delay_key = triggerType-uniqueKeywithon_conflict— a live collision inserts nothing and reportsdeduped: true). Verified byte-for-byte against a real prodarrow.batch({ executor })— builds the canonicalbatch_jobsGraphQL store (executorBatchJobStore: update / enqueueDelayed / markStranded) from any mutate-capable executor (structurally sdk-core's GqlExecutor; documents ship pre-printed via__text, so no graphql dependency).store:stays supported for tests/portability.markStrandedanticipates feat(batch): opt-in safety net for stranded pending rows #37's safety net.batchJobsActionHandler({ executor, batchjobs, passphrase? })— Netlify 2.0 handler for a Hasura actioncreateBatchjob(trigger_type, input). Refuses trigger_types outside the service's own definitions and runs the same codec, so the GraphQL surface can't create jobs the service doesn't handle.Why
One definition per batch job means the trigger_type string exists in exactly one place per service, inserts are validated by the same codec that types the handler, and "you can only create what you handle" is literal. This is the eventkit half of the distributed batchjobs design (per-service listeners + manifest-declared subscriptions + registry-routed events-proxy); routing itself stays a monorepo tooling concern and is deliberately absent here.
Tests / docs
src/plugins/__tests__/batch-job.test.ts): detector matrix incl. replay path, codec validation at both seams, dedup semantics, canonical store lifecycle through a real kit, action handler auth/refusal/validation.docs/guide.htmlbatch panel: documents the pattern with the realarexample and the routing/registry story; stale "graphqlBatchJobStore is planned" notes replaced.Notes
markStrandedfor when it lands.hopdrive/sdkmonorepo-starter.🤖 Generated with Claude Code