Repository navigation
[CTX-1186] chore(graphics): wire kitty decode/raster onto seam traits + shared png codec (#2000) - #2053
Conversation
… + shared png codec (#2000)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Xuepoo
left a comment
There was a problem hiding this comment.
Independent review verdict — PR #2053 ([CTX-1186] chore(graphics): wire kitty decode/raster onto seam traits + shared png codec (#2000))
Reviewer: independent agent (guard-dispatched, separate session), read-only. Reviewed the PR's own diff at commit 8739fcc5 (local carryctx/ctx-1186; the PR head ecbcff5 is a Merge branch 'main' into carryctx/ctx-1186 whose only delta over 8739fcc5 is main content from #2050/#2051 — no PR-authored lines).
Verdict: APPROVE (no blocking findings).
Checks (all MET):
- (a) Scope: 12 files, +1027/-170, all plausibly required by the shared-codec + seam wiring (new
kitty_seam.rs+239, newtests/kitty_seam_parity.rs+420, decode/raster/lib/Cargo.toml, plusbackground.rs/background_peak_memory.rsbecause the png feature moved off the image facade, andruntime.rs/present.rscomposition-root threading). No unrelated churn. - (b) Seam:
kitty_seam.rsaddsKittyTransmitFormat(Png/Rgb/Rgba,from_f/f_value/raw_channels), traitsKittyDecodeBackend/KittyRasterBackend, andCoreKittyBackend; aconst _: () = assert!(...)block pins the seam caps (8192px/side, 4096*4096 px, 64 MiB, 32 blits, 64 MiB/frame, f=100/24/32) to thekitty_placetwins so drift fails the build. Traits name no extension crate and use only Core carriers — abstract enough for a non-runtime consumer. - (c) Wiring:
crates/bitty-runtime/src/runtime/kitty_images.rsnow callsself.kitty_graphics.decode_transmit/decode_transmit_ownedinstead of the freebitty_rich::decode_kitty_payload*;precheck_transmitreturnsbitty_rich::KittyTransmitFormatand rejects unknownfbefore decode; the PNG path usespng::Decoderdirectly (ignore-text-chunk,set_limits(MAX_BYTES), normalize to color8|alpha, bounds-before-alloc).kitty_raster.rsdiff is doc-only (in-repo backend behind the seam). - (d) Parity test:
kitty_seam_parity.rs(420 lines) freezes the seam caps verbatim plus their relationships (MAX_PIXELS*4 == MAX_BYTES, frame cap == decode cap, raster cache 32/64 MiB), exact format mapping, and pinned errorDisplaystrings. Independent negative oracle:seam_format_mapping_is_exactassertsKittyTransmitFormat::from_freturnsNonefor[0,1,2,23,25,31,33,99,101,255,u32::MAX];seam_error_display_is_pinnedpins exact error strings. PNG fixtures are hard-coded byte probes, not golden self-comparison. - (e)
Cargo.lock= 1 line changed (single dependency edge). - (f) Gates: all reported checks pass except Windows check and test (pending); local build intentionally not run (host disk at 100%). Re-run after the branch update.
Non-blocking notes for the record:
- The PNG edge is not dropped but moved: the image-facade
pngfeature is removed and a directpng = "0.18"dependency is added tocrates/bitty-rich/Cargo.toml, reversing the older W-141 "Core retains no PNG edge" comment. Matches the PR title's "shared png codec" goal; flag for the architecture record. - Two defensive throws in the legacy path and the runtime raster call sites (
present.rs,runtime.rs) fall outside the sampled diff head and were not independently re-verified.
Gate requires one approving review; recorded here as a comment per the shared-identity constraint (single GitHub identity cannot self-approve).
Xuepoo
left a comment
There was a problem hiding this comment.
Guard verification of the post-review head defcb29f (the recorded APPROVE covered 8739fcc5). Delta beyond main merges = one test-only commit: crates/bitty-rich/src/wallpaper_theme.rs encode_png helper inside #[cfg(test)], swapping the image facade encoder for the direct png crate (consistent with the PR goal of dropping the image png edge). No production-logic change, no new dependency edge beyond the PR's declared png = "0.18". CI fully green on defcb29f (Quality gates, M1/Compat aggregates, Windows, macOS, Linux X11/Wayland, MSRV, Supply chain, CodeQL). Prior independent APPROVE stands; merging under the shared-identity constraint.
Priority: P2 | Area: architecture | Labels: chore,P2,area:architecture | Milestone: v0.1.0 | Task: CTX-1186
Closes #2000
Summary
Wires Core Kitty decode/raster onto the published
bitty-graphicsseamcontract (
bitty-graphics#15) behind a Core-owned trait, and drops thepngedge from Coreimagefeatures.bitty-rich::kitty_seam:KittyTransmitFormatmapping with theseam spelling (unknown
frejects before the call),KittyDecodeBackend/
KittyRasterBackendtraits freezing signatures/caps/error shapes, andthe stateless in-repo
CoreKittyBackend. Caps are compile-time asserted(8192 px/side, 4096^2 area, 64 MiB RGBA, 32 blits, 64 MiB frame).
Runtimetransmit (5 sites) and present raster paths call through thetraits via a
kitty_graphicsbackend field;precheck_transmitnowreturns the mapped format so unknown
fcan never reach a decode entrypoint. Swapping implementations never touches the call sites.
decode_pngand background PNG moved from theimagefacade tothe shared minimal
pngcodec (same crate+pin as the extension seam,png 0.18, already locked at 0.18.1: zero new supply-chain nodes).imagekeepsjpeg+webpfor background; background JPEG/WebPuntouched.
kitty_seam_parityintegration suite (public API only, mirrors the22 conformance assertions): frozen caps, exact format mapping, pinned
error displays, backend/free-function agreement, PNG normalization
fixtures (gray-alpha, palette, 16-bit), oversize-IHDR refusal, raster
behaviors.
Fence state (verified first, per task)
EXTENSION_CRATESalready covers all four extension crates (generalizedby CTX-1086/#1890): no fence change. W-147 9/9 green on this head, plus a
documented trial-fork negative proof (planted
bitty_graphicsreferencein a Core source: fence fails closed; probe deleted, nothing committed).
No governance test touched. No
[dependencies]edge onbitty-graphicsanywhere; the identifier appears in no Core
src/(prose mentions only).Verification
cargo fmt --check,cargo clippy --workspace --all-targets -D warningscargo nextest run --workspace --locked: 6607 passed, 0 failedcargo test --workspace --doc: greenbitty-richsuites (incl. background PNG/JPEG/WebP + peak-memory),full
bitty-runtimesuite (147 targets): greensupply-chain(deny + audit): greencargo check --target x86_64-pc-windows-gnu --workspace --all-targets: greenverify_w147_small_core_graph: 9/9 before pushjust ci-local: environmentally blocked in this sandbox (act job setsSCCACHE_GHA_ENABLED=true+RUSTC_WRAPPER=sccachewith no GHA cache;cargo metadatafails before compiling any code). Equivalent localgates above are green.
scratch-pathsfails identically on main(untouched
wsl.rs/component.rs); changed files clean.Risks / deltas
png-crate scaling(seam-identical) instead of the
image-facade scaling; outputs maydiffer by LSBs on 16-bit inputs only. No existing Core test pinned
16-bit kitty bytes; parity fixtures lock the seam outputs.
extension 128); the 64 MiB byte ceiling is shared.
*-docschange (implementation-internal seam;noted only per task).
Summary by CodeRabbit