Commit Graph

3 Commits

Author SHA1 Message Date
Maciej Lisiewski
41387e38c5 test(execute_code): pin the lifecycle inert-check rules and state its limit
Adds one refused case per load-bearing rule (import allowlist, _ prefix,
with-item, with-body order) and a RecursionError parser case; the docstring
now says deliberately obfuscated cells get through, and the refusal lists
the straight-line and import rules.

Refs #146582

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-14 16:09:37 +01:00
Maciej Lisiewski
0cfe46f0a7 fix(execute_code): judge only straight-line top-level cells as data-only
The binding check was scope-blind: a name bound only as a parameter, a
comprehension target, a local, a class attribute or under a branch/loop
counted as bound for a module-level read, which can still reach a helper
left by an earlier kernel cell. Now only straight-line top-level statements
qualify (no nested scopes, branches, loops, try or walrus), names count only
once an earlier statement bound them, frame/generator introspection and
typing.get_type_hints are refused, and parser exhaustion keeps the normal scan.

Refs #146582
2026-11-14 16:09:36 +01:00
Maciej Lisiewski
8d0513202d fix(execute_code): let documentation-only cells mention lifecycle commands
A cell that only prints or writes text quoting a gateway lifecycle command was
refused with no hint of what matched. Allow a cell whose parsed code provably
cannot start or signal a process (pure-module imports only, no process-like
attributes, every name a builtin or bound in the cell); every other cell is
scanned exactly as before. The refusal now names the matched text.

Fixes #146582
2026-11-14 16:09:36 +01:00