Skip to content

add the posthog plugin - #129

Merged
brandonphelps1212 merged 4 commits into
mainfrom
posthog-plugin
Nov 19, 2026
Merged

brandonphelps1212 merged 4 commits into
mainfrom
posthog-plugin

Conversation

@brandonphelps1212

Copy link
Copy Markdown
Contributor

What this changes

Adds posthog on the removedmembers format plugin, which learns Markdown tables. Part of #79 (I12.3 · Watch PostHog), under #15.

  • Source: posthog-python's 8.0.0 migration guide, docs/migration-7.x-to-8.0.md at tag posthog-v8.0.0 (commit 6edff41). It's MIT and saved whole, byte-identical to the tag. It's unchanged at 8.0.2 and absent at 7.91.4. The plugin reads its ### Fix removed APIs table (| Removed | Use instead |).
  • removedmembers learns Markdown pipe tables (markdown.go), with optional Guide fields: Tag, Format, Header, Effect, EnvVars, NewReplacements, Paths, StillWork. Empty values keep the old behavior: NumPy's golden is byte-identical, and the scaffolder's tests pass.
  • 7 package_release events, version 8.0.0 (a package version, so the client's package gate handles it):
    • removed_symbol for CaptureMode, capture_v1, capture_v1.CaptureV1Error, request.batch_post, _async_request.async_batch_post, request.EVENTS_ENDPOINT and request.AI_EVENTS_ENDPOINT.
    • Removals, not renames (NewReplacements): every replacement is new in 8.0.0, and CaptureError also moves module, so a rename fix would break on 7.x. Each replacement stays in the migration hint.
    • Names by the module code imports them from (Paths): the table writes request.batch_post, async_batch_post, EVENTS_ENDPOINT in one cell, but only the first is spelled out. The paths are checked against references/public_api_snapshot.txt and the code at posthog-v7.91.4.
  • Dropped and logged:
    • capture_mode (StillWork): the guide's own "Rename deprecated settings" table says posthog.capture_mode still works or has no effect in 8.x.x;
    • POSTHOG_CAPTURE_MODE: an environment variable;
    • gzip=True: an argument value of an unnamed call;
    • "The gzip parameter of …": prose; request.post and request.flags take **kwargs, so it raises nothing;
    • "The backoff dependency".

Checklist

  • Added to docs/plugins.md: new row (Layer SDK, status live). posthog is added to the pinned-releases line, docs/plugins.json is regenerated, and the README badge is 22. I compared the registered plugins with the table.
  • Every commit is signed off (DCO)
  • Golden test over the real saved guide (plugins/removedmembers/testdata/golden/posthog-8.0.0.json).
  • testdata/README.md row: URL at the tag, date, license (MIT), quote.
  • Pinned drop test: the 4 rows and 1 name that aren't removed members are each read and dropped. The guide's 8 other tables would produce names if read, and only the section heading keeps them out (shown, not assumed). Also unit tests for the Markdown parser.
  • providers/posthog.md from the template, including Why this source.
  • Fetches only through env.Get.
  • make check passes.
  • Nothing private.

Notes for the reviewer

  • Why not PostHog's API: its OpenAPI spec is only served live (us.posthog.com/api/schema/), never committed, so there's nothing to pin or replay.
    • Over two Wayback snapshots and today's live copy it has 0 operations deprecated after first appearing.
    • The 8 deprecated today arrived already deprecated.
    • Its removals are mostly /api/environments/ aliases of /api/projects/.
    • Details and numbers are on the provider page.
  • An independent review checked every event against posthog-python's code at 7.91.4 and 8.0.0. It found the module paths and the capture_mode contradiction, and both are fixed here. The CaptureV1Error rename → removal change came from an earlier check.
  • Not covered: the API, posthog-js/node, and later majors (each would be a new guide entry).

🤖 Generated with Claude Code

brandonphelps1212 and others added 3 commits November 19, 2026 17:05
Read the "Fix removed APIs" table of posthog-python's 7.x to 8.0
migration guide at tag posthog-v8.0.0 with removedmembers, which now
reads Markdown pipe tables as well as RST ones (NumPy's golden is
unchanged). 8 events: one renamed_symbol (CaptureV1Error to
CaptureError) and seven removed_symbol; an environment variable, an
argument value and two rows of prose are dropped and logged.

Signed-off-by: brandonphelps1212 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: brandonphelps1212 <[email protected]>
…ure_mode, which still works

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: brandonphelps1212 <[email protected]>
@claude

claude Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Claude finished @brandonphelps1212's task in 1m 31s —— View job


✅ Ready to merge: the plugin follows every repo rule, its 7 events match the saved guide's table, and build, vet, gofmt, the tests and the leak guard all pass.

Rules

Rule Status Evidence
Plugin list (Rule 1) ✅ posthog is registered in removedmembers.go (plugin.Register(Plugin{Guide: PostHog8})), and its row is in docs/plugins.md between the markers. The row is plain Markdown with absolute links, provider PostHog, layer SDK, format removedmembers, source at the posthog-v8.0.0 tag, status live. The docs/plugins.json entry has been regenerated (go test passes, so it's current). The README badge says 22. The pinned-releases line and the description of the removedmembers column are updated too.
Provider page ✅ providers/posthog.md gives the link and commit, the date checked (2026-11-19), why this source is the best one, four alternatives with reasons (the public API snapshot, the live-only REST schema with measured numbers, the changelog, the rendered docs) and a quote. It's also listed in providers/README.md.
Golden test + dated quote ✅ The guide is saved whole in testdata/migration-7.x-to-8.0-posthog-v8.0.0.md. golden/posthog-8.0.0.json has 7 events, each with source_url at the tag and a source_excerpt of the header and the row. The testdata/README.md row has the URL, commit, date, license (MIT, with the NOASSERTION note) and a quote. NumPy's golden file wasn't touched.
Pinned drop test ✅ TestPostHogDropsWhatIsNotARemovedMember checks that all 5 dropped rows and names are read and then dropped. It also shows that 6 names from the guide's other tables would be read without the section heading, so the test can actually fail.
Fetch only through env ✅ Fetches only through env.Get (unchanged in Run). The new code uses no net/http, no filesystem outside testdata/ and no database. contract/fixtures/ isn't touched.
Nothing private ✅ Nothing private in the code, docs, test data, commit messages or PR body. The leak guard is clean. Every commit is signed off.

Bugs

None found. What I checked:

  • The 7 events against the table: I compared them with the table at lines 87–99 of the saved guide. Every row is either an event or dropped with a logged reason.
  • Emitting removed_symbol instead of renamed_symbol: for CaptureV1Error → CaptureError this is right. The guide says "There is no alias" and the class moves module, so a rename fix would break the user's code.
  • The Markdown reader:
    • Headings inside fenced code are skipped.
    • The reader stops at the next heading.
    • It only reads the first table under the section, and checks that table's header.
    • Rows with the wrong number of cells are dropped.
    • A first cell with prose around the code spans is dropped as a whole row.
  • NumPy: its output stays identical because NumPy sets Effect and the default Tag is still "v" + Release.

Verified

  • go build ./... passed.
  • go vet ./... printed nothing.
  • gofmt -l . printed nothing.
  • go test -race ./... passed in every package, including plugins/removedmembers, plugins/all and internal/pluginlist.
  • python3 scripts/leak_guard.py --all reported "no banned terms (8 hashed terms checked)".
  • I couldn't run make check here because this environment needs approval for it. CI_go covers the targets I didn't run one by one: tidy, imports, nethttp and todos. A search for TODO(new-plugin) found none outside the scaffolder and the docs.

Non-blocking

  • A stale test comment: posthog_test.go:24-26 says "a name with exactly one name to use instead is a rename". Since NewReplacements, no PostHog row is a rename, so the comment could say that every name becomes a removal with the replacement in the hint.
  • Dropping capture_mode loses one case, on purpose: the guide's checklist (line 29) also lists importing posthog.capture_mode (the module) as breaking. So from posthog.capture_mode import … would break and gets no event of its own. The CaptureMode event already covers the usual way that module is used, and dropping the name is the right call for precision over recall. You could mention it on the provider page under Known gaps.

…ort gap

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: brandonphelps1212 <[email protected]>
@brandonphelps1212
brandonphelps1212 merged commit 0b03e11 into main Nov 19, 2026
4 checks passed
@brandonphelps1212
brandonphelps1212 deleted the posthog-plugin branch November 19, 2026 22:29
This was referenced Nov 19, 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