Repository navigation
[FSSDK-13432] Don't treat the first invalid datafile from datafileManager as fatal - #1188
Merged
Merged
Conversation
…ager as fatal Previously, if the first datafile emitted by the datafileManager was invalid while the ProjectConfigManager was starting, it was treated as a fatal init error. Now startup fails only after the datafileManager has emitted MAX_INVALID_DATAFILE_EMIT (3) invalid datafiles before a valid one. Also make jsonSchemaValidator and datafileManager private.
There was a problem hiding this comment.
🟡 Changes recommended
Critical startup hangs remain: polling can stop after an invalid response or repeatedly receive 304 responses without advancing the validation retry limit.
2 open issues
What changed in this PR
This PR makes SDK startup tolerate transient invalid datafiles from the datafile manager instead of failing on the first invalid emission.
Changes:
- Fail startup after three invalid manager emissions, while allowing a valid datafile before that threshold to complete startup.
- Make the schema validator and datafile manager fields private.
- Update tests for retry-limit failure and recovery, with and without an invalid initial datafile.
| File | Description |
|---|---|
lib/project_config/project_config_manager.ts |
Adds the invalid-emission threshold and makes internal fields private. |
lib/project_config/project_config_manager.spec.ts |
Tests threshold failure and recovery; updates invalid-datafile fixtures. |
Review effort: Balanced
Md Junaed Hossain (junaed-optimizely)
approved these changes
Nov 13, 2026
Md Junaed Hossain (junaed-optimizely)
left a comment
Contributor
There was a problem hiding this comment.
lgtm
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
ProjectConfigManagerImplno longer fails to start on the first invalid datafile from thedatafileManager. Startup now fails only afterMAX_INVALID_DATAFILE_EMIT(3) invalid datafiles arrive before a valid one. A valid datafile within that limit starts the manager as usual.datafileManageris still a fatal init error, as before.jsonSchemaValidatoranddatafileManagerare nowprivate.A single bad response, such as a truncated or corrupted payload, used to stop the SDK from starting even though the next poll would have returned a valid datafile.
Test plan
project_config_manager.spec.ts, both with and without an initial (invalid) datafile in config:onRunning()andonTerminated()reject afterMAX_INVALID_DATAFILE_EMITinvalid datafiles.onRunning()resolves and the config is updated when a valid datafile arrives afterMAX_INVALID_DATAFILE_EMIT - 1invalid ones.'ab'instead ofJSON.stringify({}).npx vitest run lib/project_config/project_config_manager.spec.ts: 47 passed.tsc --noEmitis clean.Issues