From: sashiko-bot@kernel.org
To: "Ahmed S. Darwish" <darwi@linutronix.de>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nicolas Schier" <nsc@kernel.org>,
"Julian Braha" <julianbraha@gmail.com>,
"Emanuele Rocca" <ema@debian.org>,
"Clark Williams" <clrkwllms@kernel.org>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Ingo Molnar" <mingo@redhat.com>
Cc: "Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
"Frederic Weisbecker" <frederic@kernel.org>,
"John Ogness" <john.ogness@linutronix.de>,
"Derek Barbosa" <debarbos@redhat.com>,
"Zbigniew Jędrzejewski-Szmek" <zbyszek@amutable.com>,
"Daan De Meyer" <daan.j.demeyer@gmail.com>,
"Luca Boccassi" <luca.boccassi@gmail.com>,
linux-rt-devel@lists.linux.dev, debian-kernel@lists.debian.org,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 05/11] kconfig-audit: Split policy schema for component reuse
Date: Fri, 04 Dec 2026 22:50:13 +0000 [thread overview]
Message-ID: <sashiko-outbox-250777@kernel.org> (raw)
In-Reply-To: <20261203224916.118064-6-darwi@linutronix.de>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Low] kconfig-audit: deprecated RefResolver in
SchemaFile._create_validator()
- [Low] kconfig-audit: symlinked schemas break $ref in
SchemaFile.parse()
- [Low] kconfig-audit: uncaught RefResolutionError in
Helpers.validate_yaml()
--
commit 754cf81ebb9a7fce9acd73e9326b44ad0a081fd7
Author: Ahmed S. Darwish <darwi@linutronix.de>
kconfig-audit: Split policy schema for component reuse
This commit extracts the common rule schema into schema/rule.yml so
policy-v1.yml can reference it via $ref, and updates audit.py to build a
Draft7Validator with a local file:// RefResolver for sibling schema
files.
> diff --git a/tools/kconfig-audit/audit.py b/tools/kconfig-audit/audit.py
> index eac25740becab..94ff427715d11 100755
> --- a/tools/kconfig-audit/audit.py
> +++ b/tools/kconfig-audit/audit.py
[ ... ]
> @@ -249,12 +249,7 @@ class Helpers:
> def validate_yaml(yaml: YamlDict, schema: Schema, f_name: str) -> None:
> """Validate a parsed YAML mapping against passed JSON Schema"""
> try:
> - # For regex validation, manually enforce a format checker
> - jsonschema.validate(
> - yaml,
> - schema,
> - format_checker=jsonschema.FormatChecker(),
> - )
> + schema.validator.validate(yaml)
> except jsonschema.exceptions.ValidationError as e:
> error(
> f'{f_name} does not match its schema\n'
[Severity: Low]
Should validate_yaml() also catch jsonschema.exceptions.RefResolutionError?
Draft7Validator.check_schema() only validates metaschema grammar, so $ref
targets are resolved lazily during schema.validator.validate(). Because
RefResolutionError does not inherit from ValidationError, a broken $ref
escapes with a traceback and exit status 1 instead of os.EX_DATAERR.
[ ... ]
> def parse(self) -> Schema:
> """Parse and validate a policy schema file"""
>
> - schema = Schema(self.yaml)
> + rule_schema_f = self.schema_f.parent / 'rule.yml'
> + rule_schema_y = Helpers.load_yaml(rule_schema_f)
> +
> + self._check_schema(rule_schema_f, rule_schema_y)
> + self._check_schema(self.schema_f, self.schema_y)
> +
> + validator = self._create_validator({
> + rule_schema_f.resolve().as_uri(): rule_schema_y,
> + })
[Severity: Low]
Can resolving rule_schema_f and self.schema_f independently break $ref
lookup when schema files are symlinked?
If policy-v1.yml or rule.yml is individually symlinked to a different
directory or basename (as in Nix or symlink-farm packaging), resolving
rule.yml relative to base_uri in _create_validator() will miss the
preloaded store key and fall back to remote loading, failing validation.
Resolving self.schema_f.parent once and deriving both URIs from that
directory would keep base_uri and the store keys aligned.
[ ... ]
> + def _create_validator(self, store: dict[str, YamlDict]) -> YamlValidator:
> + """Create a schema validator for resolving sibling '$ref' entries"""
> +
> + resolver = jsonschema.RefResolver(
> + base_uri=self.schema_f.resolve().as_uri(),
> + referrer=self.schema_y,
> + store=store,
> + )
> +
> + return jsonschema.Draft7Validator(
> + self.schema_y,
> + resolver=resolver,
> + # For regex entries validation, manually enforce a format checker
> + format_checker=jsonschema.FormatChecker(),
> + )
[Severity: Low]
Will jsonschema.RefResolver and the resolver= argument emit deprecation
warnings on jsonschema >= 4.18.0?
Both were deprecated in favor of referencing.Registry passed via registry=.
Because audit.py runs as __main__, Python's default warning filter prints
both DeprecationWarning messages to stderr on every run, and fails under
python3 -W error or once jsonschema removes RefResolver.
Preferring referencing.Registry when available and falling back to
RefResolver for older jsonschema would avoid the warnings while keeping
compatibility.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203224916.118064-1-darwi@linutronix.de?part=5
next prev parent reply other threads:[~2026-12-04 22:50 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 22:49 [PATCH v2 00/11] tools: Introduce a kernel configuration checker Ahmed S. Darwish
2026-12-03 22:49 ` [PATCH v2 01/11] kconfig-audit: Add schema for policy files Ahmed S. Darwish
2026-12-04 22:50 ` sashiko-bot
2026-12-03 22:49 ` [PATCH v2 02/11] kconfig-audit: Introduce a PREEMPT_RT configuration policy Ahmed S. Darwish
2026-12-04 22:50 ` sashiko-bot
2026-12-03 22:49 ` [PATCH v2 03/11] kconfig-audit: Add the configuration checker code Ahmed S. Darwish
2026-12-04 22:50 ` sashiko-bot
2026-12-03 22:49 ` [PATCH v2 04/11] Documentation: Describe kconfig-audit usage and design Ahmed S. Darwish
2026-12-04 22:50 ` sashiko-bot
2026-12-03 22:49 ` [PATCH v2 05/11] kconfig-audit: Split policy schema for component reuse Ahmed S. Darwish
2026-12-04 22:50 ` sashiko-bot [this message]
2026-12-03 22:49 ` [PATCH v2 06/11] kconfig-audit: Introduce policy overlays schema Ahmed S. Darwish
2026-12-04 22:50 ` sashiko-bot
2026-12-03 22:49 ` [PATCH v2 07/11] kconfig-audit: Add support for policy overlays Ahmed S. Darwish
2026-12-04 22:50 ` sashiko-bot
2026-12-03 22:49 ` [PATCH v2 08/11] Documentation: kconfig-audit: Describe " Ahmed S. Darwish
2026-12-04 22:50 ` sashiko-bot
2026-12-03 22:49 ` [PATCH v2 09/11] MAINTAINERS: Add entry for kernel configuration audit Ahmed S. Darwish
2026-12-03 22:49 ` [PATCH v2 10/11] kconfig: Introduce auditconfig target Ahmed S. Darwish
2026-12-04 22:50 ` sashiko-bot
2026-12-03 22:49 ` [PATCH v2 11/11] Documentation: Describe auditconfig build target Ahmed S. Darwish
2026-12-04 22:50 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-250777@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=clrkwllms@kernel.org \
--cc=daan.j.demeyer@gmail.com \
--cc=darwi@linutronix.de \
--cc=debarbos@redhat.com \
--cc=debian-kernel@lists.debian.org \
--cc=ema@debian.org \
--cc=frederic@kernel.org \
--cc=john.ogness@linutronix.de \
--cc=julianbraha@gmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=luca.boccassi@gmail.com \
--cc=mingo@redhat.com \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=rostedt@goodmis.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zbyszek@amutable.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox