Repository navigation
test: lock today's render callback and hook order - #263
Merged
Merged
Conversation
Add tests/test_call_run_order.py. Each case builds a small page whose simple="vue" rows come from a c-for loop, renders and serializes it, and records every call into user code (the id generator, Kwargs and data schema construction, template_data, js_data, css_data, on_render, on_dependencies) and every extension hook, with the execution frame each data method saw, the TRACE lines, the error with its component path and chain, and any context variable left set. The records observed on main are stored in tests/fixtures/call_run_order.json, so a later render path must keep the same calls, counts and order. Hooks are recorded with sys.setprofile on their code objects instead of by replacing hook methods, because serialization checks the built-in hooks' identity and stops hydrating a page when one is replaced. The 44 cases cover the plan's loop edge cases (row errors, depth limits, on_render boundaries, state changed by a row, child calls, slot fills, tracing) and pages serialized as every output kind. A thread case checks two overlapping renders write the same HTML. The ComponentLike.register case runs in its own process. The file runs in about 1 second. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 23, 2026
Merged
Merged
JuroOravec
added a commit
that referenced
this pull request
Oct 23, 2026
…ive render level C1) A c-for loop over a simple='vue' component now records its rows in one _DeferredRun, with one _DeferredRunRow at each row's position in the parts list, instead of building a CitryElement and a DeferredComponent per row. The render queue gives rows of one run that sit next to each other one task (_RunTask), which renders them in the order their own tasks would. A row that calls child components or takes the ordinary component path stops the task, and the queue renders that row's work with a task for the remaining rows under it; a row that is too deep or whose position is gone raises the error its own task raises. Output bytes and the order of every callback and hook are unchanged; the order records from #263 pass unchanged on both render paths. This level is Python only and runs on every interpreter, on both the Rust and the Python path. - citry_render.py: _DeferredRun and _DeferredRunRow (one object per row position, so the queue finds rows by identity when a hook reorders, drops or repeats them; the row's DeferredComponent is built once). - nodes/__init__.py: ComponentNode.render ends in _finish_render; _render_run_row; ForNode._call_run_class and _render_call_run. - component_render.py: _simple_vue_record, shared by _render_simple_vue_leaf and the run task's _run_row; _run_rows, _place_run_part, _RunTask and the settle loop's run branch with its four exits; place_child shared with the per-row task; the scan groups adjacent rows; _contains_deferred and _nesting_depth_error_for. - _vue/capture.py: a leftover row is an unresolved part. - Tests: test_call_run_tasks.py (the board spy on both paths, both position-gone exits, hook edits and a re-printed list compared with one task per row in the same process, rows that change later rows, the three public routes that see unplaced rows). - Docs: native_render.md section 3 and C1's error modes; component_rendering.md, component_rendering_defer.md, component_on_render.md, vue_optimization_rollout.md, agent INDEX, and a ledger row with the timing pending. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 23, 2026
JuroOravec
added a commit
that referenced
this pull request
Oct 23, 2026
…ive render level C1) A c-for loop over a simple='vue' component now records its rows in one _DeferredRun, with one _DeferredRunRow at each row's position in the parts list, instead of building a CitryElement and a DeferredComponent per row. The render queue gives rows of one run that sit next to each other one task (_RunTask), which renders them in the order their own tasks would. A row that calls child components or takes the ordinary component path stops the task, and the queue renders that row's work with a task for the remaining rows under it; a row that is too deep or whose position is gone raises the error its own task raises. Output bytes and the order of every callback and hook are unchanged; the order records from #263 pass unchanged on both render paths. This level is Python only and runs on every interpreter, on both the Rust and the Python path. - citry_render.py: _DeferredRun and _DeferredRunRow (one object per row position, so the queue finds rows by identity when a hook reorders, drops or repeats them; the row's DeferredComponent is built once). - nodes/__init__.py: ComponentNode.render ends in _finish_render; _render_run_row; ForNode._call_run_class and _render_call_run. - component_render.py: _simple_vue_record, shared by _render_simple_vue_leaf and the run task's _run_row; _run_rows, _place_run_part, _RunTask and the settle loop's run branch with its four exits; place_child shared with the per-row task; the scan groups adjacent rows; _contains_deferred and _nesting_depth_error_for. - _vue/capture.py: a leftover row is an unresolved part. - Tests: test_call_run_tasks.py (the board spy on both paths, both position-gone exits, hook edits and a re-printed list compared with one task per row in the same process, rows that change later rows, the three public routes that see unplaced rows). - Docs: native_render.md section 3 and C1's error modes; component_rendering.md, component_rendering_defer.md, component_on_render.md, vue_optimization_rollout.md, agent INDEX, and a ledger row with the timing pending. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Adds the callback-order tests the native render plan puts first (PR 0),
so each later Rust render level is checked against today's behavior
before it changes any code.
Each case builds a small page with a
c-forloop ofsimple="vue"rows,renders and serializes it, and records every call into user code and
every extension hook, in order: the id generator,
Kwargsand dataschema construction,
template_data,js_data,css_data, the parent'son_render,on_dependencies, the serialize hooks, the execution frameeach data method saw, TRACE lines, the error with its component path and
chain, and any context variable left set. The records observed on main
live in
tests/fixtures/call_run_order.json.CASESin the test filesays what each case changes and summarizes its record in one line.
limit,
on_renderboundaries, a row changing state for later rows,child calls, slot fills, tracing) and pages serialized as every output
kind.
ComponentLike.register(dict)case runs in its own process,because the registration lasts for the whole process.
sys.setprofileinstead of by replacing hookmethods: serialization checks the built-in hooks' identity and stops
hydrating a page when one is replaced.
packages/py/citry:uv run --no-sync python -m tests.test_call_run_order --write.A changed record is a changed contract, so explain why in the PR.
One case,
nested_template_printed_twice, locks today's internalRuntimeError("deferred part vanished from its .parts list beforeresolution"). If that bug is fixed later, update this case's record
with the fix.
Test-only: no runtime code and no changelog entry. The file runs in about
1 second. Checked locally with the fast profile of
scripts/check.py(passed) and mypy with
--platform linux.🤖 Generated with Claude Code