Repository navigation
[CTX-0247] feat(rich): kitty payload decode (PNG/RGB, bounded, fuzz-tested) - #425
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #424. Implements CTX-0247 under epic CTX-0246.
Summary
Decodes assembled Kitty graphics payloads (
kitty.rsintake unchanged) into owned RGBA8 bitmaps via a newkitty_decodemodule. Supports the formats terminals actually transmit:f=100PNG,f=24raw RGB,f=32raw RGBA; everything else fails closed. No present/render coupling (CTX-0248), no parser/APC changes.Decoder-crate justification (why not std-only, why not
image)png(0.18) over the fullimagefacade: no format autodetect, no extra codecs, no color-management stack, no EXIF/TIFF surface. Pulls onlybitflags/crc32fast/fdeflate/flate2/miniz_oxide, all already in tree.png 0.18.1is already inCargo.lockviaarboard; this adds one edge (bitty-rich -> png), no new crates. Licenses (MIT/Apache-2.0) in thecargo-denyallow list.Bounds (before allocation, checked arithmetic)
8192 px/side, 4096^2 px area, 64 MiB RGBA ceiling (IMG-3 parity, 4x+ headroom under the 320 MiB ledger). IHDR parsed via
read_infofirst;output_buffer_sizere-checked;set_limits(64 MiB)+set_ignore_text_chunk(true)as defense in depth. Raw payloads must be exactlyw*h*channels; PNG ignores supplied s/v (IHDR governs). Exact RFC admission stays with placement (CTX-0248).Tests (22 new, in-module)
Real byte vectors (Python-stdlib-generated, CRC-verified): 1x1 RGBA/RGB/gray/gray-alpha, palette, 16-bit; raw RGB/RGBA; oversize-dim and over-area rejects (raw + patched-IHDR PNG); every-prefix truncation sweep; deterministic garbage + PRNG fuzz shape; determinism; Display. Note:
pngdecodes a stream missing only the trailing IEND CRC (consumed chunks all CRC-verified) — the truncation test pins byte-equality there rather than Err.Verification
cargo fmt --all -- --check: cleancargo clippy --workspace --all-targets --locked -- -D warnings: cleancargo test -p bitty-rich --locked: 215 passed (193 existing + 22 new)cargo test --workspace --all-targets --locked: exit 0, all suites 0 failedcargo check --target x86_64-pc-windows-gnu --workspace --all-targets: exit 0actionlint,act -n(ci + codeql),[email protected]: cleancargo deny check bans licenses sources: okRisks / follow-ups
ctl::tests::control_socketpair_roundtrip_headless_live_instance(bitty-app) flaked twice under full-suite parallelism (global queue + thread races); passes solo and 247/247 with this diff on rerun. Pre-existing isolation issue; decode is never called by bitty-app. Suggest follow-up task.carryctx/ctx-0247(carryctx-managed) rather thanctx-0247/feat-*.Priority: P1 | Area: rich | Labels: feat,area:rich,P1 | Milestone: v0.1.0 | Task: CTX-0247