Skip to content

add the apichangelog format plugin and mongodb-atlas - #111

Merged
brandonphelps1212 merged 3 commits into
mainfrom
mongodb-plugin
Nov 19, 2026
Merged

brandonphelps1212 merged 3 commits into
mainfrom
mongodb-plugin

Conversation

@brandonphelps1212

Copy link
Copy Markdown
Contributor

What this changes

A new format plugin, apichangelog, and its first source, mongodb-atlas. Part of #70 (I11.2 · Watch MongoDB), under #14.

  • plugins/apichangelog reads a vendor's machine-readable API changelog: a JSON file listing, per day, each endpoint's changes per API version, with oasdiff change codes and a backwardCompatible flag.
    • It reads the file at the commit that last changed it, found through the GitHub commits API via env.Get. That URL never changes, so it's the provenance; no snapshot is needed.
    • It replays the days oldest first and emits only an endpoint version's life cycle.
  • mongodb-atlas reads MongoDB's Atlas Administration API changelog, changelog/changelog.json in mongodb/openapi. MongoDB's CI releases it ("Release API Changelog"), and the API changelog docs page is built from it.
    • deprecation: endpoint-deprecated, resource-version-deprecated, unless a later endpoint-reactivated withdraws it.
    • breaking: endpoint-removed, for example "endpoint with API Version '2023-01-01' was removed as it has reached its sunset date '2026-01-22'".
    • version: the API version the change is about (2023-01-01), the one a caller's Accept header names.
    • Evidence: a JSON pointer to the change, and the change itself as the excerpt.
  • On the changelog released 2026-11-18: 81 events, 43 standing deprecations and 38 removals.

Checklist

  • Added to docs/plugins.md: new mongodb-atlas row, status paused like the other new plugins, and apichangelog added to the Format plugin legend. Also docs/writing-a-plugin.md's table and AGENTS.md's layout. I compared the registered plugins with the table.
  • Every commit is signed off (git commit -s, DCO)
  • Golden test over a real saved copy (plugins/apichangelog/testdata/golden/mongodb-atlas.json), with a historical change: the shared-tier ("tenant") backup endpoints removed at their 2026-01-22 sunset (TestTenantBackupSunset).
  • testdata/README.md lists each file: URL, date fetched, license, quote.
  • Pinned drop test: the changelog's newest day (2026-11-18), whole and unchanged. It has 104 changes, 23 of them marked not backward compatible, and none is an endpoint's life cycle.
  • providers/mongodb-atlas.md written from providers/_template.md, including Why this source
  • Fetches only through env.Get / kit/
  • go build ./... && go vet ./... && gofmt -l . && go test -race ./... pass locally, and so does scripts/leak_guard.py --all.
  • Nothing private: no credentials, internal hosts, private links, customer names

Notes for the reviewer

  • The test copy keeps positions. The real file is 10 MB. The saved copy keeps every day, endpoint, version and change where it is, and replaces the ones the plugin doesn't read with {}, so every pointer in the golden names the same change in the real file. The plugin reads exactly the same 81 findings from the copy as from the real file.
  • Reactivations matter. MongoDB reactivates deprecated versions (13 times so far). GET /api/atlas/v2/groups/{groupId}/clusters at 2024-05-30 was deprecated on 2024-06-25 and reactivated the next day. An independent review caught that the first version ignored this and would have called live versions deprecated; the replay fixes it, and TestReactivationWithdrawsTheDeprecation pins it.
  • Deliberately not read:
    • api-path-removed-without-deprecation: its one entry comes with endpoint-added the same day, and the endpoint stayed.
    • Property-level codes, including the ones marked not backward compatible. That flag is broad: a response enum gaining a value counts (68 times). Request properties removed (4), made required (11), added as required (3) or enum values no longer accepted (36) are probably real breaks. They're a follow-up once measured.
  • Known gap: a deprecation stored before MongoDB reactivates it stays in the feed. The plugin doesn't emit it again, but nothing withdraws it.
  • The live check ran the registered plugin against GitHub and the real 10 MB file: 81 events on the first run, then "no change" and nothing new on the second.
  • Client side: Atlas versions are dates chosen per request in the Accept header (application/vnd.atlas.2023-01-01+json). The patch-it client's version check doesn't know that scheme yet.

🤖 Generated with Claude Code

apichangelog reads a vendor's machine-readable API changelog (JSON, per
day, endpoint and API version, oasdiff change codes) at the commit that
last changed it. It replays the days oldest first and emits only an
endpoint version's life cycle: deprecated, unless reactivated later, and
removed at its sunset. Its first log is MongoDB's Atlas Administration
API changelog in mongodb/openapi.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: brandonphelps1212 <bphelps1212@gmail.com>
@claude

claude Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

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


✅ Ready to merge. Every repo rule is met, all five checks pass locally, and I found no blocking bugs in the replay logic.

Rules

Rule Status Evidence
Plugin list (Rule 1) ✅ plugins/all/all.go registers one new plugin, mongodb-atlas. docs/plugins.md has its row between the markers: a plain table, absolute links only, status paused with the reason. apichangelog is added to the Format plugin legend. docs/writing-a-plugin.md, AGENTS.md's layout and providers/README.md are updated too.
Provider page ✅ providers/mongodb-atlas.md follows _template.md. Why this source has the link, the check date (2026-11-19), the reason, three alternatives not used, and a quote.
Golden test and quote ✅ TestGolden runs over the trimmed copy, with positions kept. Every event's source_pointer is resolved in the fixture and compared with its source_excerpt. Each file has a row in testdata/README.md with the URL, the date, Apache-2.0 and a quote. TestTenantBackupSunset covers the historical removal.
Drop test ✅ TestPropertyChangesMakeNoEvent uses the real 2026-11-18 day, whole and unchanged. It asserts the 23 changes not marked backward compatible are present and that no event comes out.
Fetch only via env ✅ Both fetches (the commits API and the raw file at its SHA) go through env.Get. There's no net/http, filesystem or database access.
Nothing private ✅ Nothing found in the code, tests, docs, commit or PR body. The leak guard passes.

Bugs

None found. What I checked in Read (plugins/apichangelog/apichangelog.go:121-185):

  • Pointers: they're built from the file's own index di while the loop walks the days oldest first, so they stay correct.
  • Reactivation: it clears only a standing deprecation, never a removal.
  • Repeats: an announcement repeated before any reactivation keeps the first one. A deprecation after a reactivation is a new one, and TestLifeCycleReplay pins that.
  • Output order: sorting by seq keeps it in file order.
  • Bad input: HTML, an empty array or an object return an error rather than zero events.
  • Fingerprint and subject: FingerprintV2 gets detail set to "", and the subject (kind: operation, side: request) matches the Cloudflare feed reader. A deprecation and a removal of the same version are different change types, so they don't collide.

Verified

Command Result
go build ./... ok
go vet ./... ok, no output
gofmt -l . printed nothing
go test -race ./... all packages ok, including plugins/apichangelog
python3 scripts/leak_guard.py --all no banned terms (8 hashed terms checked)

I couldn't download the real 10 MB file (the fetch wasn't approved here). So I didn't confirm the 81 findings against it myself; I relied on the fixture and the README's note on how it was made.

Non-blocking

  • A removal that's later undone. A deprecation is withdrawn by endpoint-reactivated, but nothing withdraws an endpoint-removed if the same endpoint and version later comes back as endpoint-added. You show that pattern already happened once with api-path-removed-without-deprecation. The trimmed fixture replaces endpoint-added with {}, so I couldn't check whether any of the 38 removals is followed by a re-add. If none is, a short note in the provider page's Known gaps would cover it. If one is, it should probably be handled like a reactivation, since precision comes before recall.
  • The excerpt is re-serialized. json.Marshal(c) rebuilds only the three struct fields, in struct order. That matches the file today, but if MongoDB adds a field to a change, the excerpt would silently drop it. Keeping each change as json.RawMessage and quoting it as written would make it a faithful quote. Optional.
  • Commits API rate limit. Unauthenticated calls to the GitHub commits API are limited to 60 an hour. That's fine for one daily run, but worth knowing if the hosted service ever runs many GitHub-backed plugins from one IP.

Thanks for the careful PR. The reactivation replay and the position-keeping fixture are both well done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: brandonphelps1212 <bphelps1212@gmail.com>
@brandonphelps1212

Copy link
Copy Markdown
Contributor Author

@claude review

@claude

claude Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Claude finished @brandonphelps1212's task in 49s —— View job


✅ Ready to merge. The new commit (71c2ad8) takes up both earlier suggestions cleanly. Every repo rule is still met, and I found no blocking bugs.

Rules

Rule Status Evidence
1. Plugin list ✅ docs/plugins.md:18 has the mongodb-atlas row between the markers, with absolute links only and status paused. apichangelog is added to the Format plugin legend (:37). The new commit changes no id, source or status, so the row is still right.
2. Provider page ✅ providers/mongodb-atlas.md follows the template. Why this source has the link, the date checked, why it's best, the alternatives and a quote. Line 30 now describes the removal withdrawal, and line 33 the raw excerpt.
3. Golden, README, drop test, source on every event ✅ The golden test runs over the position-kept copy. Each file has a row in testdata/README.md. TestPropertyChangesMakeNoEvent is the pinned drop test. Every event sets SourceURL (the file at its SHA), SourcePointer and SourceExcerpt (apichangelog.go:251-253). The golden file isn't edited in the new commit: the compacted raw excerpt is byte-for-byte the same as the old json.Marshal(change), because the file's field order matches the struct.
4. Fetch only through env ✅ Both fetches go through env.Get (:208, :223). There's no net/http, filesystem or database access.
5. Precision over recall ✅ The new rule only ever drops events: a removal is withdrawn when the endpoint and version show up on a later day. Reactivations still withdraw deprecations.
6. Nothing private ✅ I found nothing private in the code, tests, docs, commit messages or PR body.

I couldn't run the commands here because they weren't approved in this run. CI_go covers build, vet, gofmt and go test -race, and CI_leak_guard covers the leak check.

Blocking bugs

None.

I checked the new code in Read (plugins/apichangelog/apichangelog.go:140-178):

  • Withdrawal on a later day: r.f.Date < d.Date compares YYYY-MM-DD strings, which sort correctly. Because it requires a later day, a removal and an add on the same day don't cancel out, and that matches the provider page.
  • The withdrawal check runs before the reactivation and life-cycle checks, so any later change to that version counts as a return, including a property-level one. That's the conservative choice.
  • TestRemovalUndoneAndRawExcerpt pins both behaviours: the withdrawal, and an extra vendor field (sunset) that's kept in its original order.

Non-blocking suggestions

  1. A removal repeated on a later day moves to the later day. If MongoDB announces the same endpoint-removed on two days, the first is deleted at :151-152 and the repeat is stored at :176-177. The event still comes out, but with the later date, pointer and excerpt. Deprecations keep the first announcement. None of the 38 removals is repeated, so this doesn't affect today's output. Two ways to make it consistent:
    • skip the deletion when c.ChangeCode is itself a removal code, or
    • document that a removal keeps its latest announcement.
  2. A re-added version keeps its old deprecation. If a version is deprecated, then removed, then shows up again, the removal is withdrawn but the earlier deprecation still stands. Precision over recall suggests clearing deprecated[key] too when a removal is withdrawn, because it's unclear whether that deprecation still applies. Nothing in today's file hits this, so either fix it or note it in Known gaps.
  3. Known gaps (providers/mongodb-atlas.md:42): the note about a stored deprecation now applies to removals too. A removal already in the feed isn't withdrawn when the version comes back. Adding "or a removal before its version comes back" would cover it.
  4. Nit: the tests ignore json.Unmarshal errors (apichangelog_test.go, in TestPropertyChangesMakeNoEvent and TestReactivationWithdrawsTheDeprecation). A t.Fatal on error would make a fixture problem fail loudly instead of quietly counting zero.

Thanks for the quick follow-up. Quoting changes as written and withdrawing a removal on a later day are both clean, well-scoped fixes.

…precation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: brandonphelps1212 <bphelps1212@gmail.com>
@brandonphelps1212

Copy link
Copy Markdown
Contributor Author

@claude review

@claude

claude Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Claude finished @brandonphelps1212's task in 26s —— View job


✅ Ready to merge. The new commit (221999a) addresses all four of my earlier suggestions. Every repo rule is still met, and I found no blocking bugs.

Rules

Rule Status Evidence
1. Plugin list ✅ The new commit doesn't change the id, provider, source, what the plugin watches, the format plugin or the status. The mongodb-atlas row in docs/plugins.md and the apichangelog legend entry are still correct, and still use absolute links only.
2. Provider page ✅ providers/mongodb-atlas.md:30 now says that a removal counts from its first announcement and that a returned version loses its deprecation too. Known gaps (:42) now covers removals already in the feed. Why this source is unchanged and complete.
3. Golden, README, drop test, source on every event ✅ No golden or testdata file changed in this commit. The new rule only removes events, and none of the 38 removals comes back, so today's 81 events stay the same. Every event still carries the file URL at its SHA, a pointer and the raw excerpt.
4. Fetch only through env ✅ No fetch code changed. Both fetches still go through env.Get.
5. Precision over recall ✅ When a version comes back, its removal and its earlier deprecation are both dropped (apichangelog.go:152-157). That's the conservative choice.
6. Nothing private ✅ I found nothing private in the diff, the commit message or the PR body.

I couldn't run the commands in this run. CI_go covers build, vet, gofmt and go test -race, and CI_leak_guard covers the leak check.

Blocking bugs

None. I traced the new logic in Read (plugins/apichangelog/apichangelog.go:141-186):

  • A repeated removal keeps its first announcement. The guard lifecycle[c.ChangeCode] != event.ChangeTypeBreaking stops a second endpoint-removed from withdrawing the first. The !dup check at :180 then keeps the original date, pointer and excerpt.
  • A returned version loses its deprecation. On a later day, any change other than a removal deletes both removed[key] and deprecated[key].
  • TestRepeatedRemovalAndReturn matches the code. In the replay, /a is deprecated (01-01), removed (02-01) and added again (04-01), so it produces no events. /b is removed on 02-01 and again on 03-01. That leaves one finding at file index /2, the 02-01 /b removal, which is what the test asserts.
  • The tests now fail on a bad fixture: json.Unmarshal errors call t.Fatal.

Non-blocking suggestions

  1. A later deprecation counts as a return. If a removed version later gets an endpoint-deprecated, the removal is withdrawn and a new deprecation is stored. That's defensible, since MongoDB is talking about the version again, so it's live. It's an edge case none of today's data hits, and you may just want to know it behaves this way.
  2. Nit: line 124 of the doc comment is much longer than the lines around it. Re-wrapping it would match the rest of the comment. gofmt won't flag it.

Thanks for working through every round of feedback so carefully. The life-cycle replay is now consistent and well pinned by tests.

@brandonphelps1212
brandonphelps1212 merged commit 5e1fb26 into main Nov 19, 2026
4 checks passed
@brandonphelps1212
brandonphelps1212 deleted the mongodb-plugin branch November 19, 2026 19:00
@brandonphelps1212 brandonphelps1212 mentioned this pull request Nov 19, 2026
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.

1 participant