Repository navigation
Resolve app-scope schedules by name in configure and run now - #56
Merged
Merged
Conversation
Run now looked a schedule up only in the caller's user scope, so an app schedule was ScheduleNotFound, and configure without a scope always targeted the caller's copy. Run now now takes an optional scope query, and both routes resolve a missing scope through the SDK's new schedules.scope: the schedule saved under the name, else the app's declaration evaluated as the app schedule runs, else user. Both saved under the name fails with the new ScheduleScopeRequired. App-scope authorization is unchanged (managers only); hosted resolves only for callers who can read the app.
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.
Post-cutover backlog, item (b):
schedules.runNowhad noscope, so it returnedScheduleNotFoundfor app-scope schedules.schedules.configuredefaulted to user scope, which surprised Desk, whose schedules are app-scope.Cause
The hosted and local route handlers chose the scope themselves:
runNowalways looked up the caller's own copy.configureused user scope unlessscopewas exactly"app".Change
runNowtakes an optional?scope=app|user. It's a query parameter because existing callers send no body.configureandrunNow, via a new SDK operationschedules.scope(GET /v1/apps/:app/schedules/:name/scope):ScheduleScopeRequired(409) asking forscope. It never guesses.app; anything else falls back touser, the old behaviour.workflows.mdskill and its digest, error messages in both web apps, and a changeset.Behaviour change:
configurewithout a scope on an app-declared schedule now reaches the app schedule. A caller who doesn't manage the app gets 403 there, where they used to get 404 or an account error.Tests
New hosted scenario
hostedAppScheduleScope(self-host and Cloud):configureandrunNowwith no scope;configurewith no scope reaching the app schedule;runNowwith and withoutscope=app;scope=userreturning 404 for someone with no copy;ScheduleScopeRequiredwhen the names collide;scope=userstill working.With resolution forced back to user scope, it fails as expected.
Extended local scenario
localAppScheduleAppLinkscovers the same paths on the local server.Results: self-host 7 of 7 and local 4 of 4, including the existing hosted and local schedule scenarios. Cloud runs after merge.
bun run checkpasses.