Repository navigation
fix(schedules): inject resonate:target into schedule promise tags - #7
Merged
Merged
Conversation
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.
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the first checklist item of #6.
Since server v0.9.7 (resonatehq/resonate#1119),
schedule.createrejects requests whosepromiseTagslackresonate:target(HTTP 400), soResonate.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 apromiseTagsoverload — the wire type (ScheduleCreateReq.promiseTags) already carried the field, previously hardcodedMap.of(). The existing 5-arg overload delegates with empty tags.Resonate.schedule()injectsresonate:targetfrom the resolved target:options(new Opts().withTarget(...))when given, falling back to the network group, through the sameresolveTargetpathrun/rpcuse (buildRootPromiseCreateReq). This mirrors the TypeScript SDK'sschedule().Verification
withTarget) — full suite passes (./gradlew test: SchedulesTest 4, ResonateTest 77, all green),spotlessCheckclean.resonate dev, v0.9.8):Resonate.schedule()creates the schedule (400 before this change), the stored schedule carriesresonate:target: poll://any@<group>, the cron fires, and the scheduled function executes in the polling worker — confirming the fired promise is dispatched.Note:
LocalNetworkdoes not enforce the server's tag validation, so unit tests alone cannot catch this bug class — tracked in the #6 checklist.