Repository navigation
fix: render component calls inside tables, escape NUL in compiled templates, fix the landing demo (#235) - #239
Merged
Merged
Conversation
…235) A NUL character anywhere in a template (text, an attribute value, an expression) reached the generated `generate_template()` code as a raw NUL inside a triple-quoted literal. Python refuses source code that holds a NUL, so the template failed when Citry ran its compiled code. The Python code writer now escapes string content in one pass: backslash, double quote, carriage return, and NUL (as `\x00`, so a following digit cannot extend an octal escape). Every other character survives a triple-quoted literal unchanged; a test round-trips all control characters and a few Unicode line and format characters. One-line `"..."` literals (SafeString) go through the same function. The compiler builds them from checked names, so their output is unchanged, but a foreign span's provider name reaches the parser checked only for being non-empty, and a quote in it ended the literal early. The literal syntax and node shapes stay the same; only templates whose compiled code was invalid (or, for a provider name, evaluated to the wrong string) produce different output. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…235) In a component that uses Vue, a component call inside a <table>, <tbody>, <thead>, <tfoot>, <tr>, or <colgroup> failed at render with "Foster parenting moved this element before the nearest open table". The native Vue compiler first parses the generated template with Vize's default parser options, which read the tag Citry writes for a call (such as <citry-row-1a2b>, or the <component> loop for a run of calls) as an HTML element, so Vize's table rules moved it out of the table. The tag never reaches the browser, and the compile stage already read it as a component. That parse, and the hydration plan's parse of the same text, now read the declared call tags and <component> as components through `parse_generated_template`. Every other tag keeps the default reading, so an authored <div> or custom element directly in a table still fails. Whether the child's own root fits is still decided by the server's hydration check. A <c-element> whose c-is resolves to a table part still fails inside a table: the compiler sees only its citry-dynamic-* alias. Recorded in docs/design/vue.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The landing editor demo put <c-MemberChip> inside a Vue v-for, so its c-name read Vue's loop variable on the server and the demo failed to render. It now repeats the chips with <c-for> over a Python value and passes each member's data as Python inputs, as the docs recommend, and passes the parent's `compact` prop to each chip with :compact. The demo's three deliberate mistakes stay. The hover annotations follow the new source. A test renders the demo with its marked unknown template variable supplied, so a demo that crashes at render fails the docs tests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # CHANGELOG.md
JuroOravec
changed the base branch from
main
to
benchmarks/errors-citry-fastapi
October 21, 2026 16:37
This was referenced Oct 22, 2026
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.
Fixes #235. Each bug was found by the Vue compile check in #234.
Fixes
editor_invite_panel.pypassedc-name="member.name"to a chip inside a Vuev-for.c-nameis evaluated on the server, butmemberexists only in the browser, so rendering failed withKeyError: 'member'.<c-for each="member in members">, as the docs recommend.<table>,<tbody>,<thead>,<tfoot>,<tr>and<colgroup>, with the error "Foster parenting moved this element before the nearest open table".crates/citry_vue_compilerparsed the generated template with vize's default options. Those options read Citry's component-call tags as plain HTML elements, so vize's table rules moved them out of the table. Vize is the Rust Vue compiler Citry uses.<component>read as components.<c-for>runs,<c-if>,v-ifand fills, plus a mounted and hydrated browser test.escape_text_in_triple_quotesincrates/citry_template_parser/src/lang/python.rsdidn't escape NUL.\\,",\rand NUL, which becomes\x00so a following digit can't form an octal escape.Compiler output
The NUL fix changes the compiled output only for templates whose compiled code was invalid before, or whose provider-name literal evaluated to the wrong string. The shape of the output is unchanged. An independent reviewer agreed this doesn't change the compiler's output format. The table fix is in
citry_vue_compilerand doesn't change the Python-facing API.Release note
Fixes 2 and 3 ship in citry-core, and
citrypinscitry-core==1.8.0. Users get them after a citry-core release and a bump of that pin. Once that pin is raised, #234's check can drop the two workarounds it carries for these bugs: skipping templates that contain NUL, and staying silent on a call inside a table.Known limits
<c-element c-is="...">that resolves totrinside a table still fails. The compiler only sees its alias tag, and vize offers no way to judge it by the real tag. This is recorded indocs/design/vue.md.v-forwhose inputs read the loop variable fails with a bareKeyErrorrather than a helpful message. This is filed separately.Evidence
cargo fmt,clippyandcargo testpass forcitry_template_parserandcitry_vue_compiler. The other crates' cargo phases weren't run locally because of disk space; CI runs them.--platform linux.🤖 Generated with Claude Code