Skip to content

feat: leave out citry check findings in registered library components - #402

Merged
JuroOravec merged 1 commit into
mainfrom
fix/check-skips-library-findings
Oct 25, 2026
Merged

JuroOravec merged 1 commit into
mainfrom
fix/check-skips-library-findings

Conversation

@JuroOravec

Copy link
Copy Markdown
Member

Fixes #149.

What changes

An app that registers Citry UI used to get about 1,500 citry check errors from Citry UI's own components. The app's author can't change that code, so the check failed on every such app and hid the app's own findings. As the maintainer decided in #149, citry check now leaves out findings in the components of a registered library by default:

  • A finding is left out when every component it belongs to comes from a library installed with register_library(). This applies to the registry check and to --types. Code that two libraries share, such as a theme library built on Citry UI, is left out and counted once.
  • A finding that any app component shares is still reported. That includes a finding in the template, js_data(), JavaScript or CSS that an app's subclass of a library component inherits. For the maintainer: that means an app that subclasses a Citry UI component gets back the inherited template's findings. The docs say so. Tell me if you'd rather leave those out too.
  • One note says how many findings it left out and which libraries they came from, so the skip isn't silent:
    citry check: note: left out 1505 findings in components from the registered library 'citry-ui'; pass --include-libraries to report them
    The note is also in the JSON report's notes. The JSON schema is unchanged.
  • The exit status counts only the findings it reports.
  • --include-libraries, or LintSettings(include_libraries=True), reports them too. A non-bool setting raises TypeError when the settings are created.
  • Citry UI's own tests run the check with --include-libraries: test_component_javascript_names.py and test_citry_ui_type_check.py.

How a finding is traced to its components: the checker already names each finding's place as text. That is a component's import path with an attribute, a file path with a component in brackets, a file path with a line and column, or <file>::<Class>.messages. _LibraryOwners traces it in this order:

  1. A component named in brackets is the one the finding is about.
  2. Otherwise the file: each template, script, stylesheet and messages file maps to the components that use it, and each Python file to the components defined in it.
  3. Last, the longest component import path the origin starts with.

A finding that it can't trace to any component, such as i18n catalog or a catalog package's package:path messages file, is kept. Known limit: a --types finding in an inline template that an app subclass inherits from a library inside the workspace is placed in the library's file, so it is left out. --types already skips installed packages.

Docs

  • A new "Library components" section in docs_site/content/advanced/cli.md (#check-library-components).
  • The LintSettings.include_libraries docstring.
  • The citry check command docstring.
  • A CHANGELOG entry under Unreleased > Changed.

Tests

  • packages/py/citry/tests/test_check_libraries.py, new:
    • library findings are left out and counted while the app's own finding still fails the check;
    • an app that only registers a library checks clean;
    • the argument and the setting each report them;
    • a subclass of a library component keeps its findings;
    • the setting rejects a non-bool;
    • the command prints the note and exits 0;
    • --include-libraries --format json reports them.
  • packages/py/citry_ui/tests/test_citry_ui_registration.py::test_an_app_that_only_registers_citry_ui_checks_clean: the guard the issue asked for. A minimal app that registers Citry UI checks with zero findings, exit status 0, and the note. It uses the existing in-process check, so it adds no extra run.
  • Also: a subclass finding in inherited js_data() code stays the app's, and code two libraries share is left out once. Both fail without the fix.

Evidence (local)

  • Full citry and citry_ui suite (-m "not e2e"): 9,771 passed. One failure is local only: test_citry_ui_type_check.py::test_the_editor_accepts_digit_inputs_as_text_or_numbers gets no ty findings in my environment. It fails the same way on my main checkout and passes in CI.
  • citry_lsp: 842 passed.
  • docs_site (not e2e): 1,134 passed. The docs now also say where the setting sits among the LintSettings fields (ide/template-linting.md) and how a library checks itself (advanced/component-libraries.md). test_extract_first_party_security_error fails only in my scratch worktree, because the installed citry_core comes from a different checkout. It passes in the main checkout.
  • uv lock, ruff, ruff format, mypy (also --platform linux), the protocol phases and the validators pass.
  • This change touches no JavaScript or generated copies.

PR CI runs the cargo phases and the full matrix.

A follow-up PR will propose a check-only way for a component to declare its template-data keys, so the checker can verify Citry UI's own templates with the flag on. That adds a public option, so the proposal comes first.

🤖 Generated with Claude Code

An app that registers Citry UI got about 1,500 citry check errors from
Citry UI's own components, which the app's author cannot change, so the
check failed on every such app and the app's own findings were lost in
the noise.

citry check now leaves out findings whose components all come from
libraries installed with register_library(), from both the registry
check and --types, and prints one note with how many it left out and
which libraries they came from. The exit status counts only the findings
it reports. --include-libraries, or LintSettings.include_libraries=True,
reports them too; Citry UI's own tests pass the flag. A finding that any
app component shares is still reported, such as one in a template or
js_data() that a subclass of a library component inherits.

A minimal app that registers Citry UI now checks clean.

Fixes #149

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@JuroOravec
JuroOravec merged commit c5fad0f into main Oct 25, 2026
18 of 29 checks passed
@JuroOravec
JuroOravec deleted the fix/check-skips-library-findings branch October 25, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

citry check reports ~1,600 errors on any app that registers citry_ui

1 participant