ADL 36 · Part V — Execution, presentation, and integration

0.6.0 reconciled + 0.5.1 detail

Scheduled tasks

ADL 0.6.0 reference · Review draft 1 · November 14, 2026.

Contents · Source map · Evidence

The 0.6 edition note

Retain the implemented schedule grammar and its occurrence/execution distinctions. Aegis design discussions about monitors and occurrence ownership are feature proposals until the corresponding declaration, evaluator, and failure behavior are established. This edition adds no monitors grammar by analogy with schedules.

The scheduled caller’s identity, retries, and overlap behavior matter to policy claims. A passing foreground CRUD request does not establish scheduler coverage or exactly-once execution. Reverification should exercise a real scheduled invocation and its operation context, not merely parse the schedule.

Retained reference detail

The numbered sections below are carried from 36-scheduled-tasks.md. Their original baseline and evidence remain attached to the source. Statements about “current” or “checked” behavior in this retained text refer to those original observations unless the edition note explicitly updates them. This is a consolidated draft, not a claim of complete re-verification.

36.1 Scope and applicability

A schedule selects records and invokes an action on a recurring or relative basis. This chapter owns the declaration, timing, selection, execution identity, and observable run result. ADL 22 owns transitions; ADL 35 owns notifications; ADL 37 owns workflows. Service deployment and process supervision belong to the platform manual.

The inherited chapter (v0.5.0, retired) is the baseline. The delta §13 amends action identifiers. Current implementation observations below apply to the recorded source/build revision; they do not silently replace an inherited rule. In particular, the inherited example’s resource placement, expression advice, per-schedule timer description, and skipped-action classification differ from the current parser and engine.

36.2 Declaration and placement

Declare schedules as a mapping under domain. Each key is a schedule name. A minimal task changes selected tickets to an archived status:

# Domain fragment; recurring.yaml is the complete checked input.
schedules:
  archiveStale:
    recurrence: daily at 02:00
    source:
      resource: Ticket
    action: update
    input:
      status: archived
      amount: 3
    enabled: false

The example starts disabled so it can be invoked deliberately through the management API. Runtime enablement controls the heartbeat; it does not prohibit an administrator from running the task manually.

KeyShape and current default
descriptionString, empty
typeString, recurring; relative selects the tier path
recurrenceString, empty; recurring schedules need a valid expression to acquire a next run
source.resourceResource name, empty; * currently selects no records
source.filterAEL expression string, empty means no filter
actionAction word, empty; dispatch choices are listed in §36.5
targetResource for create, empty. A name in this domain, or another domain’s resource as domain.Resource or adl.<suite>.<domain>.<Resource> (§36.5.2)
inputField-to-value mapping; values become strings during parsing
transitionNamed transition for the transition action
skipIfAEL expression string, empty means do not skip
enabledBoolean, true
batchedBoolean, false; retained but not consumed by execution
relativeToSource record’s date field name
offsetString, retained; the current relative runner uses tiers instead
tiersArray of relative threshold/action definitions
channels, recipients, template, priorityNotification configuration for action: notify, read inline (#694)
notificationNested alternative to the four above
workflowWorkflow name for action: workflow

The current builder reads source.resource, not a top-level schedule resource. The legacy-resource.yaml probe is accepted but selects zero rows; its run reports success with zero processed records. Acceptance is therefore insufficient evidence that a schedule can reach its intended resource.

36.3 Recurrence and the server clock

The recurrence parser recognizes these forms without a separate extension provider in the checked build:

FormExample
Positive intervalevery 15 minutes, every 2 hours, every 90 days
Bare interval90 days
Daily timedaily at 02:00
Weekly timeweekly on monday at 08:00
Monthly datemonthly on 15th at 02:00, monthly on last at 02:00
Quarterly datequarterly on 1st at 06:00
Yearly dateyearly on Dec 31 at 12:00

Intervals also accept seconds and singular units. The parser lowercases the input. Times and persisted timestamps use UTC; this declaration does not carry a timezone or daylight-saving policy. weekly on monday without a time, daily at 25:00, zero intervals, and cron syntax fail the checked parser. A nonempty invalid recurrence on a recurring schedule is rejected during submission. An empty recurrence can still be admitted and manually run.

Parsing and calculating the next occurrence are separate checks. The current monthly/quarterly/yearly calculator can advance a whole period when the desired calendar date is still ahead in the current period. The examples record exact next-run values from a fixed 2026-09-10T12:00:00Z input. They also show that substring matching accepts surrounding junk. These are implementation limits, not alternative grammar or recommended recurrence spelling.

Recurrence after the fixed input aboveObserved next run
weekly on monday at 08:002026-09-14T08:00:00Z
monthly on 15th at 02:002026-10-15T02:00:00Z — skips the upcoming September date
monthly on last at 02:002026-10-31T02:00:00Z
yearly on Dec 31 at 12:002027-12-31T12:00:00Z — skips the upcoming December date

There is one heartbeat per instantiated scheduler engine, which loops over its copied schedule definitions. A domain has one live engine: submitting the domain again retires the engine before it, which finishes a run it has already started and starts no other (#1908). Production registration starts it with a 60-second heartbeat, after an initial one-second pause. Seeding computes nextRunAt for a new recurring task; a tick also fills a missing deadline. Loading a task does not itself execute it. A task is due when the tick’s clock has reached its stored deadline, compared as instants to the second. A due task is claimed before it runs: the tick moves nextRunAt from the deadline it read to the new one, and runs the task only if that update changed the row. Two schedulers on one state table, such as two server processes on one database, therefore run a due slot once between them. Because the deadline moves before the run, a server that stops in the middle of a run does not repeat that slot when it comes back (#1908). The tick computes the new deadline from the deadline that was due, not from the time the run started or finished, so the run’s duration does not push the cadence back and an every 1 minutes task runs on every 60-second tick (#1553). If the server was down past several deadlines, the task runs once and the new deadline is the first one after the current time: missed occurrences are skipped, not replayed. A manual run (POST /schedules/{name}/run) still sets the deadline one interval after the current time. The source does not provide a missed-occurrence replay queue, an exactly-once guarantee, or a per-record retry policy.

The disposable live-heartbeat case moves its stored deadline into the past, then observes the actual heartbeat update a ticket and write its run log. It does not wait for an unmodified recurrence interval. Fixed-time helper cases verify calendar calculations without waiting for calendar dates. Neither proves long-running service uptime or crash recovery.

36.4 Record selection and input values

The runner reads the entire source table and applies source.filter in memory. Rows use database-returned strings with null conversion. This path does not call the resource list handler, inherit its named/default scopes, or perform caller RBAC filtering. No caller record is available to the heartbeat. Cross-resource AEL query services are not installed in this source-selection context.

A false or failed source filter excludes the row. A true skipIf increments the skipped count. A failed skipIf does not skip: the action proceeds. These two error policies differ and are exercised independently.

The inherited statement that every input value is evaluated as AEL is not the current algorithm. The runner uses a string heuristic:

InputChecked treatment
status: archivedLiteral string archived
amount: 3, a boolean, or nullRecognized scalar becomes its JSON value
status: "'archived'"Quotes remain in the literal string
An expression containing $, (, ==, +, or -Sent to the AEL evaluator
Failed expressionOriginal expression text becomes the value

Expression context supplies $record, $this, bare field fallback, and $now. Database strings affect arithmetic: the checked $record.amount + 1 path does not reliably produce an integer suitable for the destination field. The expressions.yaml example records the resulting validation failure. Consult ADL 18 for AEL itself; this heuristic belongs to the scheduler host.

36.5 Actions, authority, and partial effects

actionCurrent execution
createCreates one target record per selected source row
updateUpdates the selected resource record
deleteInvokes the selected resource’s delete action
transitionInvokes the named transition on the selected resource
notifyDispatches through the notification engine: resolves recipients, renders the template, records the dispatch (#694)
workflowStarts an instance of the named workflow, with the selected row as trigger data (#694)
archiveWrites the selected rows to the configured archive root as CSV (RFC 4180) with an atomic rename, honouring destination, format, deleteAfterArchive and source.table. Shipped in ADL plugin 0.42.0 under ruling R17; the root is the server setting adl.archive.root, and .. or an absolute path is refused at parse time (#744)
reportRuns the declared report and records the dispatch. Shipped alongside archive in 0.42.0 (#744)
Any other stringWarns at parse time; returns an unknown-action error per row

36.5.1 notify and workflow are dispatched, not approximated

notify calls the same entry point a history-triggered notification uses, so a scheduled notification resolves recipients, evaluates its condition, honours its throttle and writes a dispatch record identically. It does not go through the administrative test-send path, which bypasses all four.

Its configuration is read inline, as siblings of action: notify — that is how every declaration in the corpus is written, and the keys are parsed by the same helper the resource-level notifications: block uses. Until #694 they were read by nothing: the task ran, selected its rows, and delivered to nobody.

A schedule with no channels, a workflow action naming no workflow, and an action the scheduler cannot dispatch are all warnings, not rejections. The platform invited authors to declare archive and report and then did not build them; failing the document would charge the author for that. The difference from before is that the document no longer loads silently.

There is no generic bus-action expression in action. The checked retention-attempt.yaml proposes a retention action with dryRun: true; the scheduler rejects it at execution as an unknown action and leaves the source record unchanged. A privacy retention operation cannot be scheduled by spelling its full action identifier here. Its direct API remains owned by ADL 45.

For update/delete/transition, the runner copies the source row’s id unless the input already supplies one. This is an id convention, not general support for arbitrary primary keys or composite keys. Table lookup is also derived from the domain/resource name; the scheduler does not carry the full resource model.

Dispatched requests use transport scheduler, user ID system, username scheduler:<scheduleName>, and the admin role. These are trusted internal operations; the initiating management caller’s roles are not propagated as the action’s limiting authority. Validation, state transitions, and other applicable handler behavior still run. The checked create, update, delete, and transition examples inspect stored effects.

Each record action is dispatched separately. A later failure does not establish rollback of earlier successful actions. The run aggregates recordsProcessed, recordsSucceeded, recordsFailed, recordsSkipped, and errors:

  • No failures produces success, including zero selected rows or all skipped.
  • Some successes and some failures produces partial_failure.
  • Failures with no successes produces failure.

Despite a stale source comment and the inherited text, unimplemented actions increment failed, not skipped. HTTP success from the manual-run endpoint wraps this result; inspect data.status and data.errors.

36.5.2 Creating in another domain

A create may name a resource of another domain as its target. The write is allowed only if that resource grants it with allowWriteFrom (ADL 12 §12.9): the list names this schedule’s domain, or holds "*" and both domains belong to the same suite. Without the grant no row is written and the run records WRITE_AUTHORITY_DENIED for each source row. A target that is not loaded is refused the same way. update, delete and transition act on the schedule’s own source.resource and cannot reach another domain.

# The owning domain
Finding:
  allowWriteFrom: [inventory]

# Domain `inventory`
schedules:
  overdueCount:
    recurrence: daily at 02:00
    source: { resource: Item, filter: "diffDays(now(), lastCountedAt) > 730" }
    action: create
    target: compliance.Finding
    input: { kind: overdueInventory, subjectId: $record.id }

The created row carries no foreign key back to the source. Write the source’s address and id into the row, as the example does. Check: tools/repro/adl/74_automation_cross_domain_create.py.

36.6 Relative schedules and persistent control

A relative task requires relativeTo and nonempty tiers. A tier supplies daysUntil, action, tag, and optionally transition; channels, recipients, and templates are retained but do not add delivery behavior. It inherits the parent input mapping and source resource.

For each dated row, the engine considers every tier whose threshold has been crossed. Successful work is deduplicated by schedule name, record ID, and tier tag. A failed action does not create that success marker. Empty tags disable deduplication. Multiple eligible tiers can run during one pass. The checked relative fixture runs twice and demonstrates a single effect with a nonempty tag; its large offset does not change the tier decision.

Runtime enabled state and nextRunAt live in a state table; existing rows survive seeding. A manual run bypasses disabled state and advances a valid recurring task’s next run. Missing schedule names are inconsistently handled: get returns 404, run returns HTTP 200 with a failure result, and enable/disable can write a state row even when no definition exists.

36.7 Generated interface, diagnostics, and restoration

Under /api/v1/{domain}/schedules, the registrar supplies:

MethodSuffixPurpose
GETemptyDefinitions with effective enabled state and next run
GET/logBounded run log with optional filters
GET/{name}One definition
POST/{name}/runManual execution
POST/{name}/enable, /{name}/disableRuntime control

These actions require admin or administrator. Missing required names use VALIDATION_ERROR; unauthorized callers receive FORBIDDEN. Logs carry times, counts, outcomes, and trigger origin. Their totalCount is the returned slice, not an independent total over all history.

Delta §13 requires the site/major action form. The current subsystem management registrations have both forms when legacy identifiers are enabled. The scheduler’s own action dispatch still constructs legacy resource action IDs. The canonical-only case disables legacy IDs, invokes the canonical schedule API, and records failed internal dispatch. Migrated management routes do not prove that their internal consumers have migrated.

The native exporter refuses domains containing schedules as an unsupported lossy projection. A registry reload with retained source reconstructs the schedule; the forced source-free example cannot recover a model. Preserve the actual source document as the recovery artifact. The evidence record separates those checks from modeller admission and timed execution.