Skip to content

split how to read (kinds/) from what to read (providers/<provider>/) - #247

Merged
adssib merged 8 commits into
mainfrom
pl-layout
Nov 21, 2026
Merged

adssib merged 8 commits into
mainfrom
pl-layout

Conversation

@adssib

@adssib adssib commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Splits how to read from what to read (approved by Adib, 2026-11-21).

core/                  unchanged in shape (the registry now takes one registration per provider and fills in its page)
kinds/<kind>/          how to read, written once, imports no provider:
                         openapi (+ adapter/: the interface and what adapters share, openapitest/)
                         changelog (+ changelogtest/)  notices (+ retire/, feed/, eol/, noticestest/)
                         catalog  apisurface (+ pysurface/, dtsurface/, apisurfacetest/)
                         migrationguide (+ sdkguide/, members/, migrationguidetest/)
providers/<provider>/  what to read, one folder per provider:
                         provider.go   its one plugin.RegisterProvider: the provider and every source, any kind
                         README.md     one page per provider, a section per source (all old pages merged, content kept)
                         <source>.go   only for code only it needs (an OpenAPI adapter, a feed's reader)
                         testdata/     saved pages, golden/, README.md (rows moved from the kinds' READMEs)
                         *_test.go     its golden and drop tests
providers/all/         imports every provider; tests: folders imported and registering themselves once,
                       metadata, every source named on its page, no pins, and the import graph

plugins/ is gone. No forwarders, no folder per source. providers/_template.md is now docs/provider-template.md (a page with a section per source).

Commits

  1. move the kinds from plugins/ to kinds/: a pure move.
  2. move each provider's sources into providers/<provider>: registrations, provider-specific code (the 17 OpenAPI adapters with their Diff/Keep, the feed readers, the retire/eol pages, the changelog/guide/package values), their tests, saved pages and goldens. The kinds export what providers build with (openapi.DeprecationsOnly, openapi.RequestSide, adapter.Releases/Commits/Daily/BasePathPointer/…, changelog.SDK, changelog.Pins, apisurface.PyPI/NPM/NPMPackage, feed.Marked/Dated/Excerpt/ListItem, catalog.Commands.ListingURL, members.Guide.TagOf/CommitsURL); shared test helpers are kinds/<kind>/<kind>test packages. RegisterProvider now refuses a second registration of a provider and fills in each source's page.
  3. one page per provider: providers' pages merged into providers/<provider>/README.md, testdata README rows moved to the provider that owns the files.
  4. scaffold into providers/<provider>, and say so in the docs: cmd/new-plugin writes a new provider's folder (provider.go, README.md, testdata README, import in providers/all) or adds a source to an existing provider's provider.go/page/testdata README; its test scaffolds every kind, the first as a new provider and the rest into it. Makefile, AGENTS.md (layout + rules), CONTRIBUTING.md, README, docs/how-it-works.md, docs/writing-a-plugin.md, docs/which-kind.md, docs/plugins.schema.json (page pattern), PR template, CI_go's comment, and release.yml's new-kind check (kinds/).
  5. leave the review prompts to their own pr: the Claude review action refuses to run on a PR whose Claude workflow files differ from main's, so the two review prompts' wording is in review prompts: kinds/ and providers/<provider>/ #248, stacked on this one.
  6. keep test kits in tests; tidy the merged pages (after the first review): the import-graph test refuses a non-test file importing a test kit (kittest or a kind's <kind>test), so openapitest's net/http can't reach code that runs; new-plugin adds a source inside the provider's RegisterProvider call and reads imports from the parsed file; same-titled sections on one page now say which source they are; testdata READMEs point at the provider's page.
  7. new-plugin: skip calls that aren't a selector; test kits by name (after the second review): a nil-pointer panic in addSource when a plain call sits above the registration (with a regression test), and testKit matches kinds/<kind>/<kind>test exactly.

Behaviour is identical

  • Goldens byte-identical: a script compares the sha256 of every golden on origin/main (plugins/**/testdata/golden/*) with its new path: 75 goldens on origin/main, 75 under providers/, 0 missing or different, 0 new. Every golden test passes against them unchanged.
  • Source ids unchanged: 26 providers, 80 sources, the same ids.
  • go run ./cmd/list-plugins, before vs after: identical except each source's page (160 changed lines, every one a page), which now points at its provider's providers/<provider>/README.md; docs/plugins.schema.json's page pattern follows.
  • make check green locally (go1.27.1): tidy, build, gofmt, vet, import allowlist, net/http guard (now core/fetch, core/kit, and the openapi test kit, which serves recorded responses over httptest), go test -race, todos, leak guard.

Needs a minor release

Import paths change, so the first release after this is a minor (v0.7.0), by hand. The scheduled run skips on its own: every kinds/ directory is new against v0.6.0.

For patch-it's hosted ingestion service, on its next bump

Old (v0.6.0) New
plugins/all providers/all
plugins/<kind> (openapi, changelog, notices, catalog, migrationguide, apisurface) and their subpackages (openapi/adapter, notices/{retire,feed,eol}, migrationguide/{sdkguide,members}, apisurface/{pysurface,dtsurface}) kinds/<kind>/…, same names
changelog.MongoDBAtlas mongodb.AtlasAdminAPI (providers/mongodb)
sdkguide.Anthropic anthropic.PythonSDK (providers/anthropic)
members.NumPy, members.NewRelic, members.PostHog numpy.Numpy, newrelic.PythonAgent, posthog.PythonSDK
retire.OpenAI, retire.Anthropic, retire.Gemini, retire.Vertex openai.Models, anthropic.Models, google.GeminiModels, google.VertexModelRetirements
feed.GitHubActions, feed.VertexAIModels, feed.CloudflareAPI github.Actions, google.VertexAIModels, cloudflare.API
eol.Salesforce salesforce.RESTAPI
catalog.Redis, catalog.GitHubGraphQL redis.Commands, github.GraphQL
changelog.Textual, changelog.Urllib3, changelog.Stripe*, changelog.Sentry*, changelog.Cloudflare*, changelog.Octokit*, changelog.PostHogGo, changelog.RedisIoredis in each provider's package, named by source id: textual.Textual, urllib3.Urllib3, stripe.Python/Node/Go/Java/Ruby/Dotnet/PHP, sentry.PythonChangelog/JavascriptChangelog/Go/Dotnet, cloudflare.Typescript/Python/Go/Terraform, github.OctokitRest/OctokitNet, posthog.Go, redis.Ioredis
apisurface.<Provider><Pkg> (OpenAIPython, StripeNode, …) <provider>.<Source> (openai.PythonSurface, stripe.NodeSurface, google.GenaiPythonSurface, datadog.DdtracePythonSurface, …)
adapter.<Provider> (OpenAPI adapters) <provider>.<Provider> (stripe.Stripe, mongodb.MongoDBAtlas, …)
saved pages and goldens under plugins/<kind>/testdata/ (and <reader>/testdata/) providers/<provider>/testdata/ (goldens keep their file names, in providers/<provider>/testdata/golden/)
plugins.json page: …/providers/<name>.md …/providers/<provider>/README.md

Anything that reads the module's goldens or saved pages finds them under providers/<provider>/testdata/ now (providers/*/testdata/golden/*.json).

Calls I made (please check)

  • Provider-specific reader types stay in their kind. catalog.Commands (Redis) and catalog.UpcomingChanges (GitHub GraphQL) and changelog.Log (MongoDB's JSON changelog) are readers of a shape, and KindOf names a source's kind by the package its plugin type is in: moving the types to providers would change kind in plugins.json. Only their values (redis.Commands, github.GraphQL, mongodb.AtlasAdminAPI) moved.
  • Config vars are named by source id in their provider's package (stripe.Python, stripe.PythonSurface): two kinds' StripePython would otherwise collide in one package.
  • Kind tests that replayed a provider's saved page moved to that provider; kind tests over inline data stayed (some now use an inline config, e.g. retire's acme page, catalog's graphql). sdkguide and migrationguide have no tests of their own left: every one read Anthropic's guide.
  • Shared test helpers are packages under each kind (openapitest, changelogtest, noticestest, migrationguidetest, apisurfacetest), not copies in 26 providers. openapitest uses net/http/httptest, so the net/http guard allows it by name.
  • RegisterProvider panics on a second registration of a provider (it used to merge per-kind registrations); Source.Page is filled in (providers/<id>/README.md), a hand-set value must match.
  • The import-graph test lives in providers/all (a Go test, no new CI step), tests included.
  • A provider id with a hyphen gets a Go package name without it (new-plugin); none exists today.

Related

  • review prompts: kinds/ and providers/<provider>/ #248: the review prompts' wording (stacked on this).
  • The paired internal handbook update links here (this repo is public, so it isn't named).
  • patch-it's hosted ingestion service switches the imports above on the bump to the release with this layout.

I read the merged provider pages and the registrations' words; nothing was reworded beyond paths and the identifiers that moved.

🤖 Generated with Claude Code

adssib and others added 5 commits November 21, 2026 00:23
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: adssib <75389300+adssib@users.noreply.github.com>
A provider's package says what to read: one provider.go registers the
provider and every source of it, whatever the kind, with the kinds' exported
types; provider-specific parsing (OpenAPI adapters, feed readers) sits
beside it, with its saved pages, goldens and tests. The kinds keep only how
to read. Goldens move unchanged.

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

The pages a provider's sources had (providers/<x>.md, <x>-sdks.md,
<x>-*-surface.md...) are one page now, a section per source, all content
kept; each kind's testdata README rows move to the provider that owns the
files. RegisterProvider fills in each source's page, and a provider is
registered once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: adssib <75389300+adssib@users.noreply.github.com>
new-plugin writes a source into its provider's folder: a new provider.go,
page and testdata README for a new provider (and its import in
providers/all), or one more source in the existing registration, page and
testdata README. Its test scaffolds every kind, the first as a new provider
and the rest into it. AGENTS.md, CONTRIBUTING.md, the README, docs/, the PR
template, the review prompts and the Release workflow's new-kind check name
kinds/ and providers/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: adssib <75389300+adssib@users.noreply.github.com>
A PR that changes the Claude workflows can't be reviewed by them (the
action checks they match main's), so their wording follows separately.

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 1m 54s —— View job


✅ Ready to merge

This is a big refactor, and it's easy to check: every file under testdata/ moved without a content change, and each rule now has a test in providers/all behind it. I found no blocking bugs. I couldn't run the tests here; CI_go runs them (build, vet, imports, net/http guard, go test -race, todos).

Rule Status Evidence
1. Registration and metadata, no hand-kept list ✅ 26 providers, each with one providers/<p>/provider.go. RegisterProvider now panics on a second registration and fills in Page from PageOf(id); a hand-set page that differs is refused (core/plugin/provider.go:141-169, tested in provider_test.go). providers/all tests check that every folder is imported, that RegisterProvider is called only once and only in provider.go, and that every source is named on its provider's page. docs/plugins.schema.json follows the new page path. I read the Anthropic registration and page: the words match what the sources do.
2. Provider page with a real "Why this source" ✅ All 26 providers/<p>/README.md have it. docs/provider-template.md replaces _template.md, with one section per source.
3. Golden, testdata row, drop test, quotes ✅ git diff -M origin/main HEAD -- '*testdata/golden/*': 75 files, 0 insertions, 0 deletions, all pure renames. Every saved copy under testdata/ is also a pure rename (442 files, 0/0). No golden was edited.
4. Fetch only through env.Get/kit, no stray net/http or filesystem ✅ The only non-test net/http outside core/fetch and core/kit is kinds/openapi/openapitest, a test helper that only _test.go files import. It serves testdata/versions/ over httptest. The Makefile allowlist moved from plugins/openapi/adapter to it.
5. Precision over recall ✅ Behaviour is unchanged: the goldens are byte-identical and the source ids are the same.
6. Nothing private ✅ I found no credentials, internal hosts or private links. The handbook update is mentioned without being named.

Blocking

None.

Non-blocking suggestions

  1. Stale review prompts (review prompts: kinds/ and providers/<provider>/ #248). .github/workflows/claude.yml and claude-code-review.yml still name providers/<api>.md, providers/_template.md and plugins/openapi/adapter/. This review ran with those prompts, so I checked the rules against the new paths myself. Please merge review prompts: kinds/ and providers/<provider>/ #248 soon after this PR so the next contributor's review isn't confused.
  2. Keep test kits out of non-test code. openapitest imports net/http and os. It passes the guard, but only because nothing outside _test.go imports it. The import-graph check (providers/all/imports_test.go, forbidden) could also refuse a non-_test.go file importing a kinds/*/*test package. Then the net/http exception stays test-only by rule, not by habit.
  3. addSource takes the first Sources: key in the file (cmd/new-plugin/main.go, ast.Inspect). If a provider ever declares a var with a Sources field above init, the scaffolder would add the new source in the wrong place. Matching inside the plugin.RegisterProvider call (as registeredIDs in providers/all does) would be safer. The same goes for addImport: it checks with bytes.Contains, so a quoted path in a comment would count as already imported.
  4. Leftovers from merging the testdata READMEs. For example, providers/stripe/testdata/README.md has a "Saved OpenAPI spec excerpts" section with no excerpts. It also has text copied from the old apisurface README: "the openai Python package's pair, 1.1.1 → 1.1.2", and "see the source's page under providers/" where the page is now ../README.md. This is wording only, but worth a pass over the other providers.
  5. Duplicate headings. providers/anthropic/README.md has two sections titled "Anthropic Python SDK" (python-sdk and python-surface). The ids in parentheses keep the anchors unique, but a clearer title like "Anthropic Python SDK public API" would help. The anthropic/models known-gaps line also still says "the [anthropic] plugin" for anthropic/python-sdk.
  6. GitLab has no golden file (this was already true on main). providers/gitlab/ is the only provider without testdata/golden/; its tests assert on events inline. It's out of scope here, but worth a follow-up so it matches rule 3.

Calls you asked me to check

  • Readers of a shape stay in their kind (catalog.Commands, catalog.UpcomingChanges, changelog.Log), and only their values move: agreed. KindOf takes a source's kind from its plugin's package, so this keeps kind in plugins.json stable.
  • Config vars named by source id (stripe.Python, stripe.PythonSurface): agreed. Otherwise two kinds' names would clash in one package.
  • Panic on a second registration: agreed. It gives Rule 1's "one registration per provider" an actual check.
  • Shared <kind>test packages instead of 26 copies: agreed, with suggestion 2.
  • Minor release (v0.7.0) by hand: correct. The scheduled run skips on its own because every kinds/ directory is new against v0.6.0.

The import-graph test refuses a non-test file importing a test kit (kittest
or a kind's <kind>test), so openapitest's net/http stays out of what runs.
new-plugin adds a source inside the provider's RegisterProvider call and
reads imports from the parsed file. Section titles that read the same on one
page say which source they are; testdata READMEs point at the provider's
page.

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


⚠️ Merge after fixes

Thanks for following up on the first review so quickly. Commit 8c28617 deals with suggestions 2, 3, 4 and 5. Commits 1–5 are unchanged, so the first review's findings still hold: the 75 goldens and 442 saved files are pure renames, the source ids are the same, and only page changes in plugins.json. I found one new bug in the rewritten addSource. It's small, but it would crash make new-plugin, so please fix it before merging. I couldn't run the tests here; CI_go runs them.

Rule Status Evidence
1. Registration and metadata, no hand-kept list ✅ Same as the first review. I read the retitled sections (anthropic, numpy, textual, urllib3, cloudflare): each title now matches its source.
2. Provider page with a real "Why this source" ✅ Same as before. The renamed headings break no links: the one cross-page anchor (urllib3 → #textual-changelog-textualtextual) still resolves.
3. Golden, testdata row, drop test, quotes ✅ No golden or saved file changed in this commit. The testdata README rows now point at ../README.md. The stale openai sentence is gone from providers/stripe/testdata/README.md.
4. Fetch only through env.Get/kit ✅ There's now a test for this: providers/all/imports_test.go forbidden refuses a non-_test.go file that imports core/kit/kittest or kinds/**/*test, except from another test kit.
5. Precision over recall ✅ Behaviour is unchanged.
6. Nothing private ✅ I found nothing private in the new commit.

Blocking

addSource can panic on a nil *ast.SelectorExpr. See cmd/new-plugin/main.go:595-596:

sel, ok := call.Fun.(*ast.SelectorExpr)
if pkg, isIdent := sel.X.(*ast.Ident); !ok || ...

Go runs the if statement's init, sel.X.(*ast.Ident), before it checks !ok. So when a call's Fun is a plain identifier (append(...), len(...), make(...), specs()), sel is nil and sel.X panics.

This doesn't happen today, and only by luck of ordering. ast.Inspect stops looking once it has found Sources, so only calls that come before plugin.RegisterProvider are reached, and every current provider.go starts with func init(). (Algolia's append(specs(), …) sits inside the call, and the closure returns false before visiting it.) But if a provider adds a package-level var x = make(...), or a helper with an append above init, then make new-plugin --provider <it> crashes instead of adding the source. The fix is to check ok first:

sel, ok := call.Fun.(*ast.SelectorExpr)
if !ok {
	return true
}
if pkg, isIdent := sel.X.(*ast.Ident); !isIdent || pkg.Name != "plugin" || sel.Sel.Name != "RegisterProvider" || len(call.Args) != 1 {
	return true
}

It would also help to add a case to cmd/new-plugin/main_test.go where the existing provider.go has a var _ = len("") (or a helper calling append) above init, so this stays fixed.

Fix this →

Non-blocking suggestions

  1. testKit matches by suffix. Under kinds/, it treats any package whose last element ends in test as a test kit. That includes kinds/x/latest or kinds/x/contest. A real reader with a name like that would be wrongly blocked from non-test code. Matching base == path.Base(path.Dir(pkg))+"test" (the <kind>test convention) would be exact. That would mean kinds/openapi/openapitest and kinds/notices/noticestest, while kinds/apisurface/apisurfacetest and kinds/migrationguide/migrationguidetest sit directly under their kind, so they match too.
  2. From the first review, still open: merge review prompts: kinds/ and providers/<provider>/ #248 (the stale review prompts) soon after this, and add a follow-up for GitLab's missing golden (this was already true on main).

Changes since the first review

  • ✅ Test kits are now limited to tests by a rule in the import-graph test.
  • ✅ addSource now looks inside the plugin.RegisterProvider call (but see the blocking bug above), and addImport reads imports from the parsed file instead of bytes.Contains.
  • ✅ Duplicate section titles now name their source ("…'s public API", "NumPy migration guides"). The anthropic/models known-gaps line now says "source".
  • ✅ The testdata README leftovers are fixed, and the rows point at the provider's page.

addSource read sel.X before checking the type assertion, so a provider.go
with a plain call (append, make) above its registration would panic; a test
pins it. A test kit is kinds/<kind>/<kind>test exactly.

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


✅ Ready to merge

Commit 660d4b2 fixes the blocking bug from the second review and takes the testKit suggestion. Commits 1–6 haven't changed, so the earlier findings still hold: the 75 goldens and 442 saved files are pure renames, the source ids are the same, and the only change in plugins.json is page. I couldn't run the tests here; CI_go runs them.

Rule Status Evidence
1. Registration and metadata, no hand-kept list ✅ Same as the earlier reviews. This commit touches no registration and no page.
2. Provider page with a real "Why this source" ✅ Unchanged. All 26 providers/<p>/README.md pages have it.
3. Golden, testdata row, drop test, quotes ✅ No golden or saved file changed in this commit.
4. Fetch only through env.Get/kit ✅ testKit (providers/all/imports_test.go:100-103) now matches only core/kit/kittest and exactly kinds/<kind>/<kind>test. All five kits fit that shape: openapitest, changelogtest, noticestest, migrationguidetest and apisurfacetest. A reader named latest or contest is no longer caught by mistake.
5. Precision over recall ✅ Behaviour is unchanged.
6. Nothing private ✅ I found nothing private in the new commit.

Blocking

None.

What the fix does

  • cmd/new-plugin/main.go:595-600 now checks ok before it reads sel.X, so a call like append(...) or make(...) is skipped instead of panicking. ✅
  • TestScaffoldFindsTheRegistrationAmongOtherCalls adds var _ = len("x") and a helper that calls append above func init() in providers/textual/provider.go. It then checks that docs is added exactly once, after plugin.RegisterProvider(. Before the fix, ast.Inspect would have reached len("x") first and panicked, so this test pins the bug. ✅

Non-blocking suggestions

  1. Make the regression test fail loudly if its setup stops working. The test uses bytes.Replace on "\nfunc init() {". If textual's provider.go is ever reformatted, the replace quietly does nothing and the test still passes, without testing the bug any more. A one-line guard fixes that: if !bytes.Contains(src, []byte("var _ = len")) { t.Fatal("setup didn't apply") }.
  2. Still open from earlier reviews: merge review prompts: kinds/ and providers/<provider>/ #248 (the stale review prompts) soon after this PR, open a follow-up for GitLab's missing golden (this was already true on main), and cut v0.7.0 by hand.

Thanks for the careful work across three rounds. The PR description's migration table will make the bump easy for patch-it's hosted ingestion service.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: adssib <75389300+adssib@users.noreply.github.com>
@adssib
adssib merged commit 9a98c91 into main Nov 21, 2026
4 checks passed
@adssib
adssib deleted the pl-layout branch November 21, 2026 18:38
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