You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Severity: medium (reactive correctness — handler can fail to re-fire)
A bare name on the right-hand side of a when/unless condition is not added to the handler's watched set, so the handler does not re-evaluate when that variable changes. A field-access RHS (<field> of <record>) is watched.
Reproducer
remember a number called reading with 0
remember a number called limit with 50
when reading is above limit
show "over"
finish
Listening for changes to: reading # `limit` is NOT watched
Contrast with a field-access RHS:
when reading is above limit of cfg
Listening for changes to: reading, cfg # the record IS watched
Root cause
_parse_value produces a BareWord for a bare RHS name (the "might be a name, might be a string" ambiguity). interpreter._walk_dependencies treats BareWord (like all literals) as contributing no dependency, so the name never enters the watched set. Only NameRef and FieldAccessNode operands are walked.
Consequence
If another handler (or cascade) changes limit, a when reading is above limit handler will not re-evaluate against the new threshold — it only reacts to changes in reading. The condition silently uses a stale threshold.
Possible fixes: (a) in a when/condition context, resolve a bare RHS name that exists in the symbol table to a NameRef (so it's watched), or (b) have _walk_dependencies also treat a BareWord whose word is a known symbol as a dependency. Either needs care around the bare-word-as-string-literal case.
Severity: medium (reactive correctness — handler can fail to re-fire)
A bare name on the right-hand side of a
when/unlesscondition is not added to the handler's watched set, so the handler does not re-evaluate when that variable changes. A field-access RHS (<field> of <record>) is watched.Reproducer
Contrast with a field-access RHS:
Root cause
_parse_valueproduces aBareWordfor a bare RHS name (the "might be a name, might be a string" ambiguity).interpreter._walk_dependenciestreatsBareWord(like all literals) as contributing no dependency, so the name never enters the watched set. OnlyNameRefandFieldAccessNodeoperands are walked.Consequence
If another handler (or cascade) changes
limit, awhen reading is above limithandler will not re-evaluate against the new threshold — it only reacts to changes inreading. The condition silently uses a stale threshold.Notes
above/below/equal_to/within/…), not specific to any one. Surfaced while implementingwithinis counted as a base reserved word but has no base-language behavior #19 (within), wherewithin N of <name>showed the same: only the field was watched.when/condition context, resolve a bare RHS name that exists in the symbol table to aNameRef(so it's watched), or (b) have_walk_dependenciesalso treat aBareWordwhose word is a known symbol as a dependency. Either needs care around the bare-word-as-string-literal case.