{"record":{"id":"d843606535882754","repo":"Hmbown/CodeWhale","slug":"truecolor-tint","errorCode":null,"errorMessage":"truecolor tint","messagePattern":"truecolor tint","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/palette/src/tests.rs","lineNumber":564,"sourceCode":"}\n\n#[test]\nfn light_palette_maps_reasoning_tint_to_light_surface() {\n    assert_eq!(\n        SURFACE_REASONING_TINT,\n        Color::Rgb(\n            WHALE_REASONING_TINT_RGB.0,\n            WHALE_REASONING_TINT_RGB.1,\n            WHALE_REASONING_TINT_RGB.2\n        )\n    );\n    assert_eq!(\n        adapt_bg_for_palette_mode(SURFACE_REASONING_TINT, PaletteMode::Light),\n        LIGHT_REASONING\n    );\n    assert_eq!(\n        adapt_bg_for_palette_mode(\n            reasoning_surface_tint(ColorDepth::TrueColor).expect(\"truecolor tint\"),\n            PaletteMode::Light,\n        ),\n        LIGHT_REASONING\n    );\n}\n\n#[test]\nfn blend_at_zero_returns_bg_at_one_returns_fg() {\n    let fg = Color::Rgb(200, 100, 50);\n    let bg = Color::Rgb(0, 0, 0);\n    assert_eq!(blend(fg, bg, 0.0), bg);\n    assert_eq!(blend(fg, bg, 1.0), fg);\n}\n\n#[test]\nfn blend_at_half_is_midpoint() {\n    let mid = blend(Color::Rgb(200, 100, 0), Color::Rgb(0, 0, 0), 0.5);\n    assert_eq!(mid, Color::Rgb(100, 50, 0));","sourceCodeStart":546,"sourceCodeEnd":582,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/palette/src/tests.rs#L546-L582","documentation":"This is a Rust `Option::expect` panic with the message 'truecolor tint': `reasoning_surface_tint(ColorDepth::TrueColor)` returned None, so calling adapt_bg_for_palette_mode on it never happened and the test aborted. The library's tint function throws (returns None) when it cannot resolve a reasoning-surface tint for the requested color depth — i.e. the TrueColor branch lacks a tint entry or the internal lookup is misconfigured. It indicates an internal lookup gap rather than bad caller input.","triggerScenarios":"Calling `reasoning_surface_tint(ColorDepth::TrueColor)` (or any ColorDepth variant) when the tint table for that depth has no entry — e.g. a new ColorDepth enum member added without extending the tint mapping, or a feature/precision downgrade path that yields no TrueColor tint.","commonSituations":"Adding a new ColorDepth variant without updating reasoning_surface_tint's match; regressing the tint table during palette refactors; tests asserting per-depth tint availability after the mapping was narrowed.","solutions":["Inspect reasoning_surface_tint's implementation and add/restore the TrueColor entry in its lookup so the Option is Some.","Exhaustively match the ColorDepth enum (match without wildcard) so the compiler forces a tint for every variant added later.","If None is legitimate for some depths, make the function return Result and let tests assert the specific expected depth."],"exampleFix":"// before\nfn reasoning_surface_tint(depth: ColorDepth) -> Option<Rgb> {\n    match depth {\n        ColorDepth::Simple => Some(SIMPLE_TINT),\n        _ => None,\n    }\n}\n// after\nfn reasoning_surface_tint(depth: ColorDepth) -> Option<Rgb> {\n    match depth {\n        ColorDepth::Simple => Some(SIMPLE_TINT),\n        ColorDepth::TrueColor => Some(TRUECOLOR_TINT),\n    }\n}","handlingStrategy":"type-guard","validationCode":"if reasoning_surface_tint(ColorDepth::TrueColor).is_none() {\n    panic!(\"tint table has no TrueColor entry; extend reasoning_surface_tint's match\");\n}","typeGuard":"fn has_truecolor_tint(depth: ColorDepth) -> bool {\n    reasoning_surface_tint(depth).is_some()\n}","tryCatchPattern":"let tint = reasoning_surface_tint(ColorDepth::TrueColor)\n    .unwrap_or_else(|| panic!(\"no reasoning tint for ColorDepth::TrueColor — check the tint table\"));","preventionTips":["Match exhaustively on ColorDepth (no `_` arm) so the compiler fails the build when a variant lacks a tint.","Unit-test every ColorDepth variant for a Some tint when adding a new variant.","Prefer returning Result over Option so failure messages can name the missing depth."],"tags":["rust","option-unwrap-panic","color-palette","missing-lookup"],"backgroundTag":"null-argument","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}