Skip to content

docs(plan): Mecatl Studio schedules acceptance plan - #1757

Merged
samuv merged 1 commit into
studio/chatfrom
plan/studio-schedules
Sep 23, 2026
Merged

samuv merged 1 commit into
studio/chatfrom
plan/studio-schedules

Conversation

@samuv

@samuv samuv commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds docs/acceptance/studio-schedules.md (Bounded): the capability-gated schedule inventory, create/update mapping onto the SDK spec with the unexposed fields preserved, lifecycle actions and fire history, and the browser cron builder and phrase parser.

Review focus

  • Live capability gating: the list never fails on an unsupported deployment; mutations answer 501 schedule_unsupported.
  • Update semantics: the request's fields are re-sent and the daemon's unexposed spec fields (carryContext, fireTimeout, limits, misfire, parts, selector, singleton) are carried over untouched.

Checker: check-acceptance-plan.sh passes; task docs passes. Stacked delivery: nothing in this series merges until the whole stack is reviewed; the plan's approval-by-merge event is deferred to the end, as its Delivery line records.

Amended after review

Three findings against the first draft of this contract:

  • One-shot times could not round-trip through datetime-local across a daylight-saving transition. That control carries no offset, so both occurrences of an ambiguous local time serialize identically and saving an edited form could move a one-shot by an hour. Reproduced: an instant of 2026-10-25T01:30Z renders 02:30 in Europe/Rome and re-parses as 00:30Z. The contract now makes the ISO instant with its offset the only representation that crosses the API, keeps the schedule's original instant and re-sends it unchanged while the displayed wall clock is unedited, and fixes the resolution rule for an edited one: the earlier occurrence when a local time happens twice, the first valid instant after the gap when it does not exist, with the resolved absolute time shown beside the field. AC4.5 and AC4.6 name the proofs, including the ambiguity test.
  • A finished schedule was labelled scheduled. The status enum gains completed, derived when the daemon reports no next fire after at least one fire, which covers both a fired one-shot and a cron that reached maxFires. AC3.5 covers both, and asserts a never-fired schedule with no next fire stays scheduled.
  • Numeric validation allowed values the SDK's int32 fields cannot hold. maxFires and oneShotMaxRetries are now bounded to 0..2147483647 and reject non-safe integers before any SDK call. AC2.5 names the proof.

The risks section records the review origin.

Contract amendments

  • Immutable trigger. An update's trigger is compared with the stored one and refused with 409 schedule_trigger_immutable when it differs, because the daemon keeps the stored next fire on update. The form locks the trigger of an existing schedule (AC2.6).
  • Timezone and one-shot time. A cron timezone the daemon could not load is 400 invalid_schedule, since the daemon would silently run it in UTC. An empty timezone is labelled UTC. A one-shot at may carry a numeric offset (AC2.7).
  • Status. Status derivation checks completed before paused, because the daemon disables a schedule in the same write that finishes it. Run now is offered only for scheduled and claimed schedules, and Pause and Resume never for a completed one (AC3.5, AC3.6).
  • Form. Saving an unchanged form sends exactly the stored mode and write flag (AC4.7).
  • Trigger lock. AC4.6 now names the create form explicitly. The new AC4.8 locks every trigger control of an existing schedule and makes the trigger shown the trigger sent.

Development stage

  • Plan / Interface
  • Implementation
  • Combined
  • Spike / Routine / Cleanup

Contract linkage

  • Work classification: Bounded
  • Classification rationale: adds the schedules product surface (/api/v1/schedules…) inside the boundary ADR 0351 fixed
  • Decision record: None — the boundary and the published-SDK rule are ADR 0351's; this plan only fills in a feature contract that ADR anticipated
  • Human waiver of spine: Yes — the directing human chose stacked (gh stack) delivery for the whole Studio series: nothing merges until every layer is reviewed, so the plan's approval-by-merge event is deferred to the end (recorded in each plan's Delivery line), and each implementation layer records the exact plan commit it built against.
  • Acceptance plan: docs/acceptance/studio-schedules.md
  • Human decisions resolved and recorded: Yes
  • Plan / Interface PR: this PR
  • Approved commit baseline: absent until the stack root merges (stacking exception above)
  • Combined/exemption rationale: N/A

Interface conformance

  • Interface contract under review: Six /api/v1/schedules… routes, live capability gating (supported: false list, 501 schedule_unsupported mutations), the trigger/mode/profile mapping, and the update rule that carries unexposed spec fields over untouched. No gRPC, Go, CLI, or tool-schema change.

Issue relationship

Relates to #1748 (parent #1736; stack #1766). Non-closing: the step completes when both of its layers merge.

Type of change

  • Behavioral/interface plan
  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation/process

Test plan

Baseline checks

  • Acceptance-plan checker
  • Linting (task lint)
  • Offline test suite (task test)
  • Offline demo (go run ./cmd/mecademo)
  • Markdown changed: docs generation/link checks (task docs)

Plan layer: the acceptance-plan checker and task docs pass. The Studio gates (task studio:check, task ac-trace) run on the implementation layer above, since this layer adds no apps/ code.

User-facing change

None — a plan document and, for the bootstrap, ADR 0351.

Special notes for reviewers

Part of a fourteen-layer stack; review bottom-up. Nothing merges until the whole series is reviewed.

@samuv
samuv added this pull request to stack #1766 September 22, 2026 08:01
@samuv samuv self-assigned this Sep 22, 2026
@samuv
samuv force-pushed the plan/studio-schedules branch from fc03cb9 to cb7d03e Compare September 22, 2026 09:03
@samuv
samuv force-pushed the plan/studio-schedules branch 2 times, most recently from 098afa0 to df793de Compare September 22, 2026 09:22
@samuv

samuv commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

Review findings addressed: DST round-trip, terminal status, int32 bounds

All three confirmed and fixed in this plan, with the implementation in #1758.

P1, one-shot times across a daylight-saving transition. Reproduced before fixing: an instant of 2026-10-25T01:30Z renders as 02:30 in Europe/Rome and re-parses to 2026-10-25T00:30Z, an hour earlier. So editing any unrelated field on such a schedule moved its fire.

The contract now makes the ISO instant with its offset the only one-shot representation that crosses the API, and the browser resolves the ambiguity rather than passing it on:

  • While the displayed wall clock still renders the schedule's original instant, that original is re-sent unchanged. This is what removes the hazard, because a wall clock alone cannot say which occurrence it meant.
  • Once edited, the wall clock resolves with a fixed rule: the earlier occurrence when a local time happens twice at a fall-back transition, and the first valid instant after the gap when it does not exist at a spring-forward transition. The form shows the resolved absolute time with its offset beside the field, so the saved instant is always the one displayed.

AC4.5 and AC4.6 name the proofs, including the ambiguity test you asked for. They are pinned in a fixed zone and pass under UTC, America/New_York, and Asia/Tokyo as well as the authoring zone.

P2, completed schedules represented as scheduled. The status enum gains completed, derived when the daemon reports no next fire after at least one fire. That covers a fired one-shot and a cron that reached maxFires. AC3.5 covers both and also asserts that a never-fired schedule with no next fire stays scheduled, so the new state cannot swallow the ordinary case.

P2, numeric validation beyond int32. maxFires and oneShotMaxRetries are bounded to 0..2147483647 and reject non-safe integers before any SDK call, so nothing reaches a signed 32-bit daemon field that cannot represent it. AC2.5 names the proof, which also covers fractional, negative, NaN, and infinite values.

The plan's risks section records that these three answer review findings.

@samuv
samuv force-pushed the plan/studio-schedules branch from df793de to 708e16d Compare September 22, 2026 09:59
@samuv

samuv commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up addressed: AC4.3 promised a round-trip the rule forbids

Correct, and the contradiction was mine: AC4.3 claimed a one-shot instant "survives an edit round-trip ... including across a daylight-saving transition" while the interface contract and AC4.6 canonicalise an edited ambiguous wall clock to the earlier occurrence. A schedule stored at the later occurrence does move once its wall clock is edited or reconfirmed. That is the intended rule, and it is not a round-trip.

  • AC4.3 keeps only the parser claims and now states plainly that it makes no claim about preserving an edited instant, pointing at AC4.5 for the unedited form and AC4.6 for the edited one.
  • AC4.6 now says editing or reconfirming a wall clock canonicalises it and does not restore the previous instant, naming the consequence explicitly: a schedule stored at the later occurrence moves to the earlier one, visible in the resolved absolute time the form shows before saving.
  • The interface contract carries the same correction, including that only an unedited form preserves the original instant.
  • A new proof, canonicalises an edited later-occurrence instant to the earlier one, asserts it directly: unedited preserves, the same wall clock re-resolved canonicalises, and editing away and back lands on the canonical instant rather than the original. It runs in a fixed zone and passes under UTC, Europe/Rome, and Asia/Tokyo.

@samuv
samuv force-pushed the plan/studio-schedules branch from 708e16d to a8d90c5 Compare September 23, 2026 08:56
@samuv
samuv force-pushed the plan/studio-schedules branch from a8d90c5 to 5ae1def Compare September 23, 2026 09:40
@samuv
samuv force-pushed the plan/studio-schedules branch from 5ae1def to ca461d9 Compare September 23, 2026 10:47
@samuv
samuv force-pushed the plan/studio-schedules branch from ca461d9 to d3300a6 Compare September 23, 2026 11:54
Bounded plan for the second Studio feature layer: the capability-gated
schedule inventory, create/update mapping onto the SDK spec with the
unexposed fields preserved, lifecycle actions and fire history, and the
browser cron builder and phrase parser with their ported tests as proofs.

Tracking: #1736

Signed-off-by: Samuele Verzi <[email protected]>
@samuv
samuv force-pushed the plan/studio-schedules branch from d3300a6 to b2a8bea Compare September 23, 2026 12:54
@samuv
samuv merged commit 2f0af43 into main Sep 23, 2026
31 checks passed
@samuv
samuv deleted the plan/studio-schedules branch September 23, 2026 13:15
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.

1 participant