Skip to content

Fix CI/CD release pipeline for Cargo workspace repos#50

Merged
konard merged 8 commits intomainfrom
issue-49-8e6972ee84cf
Apr 14, 2026
Merged

Fix CI/CD release pipeline for Cargo workspace repos#50
konard merged 8 commits intomainfrom
issue-49-8e6972ee84cf

Conversation

@konard
Copy link
Copy Markdown
Member

@konard konard commented Apr 14, 2026

Summary

Fixes #49

The CI/CD release pipeline failed at the "Auto Release" job because all release scripts assumed the root Cargo.toml contains a [package] section with name and version fields. In this workspace repository, the root Cargo.toml only has [workspace] — the package metadata lives in doublets/Cargo.toml.

Error from failed run #24406907038:

Detected single-language repository (Cargo.toml in root)
Error: Could not find name in ./Cargo.toml

Root Causes

  1. Workspace Cargo.toml incompatibility — All 9 release scripts read name/version from root Cargo.toml using regex, which fails on workspace-only manifests
  2. Pre-release version regexbump-version.rs used a regex that didn't match versions with pre-release suffixes like 0.1.0-pre+beta.15
  3. Full-range PR diff in change detectiondetect-code-changes.rs compared the full PR range (GITHUB_BASE_SHA..GITHUB_HEAD_SHA), causing CI to run on every push even when the latest commit only touched non-code files (e.g. reverts of docs-only commits)

Changes

  • Added workspace-aware Cargo.toml resolution to all 9 release scripts:
    • Detects [workspace] in root manifest
    • Parses members = [...] list
    • Finds the first publishable member (skips publish = false)
    • Uses that member's Cargo.toml for name/version/publish operations
  • Fixed publish-crate.rs to pass -p <package> flag for workspace repos
  • Fixed bump-version.rs version regex to handle pre-release suffixes
  • Aligned detect-code-changes.rs with the rust-ai-driven-development-pipeline-template:
    • Switched from full PR range diffing to merge-commit-aware per-commit diffing (HEAD^2^..HEAD^2)
    • This ensures CI correctly skips jobs when only the latest push touches non-code files
    • Removed now-unused GITHUB_BASE_SHA/GITHUB_HEAD_SHA env vars from workflow
  • Restored explanatory comments from template workflow
  • Added case study documentation with CI logs and root cause analysis

Scripts fixed: check-release-needed.rs, version-and-commit.rs, publish-crate.rs, get-version.rs, bump-version.rs, collect-changelog.rs, create-github-release.rs, check-version-modification.rs, rust-paths.rs

Test Plan

  • All scripts tested locally against workspace structure (see experiments/test-workspace-resolution.sh)
  • cargo fmt --all -- --check passes
  • cargo clippy --all-targets --all-features passes
  • cargo test --all-features passes
  • File size check passes
  • Verified check-release-needed.rs correctly finds doublets crate name and version from doublets/Cargo.toml
  • Verified get-version.rs correctly reads version 0.1.0-pre+beta.15
  • Verified bump-version.rs --dry-run correctly parses pre-release version
  • Verified publish-crate.rs resolves workspace member and adds -p doublets flag
  • detect-code-changes.rs matches template exactly (verified with diff)
  • CI pipeline passes on this branch

Verification Output

$ rust-script scripts/check-release-needed.rs
Detected workspace Cargo.toml, searching for publishable member...
Using publishable workspace member: doublets (doublets/Cargo.toml)
Crate: doublets, Version: 0.1.0-pre+beta.15, Published on crates.io: true
No changelog fragments and v0.1.0-pre+beta.15 already published on crates.io
Output: should_release=false

🤖 Generated with Claude Code

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #49
@konard konard self-assigned this Apr 14, 2026
konard and others added 3 commits April 14, 2026 15:27
All release scripts assumed root Cargo.toml has [package] with name/version.
In workspace repos, root Cargo.toml only has [workspace] — package info is
in member crates. Added workspace-aware resolution that finds the first
publishable member crate (skipping publish=false members).

Also fixed bump-version.rs regex to handle pre-release version suffixes.

Scripts fixed: check-release-needed, version-and-commit, publish-crate,
get-version, bump-version, collect-changelog, create-github-release,
check-version-modification, rust-paths.

Fixes #49

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Includes timeline reconstruction, root cause analysis,
affected component matrix, and verification results.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard konard changed the title [WIP] CI/CD publishing failed Fix CI/CD release pipeline for Cargo workspace repos Apr 14, 2026
Rust template has the same bug (issue filed: link-foundation/rust-ai-driven-development-pipeline-template#36).
JS template not affected due to npm workspace design differences.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard konard marked this pull request as ready for review April 14, 2026 15:35
@konard
Copy link
Copy Markdown
Member Author

konard commented Apr 14, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost: $7.793752

📊 Context and tokens usage:

Claude Opus 4.6:

  • Context window: 122.5K / 1M (12%) input tokens, 35.2K / 128K (27%) output tokens

Total: (146.4K + 11.5M cached) input tokens, 35.2K output tokens, $7.558413 cost

Claude Haiku 4.5:

Total: (106.6K + 475.0K cached) input tokens, 10.9K / 64K (17%) output tokens, $0.235339 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Main model: Claude Opus 4.6 (claude-opus-4-6)
  • Additional models:
    • Claude Haiku 4.5 (claude-haiku-4-5-20251001)

📎 Log file uploaded as Gist (4124KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Member Author

konard commented Apr 14, 2026

🔄 Auto-restart 1/3

Detected uncommitted changes from previous run. Starting new session to review and commit or discard them.

Uncommitted files:

?? experiments/test-workspace-resolution.log

Auto-restart will stop after changes are committed or discarded, or after 2 more iterations. Please wait until working session will end and give your feedback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard
Copy link
Copy Markdown
Member Author

konard commented Apr 14, 2026

🔄 Auto-restart 1/3 Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost: $0.603244

📊 Context and tokens usage:

  • Context window: 37.2K / 1M (4%) input tokens, 3.3K / 128K (3%) output tokens

Total: (25.6K + 720.5K cached) input tokens, 3.3K output tokens, $0.603244 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Model: Claude Opus 4.6 (claude-opus-4-6)

📎 Log file uploaded as Gist (5722KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Member Author

konard commented Apr 14, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@konard
Copy link
Copy Markdown
Member Author

konard commented Apr 14, 2026

See screenshot:

Screenshot 2026-04-14 at 9 16 08 PM

We didn't fully apply all best practices from:

For example our CI/CD does trigger at commit de71e13, while it should not, and such problems already were fixed in other CI/CDs, from which we integrated fixes to

Though it needs to be double checked.

@konard konard marked this pull request as draft April 14, 2026 16:11
@konard
Copy link
Copy Markdown
Member Author

konard commented Apr 14, 2026

🤖 AI Work Session Started

Starting automated work session at 2026-04-14T16:11:58.937Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback.

The detect-code-changes.rs script was using full PR range diffing
(GITHUB_BASE_SHA..GITHUB_HEAD_SHA), which made CI run on every PR
push even when the latest commit only touched non-code files (e.g.
reverts of docs). Switched to the template's merge-commit-aware
per-commit diffing (HEAD^2^..HEAD^2) so CI correctly skips jobs
when only the latest push is non-code.

Also restored explanatory comments from the template workflow and
removed the now-unused GITHUB_BASE_SHA/GITHUB_HEAD_SHA env vars.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard konard marked this pull request as ready for review April 14, 2026 16:17
@konard
Copy link
Copy Markdown
Member Author

konard commented Apr 14, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost: $3.538319

📊 Context and tokens usage:

Claude Opus 4.6:

  • Context window: 72.9K / 1M (7%) input tokens, 19.2K / 128K (15%) output tokens

Total: (92.5K + 4.9M cached) input tokens, 19.2K output tokens, $3.496018 cost

Claude Haiku 4.5:

Total: (25.7K + 39.6K cached) input tokens, 1.2K / 64K (2%) output tokens, $0.042301 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Main model: Claude Opus 4.6 (claude-opus-4-6)
  • Additional models:
    • Claude Haiku 4.5 (claude-haiku-4-5-20251001)

📎 Log file uploaded as Gist (2370KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Member Author

konard commented Apr 14, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@konard konard merged commit 6d7ab63 into main Apr 14, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI/CD publishing failed

1 participant