fix(schedules): enforce resonate:target in LocalNetwork schedule.create - #9
Open
flossypurse wants to merge 1 commit into
Open
fix(schedules): enforce resonate:target in LocalNetwork schedule.create#9flossypurse wants to merge 1 commit into
flossypurse wants to merge 1 commit into
Conversation
A real server rejects a schedule.create whose promiseTags lack a resonate:target tag (400) — every fired promise needs a routing target. LocalNetwork did not run that validation, so a create the server would reject succeeded in local mode and this regression class slipped past the LocalNetwork-backed unit tests. - Network.ServerState.scheduleCreate now throws ServerError(400, "promiseTags must include a resonate:target tag") when promiseTags is absent or lacks the key, before the idempotency check — mirroring the server's validate-first order. - SchedulesTest: the two low-level create tests that passed empty tags now pass a resonate:target (they would otherwise fail against a real server); add createWithoutResonateTargetIsRejected asserting the 400. Addresses the second checklist item of #6. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 second checklist item of #6 — "
LocalNetworkenforces the server's create-time validation so tests catch this class of regression."Why
Since server v0.9.7,
schedule.createrejects a request whosepromiseTagslack aresonate:targettag with HTTP 400 (validate_schedule_create_data,resonate/src/types.rs:641-643) — every promise a schedule fires needs a routing target or no worker group receives it.LocalNetworkdid not run that validation, so a create the real server rejects succeeded in local mode. That's exactly why the originalschedule()bug (#6, fixed in #7) passed its unit tests: the in-process network never enforced the tag.Change
Network.ServerState.scheduleCreatethrowsServerError(400, "promiseTags must include a resonate:target tag")whenpromiseTagsis absent or lacks the key, before the idempotency short-circuit — mirroring the server, where request validation runs before the handler.SchedulesTest: the two low-levelcreatetests that passed empty tags now pass aresonate:target(they'd otherwise fail against a real server, which is the point); addscreateWithoutResonateTargetIsRejectedasserting the 400. The high-levelResonate.schedule()tests are unaffected — fix(schedules): inject resonate:target into schedule promise tags #7 already injects the tag.Verification
./gradlew spotlessCheck test— green.SchedulesTestnow 5 (was 4), 0 skipped; full suite passes.Scope note: this mirrors only the
resonate:targetcheck — the same validator's schedule-ID-dot rule is a separate gap and left for a focused follow-up.