Skip to content

fix: treat failed feature flags as unavailable - #29

Merged
marandaneto merged 1 commit into
mainfrom
fix/spec211-failed-flags
Nov 13, 2026
Merged

marandaneto merged 1 commit into
mainfrom
fix/spec211-failed-flags

Conversation

@marandaneto

Copy link
Copy Markdown
Member

💡 Motivation and Context

Failed feature flag records can expose false or variant values and payloads instead of using the caller's default. This fixes the Roblox behavior described in PostHog/sdk-specs#211.

Records marked failed: true and their legacy flat mirrors no longer supply cached values or payloads. Boolean getters use the caller's default. The structured getter keeps its existing unavailable result with a false value and no payload. Failed reads emit evaluation_failed using the existing false response sentinel, not the caller's default. Response-wide errors remain a separate diagnostic. Event deduplication and configuration still apply, and ordinary missing keys still emit nothing.

Response-wide errored refreshes retain successful cached true, false and variant values with their paired payloads. Complete nonerrored refreshes still replace the cache. Successful recovery and quota clearing remove failure markers. Includes a Sampo patch-release changeset without a manual version bump.

💚 How did you test it?

  • lune run tests/runTests.luau: 116 passed, zero failed. The pure-module function-coverage gate passed at 43/43. This is not branch coverage or full runtime coverage.
  • selene src tests and stylua --check src tests ExampleProject passed with the pinned tool versions.
  • Public-path tests load the actual server modules under Lune, then exercise Init, reload, both getters, defaults and Flush. They inspect events delivered through the real event queue to mocked transport. Cases cover absent/false/true response-wide error bits, failed mirrors and payloads, healthy false, suppression, deduplication and retained successful pairs.
  • Independent pre-fix substitution reproduced 11 failures with the final tests. An independent subject/lifetime probe passed.
  • Isolated branch autoreview passed on commit 6974c12aef6547a013d85134b5a7ebd6d0f6d337 against main cef6b1e8db9360acdb2f99a2cc993ab6d91a09ab, with no actionable findings.

Validation used Lune 0.10.4 with mocked Roblox services, lifecycle and HTTP transport. Roblox Studio, live ingestion and the Rojo build were not run. These tests do not establish Studio or end-to-end wire conformance.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Added a changeset file in .sampo/changesets/

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Implemented and published with Pi using local shell, Git and GitHub CLI, with an isolated autoreview helper. Scope was limited to failed-record handling, cache refresh behavior and regression tests. All commits are signed. Human review is required before merge. Remaining runtime validation is listed above.

@marandaneto marandaneto self-assigned this Nov 12, 2026
@marandaneto
marandaneto marked this pull request as ready for review November 12, 2026 12:13
@marandaneto
marandaneto requested a review from a team as a code owner November 12, 2026 12:13

@ioannisj ioannisj left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 An AI agent wrote this on behalf of @ioannisj.

No findings. I went through the failed-record handling in src/Server/FlagCache.luau and the $feature_flag_called path in src/Server/FeatureFlags.luau against the spec, and both look right to me.

@marandaneto
marandaneto merged commit 8350029 into main Nov 13, 2026
14 checks passed
@marandaneto
marandaneto deleted the fix/spec211-failed-flags branch November 13, 2026 16:37
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