Skip to content

schema: add diff-impact CLI (Phase 2+3 of schema-diff) - #21

Merged
Paritsingla7 merged 1 commit into
mainfrom
feat/schema-diff-impact-cli
Aug 29, 2026
Merged

Paritsingla7 merged 1 commit into
mainfrom
feat/schema-diff-impact-cli

Conversation

@Paritsingla7

Copy link
Copy Markdown
Owner

Summary

Builds on #20 (the diff engine + real schema corpus). This adds the layer that makes it a usable feature rather than a library: cross-referencing what changed between two schemas against what a specific config actually uses.

  • hyprvalidate/schema/impact.py — find_used_symbols() collects config keys, dotted hl.* calls, and spec-table constructor fields a config references; compute_impact() cross-references that against a SchemaDiff.
  • hyprvalidate diff-impact <config> --from A.json --to B.json — new CLI command. Informational by default (exit 0 even when it finds something, since this reports what changed, not confirmed breakage); --fail-on-impact opts a CI job into gating on it.

Verified against the real regression

A config constructing hl.permission({ allow = "yes", ... }), diffed from v0.55.0's schema to v0.55.1's (the exact version transition where allow broke), reports:

[possible_rename] 'allow' on HL.PermissionSpec no longer exists - possibly renamed to 'mode' (heuristic guess, not confirmed)

The same diff run against a config that never touches hl.permission reports nothing — same two schema versions, different result, because the cross-reference is doing its job.

Documented gap, not silently overclaimed

This only sees fields written into a spec-table constructor (hl.monitor({ mode = ... })) — not fields read off a runtime object handed to a callback (e.g. win.class inside an hl.on(...) handler), which is the actual shape of the real HL.Window over_fullscreen regression this whole feature was scoped around (see #20's description). Tracing that needs real type-flow inference — which event name a handler is registered for, what payload type that event carries — that this doesn't attempt. Called out explicitly in the module docstring and CHANGELOG rather than left implicit.

Test plan

  • pytest tests/ — 214 passed (3 pre-existing/environmental entry-point failures unrelated, deselected)
  • End-to-end CLI smoke test against the real allow → mode regression, both default (exit 0) and --fail-on-impact (exit 1)
  • Confirmed an unrelated config reports nothing against the same two schemas

Cross-references what changed between two schemas against what a
specific config actually uses (hyprvalidate/schema/impact.py), rather
than reporting Hyprland's whole API surface diff - the difference
between a usable feature and noise, given how large that surface is.

New `hyprvalidate diff-impact <config> --from A.json --to B.json`
command, informational by default (exit 0 even when it finds
something) since this reports what changed in the schema, not
confirmed breakage; --fail-on-impact opts a CI job into gating on it.

Verified end-to-end against the real hl.permission{} allow -> mode
regression (Hyprland#14400): a config constructing
hl.permission({ allow = ... }) is flagged with the rename guess and
nothing else; a config that never touches hl.permission at all, diffed
against the exact same two schema versions, reports nothing.

Documented gap, not silently overclaimed: this only sees fields
*written* into a spec-table constructor (hl.monitor({ mode = ... })),
not fields *read* off a runtime object handed to a callback (e.g.
win.class inside an hl.on(...) handler) - which is the actual shape of
the real HL.Window over_fullscreen regression this feature was scoped
around. Tracing that needs real type-flow inference (which event name
a handler is registered for, what payload type that event carries)
this doesn't attempt.
@Paritsingla7
Paritsingla7 merged commit 110afae into main Aug 29, 2026
6 checks passed
@Paritsingla7 Paritsingla7 mentioned this pull request Aug 29, 2026
2 tasks done
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.

1 participant