Skip to content

ci: Run the Flagsmith SDK behavioural spec - #109

Merged
Zaimwa9 merged 1 commit into
mainfrom
feat/sdk-spec
Oct 21, 2026
Merged

Zaimwa9 merged 1 commit into
mainfrom
feat/sdk-spec

Conversation

@Zaimwa9

@Zaimwa9 Zaimwa9 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Runs the Flagsmith SDK behavioural spec against this SDK on every pull request and push to main.

  • sdk-spec/steps.swift: the steps the spec drives: Create the SDK client and one function per When step in the spec's features/. sdk-spec/Package.swift makes it a library depending on the SDK by path, and sdk-spec/Dockerfile builds the SDK from source with it under the spec's Swift harness, on Linux (swift:6.1-noble). No SDK changes were needed: it already builds on Linux.
  • .github/workflows/sdk-spec.yml: calls the spec's reusable workflow, pinned to v0.4.0 (the first release with the Swift harness, feat: Add a Swift harness sdk-spec#5), with language: swift. The workflow starts a real Flagsmith instance, seeds it through the Admin API and runs the scenarios through the steps file.
  • renovate.json: lets Renovate bump the uses: ref and spec-ref together. Its regex manager updates spec-ref, Renovate's built-in GitHub Actions manager updates the reusable workflow ref in uses:, and the SDK spec group puts both in one PR.

The spec currently covers getting environment flags and getting identity flags with traits.

Notes for review:

  • The SDK only exposes the Flagsmith.shared singleton, so a spec client is the environment key and API URL applied to it before each call. The harness runs one step at a time, so calls never interleave. Analytics, realtime updates and caching are left at their defaults (off, except analytics, which only records hasFeatureFlag/getValueForFeature calls).
  • The SDK delivers callbacks on the main queue. The harness runs steps off the main thread and serves the main queue from it.

@Zaimwa9

Zaimwa9 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

@themis-blindfold review

@Zaimwa9
Zaimwa9 marked this pull request as ready for review October 21, 2026 13:02
@Zaimwa9
Zaimwa9 requested a review from a team as a code owner October 21, 2026 13:02
@Zaimwa9
Zaimwa9 requested review from a team, khvn26 and talissoncosta and removed request for a team October 21, 2026 13:02
@Zaimwa9

Zaimwa9 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

@themis-blindfold review

@themis-blindfold

Copy link
Copy Markdown

⚖️ Themis review: ✅ Ship it

The adapter correctly maps the supported environment and identity-with-traits flows onto the SDK singleton, and the completed behavioural-spec, macOS, and lint checks all passed. This adds useful cross-SDK compatibility coverage without changing the released SDK surface.

Area Score
🎯 Correctness 5/5
🧪 Test coverage 5/5
📐 Code quality 4/5
🚀 Product impact 3/5
📝 Walkthrough
  • SDK spec workflow - runs the pinned reusable behavioural-spec workflow for pull requests and pushes to main.
  • Spec adapter - exposes health, client lifecycle, environment-flag, and identity-flag endpoints while serialising use of the SDK singleton.
  • Container build - compiles the adapter with this checkout of the SDK and packages the executable with its release version metadata.
🧪 How to verify
  1. Run the sdk-spec / Spec v0.1.1 workflow and confirm both environment and identity-with-traits scenarios pass.
  2. Build the adapter from the repository root with docker build -f spec-adapter/Dockerfile -t flagsmith-spec-adapter ..
  3. Run the image and request /health; confirm it returns the SDK name and release version.
  4. Exercise POST /clients, then both flag routes against a seeded Flagsmith instance.
    Automate: The required behavioural-spec workflow already covers the supported flag flows end to end.

Product take: A solid confidence improvement: future SDK changes are checked against shared behavioural scenarios, with no user-facing SDK change in this PR.

🧭 Assumptions & unverified claims

No unverified assumptions or claims.

A small adapter, now keeping the SDK honest on every trip through CI · reviewed at 32e58eb

@Zaimwa9

Zaimwa9 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

@themis-blindfold review

@themis-blindfold

Copy link
Copy Markdown

⚖️ Themis review: ✅ Ship it

The Swift behavioural-spec harness, Docker build, and reusable workflow are coherently wired to the SDK's existing environment and identity flag APIs. The captured CI run passed the spec job alongside macOS and lint checks.

Area Score
🎯 Correctness 5/5
🧪 Test coverage 4/5
📐 Code quality 4/5
🚀 Product impact 3/5
📝 Walkthrough
  • Spec steps - configure the singleton per scenario and expose environment and identity flag retrieval to the Swift harness.
  • Harness packaging - compile the spec steps against the local SDK package for Linux execution.
  • CI and dependency updates - run the pinned reusable specification workflow for pull requests and main, with a Renovate rule for the future tagged spec reference.
🧪 How to verify
  1. Open a pull request and confirm the sdk-spec job completes successfully.
  2. Run the environment-flags scenario against a seeded local Flagsmith instance and compare its returned feature, enabled state, and value.
  3. Run the identity-with-traits scenario and confirm the supplied traits affect the evaluated flags.
  4. After the Swift harness is released, update both workflow references to its tag and confirm Renovate proposes grouped updates.
    Automate: the new workflow already executes the behavioural scenarios on pull requests and pushes to main.

Product take: A solid compatibility safeguard: it exercises real SDK-to-server flag evaluation paths before changes merge. Its scope is currently narrow, but it establishes a useful path for broader cross-SDK coverage.

🧭 Assumptions & unverified claims

A fresh local Swift/Docker harness build was not run because those tools are unavailable in this checkout; the captured CI run completed the spec job successfully.

The new harness has its sea legs, even if the local toolbox did not · reviewed at f551b42

@Zaimwa9

Zaimwa9 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

@themis-blindfold review

@themis-blindfold

Copy link
Copy Markdown

⚖️ Themis review: ✅ Ship it

The behavioural-spec workflow, lint, and macOS checks all completed successfully. The harness configures the existing singleton before each serially executed step and covers the currently supported environment-flag and identity-with-traits flows.

Area Score
🎯 Correctness 5/5
🧪 Test coverage 4/5
📐 Code quality 5/5
🚀 Product impact 3/5
📝 Walkthrough
  • Spec workflow - runs the pinned Swift behavioural harness for pull requests and updates to main.
  • Swift steps - configure the SDK singleton and translate environment and identity flag results into the spec's response shape.
  • Container harness - builds the SDK and spec steps under Swift on Linux.
  • Dependency updates - prepares grouped updates for the spec reference once it is moved to a release tag.
🧪 How to verify
  1. Run the SDK spec workflow on a pull request and confirm the environment-flags and identity-with-traits scenarios pass against the seeded service.
  2. Run swift test on macOS.
  3. Build the harness with swift build --package-path sdk-spec --configuration release in the Swift container used by the workflow.
  4. After the spec publishes a release tag, update both workflow references to that tag and run a Renovate dry run to confirm they stay grouped.
    Automate: keep the SDK spec workflow required for pull requests.

Product take: A solid developer-confidence improvement: it continuously checks two core SDK behaviours against a real Flagsmith instance. It is not user-facing, but it reduces regression risk on a compatibility boundary.

🧭 Assumptions & unverified claims

No unverified assumptions or claims.

A small harness with a rather healthy appetite for regressions · reviewed at d623443

@Zaimwa9
Zaimwa9 force-pushed the feat/sdk-spec branch 2 times, most recently from 24db8e2 to 03b064b Compare October 21, 2026 15:28
@Zaimwa9
Zaimwa9 merged commit afda3b4 into main Oct 21, 2026
4 checks passed
@Zaimwa9
Zaimwa9 deleted the feat/sdk-spec branch October 21, 2026 15:50
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.

2 participants