Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorRules::ValidationIssue Struct Reference

One semantic compatibility issue between a rule's match and an action. More...

#include <PhosphorRules/Rule.h>

Public Types

enum class  Code : int { ContextActionWithWindowMatch = 0 , TerminalActionWithEffectActions = 1 , DuplicateSlotActions = 2 , IncompleteActionPayload = 3 }
 Wire-stable code so callers can localise the message themselves without string-matching the diagnostic. More...

Public Member Functions

bool operator== (const ValidationIssue &other) const

Public Attributes

Code code = Code::ContextActionWithWindowMatch
int actionIndex = -1
 Index into the rule's actions list — points at the offending action.
QString actionType
 Action type id for diagnostics (avoids the caller re-indexing actions).
QString message
 English diagnostic suitable for logging.

Detailed Description

One semantic compatibility issue between a rule's match and an action.

Issues are produced by Rule::validationIssues — distinct from the isValid() structural check, which only verifies that each action's params pass its descriptor. A rule can be valid (every action registered, every param well-formed) and still be diagnosable here: e.g. a SetEngineMode (context-domain) action paired with a match that references a window property silently never fires during context resolution.

The loader keeps such rules — silently dropping a hand-edited rule is hostile — but logs a warning per issue, and the settings UI surfaces them so the user can see why a rule never fires. The picker UI uses the same domain metadata to gray out incompatible action types up front.

Member Enumeration Documentation

◆ Code

enum class PhosphorRules::ValidationIssue::Code : int
strong

Wire-stable code so callers can localise the message themselves without string-matching the diagnostic.

New codes append; never renumber.

Enumerator
ContextActionWithWindowMatch 

A context-domain action (e.g.

SetEngineMode / SetSnappingLayout / SetTilingAlgorithm / DisableEngine) paired with a match that references window-property fields. The match fails during context resolution (window fields are absent on the windowless query), so the action's slot is never filled.

TerminalActionWithEffectActions 

The blanket Exclude on the same rule as one or more other slot-filling actions (border / opacity / animation override, but also gap / overlay / engine actions).

Exclude is in every full-store evaluator's terminal scope, so it stops the resolve walk the moment it matches: the co-located action's slot may be dropped and lower-priority rules are suppressed for the window. Split the exclusion onto its own rule. The SCOPED exclusions (ExcludePlacement / ExcludeDecorations / ExcludeAnimations) are not flagged — an evaluator outside their slice skips them entirely (RuleEvaluator::setTerminalActionScope), so mixing one with an action of another domain is authorable. (Name kept for wire stability; the check is not limited to Tag::Effect actions.)

DuplicateSlotActions 

Two or more SAME-TYPE actions on one rule resolve to the same slot.

Slot decoding is single-winner per (rule, type), so at most one of the duplicates takes effect (which one depends on the consumer's decode order) and the rest are dead weight. Distinct types sharing a slot (the SetSnappingLayout / SetTilingAlgorithm lossless pair) are NOT flagged. The flagged shape is what a buggy rule rebuild accretes, so surfacing it keeps such growth from surviving save/load silently.

IncompleteActionPayload 

An action whose type is registered but whose params the descriptor rejects — most often a picker the author has not filled in yet (a rule template seeds an empty screen / layout / algorithm id).

Such an action is DROPPED by RuleAction::fromJson, so saving the rule would silently lose it.

Never produced by Rule::validationIssues: a Rule already holds parsed actions, so a rejected payload cannot reach it. It is the settings editor's live check over the working rule's raw JSON, which is the only place the pre-parse shape exists. Declared here so the code vocabulary the UI switches on has one home.

Member Function Documentation

◆ operator==()

bool PhosphorRules::ValidationIssue::operator== ( const ValidationIssue & other) const
inline

Member Data Documentation

◆ actionIndex

int PhosphorRules::ValidationIssue::actionIndex = -1

Index into the rule's actions list — points at the offending action.

◆ actionType

QString PhosphorRules::ValidationIssue::actionType

Action type id for diagnostics (avoids the caller re-indexing actions).

◆ code

Code PhosphorRules::ValidationIssue::code = Code::ContextActionWithWindowMatch

◆ message

QString PhosphorRules::ValidationIssue::message

English diagnostic suitable for logging.

UI callers that need translation key off code instead.


The documentation for this struct was generated from the following file:
  • phosphor-rules/include/PhosphorRules/Rule.h