Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions trios/agent-server/apps/server/src/inngest/plan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {
SpecCatalog,
} from './spec-catalog'

/** `DISPATCH_GITHUB_ACTIONS = "workflow-dispatch"`, everything else `"tick-only"`. */
/** `DISPATCH_GITHUB_ACTIONS = "workflow-dispatch"`, everything else (launchd included) `"tick-only"`. */
export type Dispatch = 'workflow-dispatch' | 'tick-only'

export interface CronPlan {
Expand Down Expand Up @@ -96,7 +96,9 @@ export function planCron(card: CronCard, s: SchedulerSpec): CronPlan {
? 'HOST inngest: the 999 app owns the schedule (no double fire); DISPATCH_INNGEST = tick-only'
: card.host === 'timer'
? 'HOST timer: setInterval inside a 999 process, no remote handle; DISPATCH_TIMER = tick-only'
: `HOST ${card.host}: DISPATCH_RAILWAY_CRON = tick-only`
: card.host === 'launchd'
? "HOST launchd: a job on the owner's Mac, launchd owns the schedule and nothing outside the Mac can start it; reported, never dispatched; DISPATCH_LAUNCHD = tick-only"
: `HOST ${card.host}: DISPATCH_RAILWAY_CRON = tick-only`
} else if (card.schedule === '') {
reason = 'SCHEDULE is empty: DISABLED_CARD = tick-only'
} else if (!fiveFieldCron(card.schedule)) {
Expand Down
17 changes: 17 additions & 0 deletions trios/agent-server/apps/server/tests/api/queen-inngest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,23 @@ describe('the plan follows the constants', () => {
expect(plan.danglingRuns).toEqual([])
})

it("serves a launchd card (the owner's Mac) tick-only and reported, never dispatched, even with a five-field SCHEDULE", async () => {
const root = specsWith({
'crons/zz-mac.t27': cronCard('launchd/trios/doctor', {
HOST: 'pub const HOST : str = "launchd";',
SCHEDULE: 'pub const SCHEDULE : str = "11,41 * * * *";',
RUNS: 'pub const RUNS : [0]str = [];',
}),
})
const c = await loadSpecCatalog(root)
const p = planCatalog(c).crons.find(
(x) => x.cardId === 'launchd/trios/doctor',
)!
expect(p.dispatch).toBe('tick-only')
expect(p.cron).toBeNull()
expect(p.reason).toContain('DISPATCH_LAUNCHD = tick-only')
})

it('derives ids and events from the templates and keeps them unique across 59 functions', async () => {
const c = await catalogPromise
const plan = planCatalog(c)
Expand Down
Loading