Repository navigation
Catch a runtime helper leaving the widget API boundary at the commit that moves it - #59
Conversation
|
Main landed the same re-pointing while this sat open, so what is left here is the part nobody else wrote. Run 33016679240 (8a08f53) took the eleven The branch is four commits behind and would revert What survives the rebase is the reason to keep it.
|
|
The later run I was dispatched for, 33015951139 on 53daf2a, is the same fourteen — the eleven The probe module list is itself a spelled path. A name leaving the surface reads as green. The specifier check answers where a probe imports from, not whether the surface still exports what it names. fb5649e ("Make widget API entry exports explicit") turned that export list into a hand-maintained one, so a commit that shortens it puts the probes back into The half that catches it, and the bug-backsRead each module's string literals rather than its text, so its own def _probe_js(module):
return "\n".join(
node.value
for node in ast.walk(ast.parse(module.read_text()))
if isinstance(node, ast.Constant) and isinstance(node.value, str)
)Then, per probe module, against named = {
*re.findall(r"\bleaf\.([A-Za-z_$][\w$]*)", js),
*(
member.strip()
for block in re.findall(
r"const\s*\{([^{}\n]*)\}\s*=\s*"
r"await import\(\s*['\"]/runtime/widget-api\.js",
js,
)
for member in block.split(",")
if member.strip()
),
}
assert named, f"{module} holds probes and names nothing on the module"
assert named <= exported, (
f"{module} probes call {sorted(named - exported)}, which "
"runtime/widget-api.js does not export"
)
On main it collects twelve distinct names — Bug-backs, each reverted after. The first three on a tree at fb5649e carrying the same repointing this branch makes, the fourth on main at 0736905:
I also ran the repointing independently at fb5649e before finding this branch: |
leaf-agent
left a comment
There was a problem hiding this comment.
Self-authored, so COMMENT rather than an approval. The two comments above already carry the findings I'd otherwise raise — the hand-spelled probes list, and the export surface being unchecked by a specifier reading — so this adds one correction and the merged-tree evidence, and leaves those standing.
The rebase this branch is said to want isn't needed. The first comment reads the branch being four commits behind as a revert risk — that merging it as it stands would take leaf.js, updates.js, widget-api.js, projection/data.js and widget-elements.js back to their pre-a5e062d shape. It wouldn't. The merge base is fb5649e, main changed those files in a5e062d, and this branch didn't touch them at all, so a three-way merge keeps main's side. I ran it against main at dbc0065: clean ort merge, three files, no conflict.
plugins/leaf/skills/leaf/scripts/leaf/render_checks.py | 10 ++++
tests/interact_support.py | 5 ++
tests/test_interact_layer.py | 60 +++++++++++++++++++---
The identical re-pointing on both sides merges as one change rather than fighting, which is why render_checks.py reduces to the comment block. That is also the whole reviewable content of the merge — the branch is readable as a change today, and rebasing would only relabel the same result.
What the merge is worth, measured on the merge rather than on the branch. Both boundary tests pass there. Appending import "/leaf.js"; to assets/widgets/lf-suggestion.js fails test_behavior_modules_use_the_widget_api_boundary — that file is the kernel's one module and it is the half main's globs never reach, so the same plant on main today is green. pytest tests on the merged tree: 587 passed, 6 skipped (the one error is this runner having no Playwright browser). I also confirmed against main at dbc0065 that all ten probe specifiers are already /runtime/widget-api.js and that every JS name the probes reach through them still resolves on widget-api.js's export block, so the merge introduces no unresolved name.
The title and Problem section now describe main, not this PR. "Read the render gate's helpers from the widget API, not from the entry module" is what a5e062d did; what merging this does is add the test that would have caught it and open the thirteen unread modules. Worth restating before it lands, so the commit message doesn't claim the change it followed.
lint is green. The nightly test job was still running when I posted — I polled it to the cap without it settling — so the browser half is unverified here; the file-side suite above is what I can vouch for.
28aa1f9 to
844ea2a
Compare
|
Rebased onto main at 268e925 and pushed as 844ea2a, so the branch no longer carries the re-pointing a5e062d landed and reverts nothing. What is left is the guard, the Both findings from the comments above are in, carried by 28aa1f9 through the rebase: the probe modules are discovered by globbing
|
|
One What the one Locally on the rebased head: |
leaf-agent
left a comment
There was a problem hiding this comment.
Self-authored, so COMMENT rather than an approval. The rebase landed, the branch reverts nothing, and the title and description now describe this PR rather than the failure it followed — the prior review's two points are closed. One new finding on the force-pushed head, a spelling the new constant leaves behind, and a correction to the comment above.
string_source reads prose as JavaScript, and this PR just wrote the sentence that trips it. Reading string constants rather than file text is the right call, and it does what the docstring says for # comments and import statements. A docstring is a string constant too, though, so it joins the JavaScript — and the namespace half then scans that joined text for \bleaf\.(name) across the whole module. /leaf.js written as prose reads as a probe calling leaf.js. Planted on the merged tree as a module-level docstring in render_checks.py:
AssertionError: render-gate probes use names widget-api.js does not export: ['js']
render_checks.py now carries exactly that sentence — "a probe spelling /leaf.js asserts that composition on every page it reads" — as a # comment, so it is out of the reading today. The same words moved into a docstring, or a line about the boot tag added to rendering.py's, turn ci red on main with a finding about an export list nobody touched, naming the wrong file. Nothing here gates a change before it is on main, so that is the first signal rather than the second.
The discriminator is already in the tree: a payload is assigned or passed, and a bare string statement is prose. The inline suggestion filters on that, and the reading does not narrow — same ten specifiers, same twelve names, ruff format and ruff check clean on the merged tree at 5e61cdb.
Bug-backs against the suggested reading
quoteddropped fromwidget-api.js's export block —render-gate probes use names widget-api.js does not export: ['quoted'].{ shownBand }put back to/leaf.js—render-gate probes import past the widget API boundary: {'render_checks.py': ['/leaf.js'], 'rendering.py': []}.- The prose plant above — green, which is the point: it was never a probe.
One spelling left behind. test_the_skill_routes_every_reference_it_ships still opens with root = PLUGIN_ROOT / "skills" / "leaf", in the same file that now imports SKILL_ROOT — the hand-spelling the new constant's comment argues against, four hundred lines above the first use of the thing that replaces it. Outside the diff, so no suggestion; it is a one-line change to make beside the other.
Correcting the comment above: the empty commit did start ci. It says "the empty ae3db4b did not start one either", but run 33020744034 registered on pull_request at 22:46:18Z, about four minutes after that comment posted — lint is green and test was still in progress when I posted. So the workflow_dispatch trigger it suggested is not needed for this head; the workstation push already answered it. What is left standing is the narrower fact: of the two pushes to this branch, ci ran on the maintainer's and not on the bot's.
That is also why I am not pushing the fix above and am leaving it as a suggestion. A commit from here would supersede the run that empty commit was pushed to raise, and on the evidence would not raise a replacement; applying the suggestion from the UI keeps the head checkable.
leaf-agent
left a comment
There was a problem hiding this comment.
Self-authored, so COMMENT rather than an approval. The prose finding from the last review is closed — I re-ran the three bug-backs against 1003d39 and the reading holds. Two new things on the merged tree, both in the test this PR adds.
assert found is the heap assertion this PR was written to remove. The sibling docstring one function above says it in as many words: "The heap was non-empty — the corpus supplies six modules — so assert modules held while the thirteen shipped ones went unread, which is the shape a population assertion is written to catch", and that is why roots now answers per root. Then the new test asserts found — one dict across every module under scripts/leaf/ — so if string_source stops seeing rendering.py's two probes, render_checks.py keeps found non-empty and the loss is green. tests/CLAUDE.md names this under Put each assertion at the boundary that owns it: "A reading blind to one mechanism does not report that it is blind — it returns the same clean result it returns when nothing is wrong." The discovered population can't be spelled as a list without reintroducing what this removed, but it can be cross-checked: on the merged tree the AST reading and a plain text scan of the same file find exactly the same specifiers, 8 in render_checks.py and 2 in rendering.py, so asking that every module whose file text holds an absolute import('/…') also appears in found is exact today and reports a module the string reading later loses.
exported only reads re-export blocks, so a locally defined export reads as missing. export\s*\{([^}]*)\}\s*from\s*["'] requires the from, and every block in widget-api.js has one today — the file is a pure barrel and its header says the reexports are "temporary until those implementations move to their owners", which keeps it one. But a helper that gets defined there rather than reexported, or a plain export { foo };, drops out of exported while the probes still call it, and the test then reports render-gate probes use names widget-api.js does not export: ['foo'] about a name the boundary does export. I appended export function newHelper() {} to the file and confirmed the reading does not see it. A false red rather than a false green, so it is the cheaper direction to be wrong in — worth a line either way, since the message names the wrong side.
One inline suggestion below on string_source, which is a simplification rather than a finding.
What I ran on the merged tree (ff724b5, base 04be895)
The three bug-backs against 1003d39, each reverted after:
- The prose plant — this file's own
/leaf.jssentence added as a module docstring inrender_checks.py: green, which is the point of the commit. - A real specifier moved back —
const { shownBox, shownParts } = await import('/leaf.js'):render-gate probes import past the widget API boundary: {'render_checks.py': ['/leaf.js'], 'rendering.py': []}. quoteddeleted fromwidget-api.js's export block:render-gate probes use names widget-api.js does not export: ['quoted'].
tests/test_interact_layer.py -k "widget_api_boundary or routes_every_reference" is 3 passed. My first specifier plant hit line 15's # comment instead of a probe and stayed green — correctly, since a comment is not a payload — which is worth recording as the shape a bug-back can fool itself with here.
On the inline suggestion: AST nodes hash by identity, so a set of the nodes themselves does what the id() set does without resting on tree staying bound for the duration — id() is only unique among live objects. I diffed the two readings over render_checks.py and they produce byte-identical output (60848 chars). The two edits have to land together: applying only the prose half leaves id(node) not in prose never matching, which puts prose back into the reading and stays green today, so the suggestion covers both lines in one range.
ci on this head (run 33021340335, raised by the pull_request event this time) has lint green and test still in progress as I post; the browser half is unverified here.
leaf-agent
left a comment
There was a problem hiding this comment.
Self-authored, so COMMENT rather than an approval. Both findings from the last review are closed on this head — exported now reads declarations as well as re-export blocks, and the id() → node-set edit produces the same reading. One new finding, in the cross-check the population point asked for.
The cross-check reads the file text, which is the thing string_source exists to keep out. raw_modules scans module.read_text(), so any Python comment or docstring under scripts/leaf/ that spells a full import('/…') lands that module in raw_modules and never in found — and the assertion then names it as a browser probe module that disappeared from the string reading. Prepending one line to checking.py on the merged tree:
# probes reach the page via import('/runtime/widget-api.js'), not the entry moduleAssertionError: browser probe modules disappeared from the string reading: ['checking.py']
The same sentence written as that module's docstring gives the identical failure. checking.py holds no probe and nothing about the render gate moved; this is the prose-as-JavaScript shape 1003d39 closed one commit earlier, arriving back through the door beside it. string_source's own docstring is the statement it contradicts — "Python strings are the JavaScript sent to the browser; Python imports, comments and prose beside them are not" — and nothing here gates a change before it is on main, so a red like that is the first signal rather than the second.
The guard is worth keeping. But the reading it checks can lose a module exactly one way — the prose filter dropping a Constant that is a payload — and a bare string statement is dead code in Python, so that is the one respect the two readings should differ in. The suggestion below walks the same string constants with the prose filter dropped: Python comments fall out of both readings, while a future narrowing of string_source still names the module it lost. Narrowing string_source to plain assignments reports rendering.py under it, which is the loss the cross-check was written for.
It is a narrowing rather than a cure — a docstring that spells a whole import('/…') still trips it, because that string is a constant. That case is the same tension the prose filter already owns and it takes a deliberate sentence to write; a # comment does not.
What I ran on the merged tree (main at 999f933 + baf6205, merges clean)
Bug-backs, each reverted after. "as written" is this head; "suggested" is the reading below.
| plant | as written | suggested |
|---|---|---|
| unmodified tree | green | green |
# comment naming import('/runtime/widget-api.js') in checking.py |
red on ['checking.py'] |
green |
the same sentence as checking.py's module docstring |
red on ['checking.py'] |
red on ['checking.py'] |
string_source narrowed to plain-assignment constants |
— | red on ['rendering.py'] |
quoted dropped from widget-api.js's export block |
red on ['quoted'] |
unchanged |
uv run pytest tests on the merged tree: 592 passed, 6 skipped, plus one error from this runner having no Playwright browser. ruff format --check and ruff check clean with the suggestion applied.
One more thing the increment changed, not reachable while prettier runs: exported's block pattern now ends in \s*;, so an export block written without its semicolon drops out whole. Removing the semicolon after } from "../leaf.js" reports ten names the boundary does export. Prettier is a pre-commit hook and adds it back, so this is a note rather than a finding — the ; is doing no work the optional from group needs.
ci on this head has lint queued and test in progress as I post, so the browser half is unverified here.
leaf-agent
left a comment
There was a problem hiding this comment.
Self-authored, so COMMENT rather than an approval. The population cross-check from the last review is in and the reading it guards still reports a loss — I re-ran the bug-backs on the merged tree. One new finding, in the other half of the same test.
/leaf.js inside a payload string reads as a call to leaf.js. This is the prose-as-JavaScript shape 1003d39 closed, arriving through the namespace door instead — and the prose filter cannot close this one, because a payload string is exactly what the reading is supposed to include. The alias walk scans the module's whole joined payload source for alias.<name>, and both probe modules bind the namespace as leaf (import('/runtime/widget-api.js').then(leaf => in render_checks.py and twice in rendering.py), so any payload string in one of them that spells /leaf.js contributes js to used. checking.py already carries exactly that string twice today — `be exactly <script type="module" src="/leaf.js">, found attributes` — and it stays out only because that module holds no dynamic import and so is never scanned. Move the boot-tag check next to a probe, or give checking.py a probe, and ci goes red on main naming an export list nobody touched:
AssertionError: render-gate probes use names widget-api.js does not export: ['js']
The narrowing is in the suggestion below: a namespace read is never preceded by a path separator, so the lookbehind takes the filename out while leaving every real read. Nothing here gates a change before it is on main, so that red is the first signal rather than the second.
One thing the test doesn't reach, as a note rather than a finding. The population is scripts/leaf/*.py, so it answers for the gate's ten probes. The browser suite writes about thirty of its own against the same boundary, and ten names are reached from there and nowhere else — ARRANGEMENTS, actionSequence, alignText, keys, sendAction, tabStore, toast, updateSequence, watchData, wrote. A helper leaving the boundary that only those probes call is still green here and red one nightly later, which is the interval this PR exists to remove. Not a drop-in over tests/ though: test_render_startup.py imports /leaf.js on purpose, one line after the widget-api import, because loading the entry module is what that test is about.
What I ran on the merged tree (main at 999f933 + d7e49f8)
Bug-backs, each reverted after. "as written" is this head; "suggested" is the lookbehind below.
| plant | as written | suggested |
|---|---|---|
| unmodified tree | green | green |
BOOT_TAG = '<script type="module" src="/leaf.js">' as a module constant in render_checks.py |
red on ['js'] |
green |
quoted dropped from widget-api.js's export block |
red on ['quoted'] |
red on ['quoted'] |
# comment naming import('/runtime/widget-api.js') in checking.py |
green | — |
string_source narrowed to plain-assignment constants |
red on ['rendering.py'] |
— |
The last two are the increment's own subject: the comment plant is what d7e49f8 closes, and the narrowing is the loss the cross-check is written for, still reported. The suggested reading collects the same twelve names as this head, byte-identical.
The landed cross-check joins the constants and searches once rather than searching each constant, which is a wider reading than the suggestion I left — a fragment split across two literals is matched by both string_source and it, so the two differ only in the prose filter, which is what the comment claims. Resolved that thread.
uv run pytest tests on the merged tree: 592 passed, 6 skipped, plus one error from this runner having no Playwright browser. ci on this head has lint green and test in progress as I post, so the browser half is unverified here.
leaf-agent
left a comment
There was a problem hiding this comment.
Self-authored, so COMMENT rather than an approval. The namespace finding from the last review is closed on this head — the lookbehind is in and I re-ran the bug-backs on the merged tree. No new finding; one note on what the narrowing deliberately leaves.
The residual is a false red only, which is the right side to be wrong on. (?<![\w$./]) takes the path-separator spelling out, so /leaf.js in a payload string no longer contributes js. A bare leaf.js — no leading slash — still does: planting BOOT_TAG = '<script type="module" src="leaf.js">' in render_checks.py gives render-gate probes use names widget-api.js does not export: ['js']. That spelling exists in the tree today, in schema.py's VENDORED_FILES = ("leaf.js", …) and layer.py's top_files["leaf.js"], and both stay out only because neither module holds a probe.
Closing it by adding " and ' to the lookbehind class would cost more than it saves. On the merged tree it collects the identical twelve names — no payload constant in either probe module begins with leaf. — but a fragment that did would then be dropped, and a helper leaving the boundary that only such a fragment calls reads as green. That is the failure this test exists to remove; a filename read as a call is a red naming the wrong file. Worth leaving as written, and worth the line here so the next narrowing doesn't trade the directions.
Bug-backs on the merged tree (main at 5db3e8f + b9680b9)
Each reverted after. "before" is d7e49f8, the head the last review read; "after" is e84ec77.
| plant | before | after |
|---|---|---|
| unmodified tree | green | green |
BOOT_TAG = '<script type="module" src="/leaf.js">' in render_checks.py |
red on ['js'] |
green |
the same with src="leaf.js" |
red on ['js'] |
red on ['js'] |
quoted dropped from widget-api.js's export block |
red on ['quoted'] |
red on ['quoted'] |
uv run pytest tests on the merged tree: 605 passed, 6 skipped, plus the one error from this runner having no Playwright browser. ci on this head is registered and queued as I post — the workstation push raised it — so the browser half is unverified here.
|
Two current-head issues block merging this as the claimed architecture guard. First, the partial JavaScript parsing can stay green for valid syntax changes: spelling a real probe import with a template literal, import( |
9fb8fae to
3f98a2a
Compare
|
Both blockers addressed, and the branch is rebuilt on main at 6e655de as a single commit (3f98a2a). The partial parsing. Both of your cases were real, and I ran them against the previous head before changing anything: I took the first branch you offered — make the guard robust — but the durable part is not that it now knows two more spellings. It is that the reading is total: every The unrelated commit. Dropped. The rebuild is main at 6e655de plus one commit; 2355d66 ("Keep the full column at the combined strip floor") is no longer on any branch — still reachable at its SHA, and #65 holds the problem it was addressing. The merge commits are gone with it, so the diff is three files: the two tests, one constant in The counts. Corrected in the body: 1 kernel module ( Bug-backs, each reverted afterAgainst this head unless the last column says otherwise.
The "previous revision" column is the test file as it stood at 9fb8fae, run against the same planted tree. The new
One thing I can't clear from here: the force-push was made with this run's |
|
The new head fixes the template-literal and parenthesized-callback cases, drops the #65 overlap, and refreshes the body, but the claimed totality still has a false-green path at the Python/JavaScript boundary. For example, with LEFT = "im" and PROBE = LEFT + "port("/leaf.js")", Python constructs and executes import("/leaf.js"), while both probe_javascript and the raw_modules control newline-join the same AST constants into im\nport(...). probe_imports then returns no specifier and no unread site, so the guard can pass. Bracket member calls such as leaf"quoted" likewise contribute no API name, and boundary_exports can count export-looking text in JavaScript comments. At roughly 278 lines, continuing to grow a cross-language partial parser is not a reasonable architecture guard. Please narrow the guarantee and rely on the browser coverage, or evaluate/extract the probe JavaScript and use a real JavaScript parser. The SKILL_ROOT population fix remains sound; exact head 3f98a2a is HOLD. |
max-sixty
left a comment
There was a problem hiding this comment.
The import/binding reading is total now, but the namespace-use reading is not. Once a site binds leaf, probe_imports only collects leaf.<identifier> and never records an unsupported use. Valid leaf["quoted"], leaf?.quoted, or const { quoted } = leaf therefore returns unread == [] and omits quoted from names; if that helper is unique to the probe, removing its widget-api export remains green. A minimal bug-back is probe_imports("import(\"/runtime/widget-api.js\").then(leaf => leaf[\"quoted\"](el));"): this head returns an empty name set with no unread site. Please either parse/reject every unsupported occurrence of a namespace alias, or constrain the supported probe form so every capability name is extracted at the import itself. The current claim that an unaccounted form fails loudly is still false.
The gate's browser probes reach for the page's own reading of a box, a passage or a settlement — the same helper surface a behavior module reaches for. Naming the entry module there asserts something else besides: which file the runtime keeps the helper in. The runtime is moving those helpers out to their owners a domain at a time, so `Split widget element runtime` took `quoted` out from under eight probes at once and reddened eleven tests on a commit that changed no behaviour. The guard is a text reading of the modules that reach the boundary, and it carries the guarantee text can carry: none of them names the entry module's path. It does not answer whether the boundary still exports what a probe calls. The probes are JavaScript inside Python strings, and a partial reading of those reports clean for the spellings it was not written for — the same answer it gives when the probes are right — so that half stays with the render suite, which proves it by running them. A probe module's prose says "the entry module" rather than spelling the path, because a text reading cannot tell a comment from a payload. `test_behavior_modules_use_the_widget_api_boundary` was reading neither of the two roots it names: `PLUGIN_ROOT` is the payload and the product parts sit a skill directory below it, so the kernel's one module and the bundled package's thirteen went unread while the corpus's six kept `assert modules` green. Each root now answers for itself.
3f98a2a to
a8ac0bb
Compare
|
You're right on both counts, and the So I took the other branch you offered. Head a8ac0bb narrows the guarantee to the one a text reading can carry, and drops the parser.
It costs one thing and the docstring states it too: prose in a probe module says "the entry module" rather than spelling the path, because a text reading cannot tell a comment from a payload. Your two other findings are answered by the narrowing rather than by patches: there is no Bug-backs, each reverted after
The |
leaf-agent
left a comment
There was a problem hiding this comment.
Self-authored, so COMMENT rather than an approval. The narrowing is the right call — thirty-four lines, no grammar, nothing to grow — and the SKILL_ROOT half is sound: I re-ran the diff's own bug-backs on the merged tree and they hold. One finding, and it is in the population rather than in the check.
The guard picks its population by the property it asserts, so a probe module wholly on the entry module is never asked. probes keeps the modules whose text already holds /runtime/widget-api.js, and the check then asks which of those also name /leaf.js. A module reaching the runtime only through the entry module never enters the dict, so the reading passes over exactly the module that is entirely on the wrong side — and assert probes cannot see it either, because a sibling that kept one boundary reference keeps the dict non-empty. That is the same heap shape the sibling docstring one function above argues against, arriving as a filter rather than as an assert.
It is also not hypothetical. At cae9ea5 — the commit this PR exists to catch — render_checks.py held eight await import('/leaf.js') probes and zero occurrences of /runtime/widget-api.js, while rendering.py held one of each. So against that tree this guard reads a population of ['rendering.py'] and reports one stray specifier, never naming the module that carried eight of the nine and reddened the eleven tests.
The bug-back on today's tree is the same shape and it is green: replace every /runtime/widget-api.js in render_checks.py with /leaf.js — that module's cae9ea5 shape — and test_the_render_gates_browser_programs_name_only_the_widget_api_boundary passes.
The population that answers is "modules that hold a browser probe import", not "modules that already reach the boundary". It is still a text reading, still one line, and it costs no prose: an import( immediately followed by a quote and a slash is a payload in a way that a sentence about the entry module is not, so checking.py, http.py and service.py — which spell /leaf.js today in a boot tag and in prose — stay out of the population exactly as they do now. Suggestion inline. The docstring's "a module that reaches the boundary does not name the entry module's path" wants the same one-word turn if it lands.
Bug-backs on the merged tree (main at 6e655de + a8ac0bb)
Each reverted after. "as written" is this head; "suggested" is the population selector below.
| plant | as written | suggested |
|---|---|---|
| unmodified tree | green | green |
render_checks.py pointed wholly at the entry module (its cae9ea5 shape) |
green | red on ['render_checks.py'] |
| the cae9ea5 tree itself, both probe modules | population ['rendering.py'], red on ['rendering.py'] |
population ['render_checks.py', 'rendering.py'], red on both |
tests/test_interact_layer.py -k "widget_api_boundary or routes_every_reference" is 3 passed on this head as written, and 2 passed on the boundary pair with the suggestion applied. Populations under the suggested selector are identical to today's on an unmodified tree: render_checks.py and rendering.py, and nothing else under scripts/leaf/.
One thing outside the diff, worth a line because this PR's new comment is the argument for it: SKILL_ROOT is now named in interact_support.py, but tests/test_site.py and tests/test_product_page.py each still hand-spell ROOT / "plugins" / "leaf" / "skills" / "leaf" / … twice for ASSETS and DEFAULT_PACKAGE. Those four are direct paths rather than globs, so a level short fails loudly rather than silently — not the hazard the comment describes, but the same spelling.
ci on this head has lint green and test in progress as I post, so the browser half is unverified here. The diff is two tests, one constant and a comment, so the file-side suite is the surface that can see it.
Selecting it by what already reaches the boundary passes over the module that is wholly on the wrong side, which is render_checks.py at cae9ea5: eight of the nine offending probes and no boundary path. An import( on a quoted absolute path is the payload the guard is about, and it leaves the boot tag and asset paths in checking.py, http.py and service.py out of the population as before.
|
Two things on this head — a real hole in the guard I just narrowed, and the The population, fixed in 9fa7080. My own review workflow found it and it is correct: selecting the population by "already reaches the boundary" passes over the module that is wholly on the wrong side. I confirmed the bug-back before changing anything — point every The population is now what holds a browser probe import —
The first is the assertion 2355d66 rewrote, so dropping that commit is what puts it back on this branch's |
leaf-agent
left a comment
There was a problem hiding this comment.
Self-authored, so COMMENT rather than an approval. The population finding from the last review is closed on this head: the selector now reads what holds a browser probe import, the cae9ea5-shaped plant is red where it was green, and both selectors pick the same two modules on an unmodified tree. Resolved that thread. One finding, and it is in the sentence the increment added to describe the new selector rather than in the selector.
Widening the population widened the prose rule with it, and the new sentence says the opposite. import( followed by a quote and a slash is a text match, not a call, so it matches a sentence too — and the population is now every module under scripts/leaf, where before it was only the modules already reaching the boundary. Putting import('/runtime/widget-api.js') in a # comment at the top of checking.py therefore pulls that module in, and its two boot-tag strings then name the entry module: render-gate probes import past the widget API boundary: ['checking.py']. The docstring's own preceding sentence has this right — "a text reading cannot tell a comment from a payload" — and then the next one takes it back, telling a future author that an import( spelling is a payload in a way a sentence is not. What actually keeps checking.py, http.py and service.py out is narrower and true: none of them spells an import( call at all. Nothing lands here through a PR, so a sentence written on that reading reddens ci on main as the first signal. The direction is a false red, which is the right side to be wrong on — this is the line describing it, not the reading. Suggestion inline.
Bug-backs on the merged tree (main at ac88a1a + 9fa7080)
Each reverted after.
| plant | a8ac0bb | this head |
|---|---|---|
| unmodified tree | green | green |
render_checks.py pointed wholly at the entry module (its cae9ea5 shape) |
green | red on ['render_checks.py'] |
# comment spelling import('/runtime/widget-api.js') at the top of checking.py |
green | red on ['checking.py'] |
Populations on an unmodified tree are ['render_checks.py', 'rendering.py'] under both selectors, and checking.py, http.py and service.py — the three modules that spell /leaf.js today — stay out of both, as the diff claims. tests/test_interact_layer.py -k "widget_api_boundary or routes_every_reference" is 3 passed on this head.
The suggestion is prose only, so it moves no reading. ci on this head has lint green and test in progress as I post, so the browser half is unverified here; the increment is a docstring and one comprehension predicate, and the file-side suite is the surface that can see it.
|
The pivot away from the hand-written JavaScript/export parser is sound, and the narrowed text invariant is supportable. One population-order blocker remains on a8ac0bb: |
max-sixty
left a comment
There was a problem hiding this comment.
One blocker remains on current head 9fa7080: the PR narrows the new guard to specifier ownership, but leaves the old export-name parser in tests/test_interact_document.py::test_the_render_gate_takes_only_names_the_runtime_entry_exports unchanged.
That test still derives capabilities with re.findall(r"\\bleaf\\.([A-Za-z_$][\\w$]*)", gate) and compares them with /leaf.js, even though the probes now import /runtime/widget-api.js and the PR body correctly says this partial file-side export parsing should be retired in favor of executing the probes. It therefore has both failure directions the new design is trying to avoid:
- valid
leaf["quoted"],leaf?.quoted, orconst { quoted } = leafuse can omitquotedfromwanted, allowing a uniquely used boundary export to disappear without this guard noticing; - the new prose literal
leaf.quoted is not a functioncurrently satisfies the regex even if the executable call changes, and can later false-red against the boot-only entry module.
I reproduced the false-green by rewriting the executable use to each of those three valid forms, removing the dotted prose spelling, and dropping quoted from the parsed export set: missing stayed empty in every case. Please delete or redesign this stale test as part of the narrowing, and update its claimed boundary if any file-side export check remains. The independent probe-module population issue from the previous review is fixed on this head.
|
One additional current-head false green remains in the replacement population selector. The previous circular case is fixed: a wholly reverted Please make the population explicit or narrow the documented convention and enforce it without implying JavaScript recognition. The stale export-name parser identified in the current-head review is independently blocking and still needs removal or redesign. Exact head |
It parses leaf.<name> out of the gate's text and compares the result with /leaf.js's exports, which is the boundary the probes left: its destructure half now matches nothing, and the entry module is on its way to boot-only, where the remaining half would false-red. The reading has the false-green forms the narrowing above is the argument against — leaf["quoted"], leaf?.quoted, a destructure off the namespace — so rebuilding it against the new boundary would rebuild the parser this PR removed. The render suite proves that half by running the probes.
Selecting a probe population by a spelling is a selector a valid spelling can fall outside of: `import (` with a space, a template literal, a payload assembled from fragments. Each miss is silent, and the fix for each is another pattern. The convention has no population to pick. Outside checking.py, http.py and service.py — which name the path for the document's own contract — nothing under scripts/ spells it, in a payload or in a comment. So the reading recognises no JavaScript, the exemptions are a set rather than a shape a string can accidentally take, and a stale exemption is a finding in its own right.
|
Both findings taken, and the second one says the selector itself was the wrong shape rather than the wrong pattern. Head 7024a61. Three rounds of this now — a module wholly on the entry module never entering the reading, ENTRY_MODULE_NAMED_BY = {"checking.py", "http.py", "service.py"}
...
named = {module.name for module in modules if ENTRY_MODULE in module.read_text()}
assert named == ENTRY_MODULE_NAMED_BYEvery It also gained a direction it did not have: an exemption going stale is red. If The stale export-name parser is deleted — 82d553e, and the comment above it has the detail. Two things beyond the false greens you named: its destructure half matched nothing on this tree (a5e062d moved every probe off Bug-backs on 7024a61, each reverted after
|
|
The flat convention is the right simplification, and both prior blockers are closed: the stale export parser is gone, and the guard now catches the wholly reverted module plus The scan is recursive but records |
max-sixty
left a comment
There was a problem hiding this comment.
The flat convention removes the JavaScript-recognition problem, but the exemption identity should be relative paths rather than basenames. modules deliberately uses rglob("*.py"), while named collapses each match to module.name; a future scripts/other/checking.py that names /leaf.js is therefore silently covered by the existing "checking.py" exemption. A minimal bug-back is adding that nested file: the computed set remains exactly {"checking.py", "http.py", "service.py"} and the guard stays green.
Please compare module.relative_to(SKILL_ROOT / "scripts").as_posix() with exemptions such as leaf/checking.py. That keeps the now-sound flat invariant without reintroducing a population parser or allowing basename collisions. The stale export-name test is correctly retired on this head, and I found no other remaining issue in the narrowed design.
leaf-agent
left a comment
There was a problem hiding this comment.
Self-authored, so COMMENT rather than an approval. The basename-collapse finding on ENTRY_MODULE_NAMED_BY is already on the thread and is the blocker — nothing from me on it. The flat convention itself holds up on the merged tree: 28 modules read under scripts/, no duplicate basenames today, named is exactly the three, and both boundary tests pass. One thing nobody has measured, on the deletion rather than on the increment.
The retired export check was one path string from being live, and the re-pointed reading is richer than the one that was deleted. 82d553e and the comment above give three reasons: the destructure half matches nothing, the comparison set is the entry module's exports so it false-reds once the entry goes boot-only, and rebuilding it against the new boundary would rebuild the parser this PR removed. The first two are consequences of the path the test still spelled after a5e062d moved the probes, and both dissolve when '/leaf.js' becomes '/runtime/widget-api.js' in the two places it appears — the destructure regex and the file the export list is read from. Running the deleted test's own four regexes over this merged tree, changing only that string:
| as deleted | with the path re-pointed | |
|---|---|---|
| destructure sites matched | 0 | 6 |
| names read | 5 — inChrome, inUi, quoted, says, textNodesUnder |
11, adding shallowSigs, shownBand, shownBox, shownParts, standingState, uiInside |
| against the tree | green | green — all 11 exported by widget-api.js |
quoted dropped from the boundary's exports |
not read | ['quoted'] |
That last row is the cae9ea5 incident one boundary over, which is the half the render suite pays eleven browser reds to say. So the third reason is the one the decision actually rests on, and it is a judgment about what a partial text reading is worth rather than a fact about this one — the same judgment that keeps test_the_render_gates_browser_programs_name_only_the_widget_api_boundary, whose docstring argues that the narrow guarantee text can carry is worth having. Two path strings is not the parser this PR removed.
I am not asking for it back in this PR — it is out of scope for the correction the thread is holding on, and the call is yours. It is worth being made on the measurement rather than on the un-repointed shape, and if it stands, the title's claim to catch a helper leaving the boundary is now the specifier half only.
How the table was produced
The deleted test's own regexes over the merge of 7024a61 into 75cc9d5, with only the path changed:
gate = (SKILL / "scripts/leaf/render_checks.py").read_text()
wanted = set(re.findall(r"\bleaf\.([A-Za-z_$][\w$]*)", gate)) - {"js"}
for names in re.findall(r"const \{([^}]+)\} = await import\('/runtime/widget-api\.js'\)", gate):
wanted.update(p.strip() for p in names.split(",") if p.strip())Reading export declarations and export { … } blocks out of assets/runtime/widget-api.js with the deleted test's other two regexes gives 79 names; wanted - exported is empty, and removing quoted from that set gives ['quoted'].
|
Code is acceptable at exact head The body needs one final freshness edit after the automatic rebase. Its footer still says this is a single commit rebuilt on |
|
The footer is current now; thank you. The other requested freshness edit is still outstanding: |
|
Body refreshed: the pre-rebase suite count is gone, replaced by the exact-head CI result now that it is terminal. Run 33039510794 on It is main's rather than this branch's, on three readings:
Thank you for the relative-path fix in 26de18e — comparing basenames was mine to have caught, and |
|
Your merge of The What I can vouch for on the merged tree at this head: One thing to read with the exact-head |
Problem
cae9ea5 ("Split widget element runtime") moved
quotedout of the entry module intoruntime/widget-elements.jsand changed no behaviour. Eight of the render gate's browser probes reached for the runtime through the entry module, so the split took the grounding out from under all of them at once and run 33015504864 went red at eleven tests, every one of themTypeError: leaf.quoted is not a function.That spelling asserts two things and means one. It means "give me the page's own reading of whether this element is quoted"; it also asserts which file the runtime currently keeps that reading in — and the runtime is mid-way through moving those readings out to their owners. The plugin's own
CLAUDE.mdsays so in as many words: "TODO: Move the remaining helper implementations to their runtime owners sowidget-api.jsno longer reexports the entry module andleaf.jsbecomes boot-only."Main closed the run's own failure while this sat open: a5e062d ("Publish update APIs from their owner") moved every remaining probe specifier onto
/runtime/widget-api.js. What is left here is a guard against the next cut, and a hole in an existing test.Solution
Two file-side readings, both narrow.
test_the_render_gates_browser_programs_name_only_the_widget_api_boundarystates one flat convention and enforces it with no population to pick: outsidechecking.py,http.pyandservice.py— which name the entry module's path for the document's own contract, the boot tag and the note about asset URLs — nothing underscripts/spells that path, in a payload or in a comment. The exemptions are a set of relative paths in the test; everything else is read, and nested files cannot inherit an exemption through a shared basename.Selecting a probe population by a spelling was the wrong shape, and review found three ways out of it in as many rounds: a module wholly on the entry module never entering the reading,
import (written with a space, a template literal. Each miss was silent and each fix was another pattern. The reading now recognises no JavaScript at all, so there is no selector for a valid spelling to fall outside of, and a stale exemption — one of the three ceasing to name the path — is a finding in its own right rather than a permanent free pass. It costs one comment inrender_checks.py, which says "the entry module" in prose.It deliberately does not answer the other half — whether the boundary still exports what a probe goes on to call. No file-side reading here will. The probes are JavaScript inside Python strings, and every reading of that short of a real JavaScript parser is a partial one: it reports clean for the spellings it was not written for, so it answers the same way whether the probes are right or merely unread. The render suite proves that half by running the probes, which is how the original failure surfaced.
tests/test_interact_document.py::test_the_render_gate_takes_only_names_the_runtime_entry_exportsis deleted for the same reason. It parsedleaf.<name>out of the gate's text and compared the result with/leaf.js's exports — the boundary the probes left, so its destructure half already matched nothing — and redesigning it against the new boundary would have rebuilt the parser this PR removes.test_behavior_modules_use_the_widget_api_boundarywas reading neither of the two roots it names.PLUGIN_ROOTis the payload (plugins/leaf) and the six product parts sit a skill directory below it, so both globs matched nothing:assert modulesheld on the corpus's six, so the kernel's one and the bundled package's thirteen went unread — fourteen shipped modules in total. This namesSKILL_ROOTininteract_support.pyand asserts each root's population separately, so an empty one says which. All fourteen newly-read modules already import only/runtime/widget-api.js, so the widened reading adds coverage and no new failure.The comment in
render_checks.pyis the only change outside the tests: it records why the boundary is the gate's too, beside the section that owns the probes.Testing
Exact-head CI on
78a44004is terminal green in run 33044142919: lint passed in 14 seconds and the full test suite passed in 35 minutes. The exact-head tend review is also green in run 33044141063, with no new finding. On the merge withmainatfb28c76c,tests/test_interact_layer.py -k "widget_api_boundary or routes_every_reference" -q -n0passes all three selected tests,git diff --checkis clean, andpre-commit run --filesis clean on all four net-changed files.Bug-backs, each reverted after
['render_checks.py'] name /leaf.js …render_checks.pypointed wholly at the entry module, its cae9ea5 shapeawait import ('/leaf.js'), with the space['new_probe.py'] name /leaf.js …rendering.pychecking.pystopping naming it[] name /leaf.js and ['leaf/checking.py'] no longer do— the exemption cannot go stale unnoticedscripts/other/checking.pynaming the entry module['other/checking.py'], rather than inheritingleaf/checking.py's exemption/leaf.jsplanted inpackages/default/widgets/lf-board.jstest_behavior_modules_use_the_widget_api_boundary; against the pre-SKILL_ROOTglobs the identical plant passes, which is the hole counted aboveThe branch carried three merges of
main—3dfa52a(atf154596, before the relative-path exemption fix),4df9804(at8db3827), and78a4400(atfb28c76). Its net diff remained four files: the boundary comment, the sharedSKILL_ROOT, the retired partial export-name test, and the two narrow layer guards. It squash-merged as745f2a98aftermainadvanced through #66.