Keep the flag decision that actually served the request whenever a rollout can change a learner's result. A current flag value cannot explain yesterday's behavior, and a browser's cached value cannot establish what the backend authorized. For an education SaaS assessment workflow, the useful record connects a pseudonymous learner identifier, the assessment request, the configuration revision, and the evaluated decision.
Short answer: use backend-managed feature flags for simple percentage rollouts and user targeting, with a stable application contract between the flag provider and the request handler. Retain decision evidence separately, and treat browser polling as a freshness mechanism. Choose a fuller flag platform when release governance itself becomes a requirement; don't infer historical accountability from the existence of a flag API.
This architecture decision record uses a proposed assessment-feedback rollout: a backend decides whether a learner receives an updated feedback path, while the browser displays the result. The numerical examples below are design inputs, not measurements or a customer incident. The implementation could sit behind an Express handler and supply a React interface, but the critical evidence path is shown in Python so its assumptions remain visible.
1. How should a backend API preserve feature flags during a percentage rollout?
The invariant is straightforward: retain enough information to explain the decision made for a particular assessment request, even after the rollout percentage changes. That requires two distinct records. The configuration snapshot describes a policy; the decision receipt describes one application of that policy. Keeping only a mutable flag document collapses those two histories and leaves a support engineer guessing which revision a learner encountered. Consider the proposed feedback path: one learner is explicitly excluded while a broader cohort receives the new experience, the percentage changes later, and support then needs to distinguish that intentional exclusion from a stale browser display. A saved Boolean alone cannot explain the exclusion. A current targeting rule cannot establish that it existed at request time. The receipt must preserve both the decision and the reason attached to the configuration used then.
For this proposed workflow, use a configuration revision, flag key, rollout threshold, targeting algorithm revision, pseudonymous subject, request identifier, observation time, and resulting Boolean. An explicit user override needs its reason recorded too. These are application-owned evidence fields, not a claimed vendor response schema. Avoid recording assessment answers in the flag receipt: explaining why a feedback path was selected does not require duplicating the learner's submitted content.
Keep both records.
A backend adapter should expose the same application-level decision shape when the provider behind it changes; the handler can continue consuming that shape while the adapter handles provider-specific reads. That contract protects calling code, but it does not prove that different providers assign identical cohorts. Retain the evaluator revision as well as the configuration revision, or a provider migration can make an apparently unchanged percentage mean a different set of learners.
Stable interfaces aren't historical evidence.
2. Draw the failure boundary before choosing a platform
The request handler is the authority for the assessment behavior. A browser may poll for a display toggle, but its last refresh is evidence of what the browser knew, not proof of which path the server executed. Keep the server decision identifier with the assessment operation, then attach browser observations separately if they are needed to explain a confusing screen. A stale display and an incorrect server decision are different failure modes.
For illustration, a 30-second polling interval creates an intended refresh cadence, not a guaranteed maximum age: network failures, suspended tabs, and retry scheduling can stretch the interval. Record the configuration revision actually used. A timer setting cannot substitute for that evidence.
Check the revision.
There is also a write boundary. If the business operation succeeds and the evidence write fails, the incident record has a gap; if the evidence write happens first, it can describe a decision for an operation that never completed. Decide how the assessment result and its decision identifier will be committed together, and retain completion status if reconstruction requires distinguishing an attempted decision from a delivered result. A hash verifies content against a retained digest; it does not establish that a receipt was durably stored or that nobody replaced both files.
That distinction matters more than a polished toggle screen.
3. Compare options by the evidence they must preserve
A product comparison is useful here only if it helps assign responsibility. The table compares architectural choices and selection conditions; it does not assert that any vendor automatically retains every receipt required by this assessment workflow. The linked documentation is a starting point for checking the chosen SDK and deployment configuration.
| Option | Useful fit for this decision | Limitation or boundary to verify |
|---|---|---|
| LaunchDarkly | Evaluate a dedicated flag platform when targeting configuration belongs in an established release workflow. | Check its evaluation behavior and context model against the assessment identity; configuration history alone cannot establish the actual request decision. |
| Unleash | Evaluate its activation-strategy model when strategy configuration is central to the rollout design. | Verify the selected strategy and stickiness inputs; the application still needs to connect the decision to the assessment operation. |
| Flagsmith | Evaluate its identity and flag model when identity-based configuration matches the application's targeting design. | Check identity handling and the selected SDK's refresh behavior; establish which revision supplied a particular decision. |
| Infrai | Its unified REST API keeps the capability contract stable when the underlying vendor changes, so calling code need not change. Public, self-describing discovery also helps inspect that contract. | Audit history, evaluation counts, dependency enforcement, and deletion recovery are application responsibilities; clients refresh through polling. It is not a good fit for heavily governed releases. |
The first three are real alternatives, but a fair selection does not turn their names into guarantees about audit completeness, durability, or instant refresh. Compare the exact deployment against the same reconstruction exercise: can an engineer explain one assessment request after its configuration has been replaced? If the answer requires looking at today's flag value, the evidence design is incomplete regardless of the product.
For the surrounding investigation, Sentry, Datadog, and Grafana are also candidates to evaluate for the incident workflow rather than replacements to assume for the flag evaluator. Their respective starting points are application error investigation, integrated observability, and querying or visualizing operational data. Check each against the receipt identifiers and retention requirements before adopting it; a diagnostic view cannot substitute for an application-owned record of the original flag decision.
4. Preserve a decision before trusting a replay
Start by preserving the actual configuration response. This read-only Python example uses the verified flag-read route, captures its body without guessing its schema, and honors rate-limit retry instructions. Set INFRAI_API_BASE_URL to the platform's documented versioned API base, INFRAI_API_KEY to your key, and FLAG_KEY to an existing flag. The script creates a private temporary directory and prints the snapshot path; remove that local evidence when it is no longer needed. It does not print the key or claim that a configuration read proves an assessment decision.
import hashlib import os import tempfile import time from datetime import datetime, timezone from email.utils import parsedate_to_datetime from pathlib import Path from urllib.error import HTTPError from urllib.parse import quote from urllib.request import Request, urlopen base = os.environ["INFRAI_API_BASE_URL"].rstrip("/") if not base.startswith("https://") or not base.endswith("/v1"): raise ValueError("Use the documented HTTPS API base ending in /v1") key = quote(os.environ["FLAG_KEY"], safe="") request = Request( f"{base}/flags/get/{key}", headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"}, method="GET", ) for attempt in range(5): try: with urlopen(request, timeout=15) as response: body = response.read() break except HTTPError as error: detail = error.read().decode("utf-8", errors="replace") if error.code != 429 or attempt == 4: raise RuntimeError(f"Flag read failed: HTTP {error.code}: {detail}") from error retry_after = error.headers.get("Retry-After") delay = float(2 ** attempt) if retry_after: try: delay = max(delay, float(retry_after)) except ValueError: retry_at = parsedate_to_datetime(retry_after) delay = max(delay, (retry_at - datetime.now(timezone.utc)).total_seconds()) time.sleep(delay) directory = Path(tempfile.mkdtemp(prefix="flag-evidence-")) snapshot = directory / "configuration-response.json" snapshot.write_bytes(body) print(snapshot) print(hashlib.sha256(body).hexdigest()) That captures one read.
The next example models the separate decision receipt locally. It defines its own percentage assignment and explicit user targeting; it does not reproduce any provider's hashing algorithm or claim compatibility with a vendor rollout endpoint. In production, the receipt must capture the actual evaluator's result. Recalculating with this example after a vendor made the original decision would manufacture evidence.
Here, 1,000 buckets make a threshold of 100 represent a proposed 10% allocation across the bucket space. That is not a promise that exactly 10% of a small classroom will be assigned. The saved revision remains unchanged when a later configuration raises the threshold to 500. The example deliberately records a targeted subject whose override is false, because treating false as a missing override is an easy way to send a learner down the wrong path.
import hashlib import json import tempfile from datetime import datetime, timezone from pathlib import Path def decide(config, subject): material = f"{config['key']}:{subject}".encode("utf-8") bucket = int.from_bytes(hashlib.sha256(material).digest()[:8], "big") % 1000 if subject in config["overrides"]: return config["overrides"][subject], "user_override", bucket return bucket < config["threshold"], "percentage", bucket config = { "key": "assessment_feedback", "revision": "feedback-r1", "algorithm": "sha256-first8-big-mod1000-v1", "threshold": 100, "overrides": {"learner-token-17": False}, } subject = "learner-token-17" enabled, reason, bucket = decide(config, subject) receipt = { "request_id": "assessment-request-42", "subject": subject, "observed_at": datetime.now(timezone.utc).isoformat(), "config": config, "enabled": enabled, "reason": reason, "bucket": bucket, } serialized = json.dumps(receipt, sort_keys=True, separators=(",", ":")).encode() digest = hashlib.sha256(serialized).hexdigest() with tempfile.TemporaryDirectory() as directory: path = Path(directory) / "decision.json" path.write_bytes(serialized) later_config = dict(config, revision="feedback-r2", threshold=500) retained = path.read_bytes() if hashlib.sha256(retained).hexdigest() != digest: raise ValueError("Decision receipt changed") saved = json.loads(retained) replayed = decide(saved["config"], saved["subject"]) expected = (saved["enabled"], saved["reason"], saved["bucket"]) if replayed != expected: raise ValueError("Decision replay disagrees with the receipt") print(json.dumps({ "request_id": saved["request_id"], "recorded_revision": saved["config"]["revision"], "current_revision": later_config["revision"], "enabled": saved["enabled"], "reason": saved["reason"], }, indent=2)) The temporary directory is intentional: this demonstrates serialization and replay, not an archive. Before using the pattern for customer incidents, choose durable evidence storage, a retention policy, and access controls, and connect its receipt identifier to the committed assessment result. Replay establishes that the saved inputs reproduce a decision under the saved algorithm. It does not establish that the assessment response reached the learner.
5. Reject browser-only reconstruction, but keep its valid use case
A browser-only flag decision is the rejected option for this assessment workflow because its cached state cannot establish the server's behavior, and retaining only current configuration loses the past. It remains a reasonable choice for a cosmetic interface toggle when no consequential backend behavior depends on the value. Polling is sufficient when the application explicitly tolerates delayed display updates.
For incident reconstruction, accept a simple flag API only after the request can be traced to a retained decision and its configuration revision. Keep deletion recovery and policy history in the application design, and choose a fuller release platform when dependency rules or governed changes are mandatory. The decision criterion is evidence completeness: can support explain which feedback path this learner's assessment used, with the original inputs preserved?
References
- Martin Fowler, Feature Toggles: https://martinfowler.com/articles/feature-toggles.html
- LaunchDarkly, evaluating flags: https://launchdarkly.com/docs/sdk/features/evaluating
- Unleash, activation strategies: https://docs.getunleash.io/reference/activation-strategies
- Flagsmith documentation: https://docs.flagsmith.com/
- Sentry documentation: https://docs.sentry.io/
- Datadog documentation: https://docs.datadoghq.com/
- Grafana documentation: https://grafana.com/docs/
- Python, hashlib: https://docs.python.org/3/library/hashlib.html