Skip to content

sources: openapi specs, PyPI and npm API surfaces (combined) - #244

Merged
6 commits merged into
mainfrom
pl4-sources
Nov 21, 2026
Merged

6 commits merged into
mainfrom
pl4-sources

Conversation

@adssib

@adssib adssib commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

The three stacked PRs in one, for merging into main at once:

Closes #212

28 new sources in all (make plugins), each with a golden pair and a drop pair of real versions, a provider page with Why this source, and its testdata listed in testdata/README.md. Details, acceptance criteria and the calls made are in each stacked PR.

Release bump needed: minor (a new ecosystem and reader in apisurface, new fields in its snapshot, a renamed source id).

Checklist

  • Metadata complete in the registration, and I read the words.
  • Every commit is signed off (DCO)
  • Golden tests over real saved copies
  • testdata/README.md rows
  • One pinned drop test per source
  • Provider pages
  • Fetches only through env.Get / the adapter layer
  • make check passes locally
  • Nothing private

Related PRs

🤖 Generated with Claude Code

…spec

Three specs committed several times a day, versioned by the day: a spec
read from its commits is now one version per day, at the day's last
commit (Daily), for every commit-listed adapter, so no version ID is
listed twice.

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 41s —— View job


⚠️ Merge after fixes: the metadata, pages, testdata and checks all look good, but one small case in the new TypeScript comparison writes an event about the wrong parameter.

Rules

Rule Status Evidence
Metadata in the registration ✅ 15 PyPI sources (plugins/apisurface/pypi.go), 10 npm sources (npm_packages.go) and 3 openapi sources (plugins/openapi/openapi.go). Each has id, name, category, homepage, layer, watches, URLs and page. All but mongodb/atlas-admin-spec list packages; it has none on PyPI or npm, which is fine. No hand-kept list was added.
Provider pages ✅ One page per new source. I read redis-node-redis-surface.md and mongodb-atlas-admin-spec.md in full: each has source, date checked, why this one, alternatives and a quote. openai-python-sdk.md was replaced by openai-python-surface.md along with the id.
Golden test + quote ✅ testdata/golden/<provider>-<source>.json for each, over real wheels, tarballs and spec excerpts, with rows in both testdata/README.md files. openai-1.1.2.json was removed because the source id was renamed, and the PR says so.
Drop test ✅ One pair per source. For the openapi sources it's the unmarked removals (OpenAI's 2026-11-17→18 schemas, Cloudflare's /accounts/move, Atlas's /rest/unauth/version).
Fetch only via env ✅ npm and PyPI go through env.Get. The new openapi adapters call fetch.Get / github.Get inside plugins/openapi/adapter/, which is allowed. Tarballs are read in memory: links are skipped, and per-file and total size caps apply.
Nothing private ✅ The leak guard is clean, and I found nothing private in the code, pages or PR text.

Bugs

  • An inserted parameter is reported as "no longer optional". This is in plugins/apisurface/apisurface.go:396 (inline comment). comparePositional matches parameters only by position. So going from f(a, b?) to f(a, x, b?) emits changed_default for x, a parameter that didn't exist before, and the hint tells the user to "pass x". The call does break, but the event text is wrong, and that text ends up in someone's PR. Fix: require the same name at that position, and emit a note otherwise. Please also add a test case for it.

Verified

  • go build ./...: OK
  • go vet ./...: OK
  • gofmt -l .: printed nothing
  • go test -race ./...: passed (exit 0)
  • python3 scripts/leak_guard.py --all: "no banned terms (8 hashed terms checked)"

I didn't run make check PATCH_IT=… (CI_contract), because there's no patch-it checkout here.

Non-blocking

  • Classes merged by bare name. dtsurface.classes() combines every class with the same name across files (for example, two Messages classes in different namespaces). That only ever drops a removal, never adds one, so it's safe, but it can hide a real removal. Worth a line under Known gaps.
  • Where var _ Lister = OpenAI{} lives. It's at the end of adapter/versions.go, while Cloudflare's and Atlas's live in their own files. Moving it to openai.go would match.
  • More days per spec for some existing sources. adapter.Daily now also applies to the existing commit-listed specs (Appwrite and the others using commits). The IDs were already dates, so this only removes same-day duplicates, which looks right. It may be worth saying in the release notes, together with the openai/python-sdk → openai/python-surface rename.

out = append(out, Change{Change: event.PackageRemovedParameter, Kind: old.Kind, Symbol: k, Parameter: op.Name, Before: before, After: after})
case now.Params[i].Kind == "args":
return out
case op.HasDef && !now.Params[i].HasDef:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The event names the wrong parameter when one is inserted in the middle. Comparing by position, old f(a, b?) → new f(a, x, b?) reaches this case at i == 1. b? was optional and x is required, so this emits changed_default with Parameter: "x", and the text says "f's parameter x is no longer optional". But x never existed, so that description is wrong, and the hint ("Pass x…") is misleading.

The call does break, so recall isn't the problem. The problem is the event's wording, which ends up in someone's PR. One fix that keeps precision: emit the event only when the parameter at that position has the same name in both releases, and otherwise emit a note (renames already produce no event, as acme.renamed in TestPositionalParameters shows):

case op.HasDef && !now.Params[i].HasDef && now.Params[i].Name == op.Name:
	out = append(out, Change{Change: event.PackageChangedDefault, ...})
case op.HasDef && !now.Params[i].HasDef:
	out = append(out, Change{Symbol: k, Note: fmt.Sprintf("%s: parameter %d is now %s, required (was %s, optional)", k, i, now.Params[i].Name, op.Name)})

A case like "acme.inserted": f(a, b?) → f(a, x, b?) in TestPositionalParameters would pin it.

adssib and others added 5 commits November 20, 2026 21:54
Registers anthropic, stripe, google-genai, sentry-sdk, pymongo, redis,
numpy, supabase, algoliasearch, elasticsearch, ddtrace, cloudflare,
textual and urllib3, each with a golden pair and a drop pair of real
releases. openai/python-sdk is now openai/python-surface: anthropic's
python-sdk id is its migration guide's, and every API-surface source is
named <provider>/<...>-surface.

The reader now drops what scanning recent releases of these packages
showed to be no removal: a name its module still binds (an alias, an
import, a star import or __getattr__ it can't list), a property's
setter, self or cls gone, modules named internal or vendor, and an
__init__'s imports from outside its own modules. A star import re-exports
in any module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: adssib <75389300+adssib@users.noreply.github.com>
dtsurface reads a tarball's .d.ts, .d.mts and .d.cts files as text (a
tokenizer and a parser of declarations, standard library only): every
entry point package.json declares, what each exports, and below classes
and namespaces their public members, with parameters compared by
position. Nothing in the package runs.

Registers ten npm sources (openai, @anthropic-ai/sdk, stripe,
@google/genai, @sentry/node, mongodb, @redis/client, @supabase/supabase-js,
@neondatabase/serverless, convex), each with a golden and a drop pair of
real releases. One declaration reachable at several import paths is now
one event for both ecosystems, its paths in the subject's symbols.
new-plugin's apisurface template takes the ecosystem (an npm: package
picks the npm reader).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: adssib <75389300+adssib@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: adssib <75389300+adssib@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: adssib <75389300+adssib@users.noreply.github.com>
Under another name it may have been inserted before the optional one, so changed_default (and its wording) applies only when the name is the same. Also: OpenAI's Lister check beside its adapter; the class-by-name gap on the npm pages.

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

Round 2: fixed the inserted-parameter case (a required parameter under another name in an optional one's place is now a note; acme.inserted in TestPositionalParameters), moved OpenAI's Lister check, added the class-by-name gap to the npm pages. Also renamed numpy/surface, textual/surface, urllib3/surface to …/python-surface (gitleaks read "api": "urllib3/surface" as a generic API key) and rewrote that commit so the PR's history is clean.

@claude

claude Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

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


✅ Ready to merge: the round 1 bug is fixed and tested, and the renames are complete everywhere I looked.

  • Check the inserted-parameter fix and its test
  • Check the moved Lister check and the Known gaps lines
  • Check the …/python-surface renames (registration, pages, goldens, testdata README)
  • Re-check the rules table
  • Post the review

Rules

Rule Status Evidence
Metadata in the registration ✅ No change since round 1 apart from the renames. plugins/apisurface/pypi.go:21,27,28 now register numpy/python-surface, textual/python-surface and urllib3/python-surface. A grep for (numpy|textual|urllib3)/surface finds nothing left anywhere in the repo. No hand-kept list was added.
Provider pages ✅ providers/{numpy,textual,urllib3}-python-surface.md match the new ids. The short numpy.md, textual.md and urllib3.md pages belong to the existing changelog sources and this PR doesn't touch them, which is right. The class-by-name gap is now under Known gaps on all ten npm pages. I read openai-node-surface.md:35.
Golden test + quote ✅ numpy-python-surface.json and textual-python-surface.json carry the new api. b456318 regenerates urllib3's two fingerprints, which change only because the id is part of the fingerprint, and its commit subject says so. That is a correct reason to edit a golden file.
Drop test ✅ No change since round 1.
Fetch only via env ✅ No change. Round 2 only touches comparison logic, tests, a compile-time check and pages.
Precision over recall ✅ See below: the fix replaces a mislabelled event with a note, so it can't add events.
Nothing private ✅ The round 2 commits and the pages they touch contain nothing private. Renaming the ids so gitleaks no longer matches "api": "urllib3/surface" was the right call: it fixes the cause instead of adding an allowlist entry. All 6 commits are signed off.

Round 1 bug: fixed

plugins/apisurface/apisurface.go:397-402 now emits changed_default only when the parameter at that position has the same name in both releases. Otherwise it emits a note that names both parameters, with a 1-based position. In the case from round 1, f(a, b?) → f(a, x, b?), that note is parameter 2 is now x, required (was b, optional). acme.inserted in TestPositionalParameters pins it, and acme.req still pins the same-name case as changed_default opts. One more detail: the event's Parameter is now op.Name (the old parameter), not now.Params[i].Name. The two are equal in that branch, but op.Name reads correctly.

The Lister check now sits beside Reshaper in plugins/openapi/adapter/openai.go:91-94 and was removed from versions.go.

Blocking

None.

Non-blocking

  • A long comment line. In apisurface.go:381, the doc comment for comparePositional has one line much longer than the others (…a rename alone is no change. A required parameter added at the). gofmt won't flag it, but re-wrapping it would match the rest of the file.
  • Release notes. These should list all four source id renames: openai/python-sdk → openai/python-surface, plus numpy, textual and urllib3 from /surface to /python-surface. The last three never shipped under the old ids, so only the OpenAI one matters to consumers. The release notes should still say so.

Not verified here

I can't run the tests from here. CI_go covers make check (build, vet, gofmt, imports, the net/http guard, go test -race, todos), and CI_leak_guard covers the leak guard. CI_contract needs a patch-it checkout.

@adssib adssib closed this pull request by merging all changes into main in b1abc9c Nov 21, 2026
@adssib
adssib deleted the pl4-sources branch November 21, 2026 03:21
@adssib adssib mentioned this pull request Nov 21, 2026
7 of 15 tasks
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.

I19.12 · apisurface for npm: a package's exported API from its .d.ts files

1 participant