{"record":{"id":"75db3b1fa7e45b08","repo":"gitbutlerapp/gitbutler","slug":"known-to-be-valid-statically","errorCode":null,"errorMessage":"known to be valid statically","messagePattern":"known to be valid statically","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"info","filePath":"crates/gitbutler-branch-actions/src/branch.rs","lineNumber":468,"sourceCode":"                        )\n                    })\n                })\n                .transpose()?,\n            updated_timestamp_ms: first_segment\n                .and_then(|s| {\n                    let md = s.metadata.as_ref()?;\n                    Some(md.ref_info.updated_at?.seconds as u128 * 1_000)\n                })\n                .unwrap_or_default(),\n            unarchived_segments: stack\n                .segments\n                .iter()\n                .map(|s| GitbutlerStackSegment {\n                    tip: s.ref_info.clone().map(|ri| ri.ref_name).unwrap_or_else(|| {\n                        gix::refs::FullName::try_from(\n                            \"refs/heads/unnamed-ref-and-we-fake-a-name-fix-me\",\n                        )\n                        .expect(\"known to be valid statically\")\n                    }),\n                    pr_or_mr: s\n                        .remote_tracking_ref_name\n                        .as_ref()\n                        .and_then(|rn| extract_remote_name_and_short_name(rn.as_ref(), names))\n                        .and_then(|(_, short)| reviews_by_head.get(short.to_str().ok()?))\n                        .and_then(|review| usize::try_from(review.number).ok()),\n                })\n                .collect(),\n        }))\n    }\n}\n\nimpl GitButlerStack {\n    /// Return the top-most stack's commit id.\n    fn head_oid<'repo>(&self, repo: &'repo gix::Repository) -> anyhow::Result<gix::Id<'repo>> {\n        let tip_ref = self\n            .unarchived_segments","sourceCodeStart":450,"sourceCodeEnd":486,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/gitbutler-branch-actions/src/branch.rs#L450-L486","documentation":"When converting GitbutlerBranch into a listing, segments without a RefInfo get a fake ref name \"refs/heads/unnamed-ref-and-we-fake-a-name-fix-me\", whose literal string is expect()'d to be a valid gix::refs::FullName. The panic is statically impossible because the string is a hardcoded valid ref name — it documents an intentional placeholder for stack segments that have no real ref yet.","triggerScenarios":"Rendering branch/stack details where a GitbutlerStackEntry segment has no ref_info (e.g. an integration/pending segment with no resolved ref), so the fallback fake name is constructed. The expect itself never fires.","commonSituations":"Listing branches in the UI while a stack contains an unassigned or uncommitted-change segment that has no underlying git ref; serialized/partial branch data missing ref_info.","solutions":["No action needed for the panic itself — it is statically unreachable","Model the segment tip as Option<gix::refs::FullName> so no fake name is fabricated (remove the placeholder, marked fix-me)","Handle segments without ref_info explicitly in the UI instead of inventing a name"],"exampleFix":"// before\ntip: s.ref_info.clone().map(|ri| ri.ref_name).unwrap_or_else(|| {\n    gix::refs::FullName::try_from(\"refs/heads/unnamed-ref-and-we-fake-a-name-fix-me\")\n        .expect(\"known to be valid statically\")\n}),\n// after\ntip: s.ref_info.clone().map(|ri| ri.ref_name),","handlingStrategy":"type-guard","validationCode":"// No runtime guard needed: the panic is statically unreachable (literal valid ref name).\n// Guard the data instead: check segments have ref_info before rendering tips.\nlet tip = segment.ref_info.as_ref().map(|ri| ri.ref_name);","typeGuard":"fn segment_has_tip(segment: &GitbutlerStackEntry) -> bool {\n    segment.ref_info.is_some()\n}","tryCatchPattern":null,"preventionTips":["Treat the 'unnamed-ref-and-we-fake-a-name-fix-me' placeholder as a fix-me: model tips as Option<FullName>","Ensure stack segments are hydrated with ref_info before conversion to listings","Add tests covering segments without ref_info"],"tags":["rust","git","placeholder","statically-valid","tech-debt"],"backgroundTag":"internal-invariant-violation","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}