Repository navigation
feat(vue): guarantee script order and failure behaviour (#145) - #651
Merged
Merged
Conversation
Component scripts report whether they ran to their end, a third-party script that fails to load is skipped, onServerRender callbacks run in one order after the first mount and after a server render, and browser plugin scripts run before component scripts on standalone pages. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Skip callbacks of components that an earlier callback unmounted, request a skipped third-party file once per startup or server render, report a callback failure after startup, wrap only scripts Citry put in a function, check finishKey after the source, and rewrite the docs for clarity. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…callbacks (#145) Also mark the app started where startup last checks it, skip a repeated file only when it is third-party, name a failed load in the unfinished script error, and check finishKey after the source on the server too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…render-time skips (#145) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ils (#145) Co-Authored-By: Claude Opus 5.5 <[email protected]>
JuroOravec
force-pushed
the
feat/145-script-order
branch
from
November 14, 2026 14:13
b418000 to
b3e4011
Compare
The script order tests and the fragment nonce e2e helpers found script elements with a regular expression that missed upper-case tags and a closing tag such as `</script >`. They now use html.parser, which reads script text the way a browser does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 14, 2026
build(deps): apply the open Dependabot updates for ty, maturin, playwright and the Python tools
#672
Merged
Merged
JuroOravec
added a commit
that referenced
this pull request
Nov 14, 2026
…erverRender Since #651, Citry runs onServerRender callbacks after a server render with children before their parent, after every cleanup has run. Several Citry UI components relied on the parent's callback running first: - CDatePicker, CDateRange and CTimePicker un-enhanced their control in the cleanup, which hid the trigger of their CPopover, so the popover's earlier callback force-closed it. Their cleanup now keeps the control enhanced on a server-render handoff, and the popup stays closed while the server has just disabled the picker and the picker has not run yet. - An open CPopover hid its surface in the cleanup, so a layer nested inside it closed. It now stays showing and registered until its next run takes it over. - CAccordion applied item state before detecting removed items, so it skipped the removal report and the focus fallback. It reconciles the items first. - A CDialog, CDrawer or CCommandPalette opened inside a dialog that the same render opens now waits until that dialog is modal, so it opens on top. CDrawer watches every ancestor's attributes, and the palette joins the shared dialog list, so closing the outer one closes them. The JavaScript asset budgets rise to fit the added code. Co-Authored-By: Claude Opus 5.5 <[email protected]>
JuroOravec
added a commit
that referenced
this pull request
Nov 14, 2026
…erverRender (#675) Since #651, Citry runs onServerRender callbacks after a server render with children before their parent, after every cleanup has run. Several Citry UI components relied on the parent's callback running first: - CDatePicker, CDateRange and CTimePicker un-enhanced their control in the cleanup, which hid the trigger of their CPopover, so the popover's earlier callback force-closed it. Their cleanup now keeps the control enhanced on a server-render handoff, and the popup stays closed while the server has just disabled the picker and the picker has not run yet. - An open CPopover hid its surface in the cleanup, so a layer nested inside it closed. It now stays showing and registered until its next run takes it over. - CAccordion applied item state before detecting removed items, so it skipped the removal report and the focus fallback. It reconciles the items first. - A CDialog, CDrawer or CCommandPalette opened inside a dialog that the same render opens now waits until that dialog is modal, so it opens on top. CDrawer watches every ancestor's attributes, and the palette joins the shared dialog list, so closing the outer one closes them. The JavaScript asset budgets rise to fit the added code. Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Nov 14, 2026
JuroOravec
added a commit
that referenced
this pull request
Nov 14, 2026
…ight merged changes (#682) Add one record under docs/security/reviews/ for each of the eight published 0.8.0 advisories (GHSA-4hj5, -8xvf, -7qpw, -g658, -x6rm, -h524, -xmx5, -xg8c) and for each of the pull requests that Mechanism 7, step 7 owes one: #610, #640, #651, #652, #653, #658, #674 and #675. Each record says only what the public pull request, the published advisory, the merged code and its tests show, and lists what was not checked. The reviews README describes how a record for a published advisory differs from a pull request record. The Mechanism 7 list in CLAUDE.md gains the two places that GHSA-7qpw added: parser rules browsers differ on, and the page's declared encoding. 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.
Closes #145. Implements the design in
docs/design/script_order.md(#630) for 0.9.0.What changes
jsin atrythat calls__citryRuntime.finishScript(key). A component script that throws or fails to parse now keeps the Vue app from starting (or fails the server render that loaded it). The error names the component and carries the original error ascause, andreportErrorpasses the original error to the page'serrorevent. The manifest gains an optionalfinishKeyon those script entries. Python and the browser both validate it.onServerRenderhas one order. On the first mount and after a server render, callbacks run children before their parent, and siblings in the order they first mounted. Citry numbers instances in itsmountedwrapper and follows$parentlinks; it does not read Vue's internals. A callback that throws stops the rest of that pass and stops the app. First-mount callbacks now run from one ordered queue. A component that an earlier callback removed gets no callback. A component that a callback shows gets its callback after the rest.runtime.jswas rebuilt fromclient.jswithbuildCitryVueRuntime. The render snapshots were regenerated; the only differences arefinishKeyfields and bundle digests.Where the code differs from the design
wrap=False, or with atypethat has parameters (whichScriptdoes not wrap), gets notryand nofinishKey, so a throw there does not stop the app.v-if) now logs and stops the app.Tests
test/script-order.test.mjs(26 tests) coversfinishScript,finishKeyvalidation,isThirdPartyScript(including<base>, protocol-relative andnull-origin pages), callback order and the failure rule.finishKeyemission and validation, the wrap condition, and plugin script placement on both page kinds.test_script_order_e2e.pyandtest_callback_order_e2e.py. They cover plugin order, throw and parse failures before and after$component, a throwingDependenciesfile, third-party versus same-origin load failures, retry by a later fragment, a request sent once at startup and in a server render, callback order (siblings, slot fill, loop, hydrated and client-rendered), order after a server render with the response reversed, a new sibling and reordered keyed rows, components removed or shown by callbacks, and throws on first mount, after a server render and after startup. They pass on Chromium, Firefox and WebKit.finishKey.Locally the canary "runtime matches its source build" fails only because the installed Vue is 3.5.42 while the repo pins 3.5.44.
buildCitryVueRuntimeoutput equals the committedruntime.js. A few local failures (oldcitry_corebinary, WebKit charset tests) also fail onmain.Review
An independent technical review (Mechanism 6) and a re-review of the fixes. Docs had a cold read and a prose pass. Every finding was folded in.
Security (Mechanism 7)
These are the places from the Mechanism 7 list in
CLAUDE.mdthat this PR touches. Each was checked by an independent reviewer, and none has a hole:trywrapper, and the manifest JSON gainsfinishKey. The wrapper text is Citry's own and holds no</script,<!--or-->.finishKeymust be 64 hex characters, on a component entry with an owned source, and both Python and the browser check this. It is written through the existing JSON escaping. Safe.<base>element cannot change the decision. It skips only a script that the browser already refused to load, never an owned script, one that registers options, or one with afinishKey. Finish results are kept in aMap, so__proto__reaches only its own entry. Safe. The trade-off is accepted: a page runs without a skipped cross-origin file. The docs say to serve safeguards such as consent managers from the page's own origin.idandname. The origin check readsdocument.URLthrough the runtime's clobber-safe document wrapper.<img name="URL">cannot replace it, and a value that does not parse counts as the page's own origin, so it fails closed. Safe.finishScriptwrites a finish record, and it checks the key. Page code that forges a record only hides its own component's failure. Safe.strict-dynamic, with and without a throwing component. Safe.security_javascript,security_csp, a JavaScript policy). They decide from script attributes, which the wrapper does not change, and on a standalone page they also see the wrapped bytes. Warn, forbid and omit give the same results as onmain. An omitted script leaves nofinishKey. Safe.errorevent, never into page HTML. Safe.Mechanism 8: the reviewer read the advisory survey and checked the change against
script-load,dom-clobber,proto,ssr-serialize,template-inj,error-page,log-inj,sanitizer-bypass,cache-key,redosandsource-exposure. The change introduces none of them.Open: the measurement in design item 7 is not part of this PR. Two
citry_uiruntime scripts (CSplitButton, CContextMenu) throw at top level when a dependency is missing. They now stop the app, but their dependencies are app-owned files that would already stop it.🤖 Generated with Claude Code