Skip to content
Open
Show file tree
Hide file tree
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
30 changes: 30 additions & 0 deletions plugins/changelog/sdks.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package changelog

import "github.com/patch-it-dev/patch-it-plugins/core/plugin"

// The providers' official SDKs (stripe.go, sentry.go, cloudflare.go, ...),
// each read from its own changelog at every release (or, with Notes, from its
// release notes on GitHub). Every one was checked by hand: the file's path,
// the tag each release is cut at, and a release whose section this reader
// turns into events (each provider's test pins it).

// sdk is the source an SDK's changelog is, its metadata read off f.
func sdk(page, id string, f File, packages ...string) plugin.Source {
watches := "Names removed, renamed or deprecated in each release of " + f.Package + ", from the release's section of " + f.Path + " at its tag"
first := "https://github.com/" + f.Repo + "/blob/HEAD/" + f.Path
if f.Notes {
watches = "Names removed, renamed or deprecated in each release of " + f.Package + ", from the release's notes on GitHub"
first = "https://github.com/" + f.Repo + "/releases"
}
return plugin.Source{
ID: id, Layer: layerOf(f), Page: page, Watches: watches,
URLs: []string{first}, Packages: packages, Plugin: Plugin{File: f},
}
}

func layerOf(f File) plugin.Layer {
if f.Ecosystem == "terraform" {
return plugin.LayerInfra
}
return plugin.LayerSDK
}
49 changes: 49 additions & 0 deletions plugins/changelog/sdks_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package changelog

import (
"strings"
"testing"

"github.com/patch-it-dev/patch-it-plugins/core/kit/kittest"
)

// sdkCase is one SDK's changelog, saved at a release's tag
// (testdata/README.md), and the release its golden pins: the pair from the
// release before (on the registry, or among the repo's tags) to it. drop is
// another release in the same saved file (for Notes, in dropped, its own
// saved release) whose notes name nothing removed: it must read as no event.
type sdkCase struct {
file File
release, prev string
saved, dropped string
drop string
}

// checkSDKs runs each case's golden, its drop test and its registration.
func checkSDKs(t *testing.T, cases []sdkCase) {
t.Helper()
for _, c := range cases {
t.Run(c.file.API, func(t *testing.T) {
kittest.Registered(t, Plugin{File: c.file})
got := release(t, c.file.At(c.release), "testdata/"+c.saved, c.prev)
if len(got) == 0 {
t.Fatal("no events: the golden must pin a release with some")
}
kittest.Golden(t, "testdata/golden/"+strings.ReplaceAll(c.file.API, "/", "-")+".json", got)

saved := c.saved
if c.dropped != "" {
saved = c.dropped
}
_, fs, err := c.file.At(c.drop).Read(kittest.Read(t, "testdata/"+saved))
if err != nil {
t.Fatal(err)
}
for _, f := range fs {
if f.Dropped == "" {
t.Errorf("drop test %s: an event from %q", c.drop, f.Bullet.Text)
}
}
})
}
}
39 changes: 39 additions & 0 deletions plugins/changelog/stripe.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package changelog

import "github.com/patch-it-dev/patch-it-plugins/core/plugin"

func init() {
const page = "providers/stripe-sdks.md"
plugin.RegisterProvider(plugin.Provider{
ID: "stripe", Name: "Stripe", Category: plugin.CategoryPayments, Homepage: "https://stripe.com",
Sources: []plugin.Source{
sdk(page, "python", StripePython, "pypi:stripe"),
sdk(page, "node", StripeNode, "npm:stripe"),
sdk(page, "go", StripeGo, "go:github.com/stripe/stripe-go/v87"),
sdk(page, "java", StripeJava, "maven:com.stripe:stripe-java"),
sdk(page, "ruby", StripeRuby, "rubygems:stripe"),
sdk(page, "dotnet", StripeDotnet, "nuget:Stripe.net"),
sdk(page, "php", StripePHP, "packagist:stripe/stripe-php"),
},
})
}

// Stripe's SDKs: one CHANGELOG.md each, "## <a id="X-Y-Z"></a>X.Y.Z - date"
// (older ones "## X.Y.Z - date"), every breaking bullet marked "⚠️"; each
// release tagged vX.Y.Z.
var (
StripePython = File{API: "stripe/python", Package: "stripe", Ecosystem: "pypi", Module: "stripe",
Repo: "stripe/stripe-python", TagPrefix: "v", Path: "CHANGELOG.md"}
StripeNode = File{API: "stripe/node", Package: "stripe", Ecosystem: "npm",
Repo: "stripe/stripe-node", TagPrefix: "v", Path: "CHANGELOG.md"}
StripeGo = File{API: "stripe/go", Package: "github.com/stripe/stripe-go", Ecosystem: "go",
Repo: "stripe/stripe-go", TagPrefix: "v", Path: "CHANGELOG.md"}
StripeJava = File{API: "stripe/java", Package: "com.stripe:stripe-java", Ecosystem: "maven",
Repo: "stripe/stripe-java", TagPrefix: "v", Path: "CHANGELOG.md"}
StripeRuby = File{API: "stripe/ruby", Package: "stripe", Ecosystem: "rubygems",
Repo: "stripe/stripe-ruby", TagPrefix: "v", Path: "CHANGELOG.md"}
StripeDotnet = File{API: "stripe/dotnet", Package: "Stripe.net", Ecosystem: "nuget",
Repo: "stripe/stripe-dotnet", TagPrefix: "v", Path: "CHANGELOG.md"}
StripePHP = File{API: "stripe/php", Package: "stripe/stripe-php", Ecosystem: "packagist",
Repo: "stripe/stripe-php", TagPrefix: "v", Path: "CHANGELOG.md"}
)
15 changes: 15 additions & 0 deletions plugins/changelog/stripe_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package changelog

import "testing"

func TestStripeSDKs(t *testing.T) {
checkSDKs(t, []sdkCase{
{StripePython, "4.0.0", "3.5.0", "stripe-python-4.0.0-CHANGELOG.md", "", "3.5.0"},
{StripeNode, "10.0.0", "9.16.0", "stripe-node-10.0.0-CHANGELOG.md", "", "9.16.0"},
{StripeGo, "73.0.0", "72.122.0", "stripe-go-73.0.0-CHANGELOG.md", "", "72.122.0"},
{StripeJava, "21.0.0", "20.136.0", "stripe-java-21.0.0-CHANGELOG.md", "", "20.136.0"},
{StripeRuby, "7.0.0", "6.5.0", "stripe-ruby-7.0.0-CHANGELOG.md", "", "6.5.0"},
{StripeDotnet, "40.0.0", "39.126.0", "stripe-dotnet-40.0.0-CHANGELOG.md", "", "39.126.0"},
{StripePHP, "9.0.0", "8.12.1", "stripe-php-9.0.0-CHANGELOG.md", "", "8.12.0"},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is the only case where prev (8.12.1) and drop (8.12.0) differ. The saved file's two sections are 9.0.0 and 8.12.0, testdata/README.md describes the trim as "9.0.0 (the golden) and 8.12.0", and all 13 events in golden/stripe-php.json carry "previous_version": "8.12.1".

Can you confirm that a v8.12.1 tag exists in stripe/stripe-php and comes right before v9.0.0? I couldn't check that from CI. If it doesn't exist, the golden records the wrong previous version:

Suggested change
{StripePHP, "9.0.0", "8.12.1", "stripe-php-9.0.0-CHANGELOG.md", "", "8.12.0"},
{StripePHP, "9.0.0", "8.12.0", "stripe-php-9.0.0-CHANGELOG.md", "", "8.12.0"},

(then regenerate golden/stripe-php.json). If it does exist, please say so in the PR and note in the README row that 8.12.1's section was trimmed out.

})
}
14 changes: 14 additions & 0 deletions plugins/changelog/testdata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ golden files under `golden/` are what the plugin stores from them
| `textual-v0.86.0-CHANGELOG.md` | https://raw.githubusercontent.com/Textualize/textual/v0.86.0/CHANGELOG.md | `5a738fa` | 2026-11-14 08:36 UTC | MIT (Textual), kept whole | "Breaking change: Removed `App.dark` reactive attribute" |
| `urllib3-2.0.0-CHANGES.rst` | https://raw.githubusercontent.com/urllib3/urllib3/2.0.0/CHANGES.rst | `303ba81` | 2026-11-14 08:35 UTC | MIT (urllib3), kept whole | "Removed support for Python 2.7, 3.5, and 3.6" |

## SDK changelogs

Read with `Plugin{File: ...}` (`sdks.go`); `golden/<provider>-<source>.json` is what each stores from its release (`sdks_test.go`), the pair from the release before it on the registry (or among the repo's tags). Every file is the changelog at the release's tag, saved with `curl`, **trimmed** to two releases' sections, each kept whole and unchanged: the release the golden pins and one more release from the same file whose notes remove nothing the reader can name (the drop test). Only the pinned release's own section is read for the golden, so the trimmed copy gives the same events as the whole file (checked when each copy was made).

| File | URL | Tag commit | Saved | License; trimming | Quote |
|---|---|---|---|---|---|
| `stripe-python-4.0.0-CHANGELOG.md` | https://raw.githubusercontent.com/stripe/stripe-python/v4.0.0/CHANGELOG.md | `e65630a` | 2026-11-20 | MIT (stripe-python); trimmed to the sections of 4.0.0 (the golden) and 3.5.0 (the drop test), each unchanged | "Removed deprecated `AlipayAccount`, `BitcoinReceiver`, `BitcoinTransaction`, `IssuerFraudRecord`, `Recipient`, `Recip…" |
| `stripe-node-10.0.0-CHANGELOG.md` | https://raw.githubusercontent.com/stripe/stripe-node/v10.0.0/CHANGELOG.md | `321d2fd` | 2026-11-20 | MIT (stripe-node); trimmed to the sections of 10.0.0 (the golden) and 9.16.0 (the drop test), each unchanged | "Remove `AlipayAccount` and `BitcoinReceiver` from `CustomerSource`." |
| `stripe-go-73.0.0-CHANGELOG.md` | https://raw.githubusercontent.com/stripe/stripe-go/v73.0.0/CHANGELOG.md | `234502c` | 2026-11-20 | MIT (stripe-go); trimmed to the sections of 73.0.0 (the golden) and 72.122.0 (the drop test), each unchanged | "Remove `BalanceTransactionStatus`. It was meant to be an enum, but none of the enum values were defined, so it was ju…" |
| `stripe-java-21.0.0-CHANGELOG.md` | https://raw.githubusercontent.com/stripe/stripe-java/v21.0.0/CHANGELOG.md | `cd2b023` | 2026-11-20 | MIT (stripe-java); trimmed to the sections of 21.0.0 (the golden) and 20.136.0 (the drop test), each unchanged | "Removed `CashBalance.retrieveCashBalance` method. Prefer `CashBalance.retrieve`." |
| `stripe-ruby-7.0.0-CHANGELOG.md` | https://raw.githubusercontent.com/stripe/stripe-ruby/v7.0.0/CHANGELOG.md | `6081371` | 2026-11-20 | MIT (stripe-ruby); trimmed to the sections of 7.0.0 (the golden) and 6.5.0 (the drop test), each unchanged | "Remove `details` method from `Issuing.Card` resource. The method was not supported." |
| `stripe-dotnet-40.0.0-CHANGELOG.md` | https://raw.githubusercontent.com/stripe/stripe-dotnet/v40.0.0/CHANGELOG.md | `e07ebe7` | 2026-11-20 | Apache-2.0 (stripe-dotnet); trimmed to the sections of 40.0.0 (the golden) and 39.126.0 (the drop test), each unchanged | "Remove `CustomerPaymentSettingsOptions`, `CustomerPaymentSettingsPaymentMethodOptionsBancontactOptions`, `CustomerPay…" |
| `stripe-php-9.0.0-CHANGELOG.md` | https://raw.githubusercontent.com/stripe/stripe-php/v9.0.0/CHANGELOG.md | `e405c17` | 2026-11-20 | MIT (stripe-php); trimmed to the sections of 9.0.0 (the golden) and 8.12.0 (the drop test), each unchanged | "Remove deprecated `AlipayAccount`, `BitcoinReceiver`, `BitcoinTransaction`, `Recipient`, `RecipientTransfer`, and `Th…" |

## Version lists

| File | URL | Saved | License | Use |
Expand Down
128 changes: 128 additions & 0 deletions plugins/changelog/testdata/golden/stripe-dotnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
[
{
"id": 1,
"fingerprint": "sha256:eebe0e0b38610cb9a0567dd0faa50aaef5b3ad8adb64e47c4ec2b8b775a0d28c",
"api": "stripe/dotnet",
"version": "40.0.0",
"previous_version": "39.126.0",
"change_type": "breaking",
"breaking": true,
"subject": {
"type": "package_release",
"ecosystem": "nuget",
"package": "Stripe.net",
"change": "removed_symbol",
"symbols": [
"CustomerPaymentSettingsOptions",
"CustomerPaymentSettingsPaymentMethodOptionsBancontactOptions",
"CustomerPaymentSettingsPaymentMethodOptionsCardOptions",
"CustomerPaymentSettingsPaymentMethodOptionsOptions"
]
},
"description": "`CustomerPaymentSettingsOptions`, `CustomerPaymentSettingsPaymentMethodOptionsBancontactOptions`, `CustomerPaymentSettingsPaymentMethodOptionsCardOptions`, `CustomerPaymentSettingsPaymentMethodOptionsOptions` were removed in Stripe.net 40.0.0: code using it fails.",
"migration_hint": "Remove `CustomerPaymentSettingsOptions`, `CustomerPaymentSettingsPaymentMethodOptionsBancontactOptions`, `CustomerPaymentSettingsPaymentMethodOptionsCardOptions`, and `CustomerPaymentSettingsPaymentMethodOptionsOptions`. (Stripe.net's changelog for 40.0.0)",
"source_url": "https://raw.githubusercontent.com/stripe/stripe-dotnet/v40.0.0/CHANGELOG.md",
"source_excerpt": "## 40.0.0 - 2022-08-02\n⚠️ Removed\n* Remove `CustomerPaymentSettingsOptions`, `CustomerPaymentSettingsPaymentMethodOptionsBancontactOptions`, `CustomerPaymentSettingsPaymentMethodOptionsCardOptions`, and `CustomerPaymentSettingsPaymentMethodOptionsOptions`.",
"confidence": 1,
"detected_at": "2026-11-14T12:00:00Z"
},
{
"id": 2,
"fingerprint": "sha256:da684da773ddf61efd72704ca30144801a397b1f97d9ebe8b38747a7c5895aa3",
"api": "stripe/dotnet",
"version": "40.0.0",
"previous_version": "39.126.0",
"change_type": "breaking",
"breaking": true,
"subject": {
"type": "package_release",
"ecosystem": "nuget",
"package": "Stripe.net",
"change": "removed_symbol",
"symbols": [
"FilePurpose.IncorporationArticle",
"FilePurpose.IncorporationDocument",
"FilePurpose.PaymentProviderTransfer",
"FilePurpose.ProductFeed"
]
},
"description": "`FilePurpose.IncorporationArticle`, `FilePurpose.IncorporationDocument`, `FilePurpose.PaymentProviderTransfer`, `FilePurpose.ProductFeed` were removed in Stripe.net 40.0.0: code using it fails.",
"migration_hint": "Remove `IncorporationArticle`, `IncorporationDocument`, `PaymentProviderTransfer`, and `ProductFeed` from `FilePurpose` constants. The values are no longer in use. (Stripe.net's changelog for 40.0.0)",
"source_url": "https://raw.githubusercontent.com/stripe/stripe-dotnet/v40.0.0/CHANGELOG.md",
"source_excerpt": "## 40.0.0 - 2022-08-02\n⚠️ Removed\n* Remove `IncorporationArticle`, `IncorporationDocument`, `PaymentProviderTransfer`, and `ProductFeed` from `FilePurpose` constants. The values are no longer in use.",
"confidence": 1,
"detected_at": "2026-11-14T12:00:00Z"
},
{
"id": 3,
"fingerprint": "sha256:8e8af5e5a10f757b9a821b6933a11b5eed7e272b7c5f7c06ce366fe85ac1a13c",
"api": "stripe/dotnet",
"version": "40.0.0",
"previous_version": "39.126.0",
"change_type": "breaking",
"breaking": true,
"subject": {
"type": "package_release",
"ecosystem": "nuget",
"package": "Stripe.net",
"change": "removed_symbol",
"symbols": [
"CustomerUpdateOptions.TrialEnd"
]
},
"description": "`CustomerUpdateOptions.TrialEnd` was removed in Stripe.net 40.0.0: code using it fails.",
"migration_hint": "Remove `TrialEnd` property in `CustomerUpdateOptions`. The property was not supported in the operation. (Stripe.net's changelog for 40.0.0)",
"source_url": "https://raw.githubusercontent.com/stripe/stripe-dotnet/v40.0.0/CHANGELOG.md",
"source_excerpt": "## 40.0.0 - 2022-08-02\n⚠️ Removed\n* Remove `TrialEnd` property in `CustomerUpdateOptions`. The property was not supported in the operation.",
"confidence": 1,
"detected_at": "2026-11-14T12:00:00Z"
},
{
"id": 4,
"fingerprint": "sha256:f19f602855f3af0487e459aefecbf349d33357be48e1090eec34ba49d50152fb",
"api": "stripe/dotnet",
"version": "40.0.0",
"previous_version": "39.126.0",
"change_type": "breaking",
"breaking": true,
"subject": {
"type": "package_release",
"ecosystem": "nuget",
"package": "Stripe.net",
"change": "removed_symbol",
"symbols": [
"QuoteFinalizeQuoteOptions"
]
},
"description": "`QuoteFinalizeQuoteOptions` was removed in Stripe.net 40.0.0: code using it fails.",
"migration_hint": "Remove `QuoteFinalizeQuoteOptions`. The options weren't used anymore. (Stripe.net's changelog for 40.0.0)",
"source_url": "https://raw.githubusercontent.com/stripe/stripe-dotnet/v40.0.0/CHANGELOG.md",
"source_excerpt": "## 40.0.0 - 2022-08-02\n⚠️ Removed\n* Remove `QuoteFinalizeQuoteOptions`. The options weren't used anymore.",
"confidence": 1,
"detected_at": "2026-11-14T12:00:00Z"
},
{
"id": 5,
"fingerprint": "sha256:6318782d02a60ee53ce339826d81530094a32aa04dd81945452d24a7dfdd13de",
"api": "stripe/dotnet",
"version": "40.0.0",
"previous_version": "39.126.0",
"change_type": "breaking",
"breaking": true,
"subject": {
"type": "package_release",
"ecosystem": "nuget",
"package": "Stripe.net",
"change": "removed_symbol",
"symbols": [
"LoginLinkCreateOptions.RedirectUrl"
]
},
"description": "`LoginLinkCreateOptions.RedirectUrl` was removed in Stripe.net 40.0.0: code using it fails.",
"migration_hint": "Remove `RedirectUrl` from `LoginLinkCreateOptions`. The property was deprecated. (Stripe.net's changelog for 40.0.0)",
"source_url": "https://raw.githubusercontent.com/stripe/stripe-dotnet/v40.0.0/CHANGELOG.md",
"source_excerpt": "## 40.0.0 - 2022-08-02\n⚠️ Removed\n* Remove `RedirectUrl` from `LoginLinkCreateOptions`. The property was deprecated.",
"confidence": 1,
"detected_at": "2026-11-14T12:00:00Z"
}
]
Loading
Loading