chore: replace ImageSharp with NetVips in the pathfinder tests - #304
Conversation
ImageSharp 4 / Drawing 3 gate the Release build on a purchased Six Labors licence key, so the 3.x/2.x line was frozen and dependabot had to be told to stop proposing majors it could never land. NetVips is what the image pipeline in guvusocial-img-processor-svc moved to for the same reason of not wanting to be on that upgrade path. The drawing here is a grid of axis-aligned cells, so compositing is done against a plain RGBA byte buffer in MapCanvas and libvips is used only for the two parts that genuinely need a library: glyph rasterisation and PNG encoding. That also drops SixLabors.Fonts and the system-font probing it needed. The approval checksums are unchanged. They are computed from the listPixel cell colours rather than from the rendered image, so the tests assert the same thing they always did; only the documentation PNGs are regenerated. Colour constants were taken from ImageSharp's own named values so the hashes still match, which matters most for Green (008000, not 00FF00). Also drops the SixLabors dependabot ignore block, now that nothing references those packages. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 18 minutes Limit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?Wait for the limit to reset, then comment An organization admin can change what happens after included review limits in Billing. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (5)
📒 Files selected for processing (7)
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. Comment |
It holds a managed byte[] and nothing else, so there was nothing to dispose - the interface existed only to let the tests keep writing `using var`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…rom an instance method Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Follow-up to #302, which froze SixLabors at 3.x/2.x because ImageSharp 4 / Drawing 3 gate the Release build on a purchased licence key:
Freezing works but leaves us pinned to a library we can never upgrade.
guvusocial-img-processor-svcalready moved its image pipeline off ImageSharp to NetVips (3aa38fc), so this follows the same route.Approach
The drawing here is a grid of axis-aligned cells — filled rects, a few glyphs, arrows. So
MapCanvascomposites against a plain RGBA byte buffer, and libvips is used only for the two parts that genuinely need a library: glyph rasterisation (Image.Text) and PNG encoding. That also removesSixLabors.Fontsand the system-font probing it needed, since fontconfig resolvessansitself.Net effect on the tests is that they get shorter — the
image.Mutate(ctx => …)wrappers and the five-lineRichTextOptionsblocks collapse into direct calls:140 insertions, 276 deletions.
Why this is safe
The approval checksums are unchanged. They are a SHA-256 over the
listPixelcell colours, not over the rendered image — the PNG is documentation embedded in the approved markdown. So the tests assert exactly what they asserted before, and all 7 pass without touching a single.approved.md.For that to hold the colour constants had to match ImageSharp's named values byte-for-byte, so I dumped them from ImageSharp 3.1.12 rather than assuming —
Color.Greenis008000, not00FF00, which is the one that would have silently broken the hashes.Verification
dotnet test— 7/7 pass, no approved files changeddotnet build -c Release— succeeds, no licence gate∞glyphs and the blue distance gradient all render as beforeNative packages are pulled for
linux-x64(CI),win-x64andosx-arm64.🤖 Generated with Claude Code