Skip to content

Guard against cyclic theme colour references - #13046

Merged
ErikMelton merged 1 commit into
omacom:quattrofrom
AFOliveira:fix/color-reference-cycles-20260923
Sep 25, 2026
Merged

ErikMelton merged 1 commit into
omacom:quattrofrom
AFOliveira:fix/color-reference-cycles-20260923

Conversation

@AFOliveira

Copy link
Copy Markdown
Member

Cyclic theme colour references could recurse indefinitely. Track visited references and use the existing fallback when a cycle is encountered.

Validation: regression tests and disposable desktop VM checks passed.

Basecamp: report and tracking card

Resolve color references iteratively and use the caller's fallback when a reference repeats. Preserve normal palette roles, color parsing and gradient first stops.

Reported-by: Aleksej <aleksejhairov@yandex.ru>
@llstrk

llstrk commented Sep 24, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Verified: No issue found in the reviewed scope. For every reference chain that previously terminated, the new loop in flatColor returns the same result as the old recursion. For every chain that previously cycled, it returns the caller's fallback. The new test passes on this head and fails on the merge base.

shell.toml input Merge base This PR
[bar] background = "menu.background" and [menu] background = "bar.background" RangeError: Maximum call stack size exceeded fallback colour
Padded or gradient-led self-reference under [bar], e.g. background = " bar.background " or "45deg bar.background #fff" RangeError fallback colour
Exact self-reference under [bar]: background = "bar.background" fallback colour (existing !== guard) fallback colour
Acyclic chain ending in a colour or palette role resolved colour same resolved colour
Missing reference or empty value fallback colour fallback colour

The merge-base and PR columns come from evaluating the extracted Color.qml functions under Node. A differential run over 23,375 generated reference maps found no result differences on terminating inputs, and head returned the fallback in every case where the merge base overflowed.

Context: In the QML shell, Qt's JavaScript engine turns the runaway recursion into a RangeError that the property binding catches. The affected surface then keeps its previous colour and a warning is logged, rather than the shell hanging. This is inferred from Qt Declarative source, not observed in a running shell. No shipped theme contains a cycle; one arises only from hand-written shell.toml references.


Review information

Test scope: Source review of this head and the merge base. The new test and the differential comparison ran in an isolated command-only sandbox with Node 24.21.0 and 26.10.0. The QML shell was not launched, and the author's desktop VM checks were not reproduced.

AI process: Opus 5.5 Medium coordination and synthesis, independent Opus 5.5 Xhigh and GPT 6 Sol Xhigh technical assessments, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

@ErikMelton
ErikMelton merged commit b5aa835 into omacom:quattro Sep 25, 2026
@ErikMelton

Copy link
Copy Markdown
Member

Reported-by: Aleksej aleksejhairov@yandex.ru. Please include this in the cherry-pick.

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.

4 participants