feat: automate release development versions - #62
Conversation
|
Warning Review limit reached
Next review available in: 41 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe release workflow now separates stable-release and next-development commits. The CLI augments ChangesRelease and version display
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Sequence Diagram(s)sequenceDiagram
participant ReleaseWorkflow
participant VersionFiles
participant Git
ReleaseWorkflow->>VersionFiles: write stable release version
ReleaseWorkflow->>Git: commit release and create annotated tag
ReleaseWorkflow->>VersionFiles: write next -dev version
ReleaseWorkflow->>Git: commit development version
sequenceDiagram
participant CLI
participant GitRevision
participant GitStatus
CLI->>GitRevision: query short commit hash
CLI->>GitStatus: query porcelain status
GitStatus-->>CLI: return clean or dirty state
GitRevision-->>CLI: return short revision
CLI-->>CLI: format development version
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #62 +/- ##
=======================================
Coverage 99.74% 99.74%
=======================================
Files 39 39
Lines 7083 7144 +61
Branches 409 411 +2
=======================================
+ Hits 7065 7126 +61
Misses 13 13
Partials 5 5 ☔ View full report in Codecov by Harness. |
PR Summary by QodoAutomate release commit+tag and next -dev bump; add Git info to dev --version
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
weather_briefing/cli.py (1)
60-60: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winDelay Git subprocess execution until
--versionis explicitly requested.Currently,
_display_version()is evaluated eagerly whenbuild_parser()is called. During the development cycle,__version__will end with-dev, causing every CLI invocation (e.g.,run forecast) and every test that parses arguments to spawn twogitprocesses.Consider using a custom
argparse.Actionto lazily evaluate the version string only when the-V/--versionflag is passed.⚡ Proposed fix using a custom Action
- parser.add_argument("-V", "--version", action="version", version=f"%(prog)s {_display_version()}") + class _VersionAction(argparse.Action): + def __init__(self, option_strings, dest=argparse.SUPPRESS, default=argparse.SUPPRESS, help="show program's version number and exit"): + super().__init__( + option_strings=option_strings, + dest=dest, + default=default, + nargs=0, + help=help, + ) + + def __call__(self, parser, namespace, values, option_string=None): + print(f"{parser.prog} {_display_version()}") + parser.exit() + + parser.add_argument("-V", "--version", action=_VersionAction)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@weather_briefing/cli.py` at line 60, Update build_parser’s -V/--version argument to defer _display_version() until argparse processes an explicitly supplied version flag, using a custom argparse.Action or equivalent lazy mechanism. Ensure ordinary CLI parsing does not invoke Git, while -V and --version still print the dynamically computed version and exit.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@weather_briefing/cli.py`:
- Line 60: Update build_parser’s -V/--version argument to defer
_display_version() until argparse processes an explicitly supplied version flag,
using a custom argparse.Action or equivalent lazy mechanism. Ensure ordinary CLI
parsing does not invoke Git, while -V and --version still print the dynamically
computed version and exit.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2dced156-5aea-4a77-9dcc-39eaf45c2f5e
📒 Files selected for processing (5)
.github/workflows/release.ymldocs/notes.mddocs/requirements.mdtests/test_cli.pyweather_briefing/cli.py
Code Review by Qodo
1.
|
9fd621f to
47df845
Compare
47df845 to
6d9ac42
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@weather_briefing/cli.py`:
- Around line 114-126: Update the git subprocess calls in the version-query try
block to pass -C with the package/application repository directory before the
existing rev-parse and status arguments. Use the package location rather than
the process current working directory, while preserving the existing failure
fallback for installations without a Git repository.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2c188787-b508-4820-af17-c0ac8c6df558
📒 Files selected for processing (6)
.github/workflows/release.ymldocs/design.mddocs/notes.mddocs/requirements.mdtests/test_cli.pyweather_briefing/cli.py
💤 Files with no reviewable changes (1)
- docs/notes.md
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/requirements.md
|
Applied the approved CodeRabbit fix in |
Summary
masterto the next patch-devversion in a second commitpyproject.toml--versionfor development builds in a Git worktree, with safe fallback outside GitWhy
The 1.1.0 release needs an immutable tag at the release snapshot while ongoing development immediately continues as 1.1.1-dev. Development CLI output also needs enough revision context to identify the exact checkout state.
Impact
Running the release workflow from
1.0.0with the minor choice tags the release commit as1.1.0, then pushes a following1.1.1-devcommit tomasteratomically with the tag. Major and minor choices reset lower components; patch releases an existing-devtarget without incrementing it again. Formal releases keep their embedded version output; source development builds addg<short-sha>and, when applicable,dirty.Validation
prek run --all-filespassed, including Ruff, ty, actionlint, zizmor, secret scanning, and workflow checksmasteradvances to the development commit-devversions1.1.1-dirty-g<sha>formSummary by CodeRabbit
New Features
-devversion formatted with the short Git revision, and include a-dirtymarker when there are uncommitted changes.--versiongracefully falls back to the embedded version if Git info can’t be retrieved.Release Improvements
major/minor/patchbump choices and performs a two-phase release: published version commit + tag, then the next development-devcommit.Documentation
Tests