Skip to content

fix(schedules): inject resonate:target into schedule promise tags - #7

Merged
flossypurse merged 1 commit into
mainfrom
flossy/schedule-target-tags
Jul 14, 2026
Merged

flossypurse merged 1 commit into
mainfrom
flossy/schedule-target-tags

Conversation

@flossypurse

Copy link
Copy Markdown
Contributor

Addresses the first checklist item of #6.

Since server v0.9.7 (resonatehq/resonate#1119), schedule.create rejects requests whose promiseTags lack resonate:target (HTTP 400), so Resonate.schedule() fails at creation time against a real server; before that validation, fired promises had no routing target and were never dispatched.

Changes

  • Schedules.create() gains a promiseTags overload — the wire type (ScheduleCreateReq.promiseTags) already carried the field, previously hardcoded Map.of(). The existing 5-arg overload delegates with empty tags.
  • Resonate.schedule() injects resonate:target from the resolved target: options(new Opts().withTarget(...)) when given, falling back to the network group, through the same resolveTarget path run/rpc use (buildRootPromiseCreateReq). This mirrors the TypeScript SDK's schedule().

Verification

  • Unit tests: low-level tag passthrough + high-level injection (default group and withTarget) — full suite passes (./gradlew test: SchedulesTest 4, ResonateTest 77, all green), spotlessCheck clean.
  • Against a real server (resonate dev, v0.9.8): Resonate.schedule() creates the schedule (400 before this change), the stored schedule carries resonate:target: poll://any@<group>, the cron fires, and the scheduled function executes in the polling worker — confirming the fired promise is dispatched.

Note: LocalNetwork does not enforce the server's tag validation, so unit tests alone cannot catch this bug class — tracked in the #6 checklist.

Schedules.create() hardcoded Map.of() for promiseTags, so schedule.create
was rejected by the server (HTTP 400: promiseTags must include a
resonate:target tag) and, before that validation existed, fired promises
had no routing target and were never dispatched.

Schedules.create() gains a promiseTags overload (the wire type already
carried the field), and Resonate.schedule() injects resonate:target from
the resolved target (options target, falling back to the network group)
via the same resolveTarget path run/rpc use, matching the TypeScript SDK.
@flossypurse
flossypurse merged commit 0a84641 into main Jul 14, 2026
4 checks passed
@flossypurse
flossypurse deleted the flossy/schedule-target-tags branch July 14, 2026 15:12
@flossypurse flossypurse mentioned this pull request Jul 14, 2026
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