The push classifier reads a name inside an expression or an object as the hook's own - #678
Merged
Merged
Conversation
The assets test's push classifier read a push whose name is an
expression carrying a literal (a fallback such as
gesture.event || "refresh") or a name held in an object literal
(const names = {select: "x"}; pushEvent(names.select)) as the host's
expression. Its stamped-name rule is per file, so a draw hook that
reads some el.dataset.*Event could push a name of its own that way and
still pass as draw-only unless it spelled a command or list event name.
push_name/2 now resolves object.key through an object literal the
file binds object to, and reads any quoted name inside the argument as
the hook's own. A new test holds four probes, two per shape, to
pushing their own name, each alone and after a stamped-name binding.
Sabotaged: dropping either new clause turns the new test red; a map
hook pushing gesture.event || "refresh" now fails the draw-only test
as well as the exact-source one. Test-only; no lib change.
Gate: full mix quality green on this staged tree (3,952 of 3,952
tests, 95.3% coverage, dialyzer clean, ADR cites green).
Refs: sb-wcsm
johnnyt
force-pushed
the
sb-wcsm-push-classifier-test
branch
from
September 30, 2026 11:12
a978dc2 to
cd90026
Compare
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
The push classifier in
test/statifier_blocks/assets_test.exs(push_names/1,push_name/2,kind/1) is what the hook-kind tests rest on. It read two shapes of push as the host's expression:gesture.event || "refresh";const names = {select: "x"}; this.pushEvent(names.select, {}).kind/1's stamped-name rule is per file (stamped_names?/1asks whether the file reads someel.dataset.*Event), so a draw hook that reads a stamped name anywhere could push a name of its own in either shape and still pass as draw-only, unless it spelled a command or list event name.push_name/2now has two more clauses, after the existing quoted and binding-held ones:keyed_name/2resolvesobject.keythrough an object literal the file bindsobjectto (any of its bindings) and answers the quoted name underkey;A name read from a stamped attribute through an object stays an expression: the existing probe
const events = {select: this.el.dataset.selectEvent}; this.pushEvent(events.select, {})is unchanged and still green, and so is the shipped map hook'sthis.pushEvent(gesture.event, gesture.payload).A new test, "a name inside an expression or an object is the hook's own", holds four probes (two fallback expressions, two object-held names, across
pushEventandpushEventToand the three quote styles) to[{:literal, "select-row"}], to pushing their own name and to not being draw-only, each alone and again after a stamped-name binding.Test-only: no
lib/or hook change, no changelog fragment (changelog.d/README.mdexcludes tests).Sabotage
Each reverted from a copy, byte-equal, and recompiled before the next:
push_name/2push_name/2keyed_name/2, same resultgesture.event || "refresh"Gate
Full
mix qualitygreen on the committed tree: 3,952 of 3,952 tests, 95.3% coverage, dialyzer clean, ADR cites green. A first run was red on one Credo readability finding (a single-clausewithinkeyed_name/2), rewritten as acase.Review
In-turn review: re-read the diff against the bead. The acceptance asks for a probe for each shape classed as pushing its own name, each sabotaged; the table maps each shape's clause to a red run. The inside-an-expression rule is deliberately broad: a quoted string anywhere in the name argument (a comparison, a bracket key) counts as the hook's own, which can only make the guard stricter; no shipped hook pushes such an argument today, per a read of every
pushEventcall underassets/js/.Refs: sb-wcsm