Skip to content

move shared code to core/ and readers under their kind - #183

Open
adssib wants to merge 2 commits into
mainfrom
pl-r1-layout
Open

adssib wants to merge 2 commits into
mainfrom
pl-r1-layout

Conversation

@adssib

@adssib adssib commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

First of a stack of five (layout → providers and sources → no committed lists → versions → README). Refs #174 (I19.3, the shared GitHub lookup part), part of #171.

What this changes

Layout only; no plugin's behavior changes.

  • core/: what isn't one kind. core/plugin (contract and registry), core/fetch, core/kit + core/kit/kittest, core/event, core/migrate, and the OpenAPI diff engine with its helpers (core/diff, core/normalize, core/hint).
  • plugins/<kind>/: each kind with its providers. The spec adapters move to plugins/openapi/adapter, the deprecations-page reader to plugins/retirements/retire, the migration-guide reader to plugins/migrationguide/sdkguide (their testdata/ moves with them).
  • One "find the newest on GitHub" helper: core/github (LatestRelease, LatestCommit, Commit, Head, Headers). Stripe, Datadog, Vercel, Flagsmith, Supabase, Neon, Convex, PlanetScale, Appwrite, Algolia and Elasticsearch, plus apichangelog and catalog, each had their own copy of decoding GitHub's releases/latest, commits?path=…&per_page=1 or commits/<ref> response; they now call it. It takes a getter (github.Get, or the plugin's env.Get), so tests fake it the same way as before.
  • Old import paths kept: plugin, event, fetch, migrate, kit, kit/kittest, retire, sdkguide (what patch-it's hosted ingestion service imports today) stay as deprecated packages that only forward to the new ones (type aliases, constants, function values). Code built against v0.2.0's API keeps compiling unchanged.
  • Fixes two things already broken on main: docs/plugins.json and the README badge were out of date after the Salesforce plugin, and plugins/openapi/vercel_test.go wasn't gofmt'd.
  • Makefile (nethttp allowlist, todos dirs), CI comments, AGENTS.md layout, README layout table, writing-a-plugin.md and provider pages point at the new paths.

Checklist

  • Added to / updated in docs/plugins.md. Not applicable: no plugin added, removed or changed (the table is untouched; docs/plugins.json regenerated only to fix main)
  • Every commit is signed off (git commit -s, DCO)
  • Golden test over a real saved copy of the source: every golden byte-identical (36 files, sha256 compared with main)
  • testdata/README.md: unchanged, moved with its package
  • One pinned drop test: unchanged
  • providers/<api>.md: paths updated only
  • Fetches only through env.Get / core/kit/ (and core/github, which goes through fetch.Get or env.Get)
  • make check passes locally
  • Nothing private

Golden proof

find . -path '*/testdata/golden/*' -type f | xargs sha256sum: the 36 hashes are identical to main's.

Notes for the reviewer

  • Compatibility checked by building a copy of the hosted ingestion service's code against this branch (replace to the local checkout): go build ./... && go vet ./... pass. Its golden-replay test reads saved pages from the module by relative path; the two reader packages' testdata/ moved (retire/testdata → plugins/retirements/retire/testdata, sdkguide/testdata → plugins/migrationguide/sdkguide/testdata), so that test needs its paths updated when it bumps to a release with this change.
  • Old paths for packages nothing outside imports (diff, normalize, hint, adapter) are not kept: v0.x, and keeping every one would double the package list. Easy to add if wanted.
  • core/github keeps each adapter's URL variables (tests still point them at local servers); only the decoding moved.

Calls I made (please check)

  • Readers that belong to one kind became subpackages of it (plugins/openapi/adapter, plugins/retirements/retire, plugins/migrationguide/sdkguide) rather than being merged into the kind's package: no identifier clashes, smaller diff. Merging kinds (I19.4–I19.6) is separate.
  • Forwarding packages use var F = core.F for functions (and copies of exported values such as kittest.Clock, retire.OpenAI): same behavior for callers; assigning to the old variable doesn't change the new one.

Related PRs

🤖 Generated with Claude Code

core/ holds what isn't one kind: the plugin contract and registry, fetch,
kit and kittest, the event types, migrate, and the OpenAPI diff engine with
normalize and hint. The spec adapters move to plugins/openapi/adapter, the
deprecations-page reader to plugins/retirements/retire and the migration
guide reader to plugins/migrationguide/sdkguide.

The old import paths that patch-it's hosted ingestion service uses (plugin,
event, fetch, migrate, kit, kit/kittest, retire, sdkguide) stay as deprecated
packages that only forward to the new ones.

The newest-release, newest-commit-on-a-path and commit-date lookups that
nine adapters, apichangelog and catalog each decoded themselves are now one
helper, core/github.

Also regenerates docs/plugins.json and the README badge (out of date on
main since the salesforce plugin) and gofmts vercel_test.go.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: adssib <[email protected]>
gofmt versions disagree on how to align the old map literal, so CI's gofmt
failed on what a newer one wrote. Two lists need no alignment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: adssib <[email protected]>
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