Skip to content

Bound schedules, instantiate scheduled duties, and window fulfilment (#273) - #274

Open
matthiasautrata wants to merge 9 commits into
EKGF:developfrom
matthiasautrata:issue/273-bounded-recurrence
Open

matthiasautrata wants to merge 9 commits into
EKGF:developfrom
matthiasautrata:issue/273-bounded-recurrence

Conversation

@matthiasautrata

@matthiasautrata matthiasautrata commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #273. Step 8 of #275.

Rewritten on top of the reusable schedule model (#280). It follows the #184 anchor rule: the schedule's DTSTART/TZ sets the occurrence times, and activation only limits the range. The earlier version of this PR, written against dprod:recurrence, is replaced.

Stacking

This PR builds on #280, which itself contains #268, #272 and #270. Until those merge, the PR also shows their commits. The change in this PR is the last three commits, cf93e6a, b178622 and 392be9e. Merge after #280. Then squash-merge directly, or first rebase those commits onto develop.

Problem

§5.5 left scheduled duties unbounded and partly undefined:

  • expand(schedule, processors, clock) had no lower bound, so a rule without COUNT or UNTIL generated infinitely many instances.
  • The condition guard evaluated ⟦duty.condition⟧(Σ.env), which is broken in three ways:
  • instantiate gave equal values for every t. Nothing in §5.2 or §7.2 generated or evaluated instances, so the template itself was fulfilled or violated like any other duty.
  • performed had no time bounds, so one delivery fulfilled every daily instance, past and future.

§5.2 also had a stuck state. D-FULFILL required deadline ≥ clock at evaluation time, and D-VIOLATE required that no action had been performed. An action taken before the deadline but evaluated after it therefore left the duty Active.

Changes

  • expand takes a range (from, to) and returns the schedule's own times within it.
    • The expression alone fixes the times: DTSTART/TZID for RFC 5545 (with COUNT/UNTIL counted from DTSTART), and the five fields plus dprod:scheduleTimeZone for crontab. The range never moves them.
    • Whether expand returns an error does not depend on the range, so D-FREEZE and E₅ still catch a bad schedule on a template that hasn't activated yet.
    • occurrences uses [activatedAt, clock], so a template that was never activated has no instances.
    • The earlier truncate(anchor, FREQ) is gone, because DTSTART already fixes the time of day.
  • The condition is evaluated once, by D-ACTIVATE (= true). An error leaves the template Pending, and the error is collected in E₃ (Failure on the Permit path).
  • Instances:
    • An instance is identified by (template, t) and is Active with activatedAt = t, so relative deadlines run from t.
    • updateDutyStates updates the instances after the templates.
    • Templates are never fulfilled or violated.
    • §7.2 Steps 6 and 8 report instances through tracked(D).
  • Windowed fulfilment: performed(…, (since(d), effectiveDeadline(d, Σ)), Σ).
  • Specification §4.3 and the dprod:schedule comment say the same.
  • New dprod-contracts/tests/test_schedule_bounds.py. All 8 tests fail on Reusable schedule model (#184) #280's text.
  • The lifecycle example no longer records a Pending instance for 6 February: an occurrence becomes an instance only at its scheduled time. The spec overview says what an instance's window is.

Tests

🤖 Generated with Claude Code

@vercel

vercel Bot commented Oct 10, 2026

Copy link
Copy Markdown

@matthiasautrata is attempting to deploy a commit to the EKGF Team on Vercel.

A member of the Team first needs to authorize it.

@matthiasautrata
matthiasautrata force-pushed the issue/273-bounded-recurrence branch from 7a3f1ac to cf93e6a Compare October 13, 2026 21:33
matthiasautrata added a commit to matthiasautrata/dprod that referenced this pull request Oct 13, 2026
…KGF#273)

Resolves: EKGF#273

Rewrites EKGF#274 on top of the reusable schedule model (EKGF#280), following the
EKGF#184 anchor rule: the schedule's DTSTART/TZ sets the occurrence times, and
activation only limits the range.

§5.5 left scheduled duties unbounded and partly undefined:

- expand(schedule, processors, clock) had no lower bound, so a rule
  without COUNT or UNTIL generated infinitely many instances.
- The condition guard evaluated ⟦duty.condition⟧(Σ.env): Σ has no env,
  the guard did not depend on the occurrence time, and under EKGF#267 the
  condition is three-valued.
- instantiate gave equal values for every t, and nothing in §5.2 or §7.2
  generated or evaluated instances: the template itself was fulfilled or
  violated like any duty.
- performed had no time bounds, so one delivery fulfilled every daily
  instance, past and future.

§5.2 also had a stuck state: D-FULFILL required deadline ≥ clock at
evaluation time, and D-VIOLATE required no performance, so an action
taken before the deadline but evaluated after it left the duty Active.

Changes:

- expand takes a range (from, to) and returns the schedule's own times
  within it. The expression alone fixes the times (DTSTART/TZID for
  RFC 5545, COUNT and UNTIL counted from DTSTART); the range never moves
  them, and whether expand errs does not depend on it. occurrences uses
  the range [activatedAt, clock], so a template never activated has no
  instances. The truncate(anchor, FREQ) of the previous EKGF#274 is no longer
  needed, since DTSTART fixes the time of day.
- The template's condition is evaluated once, by D-ACTIVATE (= true). An
  error there leaves it Pending and is collected in E₃.
- An instance is identified by (template, t), and is Active with
  activatedAt = t, so relative deadlines run from t. updateDutyStates
  updates instances after templates; templates are neither fulfilled
  nor violated, and Steps 6 and 8 of §7.2 report instances through
  tracked(D).
- performed takes a window (since(d), effectiveDeadline(d, Σ)). An
  instance counts only actions at or after t; other duties count actions
  from their policy's effectiveDate (EKGF#269). D-FULFILL no longer compares
  the deadline with the evaluation time. A duty without an asset matches
  any performed asset.
- Specification §4.3 and the dprod:schedule comment say the same.
- Add tests/test_schedule_bounds.py, which fails on the previous text.

Refs: EKGF#184, EKGF#274, EKGF#275, EKGF#280

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@matthiasautrata matthiasautrata changed the title Bound recurrence, instantiate recurring duties, and window fulfilment (#273) Bound schedules, instantiate scheduled duties, and window fulfilment (#273) Oct 13, 2026
@matthiasautrata
matthiasautrata marked this pull request as ready for review October 13, 2026 23:50
@jgeluk
jgeluk force-pushed the issue/273-bounded-recurrence branch from 392be9e to add97d3 Compare October 21, 2026 16:37
jgeluk pushed a commit to matthiasautrata/dprod that referenced this pull request Oct 21, 2026
…KGF#273)

Resolves: EKGF#273

Rewrites EKGF#274 on top of the reusable schedule model (EKGF#280), following the
EKGF#184 anchor rule: the schedule's DTSTART/TZ sets the occurrence times, and
activation only limits the range.

§5.5 left scheduled duties unbounded and partly undefined:

- expand(schedule, processors, clock) had no lower bound, so a rule
  without COUNT or UNTIL generated infinitely many instances.
- The condition guard evaluated ⟦duty.condition⟧(Σ.env): Σ has no env,
  the guard did not depend on the occurrence time, and under EKGF#267 the
  condition is three-valued.
- instantiate gave equal values for every t, and nothing in §5.2 or §7.2
  generated or evaluated instances: the template itself was fulfilled or
  violated like any duty.
- performed had no time bounds, so one delivery fulfilled every daily
  instance, past and future.

§5.2 also had a stuck state: D-FULFILL required deadline ≥ clock at
evaluation time, and D-VIOLATE required no performance, so an action
taken before the deadline but evaluated after it left the duty Active.

Changes:

- expand takes a range (from, to) and returns the schedule's own times
  within it. The expression alone fixes the times (DTSTART/TZID for
  RFC 5545, COUNT and UNTIL counted from DTSTART); the range never moves
  them, and whether expand errs does not depend on it. occurrences uses
  the range [activatedAt, clock], so a template never activated has no
  instances. The truncate(anchor, FREQ) of the previous EKGF#274 is no longer
  needed, since DTSTART fixes the time of day.
- The template's condition is evaluated once, by D-ACTIVATE (= true). An
  error there leaves it Pending and is collected in E₃.
- An instance is identified by (template, t), and is Active with
  activatedAt = t, so relative deadlines run from t. updateDutyStates
  updates instances after templates; templates are neither fulfilled
  nor violated, and Steps 6 and 8 of §7.2 report instances through
  tracked(D).
- performed takes a window (since(d), effectiveDeadline(d, Σ)). An
  instance counts only actions at or after t; other duties count actions
  from their policy's effectiveDate (EKGF#269). D-FULFILL no longer compares
  the deadline with the evaluation time. A duty without an asset matches
  any performed asset.
- Specification §4.3 and the dprod:schedule comment say the same.
- Add tests/test_schedule_bounds.py, which fails on the previous text.

Refs: EKGF#184, EKGF#274, EKGF#275, EKGF#280

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
matthiasautrata and others added 8 commits October 29, 2026 16:54
…EKGF#271)

Resolves EKGF#271.

§7.2 Step 1 collected a duty only if `matches(n, request)`, i.e. if the
duty's own action and asset matched the request. A duty states what the
bearer must do, not what is requested, so a request to display
ex:marketData never collected the duty to report on ex:usageStats, and
§12.3's example returned no duties. Step 2 then partitioned by
`d.subject = grantor` / `d.subject = grantee`, so a duty without
dprod:subjectOfDuty belonged to neither party, though specification
§3.2 and term-mapping describe consumer duties without a subject.

The ontology comment on dprod:subjectOfDuty contradicted those
documents: it defaulted the bearer to the data product owner, which is
the provider.

- §3.2: before evaluation, a duty without a subject takes the policy's
  grantee, or the requesting agent in a policy without one. `d.subject`
  is then the bearer everywhere, including `performed`. A duty borne by
  the requesting agent stands for one duty per agent, tracked
  separately in Σ, so one agent's missed duty is not held against
  another.
- §7.2: duties are collected from every policy with a permission in
  force for the request; grantor duties are those borne by the grantor,
  and all others are grantee duties. §12.2 matches.
- Collecting every duty of a granting policy makes a provider's missed
  delivery reachable from every consumer request. Violated is terminal,
  so denying on it would lock the consumer out permanently. Step 6 now
  denies only on violations by the grantee's side; the grantor's are
  reported in `violations` on the Permit.
- dprod:subjectOfDuty comment, specification §4.10, and term-mapping
  state the default.
- Add tests/test_duty_bearer.py, which fails on the previous text.

Rebased onto EKGF#268 (order-independent errors): a policy grants only if a
permission is active (= true), and a permission in error in a policy
that does not otherwise grant (E4) gives Failure on the Permit path,
since resolving it could engage that policy's duties. Section 9.7 now
also keeps the grantor violations reported with a Permit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[Carried forward onto develop for EKGF#275 by Matthias Autrata: conflicts
resolved against EKGF#244/EKGF#245/EKGF#262/EKGF#268/EKGF#270/EKGF#272, the namespace changed from
https://www.omg.org/spec/DPROD/dprod/ to https://ekgf.org/dprod/spec/develop/,
and EKGF#244's duty-only shape and test migrated from dprod:recurrence to
dprod:schedule, which is not duty-only.]
Shapes: accept tab-separated POSIX crontab fields and reject smuggled
tab/CR/LF content; allow EXDATE/RDATE lines in RFC 5545 expressions while
rejecting non-standard or duplicate RRULE parts; reject a
dprod:scheduleTimeZone that conflicts with the embedded TZID; move the
IRI-identifier message onto its own shape so it no longer annotates
unrelated violations.

Ontology: every dprod:ScheduleFormat now declares dprod:carriesTimeZone,
and the timezone-required rule keys on it so extension formats get the
same enforcement as POSIX crontab.

Semantics: schedule errors freeze the affected duty (Rule D-FREEZE),
surface in the result's errors field, and the processor registry is part
of Σ, so the totality and determinism theorems hold for unprocessable
schedules too.

Tests and CI: every schedule case is validated both with the ontology
graph and in the bare documented CLI configuration, making the sh:class
constraints falsifiable; the obsolete-recurrence sweep covers
specification.md; validate.py runs in the build workflow.

Docs: define the previously missing example schedules, rewrite the RRULE
components table as complete expressions, and sync the guide checklist
and specification with the new rules.

[Carried forward onto develop for EKGF#275 by Matthias Autrata: the
build-spec.yml change is dropped (EKGF#262 already runs validate.py in CI),
and the namespace in the new shapes is the develop one. Schedule errors
are fitted to the error model of EKGF#267: instead of an `errors` field on a
Permit result, an unprocessable schedule of a collected duty is gathered
in E₅ and gives Failure on the Permit path, like E₃ and E₄. Deny and
NotApplicable are unaffected, since resolving the schedule can only add
duties or violations. EvaluationError admits ScheduleError, and §9.7's
completion covers schedule errors.]

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…EKGF#184)

The core spec's contract section, its worked contract example, the
contracts examples under examples/contracts/ and the overview diagram
were added after EKGF#234 and still used the removed dprod:recurrence. Each
recurring duty now references an identified dprod:Schedule (an RFC 5545
DTSTART with TZID plus RRULE), embedded as a node object in the
JSON-LD; all five documents expand without dropping a term and conform
to the contracts shapes.

The schedule identifier shape is renamed RejectAnonymousScheduleShape,
following the Reject* convention, so the spec generator no longer
renders it as a second Schedule class; it is listed with the other
rejection shapes in the specification. Schedule and ScheduleFormat are
now contract classes in the generated spec. dprod:schedule has no
domain, so it is no longer expected among the properties extending
ODRL classes.

Refs: EKGF#184, EKGF#234, EKGF#275

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…KGF#273)

Resolves: EKGF#273

Rewrites EKGF#274 on top of the reusable schedule model (EKGF#280), following the
EKGF#184 anchor rule: the schedule's DTSTART/TZ sets the occurrence times, and
activation only limits the range.

§5.5 left scheduled duties unbounded and partly undefined:

- expand(schedule, processors, clock) had no lower bound, so a rule
  without COUNT or UNTIL generated infinitely many instances.
- The condition guard evaluated ⟦duty.condition⟧(Σ.env): Σ has no env,
  the guard did not depend on the occurrence time, and under EKGF#267 the
  condition is three-valued.
- instantiate gave equal values for every t, and nothing in §5.2 or §7.2
  generated or evaluated instances: the template itself was fulfilled or
  violated like any duty.
- performed had no time bounds, so one delivery fulfilled every daily
  instance, past and future.

§5.2 also had a stuck state: D-FULFILL required deadline ≥ clock at
evaluation time, and D-VIOLATE required no performance, so an action
taken before the deadline but evaluated after it left the duty Active.

Changes:

- expand takes a range (from, to) and returns the schedule's own times
  within it. The expression alone fixes the times (DTSTART/TZID for
  RFC 5545, COUNT and UNTIL counted from DTSTART); the range never moves
  them, and whether expand errs does not depend on it. occurrences uses
  the range [activatedAt, clock], so a template never activated has no
  instances. The truncate(anchor, FREQ) of the previous EKGF#274 is no longer
  needed, since DTSTART fixes the time of day.
- The template's condition is evaluated once, by D-ACTIVATE (= true). An
  error there leaves it Pending and is collected in E₃.
- An instance is identified by (template, t), and is Active with
  activatedAt = t, so relative deadlines run from t. updateDutyStates
  updates instances after templates; templates are neither fulfilled
  nor violated, and Steps 6 and 8 of §7.2 report instances through
  tracked(D).
- performed takes a window (since(d), effectiveDeadline(d, Σ)). An
  instance counts only actions at or after t; other duties count actions
  from their policy's effectiveDate (EKGF#269). D-FULFILL no longer compares
  the deadline with the evaluation time. A duty without an asset matches
  any performed asset.
- Specification §4.3 and the dprod:schedule comment say the same.
- Add tests/test_schedule_bounds.py, which fails on the previous text.

Refs: EKGF#184, EKGF#274, EKGF#275, EKGF#280

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under the instance generation in this PR, an occurrence becomes an
instance only once its scheduled time has passed, and it is Active from
then on. The example's 6 February instance, recorded as Pending and
"not yet due", therefore cannot exist. It is removed, and the README
says when an occurrence becomes an instance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The overview gave each instance a "fulfilment window (dprod:deadline)".
Under this PR the window runs from the occurrence to the deadline, and
an unscheduled duty can have a deadline as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tonyseale
tonyseale force-pushed the issue/273-bounded-recurrence branch from add97d3 to 2199fae Compare October 29, 2026 16:55
rivettp
rivettp previously approved these changes Oct 29, 2026
@tonyseale

Copy link
Copy Markdown
Contributor

Contradiction: does a scheduled duty instance start Active or Pending?

The spec currently gives two answers, and they produce different deadlines. (Line numbers are formal-semantics.md at 2199fae.)

Example. A daily 06:00 delivery duty with a relative deadline:

ex:dailyDelivery a odrl:Duty ;
    odrl:action ex:deliver ;
    dprod:schedule ex:daily0600 ;   # DTSTART;TZID=Europe/London:…T060000, RRULE:FREQ=DAILY
    dprod:deadline "PT2H"^^xsd:duration .

On 4 Feb nothing is delivered, and the first evaluation that day is at 10:00. Is the 4 Feb instance violated?

Reading A — §5.5 (lines 632–641): yes.

Σ.state(instantiate(duty, t))       = Active   until updated
Σ.activatedAt(instantiate(duty, t)) = t

"An instance is Active from its first evaluation, with activatedAt = t (not the time of that evaluation)"

So activatedAt = 06:00, the deadline is 08:00, and at 10:00 the instance is Violated.

Reading B — Σ₀ (line 290) + §5.2 update rule (~line 495) + specification.md line 291: no.

Σ₀ gives every duty state = λd. Pending, and the Pending branch does Σ[state(d) ↦ Active, activatedAt(d) ↦ Σ.clock]. specification.md says each instance follows "Pending -> Active -> Fulfilled/Violated".

So the instance starts Pending, and at 10:00 it becomes Active with activatedAt = 10:00. The deadline is 12:00: not violated, and an 11:00 delivery fulfils it.

Deadline At 10:00 Delivery at 11:00
Reading A (§5.5) 08:00 Violated late
Reading B (Σ₀ + §5.2, spec.md) 12:00 open fulfils

Under reading B the deadline also moves with whenever someone first evaluates (first check at 15:00 gives a 17:00 deadline), so a provider escapes violations simply because nobody checked.

Reading A is clearly the intent. Suggested fix:

  • State in Σ₀ / §5.2 that an instance is created Active with activatedAt = t and the Pending branch does not apply to it, or give updateOneDuty an explicit instance branch.
  • Change specification.md line 291 to "Active -> Fulfilled/Violated".

jgeluk added a commit to matthiasautrata/dprod that referenced this pull request Nov 17, 2026
Resolves the conflicts with develop. EKGF#280 and EKGF#272 landed as squash
merges, so this branch's copies of their commits conflicted with them.
The resolved tree is this branch's own commits and EKGF#274's replayed on
develop:

- Shapes use the dprod-contracts-shapes: prefix that develop adopted
  (EKGF#295), including the new ActionShape and the specification's shape
  tables.
- ActionShape gains the dct:description every contracts shape carries
  since EKGF#302.

Core 93 OK, contracts 121 OK, validate.py clean (Python 3.13, as CI).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…KGF#273)

EKGF#280 and EKGF#272 landed on develop as squash merges, so this branch's
original copies of their commits conflicted with them in six files.
The branch's base (ae26a40) has exactly the tree EKGF#280 merged, so the
resolution is this PR's own three commits (0cd39d4, 4883ca3, 2199fae)
replayed on develop; all three apply without conflict.

Core 99 OK, contracts 117 OK, validate.py clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Formal semantics: recurrence is unbounded and partly undefined, and recurring duties are never instantiated

4 participants