Skip to content

Conversation

@JoshuaBatty
Copy link
Member

@JoshuaBatty JoshuaBatty commented Nov 21, 2025

Summary

This PR implements support for component repository migrations, specifically enabling forc-wallet to transition from its standalone repository (FuelLabs/forc-wallet) to the forc monorepo (FuelLabs/forc) while maintaining backward compatibility for all existing versions.

Background

As of forc-wallet v0.16.0, the component has been migrated from its standalone repository to the forc monorepo as an independent workspace member with its own release cycle. However, fuelup needs to continue supporting downloads of older versions from the original repository while correctly routing new versions to the monorepo.

Changes

Core Infrastructure

  • Repository Migration Logic: Added legacy_repository_name and legacy_before fields to the Component struct to support version-based repository routing
  • Tag Format Handling: Implemented tag_for_version() method to handle different git tag conventions between repositories
  • Semver Integration: Added semver dependency for proper version comparison logic

Component Configuration

  • forc-wallet Migration: Configured forc-wallet component with:
  • repository_name = "forc" (new default for v0.16.0+)
  • legacy_repository_name = "forc-wallet" (for versions < v0.16.0)
  • legacy_before = "0.16.0" (migration cutoff point)

related to FuelLabs/sway-rfcs#49


Note

Add version-based repo/tag routing to handle forc-wallet moving from forc-wallet repo to forc, while preserving older releases.

  • Core component logic
    • Add semver and extend Component with legacy_repository_name and legacy_before.
    • New methods: repository_for_version() and tag_for_version() to select repo and tag format per version.
    • Tests covering repo/tag selection and defaults.
  • Channel builder (ci/build-channel)
    • Fetch full releases list and parse component-specific tags to derive versions.
    • Use Component repo/tag helpers when generating download URLs; minor refactor using .get(); add tests.
  • Downloader (src/download.rs)
    • Construct URLs with explicit tag via github_releases_download_url_with_tag().
    • fetch_fuels_version() uses Component repo/tag helpers for forc-wallet; improve TOML fuels version lookup to include workspace.dependencies.
    • Tests added for migration and parsing.
  • Configuration
    • Update components.toml for forc-wallet: repository_name = "forc", plus legacy_repository_name = "forc-wallet", legacy_before = "0.16.0".
  • Docs
    • Update links and guidance for forc-wallet and migration fields; spellcheck list updated.

Written by Cursor Bugbot for commit c9accce. This will update automatically on new commits. Configure here.

Add support for components to migrate between repositories while maintaining
backward compatibility for older versions. This enables components like
forc-wallet to move from standalone repos to monorepos.

- Add legacy_repository_name and legacy_before fields to Component struct
- Implement repository_for_version() method with semver-based selection
- Configure forc-wallet migration from forc-wallet repo to forc monorepo
- Add comprehensive tests for migration logic
- Add semver dependency for version handling

The version boundary is set at 0.16.0: versions < 0.16.0 use the legacy
forc-wallet repository, while versions >= 0.16.0 use the forc monorepo.
Update download and channel building logic to use the new repository migration
and tag formatting functionality. This completes the forc-wallet transition
to the forc monorepo.

- Update build-channel to use repository_for_version() and tag_for_version()
- Update download logic to use new URL generation methods
- Add github_releases_download_url_with_tag() helper function
- Update documentation with comprehensive field descriptions
- Add forc-wallet migration examples to developer guide

Channel files and downloads now correctly route forc-wallet requests:
- Versions < 0.16.0: FuelLabs/forc-wallet with v{version} tags
- Versions >= 0.16.0: FuelLabs/forc with forc-wallet-{version} tags
@JoshuaBatty JoshuaBatty self-assigned this Nov 21, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on December 7

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Bug: forc-wallet migration not handled in fetch_fuels_version

The fetch_fuels_version function hardcodes the repository as forc-wallet and tag format as v{version} for all forc-wallet versions. This breaks for versions >= 0.16.0, which are released from the forc monorepo with forc-wallet-{version} tags. The function needs to use Component::repository_for_version and Component::tag_for_version methods to correctly handle the repository migration, similar to how DownloadCfg::new was updated.

src/download.rs#L406-L411

fuelup/src/download.rs

Lines 406 to 411 in adf54aa

),
"forc-wallet" => {
format!(
"https://raw.githubusercontent.com/FuelLabs/forc-wallet/v{}/Cargo.toml",
cfg.version
)

Fix in Cursor Fix in Web


@github-actions
Copy link
Contributor

github-actions bot commented Nov 21, 2025

LCOV of commit 2c5a5a8 during CI #2275

Summary coverage rate:
  lines......: 87.6% (2668 of 3045 lines)
  functions..: 61.8% (404 of 654 functions)
  branches...: 66.7% (287 of 430 branches)

Files changed coverage rate: n/a

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on December 7

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Bug: forc-wallet fuels version fetch uses wrong repository

The fetch_fuels_version function hardcodes the repository to FuelLabs/forc-wallet with a v{version} tag format for all forc-wallet versions. This breaks for versions >= 0.16.0, which are released from the forc monorepo with forc-wallet-{version} tags. The function needs to use Component::repository_for_version() and Component::tag_for_version() to determine the correct repository and tag format based on the version, similar to how DownloadCfg::new() handles this migration.

src/download.rs#L406-L411

fuelup/src/download.rs

Lines 406 to 411 in 038199a

),
"forc-wallet" => {
format!(
"https://raw.githubusercontent.com/FuelLabs/forc-wallet/v{}/Cargo.toml",
cfg.version
)

Fix in Cursor Fix in Web


Updates fetch_fuels_version to use Component::repository_for_version and
Component::tag_for_version methods for proper handling of forc-wallet's
migration from forc-wallet repo to forc monorepo at version 0.16.0.

Also enhances fuels_version_from_toml to support workspace.dependencies
in addition to regular dependencies tables.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on December 7

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Bug: Incorrect version fetching for monorepo components

The get_version function fetches the latest release from component.repository_name without filtering by component-specific tags. For forc-wallet in the forc monorepo, this returns whichever component was released most recently (could be forc, forc-wallet, or others), not necessarily forc-wallet's version. Additionally, the function unconditionally strips the first character assuming a "v" prefix, which breaks for forc-wallet's forc-wallet-X.Y.Z tag format, producing invalid semver strings like orc-wallet-0.16.0.

ci/build-channel/src/main.rs#L119-L137

fn get_version(component: &Component) -> Result<Version> {
let handle = ureq::builder().user_agent("fuelup").build();
let mut data = Vec::new();
let url = format!(
"https://api.github.com/repos/FuelLabs/{}/releases/latest",
component.repository_name
);
let resp = handle.get(&url).call()?;
resp.into_reader().read_to_end(&mut data)?;
let response: LatestReleaseApiResponse = serde_json::from_str(&String::from_utf8_lossy(&data))?;
let version_str = response.tag_name["v".len()..].to_string();
let version = Version::parse(&version_str)?;

Fix in Cursor Fix in Web


Updates get_version function to properly handle component-specific tag filtering
for monorepo components. Fixes incorrect behavior where the latest release from
any component in the repository was returned instead of the specific component.

Also fixes tag prefix handling to support both legacy v-prefixed tags and
the new {component-name}-{version} format without breaking version parsing.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on December 7

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@JoshuaBatty JoshuaBatty requested a review from a team November 25, 2025 00:02
zees-dev
zees-dev previously approved these changes Nov 25, 2025
kayagokalp
kayagokalp previously approved these changes Nov 25, 2025
@JoshuaBatty JoshuaBatty dismissed stale reviews from kayagokalp and zees-dev via 2c5a5a8 November 25, 2025 22:58
@cursor
Copy link

cursor bot commented Nov 25, 2025

PR Summary

Adds version-aware repository/tag resolution (with semver) to support forc-wallet’s move to the forc monorepo while preserving downloads for older versions.

  • Core (component crate)
    • Add semver-based routing: new legacy_repository_name and legacy_before on Component.
    • Implement repository_for_version() and tag_for_version() to choose repo/tag per version (e.g., forc-wallet-<ver> in monorepo, v<ver> legacy).
    • Unit tests for repo/tag selection across migration boundaries.
  • Channel builder (ci/build-channel)
    • Fetch all releases and parse component-specific tags when determining latest versions.
    • Use repository_for_version() and tag_for_version() when generating URLs; add tests for tag parsing.
  • Downloader/install flow (src/download.rs)
    • Generate download URLs with explicit tag (.../download/{tag}/...) and respect per-version repo/tag.
    • fetch_fuels_version now resolves correct repo/tag for forc-wallet; fuels version extraction supports workspace.dependencies.
    • Tests for migration handling and fuels version parsing; small URL helper added.
  • Configuration
    • Update components.toml for forc-wallet: repository_name = "forc", legacy_repository_name = "forc-wallet", legacy_before = "0.16.0".
  • Docs
    • Update links and contributor guide with migration notes/fields; add spellcheck words.

Written by Cursor Bugbot for commit 2c5a5a8. This will update automatically on new commits. Configure here.

@JoshuaBatty JoshuaBatty enabled auto-merge (squash) November 25, 2025 22:59
@JoshuaBatty JoshuaBatty merged commit 40b4239 into master Nov 25, 2025
23 checks passed
@JoshuaBatty JoshuaBatty deleted the josh/forc-wallet branch November 25, 2025 23:04
JoshuaBatty added a commit to FuelLabs/fuel.nix that referenced this pull request Nov 28, 2025
…epo (#204)

## Summary

Enable `forc-wallet` to be fetched from the new `FuelLabs/forc` monorepo
for versions >= 0.16.0, while maintaining backward compatibility with
the legacy `FuelLabs/forc-wallet` repository for older versions.

## Background

`forc-wallet` has been migrated to the `forc` monorepo starting at
v0.16.0. The legacy `FuelLabs/forc-wallet` repository is now archived.
This PR updates `fuel.nix` to:

- Fetch `forc-wallet` >= 0.16.0 from `FuelLabs/forc` with
`forc-wallet-{version}` tags
- Fetch `forc-wallet` < 0.16.0 from the legacy `FuelLabs/forc-wallet`
with `v{version}` tags

This mirrors the approach taken in fuelup:
FuelLabs/fuelup#807

## Changes

### Core Infrastructure (`script/refresh-manifests.sh`)
- Added `forc` repo and renamed legacy to `forc-wallet-legacy`
- Added `legacy_repo` and `legacy_before` fields to package definitions
- New `refresh_published_from_repo` function handles version-based
routing and different tag formats
- Updated nightlies to use correct tag patterns for monorepo

### Milestone Tool (`ci/update-milestones/src/main.rs`)
- Changed forc-wallet source from `FuelLabs/forc-wallet` to
`FuelLabs/forc`
- Added `normalize_tag()` for tag format conversion between repos
- New `fetch_latest_release_for_component()` finds component-specific
releases in monorepos
- Added unit tests for tag normalization logic

### Nix Patches (`patches.nix`)
- Added patch to set `buildAndTestSubdir = "forc-wallet"` for builds
from forc monorepo

### CI (`.github/workflows/ci.yml`)
- Added `rust-tests` job to run update-milestones unit tests

### Documentation
- Updated repo links in `packages.md` and `adding-packages.md`
- Updated examples in `ci/update-milestones/README.md`

### Milestones (`milestones.nix`)
- Updated forc-wallet to 0.16.1 from the forc monorepo for testnet,
ignition, and mainnet

## Testing

- ✅ `nix-instantiate --parse patches.nix` - Nix syntax valid
- ✅ `nix-instantiate --parse milestones.nix` - Nix syntax valid  
- ✅ `nix build .#fuel-testnet` - New 0.16.x forc-wallet from forc
monorepo works
- ✅ `nix build .#fuel-mainnet` - Mainnet builds successfully
- ✅ `nix build .#forc-wallet-0-15-2` - Old version from legacy repo
still works
- ✅ `cargo test` - Rust unit tests pass

## Note

This implementation uses `legacy_repo` and `legacy_before` fields on
package definitions, making it extensible for future sway tool
migrations to the forc monorepo (as outlined in the [tooling monorepo
RFC](https://github.com/FuelLabs/sway-rfcs/blob/73511cfa579d787927289145a58224b92500374d/rfcs/0017-tooling-monorepo.md)).

---------

Co-authored-by: GitHub Action <action@github.com>
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.

3 participants