Skip to content

chore(remote-config): deprecate RemoteConfigFetchResponse and FetchResponseData - #3302

Open
ritiktaneja wants to merge 1 commit into
firebase:mainfrom
ritiktaneja:chore/rc-deprecate-fetch-response
Open

ritiktaneja wants to merge 1 commit into
firebase:mainfrom
ritiktaneja:chore/rc-deprecate-fetch-response

Conversation

@ritiktaneja

Copy link
Copy Markdown

Remote Config server-side rendering (SSR) hydration of the client SDK has been deprecated; the backend rejects client fetches of server templates, and the JS SDK is deprecating templateId/initialFetchResponse in parallel.

  • Mark RemoteConfigFetchResponse and FetchResponseData @deprecated (to be removed in the next major release).
  • Log a one-time console warning when RemoteConfigFetchResponse is constructed.
  • No changes to getServerTemplate / initServerTemplate / evaluate().

…sponseData

Remote Config server-side rendering (SSR) hydration of the client SDK
has been deprecated; the backend rejects client fetches of server
templates, and the JS SDK is deprecating templateId/initialFetchResponse
in parallel.

- Mark RemoteConfigFetchResponse and FetchResponseData @deprecated
  (to be removed in the next major release).
- Log a one-time console warning when RemoteConfigFetchResponse is
  constructed.
- No changes to getServerTemplate / initServerTemplate / evaluate().
@ritiktaneja
ritiktaneja requested a review from a team November 2, 2026 07:40

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request deprecates the FetchResponseData interface and the RemoteConfigFetchResponse class in the Remote Config module, adding deprecation warnings and corresponding unit tests. The feedback points out that using a global module-level variable to track the warning state makes unit tests order-dependent and fragile. It is recommended to refactor this state into a static property on the RemoteConfigFetchResponse class and reset it in the test suite's beforeEach hook to ensure test isolation.

const HTTP_NOT_MODIFIED = 304;
const HTTP_OK = 200;

let fetchResponseDeprecationWarned = false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using a global module-level variable fetchResponseDeprecationWarned to track whether the deprecation warning has been logged makes the unit tests order-dependent and fragile. If other tests instantiate RemoteConfigFetchResponse before the deprecation test runs, or if a single test is run in isolation (e.g., using it.only), the deprecation warning test will fail because the warning will not be logged again.

To make the tests robust and independent, we can store this state as a private static property on the RemoteConfigFetchResponse class and reset it in the test suite's beforeEach hook.

Comment on lines +729 to +736
if (!fetchResponseDeprecationWarned) {
fetchResponseDeprecationWarned = true;
console.warn(
'RemoteConfigFetchResponse is deprecated and will be removed in the next major ' +
'release. Remote Config server-side rendering (SSR) hydration of the client SDK ' +
'is no longer supported.'
);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Update the constructor to use the class's static property RemoteConfigFetchResponse.deprecationWarned instead of the global module-level variable. This allows the warning state to be reset between tests. Note that you should also add private static deprecationWarned = false; inside the RemoteConfigFetchResponse class definition.

Suggested change
if (!fetchResponseDeprecationWarned) {
fetchResponseDeprecationWarned = true;
console.warn(
'RemoteConfigFetchResponse is deprecated and will be removed in the next major ' +
'release. Remote Config server-side rendering (SSR) hydration of the client SDK ' +
'is no longer supported.'
);
}
if (!RemoteConfigFetchResponse.deprecationWarned) {
RemoteConfigFetchResponse.deprecationWarned = true;
console.warn(
'RemoteConfigFetchResponse is deprecated and will be removed in the next major ' +
'release. Remote Config server-side rendering (SSR) hydration of the client SDK ' +
'is no longer supported.'
);
}

Comment on lines +1590 to +1592
beforeEach(() => {
warnStub = sinon.stub(console, 'warn');
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Reset the static deprecationWarned property on RemoteConfigFetchResponse before each test to ensure that tests are completely isolated and independent of execution order.

Suggested change
beforeEach(() => {
warnStub = sinon.stub(console, 'warn');
});
beforeEach(() => {
warnStub = sinon.stub(console, 'warn');
(RemoteConfigFetchResponse as any).deprecationWarned = false;
});

This branch has not been deployed

No deployments
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.

1 participant