chore(release): 2.8.1#2097
Conversation
Fixes the S3358 nested-ternary regression in the new `worktrees unlock` command (worktrees_cmd.py), which is a gated file and kept the release commit red, and re-cuts the release as 2.8.1. Content is otherwise the intended 2.8.0 (Codex OAuth fix, worktree GC reliability, the unlock command, and the security cleanup); 2.8.0 was never tagged.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRetags the unreleased 2.8.0 work as 2.8.1, fixes a Sonar S3358 nested-ternary issue in the new File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Sonar insights (advisory, no merge-block)Snapshot of
Run This comment is a soft signal. The Sonar scan runs on push to |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe release notes and package version were bumped to ChangesRelease metadata
Worktrees unlock output
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Review-bot acknowledgement summary
All must-address findings are resolved or acknowledged. |
|
bernstein doctor observe for PR #2097 ( sonar -- OK (project bernstein)
code-scanning -- WARN (2 open alert(s))
Skipped backends (credentials not configured)
See docs/observability/unified-doctor.md for backend setup notes. |
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The new liveness mapping assumes
aliveis always one ofTrue,False, orNone; consider usingdict.get(alive, "liveness unknown")or a safer default to avoid a potentialKeyErrorif other values ever appear.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new liveness mapping assumes `alive` is always one of `True`, `False`, or `None`; consider using `dict.get(alive, "liveness unknown")` or a safer default to avoid a potential `KeyError` if other values ever appear.
## Individual Comments
### Comment 1
<location path="src/bernstein/cli/commands/worktrees_cmd.py" line_range="696" />
<code_context>
age_str = f"{int(age)}s" if isinstance(age, (int, float)) else "unknown age"
owner = f"pid {pid}" if pid else "an unknown process"
- liveness = "alive" if alive else ("not running" if alive is False else "liveness unknown")
+ liveness = {True: "alive", False: "not running", None: "liveness unknown"}[alive]
if as_json:
</code_context>
<issue_to_address>
**issue (bug_risk):** Dict indexing here can raise a KeyError if `alive` is any non-boolean/non-None value.
The original ternary safely handled any non-boolean `alive` values via its final `else` branch. With dict indexing, values like `0`, `1`, or other truthy/falsy but non-`True`/`False`/`None` inputs will now raise `KeyError`. To keep the previous robustness, either use `.get(alive, "liveness unknown")` or normalize `alive` to `True`/`False`/`None` before indexing.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| age_str = f"{int(age)}s" if isinstance(age, (int, float)) else "unknown age" | ||
| owner = f"pid {pid}" if pid else "an unknown process" | ||
| liveness = "alive" if alive else ("not running" if alive is False else "liveness unknown") | ||
| liveness = {True: "alive", False: "not running", None: "liveness unknown"}[alive] |
There was a problem hiding this comment.
issue (bug_risk): Dict indexing here can raise a KeyError if alive is any non-boolean/non-None value.
The original ternary safely handled any non-boolean alive values via its final else branch. With dict indexing, values like 0, 1, or other truthy/falsy but non-True/False/None inputs will now raise KeyError. To keep the previous robustness, either use .get(alive, "liveness unknown") or normalize alive to True/False/None before indexing.
Re-cuts the release as 2.8.1 after fixing an S3358 nested-ternary regression that the gated-file check flagged in the new
worktrees unlockcommand, which kept the 2.8.0 commit red.worktrees_cmd.pyliveness label uses a mapping instead of a nested ternary (it is in the S3358 regression target list).pyproject.toml(anduv.lock) 2.8.0 -> 2.8.1; renames the notes todocs/release-notes/v2.8.1.md.2.8.0 was never tagged, so the published release is 2.8.1 with the same content (Codex OAuth fix #2086, worktree GC reliability #2093,
worktrees unlock#2094, security cleanup #2087). On merge, a green main run triggers auto-release to tagv2.8.1.Summary by Sourcery
Bump the project to release version 2.8.1 and address a liveness labeling regression in the new
worktrees unlockcommand.Enhancements:
worktrees unlockliveness label to use a mapping for clearer handling of alive, not running, and unknown states.Build:
Documentation:
Summary by CodeRabbit