{"record":{"id":"8cc666c02d25101f","repo":"GitoxideLabs/gitoxide","slug":"the-selected-review-return-commit-does-not-descend","errorCode":null,"errorMessage":"the selected review return commit does not descend from the reviewed commit","messagePattern":"the selected review return commit does not descend from the reviewed commit","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/review.rs","lineNumber":260,"sourceCode":"    let base = commit\n        .parents\n        .first()\n        .copied()\n        .context(\"a review commit must have a base\")?;\n    let mut reference = repo\n        .find_reference(review_ref.as_ref())\n        .context(\"the review reference is missing\")?;\n    let legacy_reattach = reference.target().try_name().map(ToOwned::to_owned);\n    let tip = reference\n        .peel_to_id()\n        .context(\"the review reference does not resolve\")?\n        .detach();\n    let delete_refs = resources(&repo, review_ref.clone())?;\n    let return_name = return_to(&commit)?.or(legacy_reattach);\n    let has_return = return_name.is_some();\n    let checkout = if let Some(id) = fallback {\n        if !graph.is_ancestor(tip, id) {\n            anyhow::bail!(\"the selected review return commit does not descend from the reviewed commit\");\n        }\n        Some((id, None))\n    } else {\n        return_name\n            .map(|name| {\n                let Some(mut reference) = repo.try_find_reference(name.as_ref())? else {\n                    return Ok(None);\n                };\n                let checkout_reference = if name.as_bstr().starts_with(history::PIN_PREFIX) {\n                    reference.target().try_name().map(ToOwned::to_owned)\n                } else {\n                    Some(name)\n                };\n                let id = reference\n                    .peel_to_id()\n                    .context(\"the review return reference does not resolve\")?\n                    .detach();\n                if !graph.is_ancestor(tip, id) {","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/review.rs#L242-L278","documentation":"When an explicit fallback return commit is supplied to `finish_with_progress`, the library requires that commit to descend from the reviewed commit (tip of the review). If `graph.is_ancestor(tip, fallback)` fails, the fallback is not a valid destination to move reviewed work onto and the operation is refused.","triggerScenarios":"Calling `finish_with_progress(repo, graph, review, Some(fallback_id), ...)` where `fallback_id` is an unrelated commit, an ancestor of the review tip, or on a divergent branch.","commonSituations":"The caller cached an old return commit id that was later rebased away; a typo or stale ObjectId from another session was passed; the user picked a return point on a sibling branch.","solutions":["Pass a fallback commit that is a descendant of the review tip, e.g. `git merge-base --is-ancestor <tip> <fallback>` first.","Pass `None` for fallback so the library resolves the stored return reference instead.","Re-resolve the fallback id from the current branch tip if the branch was rebased."],"exampleFix":"// before\nfinish_with_progress(repo, &graph, review_id, Some(stale_return_id), progress)?;\n// after\nlet tip = /* peel review ref */;\nif !graph.is_ancestor(tip, stale_return_id) {\n    finish_with_progress(repo, &graph, review_id, None, progress)?;\n} else {\n    finish_with_progress(repo, &graph, review_id, Some(stale_return_id), progress)?;\n}","handlingStrategy":"validation","validationCode":"if let Some(fallback) = fallback_id {\n    if !graph.is_ancestor(review_tip, fallback) {\n        return Err(anyhow::anyhow!(\"fallback return commit must descend from the reviewed commit\"));\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Derive the fallback id from the current branch tip at call time, never from cached values.","Prefer passing `None` and letting the library resolve the stored return reference.","After any rebase, refresh all stored ObjectIds before finishing reviews."],"tags":["git","review-workflow","invalid-argument-value"],"backgroundTag":"invalid-argument-value","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}