Repository navigation
build: shrink the citry wheel by 27 KB (minified dev check, compact diagnostic table) - #245
Merged
Merged
Conversation
CLAUDE.md and the agent index named only template_parser, safe_eval and html_transform (plus i18n in the index); lib.rs also registers vue and template_formatter. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… arguments (#207) Section 5.1 already says written arguments replace the form's fields; the component-tag section still described a merge that the browser runtime does not do (both paths go through declarativeEventArgs in _vue/client.js). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e emit payload (#207) A listener written as a bare method name, such as @hide="hideCard", is now passed to a generated function typed from the child's emits, so tsc compares the method's parameters with the payload (m60). The props and events guide documents typed emits, which also report a wrong payload at the child's $emit call (m30). Co-Authored-By: Claude Opus 5.5 <[email protected]>
… render errors (#207) 12a: the missing and duplicate #c-key messages now give the template and line for inline templates, template files, slot fills and template-valued attributes, include the repeated value, and explain nested loops; the element-key conflict shares one message with the parser's wording. 12b: when the Vue compiler reports MODEL_HELPER_MISMATCH, the render searches the authored templates the Vue template came from with the invalid-model-target rule and names each element, its template and line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A Secret[T] wraps a server-only value such as an API token. Its text form is ***, so a template never shows it; js_data(), css_data() and State refuse it with an error naming the component and key path; and the citry.js-data.unsupported-type rule reports it statically (annotations, module constants, also nested in literals, and values ty types as Secret). The component options and security guides explain how to keep tokens off the page (m42). Co-Authored-By: Claude Opus 5.5 <[email protected]>
… and variable rules (#207) citry.css.misspelled-class (rule_misspelled_css_class, a warning) reports a static class one slip from a class selector in the component's own CSS that no CSS Citry reads declares (m16). citry.css.undeclared-class and citry.css.undeclared-variable are off by default ("ignore", which the diagnostics schema now allows with a configurable severity) and report every class no CSS Citry reads declares and every var(--x) without a fallback that nothing sets. All three run in citry check with the app loaded. _css_scan.py is the one reader of selectors and custom property declarations. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-checked (#207) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…velopment mode (#207) 12c: with Citry(mode="development"), a hydrating page inlines _vue/dev_checks.js, and the runtime compares each shell's served HTML with Vue's first render and logs a console warning naming the component, the element, the first difference, and the data-allow-mismatch value that silences it (m14). Production pages carry no flag and no script. 12d: in development mode, serialization collects each component's own ids and issues one RuntimeWarning per page listing every id two components (or two renders of one) wrote, with the components and template files (m57). Co-Authored-By: Claude Opus 5.5 <[email protected]>
… m50 (#207) The decisions table records what was built for items 8, 11, 12a-12d, 13, the two off-by-default CSS rules, and 14. Section 15 proposes a check for an inject() key no ancestor provides (m50) for the maintainer to decide. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CSS rules: the misspelled-class rule no longer reports a missing final d/r/n of a word family or a slip in a short first hyphen part (p-4/px-4), reads other components' stylesheets only when a class is one slip from the component's own CSS, and the variable messages say the property gets its initial or inherited value. Secret: constant-time equality for text and bytes; css_data() refuses a Secret even without CSS; a Secret in a cache key gets its own error and is never hashed into the key; citry check also follows attributes, *, both branches of a conditional and Const(); the js-data warning has a Secret message in citry check and the editor; the State error names the class. Development checks: same-tag v-if/v-else branches are paired by their whole subtree within a budget, so a correct page no longer warns; the script is read once; warnings from the repeated-id, CSP and JavaScript policy checks point at the caller's code (_caller_warnings.py). Render errors: an element-key clash names its template, line and column; the v-model search reads template-valued attributes. Prose fixes across the docs, docstrings, messages, changelogs and design docs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Development checks: an agreeing pair outranks any number of differing pairs, a branch rejected only by the quick text check gets a full comparison while budget remains, and the budget now charges the text search (raised to 200,000 steps). Caller warnings work through a symlinked import path and document the Events response case. CSS rule: the final d/r/n exclusion covers only listed UI words (collapse, disable, show, toggle, ...), the short-first-part exclusion covers only a doubled or dropped letter, and a word already ending in s is not excused, so heade, iu-button and progres are reported again. Secret: the static walk reads attributes without running user code, judges only built-in values, survives deep nesting and skips a value a property shadows; equality treats str and bytes subclasses as text; css_data() refuses a nested Secret with or without CSS; the js-data message says a field can hold a Secret. Prose fixes in the docs, changelogs and design docs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The CSS checks, citry.Secret, and the development-mode browser check (_vue/dev_checks.js) grow the wheel to 1,360,663 bytes, 9 KB over the cap the earlier #207 batch set. The cap moves to 1,344 KiB, about 15 KB of headroom. Co-Authored-By: Claude Opus 5.5 <[email protected]>
On Python 3.10, types.SimpleNamespace lists its own C __getattribute__ in its class namespace, so the js_data() Secret check took it for a hook that might run code and left SETTINGS.auth.token unchecked. It runs no user code, so it joins object, type and ModuleType. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pytest puts a test's id in the PYTEST_CURRENT_TEST environment variable, and the deeply nested @media case made it longer than the 32,767 characters Windows allows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # benchmarks/errors/frameworks/citry/framework.toml # docs/design/vue.md
…207) citry.template.unknown-inject-key (rule_unknown_inject_key, a warning) reports a self.inject("key") with a literal key and no default whose key reaches the component from no provider (m50). citry/_provide_keys.py reads every registered template once and walks up from each template that writes the component's tag: <c-provide> keys around the tag, provide() keys of the components on the way, keys around the <c-slot> that shows slot content, and literal render(provides={...}) keys in the project's Python files. A component no template writes falls back to every key the app provides. Paths through a provider Citry cannot read report nothing. citry check runs it with the app loaded; the editor's app worker sends the keys per component class (inject_keys) and the editor reads the calls from the open buffer. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A <c-slot> written in another component's body, and its fallback content, now get that component's slot keys. provide() and inject() calls in base classes and mixins outside Citry and the standard library count, including LibraryComponent definitions. A component that Python builds inside a component's methods, or passes to another component, is no longer checked below that point, and a component used only inside its own cycle of templates falls back to every key the app provides. A render(provides=...) key written as a module constant counts. Slot answers are kept once final, so slots passed through many components stay fast, and a project folder past 20,000 Python files turns the rule off. The messages now say what to do next, the editor tolerates fields a newer worker adds, and the docs list exactly what counts and what is skipped. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A component Python places inside other content is no longer compared with every provided key when no template uses it. Slot answers are worked out once per (component, slot) pair until they stop changing, so slots passed through cycles stay fast. Standard-library classes are found by file location, so a project package named like a standard module is read. A class without a readable class statement counts as providing nothing unless its compiled methods name provide. render(provides=...) keys imported from a loaded module or a project module count. Project files are read one at a time; test files do not hide components, and a component passed to another one through a variable counts as placed. Calls in installed packages are not reported, and a mixin's message names a component that uses it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Only folders inside the project mark a test file, so a project under a folder named tests still finds components Python places. render(provides= ...) keys imported with a relative import, or read from a module imported from a package (from shop import keys), count. The compiled-method check for a class without a readable class statement follows decorators and property accessors. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The inject-key check grows the wheel to 1,377,070 bytes, 814 bytes over the cap. The cap moves to 1,360 KiB, about 15 KB of headroom. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The wheel grew to 1,377,070 bytes over the #207 work. Two generated files carried text the installed package never reads: - The development check now ships as `_vue/dev_checks.min.js`, which the citry-client build writes from the readable `_vue/dev_checks.js` with the same whitespace-only esbuild settings as the prepared coordinator. The readable file stays in the repository and the sdist. A canary test fails when the minified file is stale, and the JS, Python and browser tests run the minified file. - The generated `_diagnostic_catalog.py` keeps only the catalog fields `diagnostic_definition` reads, one compact line per code. The reference page reads `when`, `fix` and `examples` from catalog.json itself. The wheel now measures 1,349,416 bytes. MAX_WHEEL_BYTES stays at 1,360 KiB, which leaves about 43 KB of headroom. Co-Authored-By: Claude Opus 5.5 <[email protected]>
12 tasks
Give hot reload and development mode their own guides: /guides/hot-reload/ covers file reloading only, and /guides/development-mode/ covers Citry(mode="development") and what it turns on. /guides/dev-server/ now redirects to the hot reload page, and every link points at the new pages. On the pages this branch touched, move typing, linting, and error detail out of the main flow into one section near the end of each page: "Keep tokens off the page" now sits before "Check JS code" on Component options, and Props and events gains "Catch mistakes early". The full list of rules for method listeners moves to the VS Code page, and the CSS class rule details move to the template linting page's less common cases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… fix/static-checks-207-inject
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… fix/static-checks-207-inject
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… fix/static-checks-207-inject
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… fix/static-checks-207-inject
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… fix/static-checks-207-inject
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Stacked on #243; merge that first. It shrinks the
citrywheel from 1,377,070 to 1,349,416 bytes (−27,654) after the #207 checks grew it. Import time forcitryis unchanged at a median of about 155 ms.What changes
_vue/dev_checks.js: the readable source stays in the repo and the sdist, likeclient.js. A newbuildCitryDevChecks()step inpackages/js/citry-client/build-support.mjswrites_vue/dev_checks.min.js, using the same esbuild settings asclient.js(comments and whitespace removed). Only the minified file ships. A canary inpnpm checkfails when it is out of date._diagnostic_catalog.py: the file Citry generates fromcatalog.json.scripts/generate_diagnostic_catalog.pynow writes one compact line per code, with only the fields Citry reads at runtime, listed inPYTHON_RUNTIME_FIELDS. The file goes from 204 KB to 57 KB.when,fixandexamplesfields are left out; the docs site reads them fromcatalog.json.catalog.json.PYTHON_RUNTIME_FIELDS.Not done
Other savings would mean renaming identifiers in the shipped JavaScript, which the build deliberately doesn't allow (about 13 KB), or changing the
DiagnosticDefinitionshape (about 4 KB). The PR doesn't take either.Evidence
node --test; andpnpm check.--platform linux.scripts/validate.py, the wheel check, and the full distribution proof, which rebuilds from the sdist and smoke-installs the wheels.🤖 Generated with Claude Code