Skip to content

fix: split the bloom blur so every toolchain can type-check it - #1

Merged
oddurs merged 1 commit into
mainfrom
fix/bloom-blur-typecheck
Sep 11, 2026
Merged

oddurs merged 1 commit into
mainfrom
fix/bloom-blur-typecheck

Conversation

@oddurs

@oddurs oddurs commented Sep 11, 2026

Copy link
Copy Markdown
Owner

Problem

The first CI run on main failed to build:

Sources/Windflow/Canvas.swift:449:9: error: the compiler is unable to
type-check this expression in reasonable time

blurBloom inlined the index arithmetic for both blur passes into two nested
withUnsafeMutableBufferPointer closures. Swift 6.3.1 locally handles it; the
toolchain on the macos-15 runner gives up. Green locally, red in CI — the
worst failure mode for a build only one machine ever compiles.

Approach

The two passes are now blurRows and blurColumns: static methods with
explicit signatures, with the incoming and outgoing indices of the sliding
window as named locals rather than sub-expressions. Nothing left is large enough
to strain inference. The loop structure and the arithmetic are unchanged.

Look at this sceptically

  • Is it really behaviour-preserving? The composited frame is byte-identical
    before and after at a fixed seed (WINDFLOW_SEED=99, 800×450, t=20s). The
    paint checksum alone would not have proved this — bloom never touches the
    paint buffer — so the comparison is of the final PNG.
  • This class of bug can recur. Nothing stops the next deeply nested
    expression from tripping a different toolchain, and CI is the only thing that
    would catch it. The composite loop in the same file nests nine closures and is
    the obvious next candidate.

Swift 6.3.1 compiles the nested closure fine; the toolchain on the macOS runner
gives up on it, which is the worst way to find out — green locally, red in CI.

The two passes are now separate methods with explicit signatures and the index
arithmetic hoisted into named locals, so nothing in the expression is large
enough to strain inference. The composited frame is byte-identical before and
after at a fixed seed.
@oddurs
oddurs merged commit a989a16 into main Sep 11, 2026
2 checks passed
@oddurs
oddurs deleted the fix/bloom-blur-typecheck branch September 11, 2026 06:07
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