Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion scripts/update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
"""

import re
import subprocess
from pathlib import Path

import tomli


def main() -> None:
"""Update version in __init__.py to match pyproject.toml."""
"""Update version in __init__.py to match pyproject.toml and refresh uv.lock."""
# Read version from pyproject.toml
pyproject_path = Path("pyproject.toml")
init_path = Path("stackone_ai/__init__.py")
Expand All @@ -36,6 +37,11 @@ def main() -> None:
else:
print(f"Version in {init_path} already matches {version}")

# Update uv.lock to reflect version change in pyproject.toml
print("Updating uv.lock...")
subprocess.run(["uv", "lock"], check=True)
Copy link

@cubic-dev-ai cubic-dev-ai bot Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Missing error handling for subprocess call. Per project standards in .cursor/rules/uv-scripts.mdc, external calls should use try/except blocks with meaningful error messages and appropriate exit codes. If uv is not installed or the command fails, users will see an unhelpful traceback.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/update_version.py, line 42:

<comment>Missing error handling for subprocess call. Per project standards in `.cursor/rules/uv-scripts.mdc`, external calls should use try/except blocks with meaningful error messages and appropriate exit codes. If `uv` is not installed or the command fails, users will see an unhelpful traceback.</comment>

<file context>
@@ -36,6 +37,11 @@ def main() -&gt; None:
 
+    # Update uv.lock to reflect version change in pyproject.toml
+    print(&quot;Updating uv.lock...&quot;)
+    subprocess.run([&quot;uv&quot;, &quot;lock&quot;], check=True)
+    print(&quot;uv.lock updated successfully&quot;)
+
</file context>
Suggested change
subprocess.run(["uv", "lock"], check=True)
try:
subprocess.run(["uv", "lock"], check=True)
except FileNotFoundError:
print("Error: 'uv' command not found. Please install uv first.")
raise SystemExit(1)
except subprocess.CalledProcessError as e:
print(f"Error: 'uv lock' failed with exit code {e.returncode}")
raise SystemExit(1)
Fix with Cubic

print("uv.lock updated successfully")
Comment on lines +40 to +43
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lockfile update in this script will not be committed back to the repository. The release workflow runs this script after a release is created, updates the lockfile, builds and publishes, but never commits the updated uv.lock. This means the repository will have an out-of-sync lockfile.

Consider one of these approaches:

  1. Run uv lock as part of the release-please PR (before merging), not after the release
  2. Add a git commit and push step in the workflow after running this script
  3. Use a GitHub Action that can amend the release commit or create a follow-up commit

The current implementation will cause the published package to be built with one lockfile while the repository contains a different one, leading to reproducibility issues.

Copilot uses AI. Check for mistakes.
Comment on lines +42 to +43
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While check=True will raise CalledProcessError on failure (which is good), consider adding explicit error handling with a try-except block to provide a more informative error message if the uv lock command fails. This would help diagnose issues such as uv not being installed or lockfile conflicts.

For example, catching CalledProcessError and printing the stderr output would make debugging easier in CI environments.

Suggested change
subprocess.run(["uv", "lock"], check=True)
print("uv.lock updated successfully")
try:
result = subprocess.run(
["uv", "lock"],
check=True,
capture_output=True,
text=True,
)
except FileNotFoundError as e:
print("Error: 'uv' command not found. Make sure 'uv' is installed and on your PATH.")
raise
except subprocess.CalledProcessError as e:
print("Error: 'uv lock' command failed.")
if e.stderr:
print("stderr from 'uv lock':")
print(e.stderr)
raise
else:
if result.stderr:
# Optionally surface non-fatal warnings from uv
print("Warnings from 'uv lock':")
print(result.stderr)
print("uv.lock updated successfully")

Copilot uses AI. Check for mistakes.


if __name__ == "__main__":
main()