Repository navigation
fix: keep a fill's values in its author when a transparent component passes it on - #341
Conversation
…passes it on A component that starts Vue and puts a <c-raw> block, a Markup value or #c-ignore contents inside <c-i18n>, <c-provide>, or another transparent component that passes it into a component's slot failed to render with "prepared opaque HTML values do not match definition declarations". A transparent component has no Vue definition of its own, so assembly writes its template straight into the definition of the component it sits in, and copies the values of that body into that occurrence's prepared data. That copy also ran for a fill inside it that is handed on as a Vue slot, although such a fill is compiled in its author's definition and reads its values from its author's data. <c-i18n> is one such case: it passes its body through a transparent <c-component> to a host component, which wraps it in a transparent <c-element>. The <c-raw> HTML then also landed in the host's data, whose definition declares no opaque HTML site, and the manifest check rejected it. Assembly now copies a body's values into an occurrence's data only when the body is compiled into that occurrence's definition: always for the occurrence's own template, and for a fill's body only when the body stays there (the fill is written straight into the definition, or its receiver and author are the occurrence being assembled). The flag that says so is renamed compiled_here. The code works out which occurrence receives the body before it transforms the body. Tests: the <c-raw> HTML stays only in the page's data, and the page's definition reads it, for <c-i18n> (server and client), a transparent component inside <c-i18n>, <c-provide> inside <c-i18n>, a transparent component that forwards into an ordinary component, and a Markup value and #c-ignore contents inside a transparent component. The test that locked the extra copy of a fill's text into the receiving component's data now checks that the text stays in its author. Fixes #334 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
While fixing #329 I hit the same error ("prepared opaque HTML values do not match definition declarations") from two shapes, and wrote a separate fix before I saw this PR. Both shapes render on this branch (3acbb64) and fail on
A reviewer of my version found two older bugs nearby. Neither this PR nor my version fixes them, and both fail the same way on
I can open issues for these two if that helps. 🤖 Generated with Claude Code |
The accordion and disclosure scenario test asserted that the scenario's "outline" title was copied into each item's prepared data. The title is written by the scenario page and passed into the item's slot, so the page's template compiles it and reads it from the page's data; the item's copy was never read. Since #341, assembly no longer writes that copy, so the test now checks the title in the page's data and still checks that the chevron glyph never reaches Vue as text. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fixes #334
What changes
In a component that uses Vue, a
<c-raw>block, aMarkupvalue, or#c-ignorecontents could fail to render with "prepared opaque HTML values do not match definition declarations". This happened when the content sat inside<c-i18n>, inside<c-provide>, or inside another transparent component (one with no Vue definition of its own) whose content ends up in a component's slot.Cause (in
packages/py/citry/citry/_vue/direct_capture.py):<c-i18n>is one such case. It passes its body through a transparent<c-component>to a host component, which wraps the body in a transparent<c-element>.<c-raw>HTML also landed in the host's data. The host's definition declares no opaque HTML site, and the manifest check (_vue/protocol.pyprepared_manifest) rejected it.Fix: assembly copies a body's values into an occurrence's data only when the body is compiled into that occurrence's definition.
compiled_here=True.projected_data. It is renamedcompiled_hereand documented at the parameter.Tests
New:
tests/test_vue_prepared_capture.py::test_raw_html_inside_a_transparent_component_stays_in_its_author. It checks that the HTML lands only in the page's data and that the page's definition reads it. It covers seven shapes:<c-i18n>, server and client;<c-i18n>;<c-provide>inside<c-i18n>;Markupvalue inside a transparent component;#c-ignorecontents inside a transparent component.The shapes fail on main and pass now.
Changed:
tests/test_vue_direct_relationships.py. The old testtest_flattened_projection_namespaces_lexical_text_after_physical_keyasserted that a fill's text was copied into the receiving component's data. That component's template never reads it; the author's does. The test is nowtest_a_fill_passed_through_a_transparent_component_keeps_its_text_in_its_authorand checks that the text stays in its author.Changed:
citry_ui/quality/tests/test_routes.py.test_flattened_state_projection_binds_lexical_text_but_not_the_indicator_glyphasserted that the accordion and disclosure scenarios' title was copied into each item's data. The scenario page writes the title and passes it into the item's slot, so the page's template reads it from the page's data, and the item's copy was never read. This PR stops writing that copy. The test is nowtest_projected_title_is_text_in_its_author_and_the_indicator_glyph_is_not; it checks the title in the page's data and still checks that the chevron glyph never reaches Vue as text. (Commit d5a07cd from the Vue lane, cherry-picked; the file passes on this branch, 169 tests.)The reviewer also ran a 49-shape probe, each shape with and without page
js, comparing this branch with main:$citryPreparedkey that its data lacks.Evidence
Run locally on origin/main 1b64f71, with a citry_core built from it:
-m "not e2e"): 9,481 passed.check.py --reuse): 0 mismatches, 0 Vue errors.--platform linux.PR CI runs the cargo phases. This change has no Rust.
Review
An independent adversarial review ran twice, each time with a prose pass. Its findings are folded in:
<c-i18n>case;Markupand#c-ignore;🤖 Generated with Claude Code