Repository navigation
Asks the access module before an editor resume - #282
Merged
Merged
Conversation
The editor resumes a stored execution named by its execution parameter, and a Journey's execution records the scope it runs under. The page now reads that scope and asks the access module with the session's actor before it resumes; an actor outside the scope is answered what an unknown id is answered. The host's start keeps its kind check alone, and its moduledoc says why: the callback is handed no actor, and the caller asks the access module before it starts. The visitor plug's moduledoc says a prod build names no librarian. Refs: se-4n35
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.
What changes
StatifierExamplesWeb.EditorLive'sresumed_in_reach/2reads the scope the execution records (StatifierExamples.Charts.Durable.scope/1) and asksRiddler.Journey.Access.check/4withStatifierExamplesWeb.JourneyAccess, the session's actor and:presentbefore the resume. An actor outside the scope, or a scope the record holds in a shapeRiddler.Journey.Scope.from_data/1does not read, is answered:execution_not_found, the answer an id nobody stored gets. An execution that records no scope (every one the editor's own Run starts) resumes as before. The moduledoc's new section "Whose execution the page opens" says so.StatifierExamplesWeb.JourneyHost.start/2keeps its kind check alone, and its moduledoc ("The scope") now says why it need not refuse a scope its caller could not hold. TheRiddler.Journey.Hoststart/2callback is handed a Path and a scope and no actor, so the host cannot read who is asking; riddler's Host moduledoc ("What a renderer asks, and when") putscheck/4with:presentand the start scope on the caller, beforestart/2. Both of this app's starts do:StatifierExamplesWeb.SettingsLive's start andStatifierExamplesWeb.SignupJourneyLive's start each take the scope fromJourneyAccess.start_scope/2and askcheck/4first. Refusing insidestart/2would need an actor the callback does not carry, which means a mechanism riddler does not name.StatifierExamplesWeb.Visitor's moduledoc names the prod case. The prod configuration names nolibrarian_of:, so a prod build makes no session a librarian, and a start of the branch onboarding or of a setup draws the one refusal for everyone.riddler's behaviour was read at 0.9.0, the version
mix.lockresolves.What the resume does today, by execution
Probed on the test database before the change was written:
Durable.resume/1answers:chart_unknown, since these charts are not ones the editor resumes. Before this change an outsider was answered:chart_unknowntoo, which an id nobody stored is not; now the outsider is answered:execution_not_foundand a member still meets:chart_unknown.Answers that change
No public function's name or arity changes. One existing answer changes on the editor page: a resume of an execution that records a scope the session's actor does not hold now shows
execution refused: :execution_not_foundwhere it showed the resume's own refusal. No existing test's expectation changes.Tests
Two new tests in
editor_live_test.exs, "picking a durable run back up"::execution_not_foundto another visitor and to a fresh session, and:chart_unknownto its own visitor.Sabotage, each run and reverted from a copy:
check/4's refusal turned into:okinresumed_in_reach/2: the first test went red on its assertion.Gate
mix qualitygreen (format, compile with warnings as errors, credo, dependencies, dialyzer, tests with coverage). The commit's staged tree is byte-identical to the tree that run went green on, with the repo's gate lock and one machine slot held across both, so the commit was made without a second run.Review
Gate tier: the diff touches no released package's contract and is under the size threshold, so it took the in-turn pre-request review round: a diff review found nothing blocking. Its advisories were left as they are: the check refuses nothing the resume would accept today, since the library Paths' charts are not ones the editor resumes (the moduledoc says so); an unreadable stored scope is answered as not found with no log line; and the member's
:chart_unknownassertion will move if the editor learns those charts, which its comment says.