Skip to content

add the flagsmith plugin - #136

Merged
AbdullahT01 merged 3 commits into
mainfrom
flagsmith-source
Nov 20, 2026
Merged

AbdullahT01 merged 3 commits into
mainfrom
flagsmith-source

Conversation

@AbdullahT01

@AbdullahT01 AbdullahT01 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Adds Flagsmith as a new openapi plugin. Source: openapi.yaml at the root of Flagsmith/flagsmith, its own OpenAPI 3.1 spec, generated with drf-spectacular and regenerated (and committed back by a bot) on every pull request that touches api/**, so a release tag always carries the spec for the code it ships. It reports whole operations removed and request-side parameter changes, same as GitLab's and the other openapi providers.

Closes #104.

Researched and ruled out before landing on the full openapi.yaml:

Source Why not
sdk/openapi.yaml (the same spec, filtered to SDK-only endpoints) Narrower for no benefit; the real removal found is Admin-API-adjacent, and the full file catches both surfaces.
A deprecations/sunset page None exists on docs.flagsmith.com; the release-process page points to GitHub Releases instead.
The main repo's CHANGELOG.md / GitHub Releases Release-please categorizes them, but entries are prose feature summaries ("Remove the experimental flag update endpoints"), never a backtick-wrapped name; changelog's classifier matched nothing.
flagsmith-python-client's and flagsmith-js-client's CHANGELOG.md (Python and JS SDKs, checked first per the ticket) Both are release-please too, with "⚠ BREAKING CHANGES" sections, but none plainly names a removed symbol the way changelog expects (closest: "The Edge API will no longer allow for flagsmith.incrementTrait, this PR removes it", whose sentence shape doesn't match the "Removed X" templates). Neither has a MIGRATION.md. Left for a future, separate client-library plugin.
An RSS/Atom feed None found.

The replay fixture: v2.286.0 → v2.287.0 (2026-10-15 to 2026-10-20), PR #8736 "Remove the experimental flag update endpoints", removed three whole operations and their eight request-body schemas, listed under "Features" in the v2.287.0 release notes. Honest caveat: all three were tagged "EXPERIMENTAL ENDPOINT - Subject to change without notice" from the day they shipped, not long-stable endpoints — still a real removal a caller of them would have hit, by the same mechanism (an operation gone between two tagged specs) that would catch a stable one's removal. Documented prominently in providers/flagsmith.md.

A real bug the fixture surfaced: the differ reports the 8 removed request-body schemas as their own "schema removed" changes, side response by default (Flagsmith names its request bodies, unlike GitLab's hash-named ones, so there's nothing to inline). Registered with Keep: requestSide, same filter and same reason as GitLab's, which drops those 8 and keeps the 3 real operation removals.

Fixed after review: the fake test adapter recorded version/previous_version as the raw tag (v2.287.0/v2.286.0); the real adapter strips the leading v (strings.TrimPrefix(tag, "v")), so the golden didn't match production. Fixed the fake and regenerated the golden to 2.287.0/2.286.0.

Checklist

  • Added to docs/plugins.md (new row) and make plugins-json run
  • Every commit is signed off (git commit -s, DCO)
  • Golden test over a real saved copy of the source (testdata/golden/flagsmith.json)
  • testdata/README.md lists each file: URL, date fetched, license, quote
  • One pinned drop test: a real commit that only reworded two description strings, no event
  • providers/flagsmith.md written from providers/_template.md, including Why this source
  • Fetches only through env.Get (fetch.Get in adapter/flagsmith.go)
  • make check passes locally
  • Nothing private: no credentials, internal hosts, private links, customer names

Notes for the reviewer

  • No deprecation signal is read: nothing in Flagsmith's spec marks deprecated: true on an operation yet, so only an already-gone operation becomes an event (see Known gaps in the provider page).
  • The Python and JS/TS SDK client libraries aren't watched (see table above); a future ticket could add a looser classifier or a dedicated reader for either.

Signed-off-by: AbdullahT01 <[email protected]>
@AbdullahT01
AbdullahT01 requested a review from adssib as a code owner November 20, 2026 02:40
@claude

claude Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Claude finished @AbdullahT01's task in 2m 10s —— View job


⚠️ Merge after fixes. The plugin itself is well researched and follows the rules, but CI_go fails at its gofmt step on the vercel_test.go "fix" in this PR, and the golden records a version that production won't emit.

Rules

Rule Status Evidence
Plugin list (Rule 1) ✅ New flagsmith row sits between the markers, uses absolute links, and has format openapi. docs/plugins.json (count 29) and the README badge are regenerated. I compared the row's words with providers/flagsmith.md and they match.
Provider page ✅ providers/flagsmith.md follows the template. Why this source gives the link, the date checked (2026-11-19), why it's the best source, five alternatives with reasons, and a quote. It's also listed in providers/README.md.
Golden test + quote ⚠️ testdata/golden/flagsmith.json holds 3 operation removals from the real v2.286.0 → v2.287.0 specs (trimmed, with the trim explained). testdata/README.md has URL, date, license and quote. Every event has source_url and source_excerpt. The version field is wrong, though (see Bugs).
Drop test ✅ Commits c3ef832 → f504f16 only reword descriptions, and the test checks that no event comes out.
Fetch only via env ✅ adapter/flagsmith.go fetches only through fetch.Get, like every other adapter. No filesystem or DB access outside tests.
Nothing private (Rule 2) ✅ Leak guard is clean. I found nothing private in the code, docs, commit or PR body ([email protected] is Flagsmith's public contact in their own spec).

Bugs

  1. CI_go fails: plugins/openapi/vercel_test.go is not gofmt-formatted (inline comment). On main this map already passes gofmt: gofmt deliberately starts a new alignment section where the key lengths jump. The re-padding in this PR is what fails CI_go's gofmt step (Go 1.27.1): not gofmt-formatted. Run 'gofmt -w plugins/openapi/vercel_test.go'. Fix: drop the change to that file (git checkout origin/main -- plugins/openapi/vercel_test.go) and remove the related line from the PR description.
  2. The golden's version / previous_version don't match production (inline comment). adapter.Flagsmith.Fetch emits 2.287.0 (with the v stripped), but fakeFlagsmithAdapter.Fetch sets Version: tag, so the golden records v2.287.0 / v2.286.0. Use strings.TrimPrefix(tag, "v") in the fake (Vercel's fake does this), regenerate the golden, and say in the PR why the new output is right.

Verified

  • go build ./...: ok
  • go vet ./...: ok
  • gofmt -l .: ❌ prints plugins/openapi/vercel_test.go
  • go test -race ./...: all packages pass, including TestFlagsmithGolden, TestFlagsmithDropsADescriptionOnlyChange and TestFlagsmithRegistersItself
  • python3 scripts/leak_guard.py --all: no banned terms (8 hashed terms checked)
  • CI on this PR: CI_go ❌ (gofmt step), CI_leak_guard ✅, CI_dco ✅, CI_contract ✅
  • requestSide (plugins/openapi/openapi.go:80) keeps only Side == request. The golden shows the 3 operation removals survive and the 8 "schema removed" response-side echoes are dropped.

Non-blocking (optional)

  • No adapter test. Every other adapter has an adapter/<name>_test.go, and the comment above flagsmithReleasesURL says the URLs are variables "so tests can point them at a local server", but there's no adapter/flagsmith_test.go. A small test against httptest would cover the YAML→JSON conversion, the empty tag_name error, and the v trimming, which is exactly what bug 2 slipped past.
  • Experimental endpoints. Each operation carries **EXPERIMENTAL ENDPOINT** in its description. You've documented the caveat well. If future removals of experimental-only endpoints turn out to be noise for users, a Keep that drops operations tagged experimental would be a cheap precision win. That's a call for later, not for this PR.
  • drf-spectacular enum names. drf-spectacular sometimes renames generated enum components (e.g. TypeEnum → Type0a5Enum) when an unrelated serializer adds a collision. If that ever shows up as a request-side change on the live spec, it would be worth a second drop test.

Thanks for the thorough source research and the honest caveat in the provider page. Once those two fixes are in, this looks good to go.

Comment thread plugins/openapi/vercel_test.go Outdated
Comment on lines +222 to +224
"Undeprecated thing": false,
"Deprecated runtimes for a project": false,
"Update a project (deprecated fields are ignored)": false,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Blocking: this reformat is what makes CI_go fail. The main version of this map passes gofmt. gofmt starts a new alignment section here because the key lengths jump, so the shorter keys are meant to stay unpadded. With the extra padding, CI_go's gofmt step (Go 1.27.1) fails with:

##[error]not gofmt-formatted. Run 'gofmt -w plugins/openapi/vercel_test.go'.

gofmt -l . on this branch also lists this file. The fix is to drop the change to this file (git checkout origin/main -- plugins/openapi/vercel_test.go). Your local gofmt may be an older or newer Go than CI's 1.27.1; make GO=/path/to/go1.27.1 check will match CI.

return adapter.Spec{
Content: content,
Version: tag,
SourceURL: "https://raw.githubusercontent.com/Flagsmith/flagsmith/" + tag + "/openapi.yaml",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Golden doesn't match what production emits. adapter.Flagsmith.Fetch sets Version: strings.TrimPrefix(tag, "v") ("2.287.0"), but this fake sets Version: tag. As a result testdata/golden/flagsmith.json records "version": "v2.287.0" / "previous_version": "v2.286.0", which the real plugin will never produce. Vercel's fake mirrors its adapter on this point. Suggested fix (then regenerate the golden and say so in the PR):

Suggested change
SourceURL: "https://raw.githubusercontent.com/Flagsmith/flagsmith/" + tag + "/openapi.yaml",
Version: strings.TrimPrefix(tag, "v"),

(This needs "strings" in the imports.)

@AbdullahT01

Copy link
Copy Markdown
Contributor Author

@claude review

@claude

claude Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Claude finished @AbdullahT01's task in 24s —— View job


✅ Ready to merge. Both blocking issues from the last review are fixed, and all four CI checks pass on the latest push.

Rules

Rule Status Evidence
Plugin list (Rule 1) ✅ The flagsmith row sits between plugins:start and plugins:end, uses absolute links, has format openapi and status live. docs/plugins.json and the README badge were regenerated (CI_go's freshness check passes). Its words still match providers/flagsmith.md.
Provider page ✅ providers/flagsmith.md follows the template. Why this source has the link, the date checked (2026-11-19), the reasoning, the alternatives it ruled out, and a quote. It's also listed in providers/README.md.
Golden test + quote ✅ testdata/golden/flagsmith.json now records "version": "2.287.0" / "previous_version": "2.286.0". That matches adapter.Flagsmith.Fetch (strings.TrimPrefix(tag, "v")). The testdata/README.md rows are present. All 3 events carry source_url and source_excerpt.
Drop test ✅ TestFlagsmithDropsADescriptionOnlyChange replays c3ef832 → f504f16, a commit that only reworded descriptions, and expects no events.
Fetch only via env ✅ adapter/flagsmith.go only fetches through fetch.Get. There's no net/http and no filesystem access outside tests.
Precision over recall ✅ Keep: requestSide drops the 8 response-side "schema removed" echoes and keeps only the 3 real operation removals.
Nothing private (Rule 2) ✅ CI_leak_guard passes, and I found nothing private in the code, docs or commits.

What changed since the last review

  • 5a0607c reverts plugins/openapi/vercel_test.go. The file is no longer in the diff, and CI_go's gofmt step passes.
  • 3f90cf0 makes the fake adapter strip the leading v like the real one. The golden was regenerated, and the new output is correct because it is now exactly what production emits.

CI

CI_go ✅, CI_leak_guard ✅, CI_dco ✅, CI_contract ✅. CI_go runs the full make check (build, gofmt, vet, imports, net/http guard, go test -race, todos), so I didn't re-run the tests here.

Non-blocking (optional)

  • PR description is out of date: it still says the PR "also includes a one-line gofmt -w fix to plugins/openapi/vercel_test.go". That change was reverted, so please remove that paragraph. It would also help to add one line saying the golden's version / previous_version changed from v2.287.0 / v2.286.0 to 2.287.0 / 2.286.0 to match the real adapter. AGENTS.md asks for golden edits to be explained in the PR.
  • No adapter/flagsmith_test.go (same note as last time). A small httptest test would cover the YAML→JSON conversion, the empty tag_name error and the v trimming. The variable URLs are already set up for it.
  • Experimental endpoints: if removals of experimental-tagged operations turn out to be noise later, a Keep that drops them would be cheap. That can wait for a later PR.

Thanks for the quick, clean fixes, @AbdullahT01. The source research and the honest caveat about the experimental endpoints make this an easy plugin to trust.

@AbdullahT01
AbdullahT01 merged commit 979ec6b into main Nov 20, 2026
4 checks passed
@AbdullahT01
AbdullahT01 deleted the flagsmith-source branch November 20, 2026 05:04
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.

I15.5 · Watch Flagsmith

1 participant