Repository navigation
feat(events): offer a reload for renders and fragments from another release, and check rolling deploys at release - #714
Merged
Merged
Conversation
…lease, and check rolling deploys at release Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ng-deploy check Co-Authored-By: Claude Opus 5.5 <[email protected]>
… Kwargs Co-Authored-By: Claude Opus 5.5 <[email protected]>
… and add citry:fragments:stale Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ocument the fragment event Rename the docs section to Handle out-of-date pages, lead it with the production case, add a banner example and the citry:fragments:stale event, and update every page, guide, design doc and changelog entry that described a reload question in production. Co-Authored-By: Claude Opus 5.5 <[email protected]>
List every cause of stale_state, cancel the events in the example, say which calls keep failing, explain what a refused fragment looks like, and fix the stale reload wording in two docstrings. Co-Authored-By: Claude Opus 5.5 <[email protected]>
JuroOravec
force-pushed
the
test/rolling-deploy
branch
from
November 15, 2026 17:20
39e8f9b to
8732b5d
Compare
…ported A fragment's development flag now counts only on a page with no Citry app of its own, so an injected fragment block cannot make a production page ask the reload question. Add tests for that case and for the flag reaching a fragment, add an upgrade step for the out-of-date listener, and fix the remaining reload wording. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… count Each successful bump must render the count 1, and a second bump sent with the State the first answer returned must render 2, for signed and server-stored State in both directions. After stale_state the second call is reported as skipped. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t count A server that ignored the page's State would also render 1 after one click, so the pages now start at 41 and the check expects 42 and 43. Also accept a token refreshed by a state action, and word the skip reason so it fits a render the page cannot read. Co-Authored-By: Claude Opus 5.5 <[email protected]>
JuroOravec
added a commit
that referenced
this pull request
Nov 16, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
JuroOravec
added a commit
that referenced
this pull request
Nov 16, 2026
* docs: record the security reviews of #713, #714, #718 and #722 Adds the Mechanism 7 step 7 records for four merged pull requests: GHSA-x773 (#713, reserved attribute names as c-bind keys), #714 (out-of-date pages and the rolling-deploy check), #718 (one Rust URL scheme reader), and GHSA-7fjh (#722, reserved data-* names in Citry UI attribute maps). The two advisory records name the advisory and the affected and fixed versions; the facts come from the pull requests. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * docs: link the #720 follow-up from the #714 review record Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Sonnet 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.
Part of the 1.0.0 work (#624, C6; decision 10 and the C6 scope additions). One PR, because the script's judgement of a render with other helpers depends on the browser change.
What changes
The page reports that it is out of date instead of failing with a plain error when it gets something another Citry release wrote and it cannot read:
vue-prepared/1render whose definitions name another helper contract (checked first in preflight, then again where a definition asset or script is registered);protocolis notcitry-vue-fragment/1, or that has a top-level field other thanvue.The runtime fails these with an error whose
codeisstale_stateandstatusis 0. The Events bridge sends everystale_statefailure, from the server or from the browser, through onereportFailurepath: the cancelablecitry:events:stale(reasonversion), then Citry's own once-per-page report, thencitry:events:error. That path now covers queued calls,wait: falseactions, and the publicCitry.events.applyActions(including its preflight). A refused fragment fires the newcitry:fragments:staleevent instead (see below).Production behaviour change (maintainer decision)
Citry's own report on an out-of-date page, from an expired State token (#706) or from a deploy:
configuration.development === true): the built-inconfirm("This page is out of date. Reload to continue?"), once per page.stale_state, Citry still firescitry:events:stale(reasonversion) andcitry:events:error, and it writes oneconsole.warnper page that names the cause and links https://citry.dev/reference/browser-apis/#out-of-date-pages.staleevent replaces the report in both modes. The once-per-page flag is shared by every app on the page and by fragments, so the first report decides.serialization.pynow writesdevelopmentinto the page configuration, so a fragment knows which mode its server ran in. The page's own mode (from the first appstartDocumentstarts) decides how a refused fragment is reported; the fragment's flag counts only on a page with no Citry app of its own. That way a fragment block injected into a production page without a nonce cannot make it ask the question.Why a separate
citry:fragments:staleevent. A fragment comes from no event call. Everycitry:events:staledetail promisesinstance,classandevent, and a fragment has none of them, so reusing that event would break its documented shape.citry:fragments:stalebubbles, is cancelable (cancelling replaces Citry's report, as forcitry:events:stale), hasdetail {reason: "version", error}, and fires on the fragment's data<script>while it is in the page, otherwise ondocument. A listener ondocumentalways hears it.Docs: browser APIs has a new section "Handle out-of-date pages" with a banner-and-reload-button example, a warning not to reload from the listener (a cached page with an expired token would loop), and the fragment event. It says an expired token is the common production case. The Versioning page, web frameworks, State, cache backends, security, development mode, troubleshooting (a row for the warning), HTML fragments, the spec, the upgrade guide, the blog post, the design docs and the CHANGELOG are updated to match. The CHANGELOG has an "Upgrading from 0.9.x" entry for the production change and an "Added" entry for the fragment event.
2.
scripts/rolling_deploy/:check.pyinstalls the previous published citry (from PyPI) and the candidate (wheel or checkout) in two uv environments.scenario.pyruns the same app on both. In each direction (old page to new server, then new page to old server) it renders pages with signed and server-stored State into a sharedDiskCache, sends their event calls to the other release through the WSGI app, fetches their runtime and definition files (compared by SHA-256), and renders a cached component again. An answer must be a success orstale_state.bumpmust render 42. The count is read from the answer's render as the whole textrolling-count-<n>, whichscenario.pybuilds intemplate_data, so it reaches the render as one string in any form (the text of an HTML render, or a value in a Vue render's data) without depending on a field name the release's browser code chose. A render showing no count, another count, or two counts fails.bumpgoes to the same serving release with the State token, render ID and app revision the first answer returned, and must render 43. For signed State this proves the new token carries the new count. For server-stored State the answer returns a new pointer on every write (each write stores State under a new key and leaves the old entry), so the check sends the returned pointer, not the original one: the original would rightly still show 42. A separatescenario.py answerprocess with a fresh engine reads the new pointer, so 43 can only come from the shared store. After an answer that leaves the page out of date (stale_state, or a render with other helpers), the second call is reported asSKIP, not failed.rolling-deployjob inpy--citry--publish.yml, run forqualify, besidesmoke-python, and required byverify-distributions. It is not run on PRs. Plus one line in the release section ofdocs/codebase.md.The script's check is now named
page_reports_out_of_dateand its statusstale.Adding a verification step (CLAUDE.md checklist)
UV_NO_CACHE=1, 0.9.0 to the built candidate wheel, both directions). With checkout, setup-python, uv install and two artifact downloads, the job should take well under 1 minute. I could not time it in CI, because a qualify run needs a release candidate onmain. It runs in parallel with thesmoke-pythonmatrix, whose five jobs took 01:38:24 to 01:43:15 (about 5 minutes, mostly runner queueing) in the last qualify run, 43663453455. So I expect no addition to the release critical path. Worst case, if it is the last job to get a runner, it adds under 1 minute.raw-citry-distributionswheel and, when selected, thecandidate-citry-core-wheelfrombuild. Nothing is rebuilt.smoke-python; both gateverify-distributions.Smoke run against 0.9.0
python scripts/rolling_deploy/check.py --previous 0.9.0, with the candidate built from this branch's checkout (its version still reads 0.9.0 because main has not been bumped; the different runtime hashes show the two installs differ). The run is report-only, because 0.9.0 to 0.9.0 is not a 1.x deploy. Output on 2d220e1:Checks
pnpm --dir packages/js/citry-client run check: 334 pass. Generatedruntime.js,events.jsandfragments.jswere rebuilt withpnpm run build.stale_statefailures on every path: a waited action, await: falseaction, and publicapplyActionsrefused in preflight;citry:fragments:stale(on the block, or ondocumentonce the block is gone) and reports once: a question in development, a warning in production, nothing when cancelled; one refused for its nonce does not;registerDefinitiontreats another helper contract asstale_state.packages/py/citry/tests/test_rolling_deploy_script.py(20 tests): which pairs are promised, the previous-release pick from a synthetic PyPI payload, how answers are classified, the page reader, the digest check, and the exit rule when a stage cannot run.yamlorcitry_ui, pydantic 2.14.3 against the locked 2.14.1, and no tzdata. They are in unrelated files.scripts/validate.pypassed;test_ci_workflows.pypassed, with the--core-wheelconsumer count updated to 3; ruff and mypy are clean, including--platform linux. I did not run the full gate, because its cargo phase needs a Rust build, which this lane must not run.Review (Mechanism 6, 7, 8)
An independent reviewer (technical, security, advisory survey, prose) and the
docs-cold-readeragent both read the change. Fixed during the review:applyActionsgave no out-of-date report, because its preflight ran outside the reporting path. It is now reported, and the test makes the failure happen in preflight;stale_state. It now says the error is made in the browser and never travels on the wire;docs-cold-readerpass found: the cause list missed dropped server-stored State and unknown token versions; "the page stays unusable" overstated it (only calls from that component fail); the example did not cancel the events, so development showed both the dialog and the banner; a refused fragment's visible effect was not described;cache.pyandsettings.pydocstrings still mentioned the old reload offer. All fixed.Citry.fragments.load, which is not public;_max_agefix;prepared, and the fragment e2e fails if any dialog opens in production;tokens.py,docs/codebase.md, the CHANGELOG (the snippet now cancels and listens for both events), the spec,settings.py, development mode and troubleshooting;cache.py.stale_statealso when the page refused a render with other helpers; it now says "left the page out of date";stateaction (instead of the render's Events record) is now accepted;test_rolling_deploy_script.py, including a success with the wrong count (1, 41, 43, none, two counts), a wrong count with other helpers, and the skip reasons.Not changed:
Security (Mechanism 7). Places touched: Events responses, navigation (
location.reload), fragment data blocks, and the CSP nonce path. The question and warning texts are constants, the question appears only on a development page, and the navigation is always a reload of the same URL after the visitor agrees. Routes the reviewer classified:applyActions;The reviewer also noted, for the maintainer, existing behaviour that this PR did not add: under a CSP without nonces, an injected fragment block can start a fragment with definition URLs it chooses.
Mechanism 8. The reviewer read the advisory survey and checked hydration, trusted-shape, script-load, open-redirect, xss-url, dom-clobber, proto, ci and cache-key. This change introduces none of them.
🤖 Generated with Claude Code