Skip to content

Conversation

@kayagokalp
Copy link
Member

Overview

Implements support for patching registry dependencies (from forc.pub) using the [patch] table in Forc.toml. Previously, only Git dependencies could be patched, which created a workflow gap when packages like std migrated from Git to the registry.

Motivation

When std and other core packages moved to forc.pub registry, developers lost the ability to:

  • Test local changes to standard library code
  • Use unreleased features from development branches
  • Debug issues with instrumented versions of dependencies

This PR restores that capability by extending the existing patch system to support registry packages.

Implementation

Key Features

  1. Registry Patching: Use [patch.'forc.pub'] to override registry dependencies
  2. Multiple Source Types: Patch with local path or Git repository
  3. Namespace Support: Built-in support for namespaced packages (implementation-ready for future use)
  4. Priority System: Namespace-specific patches override generic patches

Usage

Basic Usage

[dependencies]
std = "0.70.1"

[patch.'forc.pub']
std = { path = "../sway/sway-lib-std" }

Patch with Git Branch

[dependencies]
std = "0.70.1"

[patch.'forc.pub']
std = { git = "https://github.com/fuellabs/sway", branch = "my-feature" }

Workspace-Level Patches

[workspace]
members = ["contract-a", "contract-b"]

[patch.'forc.pub']
std = { path = "../custom-std" }

Documentation

Updated user documentation in:

  • docs/book/src/forc/manifest_reference.md - Complete patch section rewrite with examples
  • docs/book/src/forc/workspaces.md - Added registry patching examples
  • Inline code documentation with TOML syntax notes

Breaking Changes

None. This is a purely additive change. All existing Git patches continue to work exactly as before.

Notes

  • TOML Syntax: Quotes are required: [patch.'forc.pub'] not [patch.forc.pub]
  • Source Matching: Registry patches only apply to registry dependencies
  • Namespace Support: Implementation includes namespace support

@kayagokalp kayagokalp self-assigned this Oct 27, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 27, 2025

CodSpeed Performance Report

Merging #7469 will not alter performance

Comparing kayagokalp/patch (ad8bcf9) with master (f92c3f2)

Summary

✅ 25 untouched

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.

2 participants