Skip to content

stripe: sdk changelogs read the api version they pin; stripe/api lists api versions - #246

Merged
adssib merged 5 commits into
mainfrom
pl-stripe-mapsto
Nov 21, 2026
Merged

adssib merged 5 commits into
mainfrom
pl-stripe-mapsto

Conversation

@adssib

@adssib adssib commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Two parts: the SDK changelogs read the API version each release pins, and stripe/api lists its versions by that same API version, so the two ids match.

1. The SDK changelogs fill MapsTo

The seven Stripe SDK changelog sources (stripe/python, stripe/node, stripe/go, stripe/java, stripe/ruby, stripe/dotnet, stripe/php) now fill plugin.Version.MapsTo while listing their releases: stripe/api at the API version the release's own changelog section states it pins.

Every SDK states it the same way when a release changes the pin (checked 2026-11-20 in all seven CHANGELOG.mds):

This release changes the pinned API version to 2026-11-18.endive.

and a few releases say they keep it ("This release doesn't change the pinned API version; it still uses 2026-05-27.dahlia." in Go, Java and .NET; "…does not change the pinned API version. It's still 2026-06-24.dahlia." in PHP; "This release uses the same pinned API version to 2026-03-25.dahlia as the last major release." in Node). Those four sentences are read; nothing else is.

Example pair: stripe/python 16.1.0 → stripe/api 2026-10-28.endive, 17.1.0 → stripe/api 2026-11-18.endive (17.0.0 says nothing: zero).

  • plugins/changelog/pins.go: pins(file), the stated pin per release (one pass over the Markdown changelog, code blocks skipped, two different versions in one section are none); File.pinned reads the changelog once per listing, at the newest release's tag (which has every earlier section), and sets MapsTo. A changelog that can't be fetched leaves the listing as it is (logged; the next listing fills it).
  • File.Pins (new field): the source a release's section pins a version of. Set to stripe/api on the seven Stripe files; empty everywhere else, which fetches nothing extra.
  • providers/stripe-sdks.md: what's read, quotes, and the gaps below.

2. stripe/api lists API versions, not release tags

Before, stripe/api listed every stripe/openapi release tag (v2191 … v2602, ~2,600 tags, several a day), while its events carried the spec's info.version. Now its versions are Stripe's API versions, as the releases' notes name them. Since v2191 (2026-03-11) every release's notes have a table:

| openapi/spec3.sdk.{json,yaml} | 2026-11-18.endive |

  • Listed: one version per API version named in the notes, oldest first. Each one is read at the newest release that names it (Ref, URL) and dated by the first (Released). Today that gives 2026-02-25.clover@v2203, 2026-03-25.dahlia@v2248, … 2026-10-28.endive@v2600, 2026-11-18.endive@v2602. Pairs are API version → next API version, and events' version/previous_version are these ids (the spec's info.version).
  • Checked on read: the file read is still latest/openapi.spec3.json. If the spec at that release declares another version, ReadAt returns an error (new optional adapter.SpecVersioned interface); it is never read as the listed version. This happens today: at v2602 the notes say 2026-11-18.endive but the GA file still says 2026-10-28.endive. When a later release's file catches up, its notes name the same version, Ref moves to it, and the next run reads it.
  • Not listed: releases before v2191 name no version, so nothing older than 2026-02-25.clover is listed. Naming those would mean reading thousands of old specs or guessing.
  • Removed (dead): the legacy openapi/spec3.json fallback for tags older than latest/ (v207-era) and its test. No listed release needs it any more.
  • Goldens: none changed. There is no stripe/api golden; the OpenAPI goldens are other providers' and are untouched.
  • Tests:
    • TestStripeListsAPIVersions runs over a saved listing (adapter/testdata/versions/stripe-openapi-releases.json, 21 real releases: the first and last of each of the 10 named versions, plus v2190 with no table).
    • TestASpecVersionedReadMustDeclareItsVersion covers the read check.
    • TestStripePinsAreVersionsStripeAPILists: every pin the seven SDK sources read from their saved changelogs is an id stripe/api lists from that saved listing (via the registered stripe/api plugin).

Checklist

  • Metadata complete in the registration: Not applicable: no source added; the seven registrations are unchanged apart from Pins. I read providers/stripe-sdks.md's words.
  • Every commit is signed off (git commit -s, DCO)
  • Golden test: not applicable, no event output changes (the existing Stripe goldens are untouched)
  • testdata/README.md lists each file: the seven saved changelogs under testdata/pins/ (each SDK's CHANGELOG.md at its newest release tag, trimmed to 2–3 whole sections: one that changes the pin, one that says nothing, and the "keeps it" wording where the SDK has one) and one tag list written for the test
  • Drop test equivalent: a release whose section says nothing (17.0.0, 23.0.1, 86.4.2, …) pins nothing; a statement inside a code block or before the first release is nobody's; two versions in one section are none (TestAnUnsurePinIsNone)
  • providers/stripe-sdks.md updated
  • Fetches only through env.Get
  • make check passes locally
  • Nothing private

Tests: TestStripeReleasesStateWhatTheyPin (each saved file, every stated pin exactly), TestListedVersionsCarryWhatTheyPin (stripe-go listed from its tags, MapsTo set from the changelog at the newest tag), TestPinsAreReadOnlyWhenTheyCanBe (fetch failure → no pins, no error; no Pins → no extra fetch), TestAnUnsurePinIsNone. Ran the reader over all seven full changelogs: 33–60 pins each, every one a real "pinned API version" sentence (back to stripe-go's 2014-11-20), e.g. stripe-dotnet 24.0.1's "Fix pinned API version to 2019-02-19".

Notes for the reviewer

  • The pin and stripe/api's ids are the same strings (part 2). The cross-check test pins that down.
  • Only releases that say so have a pin. Stripe states the pin only when it changes (and a few releases that keep it), so most minors and patches pin nothing here, even though they keep the release before's. Carrying the last stated pin forward would fill every release, but it isn't what that release says; left out on purpose.
  • Older wordings without "pinned" ("Major version release for API version 2022-08-01", "Move to API version …", "Upgrade API version to …") aren't read: precision over recall.
  • Other SDK changelogs checked for a plainly stated pinned API version (2026-11-20): Cloudflare (Python, Go, TypeScript, Terraform), Sentry (Python, JavaScript, Go, .NET), Octokit (rest.js, octokit.net), PostHog Go, ioredis. None states one (Cloudflare's, PostHog's and Sentry's APIs aren't versioned that way; Octokit's notes never name the GitHub REST API version), so only Stripe fills MapsTo.
  • Release: a minor release (v0.6.0) after merge. File.Pins and adapter.SpecVersioned are new exported API, and stripe/api's version ids change. The ingest bump then re-lists stripe/api with new ids; ingest has no production data to keep, and the old tag-id rows can be dropped (DB reset). patch-it's hosted ingestion service picks it up on that bump.

Part of #186.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: adssib <75389300+adssib@users.noreply.github.com>
@claude

claude Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Claude finished @adssib's task in 1m 44s —— View job


✅ Ready to merge. The pins are read only from plainly worded sentences in each release's own section, every check passes, and no event output changes. One design question below needs a maintainer to decide before release.

Rules

Rule Status Evidence
Metadata in the registration (Rule 1) ✅ No source added or removed. The seven Files in stripe.go only gain Pins: "stripe/api". No hand-kept list reappears.
Provider page ✅ providers/stripe-sdks.md gets the quoted wordings (dated 2026-11-20), the new read in "What the plugin reads", and two honest Known gaps.
Golden test + quote ✅ n/a No event output changes and the Stripe goldens are untouched. Each of the seven saved changelogs has a testdata/README.md row with URL, tag commit, date, license (MIT, or Apache-2.0 for .NET), the sections kept and a quote. stripe-go-tags-pins.json is listed as written for the test.
Drop test ✅ Sections that say nothing get no pin (17.0.0, 23.0.1, 86.4.2, …). TestAnUnsurePinIsNone covers a code block, text before the first release, and two different versions in one section.
Fetch only via env ✅ One extra env.Get per listing, only when Pins != "". No net/http, no filesystem access. TestPinsAreReadOnlyWhenTheyCanBe checks the no-Pins path makes no extra fetch.
Precision over recall ✅ Only four wordings are read, each containing "pinned API version". A conflict in one section gives no pin, and nothing is carried forward to later releases.
Nothing private (Rule 2) ✅ The diff, the PR body and the commit contain no credentials, internal names or private links. The leak guard is clean.

Bugs

None found that block the merge.

Design question for a maintainer (not a code bug): the comment on plugin.Pin.Version (core/plugin/versions.go:58) says it holds the version "as that source names it". stripe/api lists its versions by stripe/openapi release tag (v2602, from adapter/versions.go), but this PR pins 2026-11-18.endive, which is the version its events carry. The PR says so openly, in its description and in Known gaps. Before v0.6.0, someone should confirm which of the two the hosted service joins MapsTo on. If it joins on listed ids, these pins won't match anything. Nothing wrong would be emitted, so precision holds, but the feature would do nothing until stripe/api lists by API version.

Verified

  • go build ./...: OK
  • go vet ./...: OK
  • gofmt -l .: printed nothing
  • go test -race ./...: all packages pass, including plugins/changelog with the four new tests
  • python3 scripts/leak_guard.py --all: "no banned terms (8 hashed terms checked)"
  • Confirmed that core/versions returns lists oldest first, so vs[len(vs)-1] is the newest release.
  • Confirmed that mdRelease matches both heading styles (## <a id=…></a>X.Y.Z and ## X.Y.Z), and that ### subheadings don't end a release's section.

Non-blocking (optional, comments left on the lines)

  • pins.go:41: headings are checked before fences, so a # comment line inside a fenced code example ends the release early. A pin sentence after that block is then missed, though never misattributed. Checking for fences first fixes it.
  • pins.go:79: if the newest registry release has no matching git tag yet, the single fetch fails and every release has an empty MapsTo on that listing. Trying the next-newest version as a fallback would avoid that. It's also worth checking that the hosted service doesn't overwrite stored pins with zero.

Thanks for the careful testdata and for writing up the gaps so clearly.

Comment thread plugins/changelog/pins.go
out, conflict := map[string]string{}, map[string]bool{}
release, fenced := "", false
for _, l := range strings.Split(strings.ReplaceAll(string(file), "\r\n", "\n"), "\n") {
if strings.HasPrefix(l, "## ") || strings.HasPrefix(l, "# ") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Non-blocking: the heading check runs before the fence check, so a # comment line inside a fenced Ruby/Python/shell example (common in migration notes) ends the current release: any pin sentence after that code block in the same section is lost. That loses a pin rather than inventing one, so precision is fine. Moving the fence toggle above the heading check fixes it:

if strings.HasPrefix(strings.TrimSpace(l), "```") {
	fenced = !fenced
	continue
}
if fenced {
	continue
}
if strings.HasPrefix(l, "## ") || strings.HasPrefix(l, "# ") { ... }

(A changelog that never closes a fence would then hide every heading after it. If you care about that, also reset fenced on a ## heading.)

Comment thread plugins/changelog/pins.go Outdated
if f.Pins == "" || f.Notes || len(vs) == 0 {
return vs
}
newest := f.At(vs[len(vs)-1].ID)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Non-blocking: for the registry-listed SDKs (PyPI, npm), the newest version comes from the registry, but the changelog is fetched at its git tag. If a release reaches the registry before its tag exists, or never gets a v-prefixed tag, this fetch 404s and every release loses its MapsTo until the next release. One fallback would be to try the next-newest version when the newest fails. Not a correctness bug as it stands, because nothing wrong is emitted. Worth checking that the hosted service doesn't overwrite a previously stored MapsTo with zero on such a listing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: adssib <75389300+adssib@users.noreply.github.com>
@adssib

adssib commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

@claude review

@claude

claude Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Claude finished @adssib's task in 33s —— View job


✅ Ready to merge. The new commit (2fd00ee) fixes both earlier non-blocking points correctly and adds a test for each. Nothing in it can emit an event, or a pin, for a release that didn't state one.

What changed since the last review

  • Code blocks before headings (plugins/changelog/pins.go:41-53): a fence now toggles before the heading check, so a # upgrade comment inside a code example no longer ends the release's section. A real release heading (## X.Y.Z) resets fenced, so a block that's never closed hides at most the rest of its own section. That loses pins but never misattributes one. The new case in TestAnUnsurePinIsNone covers it.
  • Fall back to the tag before (pins.go:91-96): if the newest release's tag can't be fetched (it's on the registry before the tag is pushed), the changelog is read at the second-newest tag. Pins are keyed by each section's own release heading, so the older file can't give the newest release someone else's pin. The newest release just has none on that listing. It tries two tags at most, so a broken repo costs one extra request. TestPinsFallBackToTheTagBefore and the new fetch count in TestPinsAreReadOnlyWhenTheyCanBe (tags + 2 changelogs) pin this behaviour down.

Rules

Rule Status Evidence
1. Metadata in the registration ✅ No source added or removed. The seven Stripe Files in stripe.go only gain Pins: "stripe/api". No hand-kept list.
2. Provider page ✅ providers/stripe-sdks.md quotes all four wordings (dated 2026-11-20), describes the MapsTo read, and lists two honest Known gaps.
3. Golden + testdata + drop test + source/quote ✅ n/a for golden No event output changes; Stripe goldens untouched. Seven saved changelogs each have a testdata/README.md row (URL, tag commit, date, license, sections kept, quote). stripe-go-tags-pins.json is listed as written for the test. Drop-equivalents: silent sections (17.0.0, 23.0.1, 86.4.2…), code blocks, text before the first release, conflicting versions.
4. Fetch only via env ✅ Only env.Get, and only when Pins != "". No net/http, no filesystem outside testdata/.
5. Precision over recall ✅ Only four sentences containing "pinned API version" are read. A conflict gives no pin, nothing is carried forward, and a fetch failure leaves MapsTo zero.
6. Nothing private ✅ No credentials, internal names, private links or session links in the diff, PR body or commits.

I can't run the tests here; CI_go covers them (build, vet, gofmt, the import and net/http guards, go test -race, todos, leak guard).

Blocking bugs

None.

Non-blocking suggestions

  • Provider page wording: providers/stripe-sdks.md still says the changelog is read "at the newest release's tag". Adding "(or the one before, when that tag isn't pushed yet)" would match pins.go's doc comment.
  • Still open from the last review (a maintainer's call, not a code bug): MapsTo.Version is 2026-11-18.endive, which is the version stripe/api events carry, but stripe/api lists its versions by stripe/openapi tag (v2602). Before cutting v0.6.0, confirm which of the two patch-it's hosted ingestion service joins on. Also confirm it doesn't overwrite a stored MapsTo with zero when a listing can't read the changelog.

Thanks for picking up both suggestions so quickly, with tests for each.

adssib and others added 2 commits November 20, 2026 22:55
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: adssib <75389300+adssib@users.noreply.github.com>
…them

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: adssib <75389300+adssib@users.noreply.github.com>
@adssib adssib changed the title changelog: read the API version each stripe sdk release pins stripe: sdk changelogs read the api version they pin; stripe/api lists api versions Nov 21, 2026
@adssib

adssib commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

@claude review

@claude

claude Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Claude finished @adssib's task in 1m 8s —— View job


✅ Ready to merge. The two new commits (54acfb4 and 843a2b5) answer the design question from the last two reviews: stripe/api now lists its versions by API version, so the ids its listing uses, its events' version and the SDKs' MapsTo pins are all the same strings. The new read check means a spec is never read as a version it doesn't declare. Two non-blocking questions below are for a maintainer, about how the hosted service handles a version that fails to read.

Rules

Rule Status Evidence
1. Metadata in the registration ✅ No source added or removed. The seven Stripe Files only gain Pins: "stripe/api". stripe/api's registration is unchanged; only its adapter's listing changes. No hand-kept list.
2. Provider page ✅ providers/stripe.md covers the new listing: the notes table quote, the source URL (/releases, checked 2026-11-20), the GA-file lag with a real example (v2602), and the new gap that nothing before v2191 is listed. providers/stripe-sdks.md now mentions the tag-before fallback, which was my earlier suggestion, and drops the gap the new listing closes.
3. Golden + testdata + drop test + source/quote ✅ (no golden needed) No event output changes and no golden was edited. stripe-openapi-releases.json has a testdata/README.md row: 21 of 2,591 releases, the first and last of each API version, plus v2190 with no table. That v2190 entry is the drop case: no table means not listed. TestStripePinsAreVersionsStripeAPILists checks that every pin read from the saved changelogs is an id stripe/api lists.
4. Fetch only via env/kit ✅ The listing goes through versions.GitHubPages with github.Get, and the spec through fetch.Get in plugins/openapi/adapter/, which is allowed. pins_stripe_test.go imports net/http/httptest, but the nethttp target only checks non-test imports (.Imports), so that's fine.
5. Precision over recall ✅ The ReadAt check (plugins/openapi/openapi.go:281) returns an error when the spec at Ref declares a different version, so a lagging GA file can't produce events labelled with the wrong version. The regex is anchored to the openapi/spec3.sdk.{json,yaml} row, so the beta/private_preview rows (2026-11-18.preview) don't match. Releases whose notes name no version are left out, never guessed.
6. Nothing private ✅ No credentials, internal names, private links or session links in the diff, the PR body or the commit messages.

I can't run the tests here; CI_go covers them (build, vet, gofmt, the import and net/http guards, go test -race, todos, leak guard).

Blocking bugs

None.

Things I checked

  • The lag check returns a plain error, not ErrNothingToRead. That's the right choice. ErrNothingToRead would mark the pair as skipped for good, while a plain error is a failure that gets retried, which is what you want until the GA file catches up.
  • Released and Ref: releases are sorted by published_at before grouping, so Released is the first release's date and Ref/URL are the last release's. Drafts and prereleases are skipped. The test pins the newest version's date to v2601 and its URL to v2602.
  • Dropping the legacy openapi/spec3.json fallback is safe. Every listed Ref is v2203 or later, and latest/ exists there. The old v207 URLs left in core/normalize/normalize_test.go are only fixture provenance strings and fetch nothing.

Non-blocking suggestions

  • A version the GA file never declares (for a maintainer). The listed id comes from the SDK spec's row, but the file read is the GA latest/openapi.spec3.json. If Stripe ever moves the SDK spec on to version Y before the GA file has declared X, then X's Ref stops moving, and ReadAt(X) fails on every run. Two things to confirm in patch-it's hosted ingestion service:

    1. A version that fails to read on every run doesn't block the X→Y pair, or the pairs after it.
    2. When a listing returns the same id with a new Ref, the service reads it at the new Ref. The page's "the next run reads it" depends on this.

    This doesn't happen in today's data: each of the 10 listed versions is read at a release where the GA file should have caught up. If it ever does, though, a short note under Known gaps in providers/stripe.md would help.

  • The PR says the GA file catches up, but there's no check of the older versions. If you still have the files, a one-line note in the PR saying you fetched latest/openapi.spec3.json at each listed Ref (v2203 … v2600) and its info.version matched would show that all ten older versions read cleanly today. (v2602 is the known exception the page already describes.)

  • Nit: providers/stripe.md's Known gaps has a blank line after the two new bullets, which splits it into two lists in some renderers.

Thanks for closing the id mismatch at the source instead of documenting around it, and for the cross-check test that keeps the two sides in step.

…sion

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: adssib <75389300+adssib@users.noreply.github.com>
@adssib
adssib merged commit e7d2213 into main Nov 21, 2026
4 checks passed
@adssib
adssib deleted the pl-stripe-mapsto branch November 21, 2026 05:07
This was referenced Nov 21, 2026
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.

1 participant