{"record":{"id":"518090d4bc24b474","repo":"Hmbown/CodeWhale","slug":"unbalanced-brace-in-brand-lockup-css","errorCode":null,"errorMessage":"unbalanced brace in brand lockup css","messagePattern":"unbalanced brace in brand lockup css","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/integrations/dsh/tests.rs","lineNumber":782,"sourceCode":"    let css_region = &js[css_start..];\n    let end = css_region\n        .find(\"return React.createElement(\")\n        .unwrap_or(css_region.len());\n    let css_region = &css_region[..end];\n\n    let mut depth = 0i32;\n    let mut max_depth = 0i32;\n    for ch in css_region.chars() {\n        match ch {\n            '{' => {\n                depth += 1;\n                max_depth = max_depth.max(depth);\n            }\n            '}' => depth -= 1,\n            _ => {}\n        }\n        if depth < 0 {\n            panic!(\"unbalanced brace in brand lockup css\");\n        }\n    }\n    assert_eq!(depth, 0, \"brand lockup css must close every rule it opens\");\n    // A media query is the only legitimate nesting level in this sheet.\n    assert!(\n        max_depth <= 2,\n        \"brand lockup css nests {max_depth} deep; only @media may nest, \\\n         so a selector was authored inside a declaration block\"\n    );\n\n    // The mark's own sizing rule must be a top-level rule, not nested: it is\n    // what makes the inline SVG a block box inside the grid cell. In the\n    // emitted CSS that means it is preceded by a closing brace, never by a\n    // declaration.\n    let marker = \"#codewhale-brand-mark svg{display:block;width:34px;height:34px;}\";\n    let at = css_region\n        .find(marker)\n        .expect(\"the mark's svg sizing rule must be emitted\");","sourceCodeStart":764,"sourceCodeEnd":800,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/tui/src/integrations/dsh/tests.rs#L764-L800","documentation":"Test-only panic in brand_lockup_css_rules_are_not_accidentally_nested: while scanning the extracted brand-lockup CSS region character by character, a closing brace appeared with depth already at zero, meaning the embedded JS/CSS contains a rule closed more times than opened — likely a brace inside a string or accidental rule nesting.","triggerScenarios":"Thrown at crates/tui/src/integrations/dsh/tests.rs:782 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Balance the braces in the brand lockup CSS inside the JS asset","Escape or avoid literal braces in strings within the scanned CSS region","Re-run the depth scan after editing to confirm depth returns to 0"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}