UN-3479 [FIX] release workflow: validate before tag/publish + lint cleanup#17
Conversation
…eanup Fixes the issues exposed when the v1.3/v1.4 dispatches blew up: - 10 E501 line-too-long violations in src/unstract/clone/ (caused the lint failure in release run 26506031574) - Release workflow did commit-bump + push-to-main + tag + GH release BEFORE running lint/tests/build, so a lint failure left main with a phantom version bump and an orphan release. Lint/tests/build now run against the bumped __init__.py in-place, and only on success does the workflow commit, tag, release, and PyPI-publish. - Add ruff to the PR gate (test.yml) so lint regressions block at PR time instead of release time. - Revert __version__ from 1.4.0 to 1.2.1 so the next manual trigger produces the intended v1.3.0 cleanly. Orphan v1.4.0 tag + GitHub release have been deleted out-of-band. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
| Filename | Overview |
|---|---|
| .github/workflows/main.yml | Release workflow restructured to run all verification (lint, tests, build, publish) before committing/tagging; Compute new version no longer carries the old workflow_dispatch guard, and all intermediate steps lack that guard too |
| .github/workflows/test.yml | Added ruff check src/ lint step before pytest so lint regressions now block PRs; straightforward and correct |
| src/unstract/api_deployments/init.py | Version reverted from 1.4.0 to 1.2.1 so the next manual minor bump produces the intended v1.3.0 |
| src/unstract/clone/exceptions.py | Docstring shortened to fix E501 line-length violation; no behavioral change |
| src/unstract/clone/phases/adapter.py | NameConflictError message truncated for E501; no behavioral change |
| src/unstract/clone/phases/api_deployment.py | Two string literals shortened to fix E501; no behavioral change |
| src/unstract/clone/phases/connector.py | Log message shortened to fix E501; no behavioral change |
| src/unstract/clone/phases/custom_tool.py | Error string shortened to fix E501; no behavioral change |
| src/unstract/clone/phases/files.py | Warning log message shortened to fix E501; no behavioral change |
| src/unstract/clone/phases/pipeline.py | Info log message shortened to fix E501; no behavioral change |
| src/unstract/clone/phases/tool_instance.py | Warning log message shortened to fix E501; no behavioral change |
| src/unstract/clone/report.py | Docstring shortened to fix E501; no behavioral change |
Sequence Diagram
sequenceDiagram
participant GH as GitHub Actions
participant FS as File System
participant PyPI as PyPI (Trusted Publisher)
participant Repo as Git / GitHub
GH->>FS: Compute new version (bump __init__.py locally, no commit)
GH->>FS: Verify version update (file vs step output)
GH->>GH: Lint (ruff check src/)
GH->>GH: Tests (pytest)
GH->>GH: Build (uv build)
GH->>PyPI: Publish (uv publish via OIDC)
Note over PyPI: Point of no return — artifact is live
GH->>Repo: git commit version bump + push to main
GH->>Repo: git tag vX.Y.Z + push tag
GH->>Repo: gh release create vX.Y.Z
GH->>GH: Success message
Reviews (2): Last reviewed commit: "fix(ci): publish to PyPI before tag/rele..." | Re-trigger Greptile
… guards Address greptile P1 + P2: - P1: uv publish now runs before commit/tag/release. PyPI is the only irreversible step, so if a later git/release call fails the artifact is the source of truth and the metadata can be retried. - P2: workflow only triggers on workflow_dispatch (see top-level `on:`), so the per-step `if: github.event_name == 'workflow_dispatch'` guards were redundant and inconsistent (only on bookends, not lint/test/build). Removed them — any future trigger addition should be a deliberate per-step decision. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Summary
Three tightly-coupled fixes prompted by the broken
v1.3/v1.4release dispatches today.1. Lint failures in
src/unstract/clone/Run 26506031574 failed with 10
E501(line-too-long > 88) violations across the newclonesubpackage. These were not caught at PR time because the PR-gate workflow (test.yml) only ranpytest. Reworded the offending lines (no behavioral change) and addedruff check src/totest.ymlso lint regressions block at PR time.2. Release workflow ordering
main.ymlperformedversion bump → commit to main → push tag → create GH releasebefore runninglint/tests/build. So a lint failure leftmainwith a phantom version bump and an orphaned GitHub release (v1.4.0, deleted out-of-band as part of this work).New ordering — verification first, side-effects second:
__init__.pylocally (no commit)ruff check src/)pytest)uv build)main, tag, push tag, create GH releaseuv publishto PyPI3. Version revert:
1.4.0 → 1.2.1Run #1 (failed at tag step but succeeded at commit-push) and run #2 (created
v1.4.0then failed at lint) leftmainat1.4.0with no corresponding published artifact. Reverted so the next manual trigger produces the intendedv1.3.0.Test plan
uv run ruff check src/passes locallyuv run pytest tests/— 167 passed locallygh release delete v1.4.0+git push --delete origin v1.4.0done out-of-bandLint (ruff)step ontest.ymlruns greenmain.ymlmanually withminorbump → expect cleanv1.3.0release end-to-end🤖 Generated with Claude Code