← Back to Pull requests

feat(core): add scheduledExecution subject and events #323

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Jul 29, 2026 18:12 UTC
Author

Changes

Adds a scheduledExecution subject to the Core vocabulary, with created, modified, canceled, triggered and missed predicates.

A scheduledExecution is a registered intent to enqueue a target execution — a build, a deployment, a change window opening — at a future time. It covers the lifecycle before enqueueing: the schedule is registered, possibly changed, and then either fires, is canceled, or does not fire at all.

Why a new subject

This came from an operator running scheduled deployments who needed the event stream to answer six questions: who scheduled a build or deployment, whether the schedule was subsequently changed, who changed it, whether it was canceled, who canceled it, and whether it actually fired and when.

The existing queued predicates cannot answer any of them. build.queued and the service deployment events represent work already accepted into an execution queue — the earliest moment the vocabulary can currently express. A schedule registered today to fire next Tuesday is invisible until it materializes as a queued execution, and by then the registration, every amendment to it, and any cancellation have left no trace.

Making the schedule itself a subject puts that history in the stream. triggered is the hand-off: the occurrence that subsequently produces the existing queued event for the target.

author on triggered

author is required when trigger.type is manual, and MUST NOT be present for any other value. The schema encodes both directions, and requires trigger.type so neither branch can be evaded.

The biconditional is the point. Because the absence of author is what tells a consumer that no actor fired the execution, a time-fired event must not carry one — attaching the schedule's creator there would misreport a weeks-old registration as a person running something today. A pipeline or an event is likewise not a person, so those values carry no author either.

Manual firing is ordinary, not an exception. A scheduler's "Run Now" is the normal way an author tests a schedule before trusting it to fire unattended. It is therefore an attribute of triggered rather than a separate predicate, which would rest on the premise that "Run Now" is unusual. Audit interest in off-schedule firing of a sensitive target is a consumer policy — filter on trigger.type and target — not a vocabulary distinction.

missed

missed is a live producer reporting that a scheduled execution did not fire. It distinguishes a schedule that never fired from an execution that fired and then failed; the latter is reported by the target's own events.

Emission is at the producer's discretion and the vocabulary sets no tolerance window. A normative threshold was considered and not taken: arrival time cannot be predicted accurately in a distributed system, so any threshold would encode a guarantee the transport cannot make. Producers know their own scheduling semantics, and consumers should read scheduledTime against the event's own timestamp rather than rely on a standard grace period.

A producer that was itself unavailable at scheduledTime emits nothing at all, including no missed. That gap is found by querying for the event that is absent, which is the same mechanism that detects any expected occurrence that never arrived.

Design decisions

Two times are carried, and both matter. scheduledTime is the intended time; context.timestamp is when the occurrence happened. On triggered, the difference between them is the on-time-versus-late record. The producing scheduler or controller is identified by context.source, which every CDEvent already carries, so no separate field names it.

author records attributed identity, not authenticated identity. It is an addressing key: the actor the producing system attributes the action to. Proving the actor is the producer's responsibility.

target carries a type alongside id and source, so consumers can route on the kind of thing scheduled, and so target references are shaped consistently across subjects. type is a free string — build, deployment, changeWindow — rather than a closed enum, so the subject is not coupled to a fixed list of schedulable things.

triggeredExecution is a field, not a link. Replacing it with a relation link to the enqueued execution was considered. Linking is optional in CDEvents and an event should be complete without it: a consumer reading a triggered event should not have to consult a second mechanism to learn what was enqueued, particularly when the scheduler knows exactly what it just enqueued and can say so directly.

The subject is treated as a sequence of actions, not a definition. It was put to us that the lifecycle here is mostly definitional and might not warrant occurrence events. Registering a schedule is an action taken at a point in time by an identifiable actor, and it produces something that did not exist beforehand; canceling it removes that thing. Each is an occurrence an auditor may need to account for, and each is reported as it happens.

No field for event publication time. Publication timing is a property of the transport carrying the event, not of the thing that happened. The intended time and the occurrence time are both present already.

No attempt identifier. A retry is a new occurrence with its own identity. This is also not specific to scheduledExecution; if attempt identity is wanted, it belongs in the context for every subject.

The trigger object is reused byte-identically from the Testing vocabulary, including its existing schedule value. No new common objects are introduced.

Out of scope

  • The authorization decision to create or amend a schedule. approval already covers accountable authorization decisions. A schedule requiring sign-off is two occurrences.

  • Whether a fired execution is permitted to proceed. Control-plane behavior. These events report that the schedule fired.
  • Notes on this change

    Event versions start at 0.1.0-draft.

    schemas/_defs/ entries and x-cdevents-semantics are not included here. The predicate definitions this subject would need overlap with those already being added by #319 and with further subjects we are proposing; adding them here would collide. We will follow up with them once #319 lands.

    Submitter Checklist

    As the author of this PR, please check off the items in this checklist:

  • Has the primer doc been updated if a design decision is involved — no new concept is introduced; this applies existing vocabulary patterns

  • Have the JSON schemas been updated if the specification changed

  • Has spec version and event versions been updated according to the versioning policy — new events start at 0.1.0-draft; the spec version is unchanged

  • Meets the CDEvents contributor standards
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: sol-duara Review duration: 180049m
    All Vouch review confidence checks passed
    Residual risk 0.33 = Change Risk (0.59) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.59 · 650 lines diff across 8 files
    0.59
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #323"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 59% (MEDIUM) · Higher = larger blast radius
    59%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.7% · Lower = rushed or shallow review
    44.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 32.6% · Safe to merge
    32.6%
    Repository