Repository navigation
Keeps the upgrade host's step handler map - #229
Merged
Merged
Conversation
On every cancel, the upgrade host looked up an invocation's handler by authoring the loan document again and reading the palette, though the compile was already kept. The block-to-handler map is now built once per node from the document and the palette and kept beside the compile, and the lookup maps the provenance's block id through it. Every answer is the same as before. A new loan test pins that the lookup reads the kept map. No pin moves.
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.
Summary
On every cancel, the upgrade host's
UpgradeHost.Loans.handler_for_invocation/1found an invocation's handler by authoring the loan document again (the palette and every gated edit, throughLoanDocument.document/0) and reading the palette, although the compile it maps the invocation's state through was already kept per node.The block-to-handler map (a step block's id to the handler serving its invoke type) is now built once per node from the document and the palette, kept under
:persistent_termbeside the compile through the module's existingcached/2, and the lookup maps the provenance's block id through it. The build loads each palette module before asking it forinvoke_type/0, because the map is kept and a miss would be kept with it.Every answer is unchanged: a state with no owner in the provenance, a block that is not an invoke step, and an invoke type no handler serves each still answer
:error.Tests
A new loan test, "the handler lookup reads each step's handler from a map kept once per node, not from the document", pins that the map is kept after a lookup and that the lookup answers from the kept map (a swapped map changes its answer; the test restores the kept map on exit). The existing loan test's two lookups and its unknown-state
:errorstay as they were.Sabotage, both red on an assertion and restored byte-equal: the map built on every call with nothing kept (the kept-map assertion read nothing); the lookup dropping and rebuilding the map on every call (the swapped-map assertion answered the fine's real handler).
Gate
The root
mix qualityand, fromupgrade_host/, the CI job'smix deps.get --check-locked,mix compile --warnings-as-errors(test env) andmix testall green on the rebased head. The upgrade host's exact pins inupgrade_host/mix.exsand itsmix.lockdo not move.Review
The pre-request review round (a diff critic and a test critic) found nothing blocking. No record text in this change.