Analysis: Never call a constant an identity once the map travels - #2290
Merged
Conversation
`for` said a constant was derived and `across` said it was an identity, and `across` is the one whose answer is delivered. A client reading that map is told it can write `<%= Post.count %>` by copying a value it has never been given. A partial's incoming locals are not among the names it declares, so the names carried by the trace are treated as settable to make a partial answer in its caller's terms. Constants arrive by the same door and are not settable by anything, which is what `for` had right and `across` lost. The map already left constants out of the request names, so nothing could reach one by the name a request uses. That is what kept this from being reachable in practice, and it is not the same as the map being right.
|
View your CI Pipeline Execution ↗ for commit faea43e
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
🌿 Interactive Playground and Documentation PreviewA preview deployment has been built for this pull request. Try out the changes live in the interactive playground: 🌱 Grown from commit ✅ Preview deployment has been cleaned up. |
commit: |
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.
This pull request fixes a slot dependency map that told a client it could write a value the client has never been given.
SlotDependenciesclassifies each slot by where its next value comes from.identitymeans the slot's expression is the state itself, so a client writes it by copying what it already holds. Everything computed isderived, and only the server can answer it.A constant is a dependency and not something a page can set, so it can never be an identity.
forhad that right andacrossdid not, andacrossis the one whose answer is delivered:A partial's incoming locals are not among the names it declares, so #2281 treats the names the trace carries as settable, which is what lets a partial answer in its caller's terms. Constants arrive through the same door and are settable by nothing, so the exclusion
forapplies was lost on the way.The map already leaves constants out of the request names it publishes, so
payload["params"]is empty for a template whose only state isPost.count, and nothing resolves to it by the name a request would use. Reaching it takes callingstate.set("Post.count", …)by the state's own name, through the escape hatch meant for state whose request name could not be derived.