Repository navigation
fix: JSON check ranges, State token spec, and v-for variable errors (#203, #204, #240) - #247
Merged
Merged
Conversation
The Events spec said a token that fails signature verification answers invalid_state 403. The server answers stale_state 409 when the token is still readable, because a changed signature looks exactly like an honest token signed with a secret the server has since removed. The spec now states that rule and the order the server checks a token in: a missing or unreadable token (403), then an expired token, a signature no current secret matches, or server-held State that is gone (409), then a token minted for another component class (403), then State that no longer fits the component's State class (409). The server behavior is unchanged. Token tests now tie a changed-signature token to the stale_state example result, and pin the order: a stale signed or server-held token for another class answers 409. Fixes #204 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…it counts in (#203) `citry check --format json` numbered template syntax errors, unknown variables, unknown components, and i18n catalog errors from 1, and every other rule from 0. A JsData field's column counted UTF-8 bytes. Every range now comes from its byte offsets through one helper, so lines and columns count from 0 with columns in UTF-16 code units, as the Language Server Protocol counts them. Lines end only at CR LF, CR, and LF, the way Python and editors end them, and byte offsets count each line break as one "\n", as Python reads a text file. Each range now carries `source_kind`, the name and values ComponentGraphLocation already uses: "file" when it counts in the file the origin names, "inline" when it counts in a string written on a class, such as `template`. A report rejects a finding that has a range but no `source_kind`, so a new rule cannot ship an ambiguous range. A JsData field's origin now names its Python file, like the other findings about Python code. An i18n catalog error is placed in the text the compiler read, so a `messages_file` error counts in that file. The error benchmark's citry parser read inline template lines as counted from 1; it now adds 1 for the 0-based line, and maps a finding whose origin is a template, JavaScript, CSS, or messages file to that file. Fixes #203 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ble (#240) A component input such as `c-name="member.name"` inside `<li v-for="member in members">` failed at render with a KeyError that only named `member`, printed as one escaped line. Citry evaluates the input on the server, and `member` exists only in the browser. When safe_eval reports a failed lookup of a name the server lacks, the render error helper checks whether the innermost Vue v-for around the failing node declares that name. If so it raises a VueLoopVariableError (still a KeyError) that names the tag, the template, and the line, says why the variable is missing, and gives the fix: repeat on the server with `<c-for each="member in members">` (or, when the server has no such list, a `<c-for>` over a list from template_data()). For `{{ }}`, `c-*` attributes, `<c-if>`, and `<c-for>` it also offers the Vue form (`v-text`, a `:` binding, `v-if`, a nested `v-for`), unless a component call sits between the loop and the expression, which the Vue compiler rejects inside a v-for. Any other KeyError, including a different missing name in the same expression, is left as it is. `<c-if>` and `<c-for>` conditions that read the loop variable also get a template snippet. The troubleshooting guide gains a section for the error. Fixes #240 Co-Authored-By: Claude Opus 5.5 <[email protected]>
JuroOravec
changed the base branch from
main
to
docs/landing-benchmark-charts
October 22, 2026 10:36
Main brought two checks whose findings carry ranges: the CSS class rules (#242) and the unknown inject key rule (#243). Both already counted from 0 in UTF-16 units through `_byte_offset_coordinates`, but neither said which text it counts in, so the report rejected them. The CSS class findings are now built with `_ranged_finding` from their template source, and the inject key findings are marked as counting in the component's Python file. Their tests now also check `source_kind`; no expected position changed. 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.
Fixes three issues, one commit each.
#204: when a rejected State token answers
stale_stateThe server's behavior is intentional. A token whose signature no current secret matches, but whose payload still reads cleanly, looks exactly like one signed with a rotated-out secret, so it answers 409
stale_state. The Events spec now matches the code and states the order in which the server checks a token (malformed → 403; expired, unknown signature, or server-held State gone → 409; another component class → 403; State that no longer fits → 409). New tests lock that order for signed and server-held tokens. Server behavior is unchanged.#203:
citry checkJSON rangesEvery range in the JSON report now counts lines and columns from 0, with columns in UTF-16 units as in the Language Server Protocol, and line breaks may be CR LF, CR, or LF. Each range says which text it counts in:
"source_kind": "file" | "inline"(the same name and values asComponentGraphLocation.source_kind). An i18n catalog error now points into themessages_fileit came from, and a JsData origin names its Python file. Building a report fails if a range has nosource_kind. The error benchmark's Citry parser is updated to the new numbering. A "JSON report" section in the CLI docs describes it.#240: a server expression that reads a Vue
v-forvariableReading a
v-forvariable from server-side code ({{ }},c-*attributes,c-bind,<c-if>/<c-for>conditions) now raisesVueLoopVariableError(still aKeyError). The message names the tag, template, and line, says the variable exists only in the browser, and suggests<c-for each="member in members">or the Vue form. OtherKeyErrors are unchanged. A destructuredv-forand#c-keyon a plain element still raise a plainKeyError. Troubleshooting docs have a new "Loop variable missing" section.Checks
ruff, mypy (also with
--platform linux), the validators, and the docs build check are clean. Locally, pytest failures come only from the environment (the published citry-core 1.8.0 is missing unreleased Rust changes, plus tzdata and pygments version drift); CI is authoritative.Note for #243: once it's rebased on this,
_unknown_inject_key_findingsneeds_counted_in(..., "file"). #242 will have a text conflict on the JsData origin line.Closes #203. Closes #204. Closes #240.
🤖 Generated with Claude Code