Repository navigation
feat(core): exact Vue syntax errors, parser-marked prop writes, declared directives and inheritAttrs; citry-core 1.9.0 (#207) - #244
Merged
Conversation
The OXC browser analysis now reports what the Vue rules guessed before: - `analyze_browser_source` returns the parser's first syntax error (message and UTF-8 byte range in the authored text), taken from a second parse of the authored text alone, and marks each free name as written or read using OXC's own reference flags. - Text that closes the generated wrapper function, such as `a); (b`, is now invalid in both modes. - `analyze_component_source` marks member writes (`this.open = false`), reads the `directives` option like `emits`, and reports each call's `inheritAttrs` when the source proves it. The result structs become `#[pyclass(frozen, eq)]` records with a Python-style `__repr__`, so the PyO3 glue can return them directly. `oxc_diagnostics` (already in the lock graph at 0.143.0) is now a pinned workspace dependency so the error mapping can name its type. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`template_parser.analyze_browser_source()` and `analyze_component_source()` now return `BrowserAnalysis` and `BrowserComponentAnalysis` records instead of tuples. The eleven record classes are registered in the `template_parser` submodule, re-exported from `citry_core.template_parser`, and stubbed in `_rust.pyi` from the Rust structs; a test keeps the stub's fields equal to what Python reads. citry's wrappers, the render-time instance check, and the `vue_variables` validation read the records. The wrappers gain the syntax error, write flags, declared directives, and `inheritAttrs`, with defaults, so their callers keep working. citry-core moves to 1.9.0 and citry pins `citry-core==1.9.0` in the same change, as docs/codebase.md requires. The distribution test reads the version from the manifest instead of a copied literal. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ared directives, inheritAttrs (#207) - `citry.vue.invalid-expression` names the JavaScript parser's message (new catalog variant `parser`, parameter `detail`) and spans the token it points to. An error at the end moves back to the last character written; an expression with a character reference keeps the whole range and the generic message. Findings carry the whole expression as `context_start_index`/`context_end_index`, which the Vue compiler rule's duplicate filter compares against. - `citry.browser.prop-assignment` uses the parser's write flags instead of reading the text after a name, so a write in component JavaScript now follows the rule's severity. This changes the earlier "at most a warning" contract on purpose; the tests are updated. - `citry.template.misspelled-directive` skips a `v-*` name that every rendering component registers in `directives`, under Vue's lookup. - `citry.template.missing-image-alt` reports a component's single root `<img>` when its JavaScript proves `inheritAttrs: false`. Catalog, generated bindings, docs, and changelogs move with the rules. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t quiet on narrowed expression errors - The engine fills `declared_directives` and the image rule's `root_may_receive_attributes` from each owner's current JavaScript once the application is loaded. The analysis is cached by JavaScript text, so a lint pass over unchanged text reuses it. - A narrowed `citry.vue.invalid-expression` diagnostic carries the whole expression in `Diagnostic.data` (`expressionRange`), and `map_type_check_findings` uses it to drop a TypeScript error elsewhere in the same expression. Malformed data falls back to the range. - citry-lsp now requires citry>=0.6.1, the release that carries these fields, so the release plan publishes citry first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Folds #239's unreleased citry-core fix (NUL escaping) into the 1.9.0 release notes, and moves the error benchmark's citry-core override to 1.9.0 with citry's pin, as its test requires. That baseline's uv.lock can only be refreshed once citry-core 1.9.0 is on PyPI. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…se keeps a parent's alt off the root image Browser evidence for the two skips the checks now make: a component that registers `iff` and `myDir` renders `v-iff` and `v-my-dir` without the unregistered-directive error, and a root `<img>` in a component with `inheritAttrs: false` never receives a parent's bound `alt`, server-side or after Vue mounts or hydrates, while a control component does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… no TypeScript error Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The directive skip is decided per component: a `v-*` name is reported
for the components that do not register it and do not ignore the rule,
with their severity, so an ignoring component no longer blocks the skip.
- A broken listener reports the error from whichever parse got further,
so `function () { a +* b }` is not blamed for a missing name. A parser
error at the end of the text moves back over spaces and comments to the
last token.
- An error the standalone parse raises only because it runs at the top
level, such as `new.target`, no longer hides the author's mistake.
- The records hash by value, and `__repr__` quotes strings as Python does.
- `BrowserSyntaxError` and `BrowserDirectiveName` are exported from
`citry.analysis`.
- The editor test now uses an expression TypeScript reports on its own,
so it proves the `Diagnostic.data` filter is needed.
- citry-lsp's `citry>=` floor stays 0.6.0 until the release pull request
sets citry to 0.6.1: the editor refuses a Citry below
`MINIMUM_CITRY_VERSION`, including this workspace's. citry-lsp's
AGENTS.md now says what moves together.
- Prose: app-only skips stated, the catalog lists all three directive
lookups, design doc and docstrings updated, wording fixes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pes the wrapper The rule that prefers the wrapped parse's error over an earlier standalone one made `a))`, `a) b` and `a } b c` report a statement message from the generated code. The standalone error now stays when it sits on a closing `)`, `]` or `}`, the only way the wrapped parse gets past it; otherwise an earlier standalone error, such as `new.target` (now also at the end of the text), gives way to the wrapped one. These inputs are locked in the tests. Also: an end-of-text range falls back to the last character when a quote inside a regular expression looks like an unterminated string, and the record `__repr__` comment states where it differs from Python. Co-Authored-By: Claude Opus 5.5 <[email protected]>
12 tasks
JuroOravec
added a commit
that referenced
this pull request
Oct 22, 2026
#244 raised citry's pin to citry-core==1.9.0 but left the distribution verifier expecting 1.8.0, so every citry wheel check failed with "unexpected runtime dependencies". The verifier now reads citry-core's own [project] version, and a test checks that citry pins that release. 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.
Exact Vue syntax errors, parser-marked prop writes, declared directives, and inheritAttrs (#207 items 9 and 10)
This implements items 9 and 10 of
docs/design/issue_207_proposals.md(Option 1 for both) and theinheritAttrsextension for benchmark case m53 (an<img>withoutalt). It changes citry-core's Python surface, so it releases citry-core 1.9.0 together with the citry that pins it.What a developer sees
v-if="open &&"now reads "The Vue expression in 'v-if' is not valid JavaScript (Unexpected token), so Vue cannot compile this template." The editor underlines the last&instead of the whole value. A brokenfunction () {...}listener is blamed for its own mistake, not for a missing function name. An expression that contains a character reference such as&keeps the whole range and the message without a parser error, because positions in the decoded text do not match the template.open /* note */ = falseand[open] = pairare now reported;openfollowed by--counton the next line is not. A write in component JavaScript, such asthis.open = false, now followsrule_prop_assignmentlike a template write. Before, it was capped at a warning; the tests that encoded that cap are updated on purpose.v-iffpasses when every component that renders the template registersiffin$component({ directives }), under Vue's lookup (my-dir,myDir,MyDir). A shared template is still reported for each component that does not register the name, with that component's severity, and so is an option Citry cannot read.citry check --staticand an editor without the application still report it.inheritAttrs: falsemakes a root<img>without alt reportable (with the application loaded). Vue then never passes a parent'saltto it. AninheritAttrsvalue Citry cannot read counts as passingalton, so the rule stays quiet.How it works
analyze_browser_sourceparses the authored text inside a generated async function to find free names, as before. When that fails, or when the text closes the generated function (a); (b, now invalid), the error comes from a second parse of the authored text alone. Each free name carries the write flag of OXC, the Rust JavaScript parser the analysis uses. An error the top-level parse raises only because it runs outside a function, such asnew.target, gives way to the wrapped parse's error, unless it sits on a stray),]or}that closes the generated function.analyze_component_sourcemarks member writes, readsdirectivesthe same way it readsemits, and reports each call'sinheritAttrs.BrowserAnalysis,BrowserComponentAnalysis, and nine more) that compare and hash by value. The tuple shapes are gone, so a later field will not break callers again. A test keeps the hand-written_rust.pyistub equal to the fields Python reads.inheritAttrsfacts, cached by the JavaScript text. A narrowed syntax diagnostic carries the whole expression inDiagnostic.data(expressionRange), and the TypeScript duplicate filter uses it. That is needed: for@click="startDrag('a');;let x = 1; let x = 2", TypeScript reports the type error at'a', away from Citry's finding on the secondx; an integration test shows TypeScript reporting it alone and nothing once Citry's diagnostic is passed.Checks run before merging
return ++this.value), where the old guess was wrong.iffandmyDirrendersv-iffandv-my-dirwithout the unregistered-directive error.inheritAttrs: false, a parent's boundaltreaches the root<img>neither in the server HTML nor after Vue mounts or hydrates; a control component does receive it.analyze_browser_sourcecall (about one microsecond) and 2% peranalyze_component_sourcecall. That is under the 10% slowdown the design allowed, so the records stay.Release
citry-core==1.9.0, in this change. This is a breaking change in a minor release, following the 1.8.0 precedent.declared_directives,context_start_index), so citry-lsp must requirecitry>=0.6.1before it is released. Its floor stayscitry>=0.6.0here, because the editor refuses a Citry older thanMINIMUM_CITRY_VERSION, and this workspace's citry is still 0.6.0. The release pull request must set citry's version to 0.6.1 and, in the same change, raise citry-lsp'scitry>=requirement,MINIMUM_CITRY_VERSIONincitry_lsp/protocol.py, and the expected entry inscripts/verify_citry_lsp_distribution.py(see the new note inpackages/py/citry_lsp/AGENTS.md). The raised floor also makes the release plan publish citry before citry-lsp.citry-core,citry,citry-lsp; qualification uses the citry-core wheel built from the same commit. Then rungh workflow run repo--release.yml -f candidate_run_id=<run-id>.benchmarks/errors/frameworks/citry/baseline/uv.lock. Its override already says 1.9.0, as its test requires, and the benchmark runner refuses the stale lock until then.Rebuild after pulling
The extension's Python interface changed. After pulling, rebuild it before running anything:
Running
.venv/bin/pytestoruv run --no-syncagainst an extension built before this change fails withAttributeErroron a tuple, at app startup whenvue_variablesorcomponent_js_globalsis set, and in renders and lint.🤖 Generated with Claude Code