Skip to content

fix(build): annotate ThumbHash cosine tables so Swift 6.3.3 can type-check them - #608

Merged
Quick104 merged 1 commit into
Silo-Server:mainfrom
timmyconnect:fix/thumbhash-type-check
Oct 7, 2026
Merged

Quick104 merged 1 commit into
Silo-Server:mainfrom
timmyconnect:fix/thumbhash-type-check

Conversation

@timmyconnect

@timmyconnect timmyconnect commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A — narrow fix

main does not build with Xcode 26.6 (17F113, Apple Swift 6.3.3, swiftlang-6.3.3.1.3) on an Apple Silicon Mac. At 0a4cce3, the Silo, SiloTV and SiloMac schemes all fail with the same two errors:

iosApp/iosApp/Components/ThumbhashImage.swift:173:23: error: the compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
iosApp/iosApp/Components/ThumbhashImage.swift:178:23: error: the compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
** BUILD FAILED **

The expressions are the nested flatMap/map closures that build fxTable and fyTable in ThumbHashDecoder, added in #603.

The "Apple regression" workflow passed on 0a4cce3. Its workflow file pins Xcode 26.3, so this looks specific to the newer compiler. I did not test Xcode 26.3 locally.

Approach

Give both tables and their closures explicit types ([Float32], Int parameters, Float32 results) so the compiler has nothing to infer. The change is four lines in one file and does not change behaviour.

The let annotation alone is enough to compile. I kept the closure signatures as well so that each closure type-checks on its own.

Validation

Platforms affected: iOS, tvOS and macOS (build only). All commands ran locally with Xcode 26.6 after cd iosApp && xcodegen generate.

Before the fix, at 0a4cce3:

  • xcodebuild -project Silo.xcodeproj -scheme SiloMac -destination 'platform=macOS' -configuration Debug build: ** BUILD FAILED ** with the two errors above
  • xcodebuild build -project Silo.xcodeproj -scheme Silo -destination 'platform=iOS Simulator,name=iPhone 17 Pro' CODE_SIGNING_ALLOWED=NO: ** BUILD FAILED **, same two errors
  • xcodebuild build -project Silo.xcodeproj -scheme SiloTV -destination 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' CODE_SIGNING_ALLOWED=NO: ** BUILD FAILED **, same two errors

After the fix, at 9e0fddb:

  • xcodebuild build -project Silo.xcodeproj -scheme SiloMac -destination 'platform=macOS': ** BUILD SUCCEEDED **
  • xcodebuild build -project Silo.xcodeproj -scheme Silo -destination 'platform=iOS Simulator,name=iPhone 17 Pro' CODE_SIGNING_ALLOWED=NO: ** BUILD SUCCEEDED **
  • xcodebuild test -project Silo.xcodeproj -scheme Silo -destination 'platform=iOS Simulator,name=iPhone 17 Pro' CODE_SIGNING_ALLOWED=YES CODE_SIGN_IDENTITY=-: Executed 2519 tests, with 0 failures (0 unexpected), ** TEST SUCCEEDED **
  • xcodebuild test -project Silo.xcodeproj -scheme SiloTV -destination 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' -only-testing:SiloTVTests -parallel-testing-enabled NO CODE_SIGNING_ALLOWED=YES CODE_SIGN_IDENTITY=-: Executed 2302 tests, with 0 failures (0 unexpected), ** TEST SUCCEEDED **

The five existing ThumbHashDecoderTests pass on both platforms. No test was added, because the change is type annotations only.

Not run: a separate SiloTV build-only command after the fix (the tvOS test run compiles the target), any build with Xcode 26.3, and the app itself.

Evidence

Evidence: none, no user-visible change

Risks

None identified. The existing decoder tests check dimensions and alpha, not RGB values, so they would not catch a change in the cosine tables; the review below compared the old and new tables bit for bit instead.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code (Claude desktop app)
  • Tool(s): Claude Code
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: A separate Claude Opus agent reviewed the commit read-only and tried to disprove "no behaviour change". It compiled the old and new expressions standalone on Swift 6.3.3 for macOS arm64: the old form reproduced the error, and with solver limits raised it inferred [Float], the type now stated. It compared bitPattern of old and new fxTable values for widths 1 to 32 and stops 3 to 7 and found 0 mismatches; fyTable is the same expression and was not compared separately. It found no correctness issue and raised two low-severity points: the tests assert no pixel values (predates this change, noted under Risks), and the closure signatures are redundant given the let annotations (kept, see Approach). It did not run xcodebuild or test the iOS or tvOS SDKs.

🤖 Generated with Claude Code

Note

Fix Swift 6.3.3 type-checking of ThumbHash cosine tables

Adds explicit Float32 array and closure type annotations to the cosine lookup-table construction in ThumbHashDecoder.decodeRGBA in ThumbhashImage.swift. This lets the Swift 6.3.3 compiler type-check the expressions. No runtime behavior changes.

Macroscope summarized 9e0fddb.

…check them

With Xcode 26.6 (Swift 6.3.3) the nested flatMap/map closures that build
fxTable and fyTable in ThumbHashDecoder fail with "the compiler is unable
to type-check this expression in reasonable time" on the Silo, SiloTV and
SiloMac schemes. Give the tables and their closures explicit types so the
compiler has nothing to infer. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌
⚠️ 2 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Centralize server-relative authentication path validation
  • Enforce latest-link-wins centrally across deferred deep links

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: af80aae0-eb0b-4f8a-a18d-6c491d3c43d8
📥 Commits

Reviewing files that changed from the base of the PR and between 0a4cce3 and 9e0fddb.

📒 Files selected for processing (1)
  • iosApp/iosApp/Components/ThumbhashImage.swift

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The fxTable and fyTable closures in ThumbHashDecoder.decodeRGBA now explicitly declare parameter and result types. Their calculations are unchanged.

Changes

ThumbHash type annotations

Layer / File(s) Summary
Cosine-table closure types
iosApp/iosApp/Components/ThumbhashImage.swift
The closures now declare coordinate and coefficient parameters as Int and cosine results as Float32. The calculations are unchanged.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Suggested reviewers: quick104

Merge Risk: ⚪ Minimal · up to 9e0fd

This change makes the cosine-table types explicit without changing the calculations or decoder behavior, so no new user-facing risk is evident and the PR is ready to merge after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the build fix and the ThumbHash cosine tables that required explicit annotations for Swift 6.3.3.
Description check ✅ Passed The description explains the type-checking failure, the annotation changes, and the reported validation results. It is directly related to the changeset.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This was referenced Oct 5, 2026

Quick104 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Silo's pull request guidance changed today (#658). A PR that changes what a user sees now needs before-and-after evidence in its Evidence section, and a PR with no visible change says Evidence: none, no user-visible change. This PR was opened before the rule existed, so it hasn't had a chance to meet it yet.

Missing here: Needs the line 'Evidence: none, no user-visible change'.

The rules are in Show visible changes, and the PR template shows the Evidence section layout. I've converted this PR to draft for now. Mark it ready for review once the Evidence section is filled in.


Generated by Claude Code

@Quick104
Quick104 marked this pull request as draft October 6, 2026 19:25
@timmyconnect
timmyconnect marked this pull request as ready for review October 7, 2026 13:12
@Quick104
Quick104 merged commit c81f628 into Silo-Server:main Oct 7, 2026
7 checks passed
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.

2 participants