Skip to content

Commit 4902bc1

Browse files
committed
docs(flags): refresh capability migration TODOs
1 parent 54519d2 commit 4902bc1

3 files changed

Lines changed: 27 additions & 20 deletions

File tree

packages/core/src/flags/configuration/__tests__/rules.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,10 @@ describe('rules configuration', () => {
200200

201201
// TODO(FFL-2837): Replace this legacy JSON compatibility test with a
202202
// generated protobuf fixture after a flagging-core release contains
203-
// DataDog/openfeature-js-client#344 through `41dff20`. Round-trip the
203+
// DataDog/openfeature-js-client#344 through `9f794c7`. Round-trip the
204204
// generated fixture and confirm that serialization preserves the unknown field.
205+
// Add a fixture with an unsupported minimum feature level and require a
206+
// flag-scoped `PARSE_ERROR`, not `FLAG_NOT_FOUND`.
205207
it('keeps supported known data when an unknown field is present', () => {
206208
const source = buildRulesConfiguration();
207209
(source.flags['dynamic-flag'] as typeof source.flags['dynamic-flag'] & {
@@ -228,7 +230,7 @@ describe('rules configuration', () => {
228230

229231
// TODO(FFL-2837): Replace this unsafe JSON number with an out-of-range
230232
// protobuf `int64` fixture after flagging-core contains PR #344 at or after
231-
// `41dff20` plus the no-`BigInt` follow-up. The generated parser must preserve
233+
// `9f794c7` plus the no-`BigInt` follow-up. The generated parser must preserve
232234
// the source value as `bigint` where supported. Run the same evaluation with
233235
// global `BigInt` unavailable and require `PARSE_ERROR`, not `GENERAL`.
234236
it('returns PARSE_ERROR instead of serving an unsafe integer', () => {

packages/core/src/flags/configuration/rules.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type { EvaluationContext, JsonValue, PrimitiveValue } from '../types';
1414

1515
// TODO(FFL-2837): Replace this legacy UFC v1 alias with
1616
// `NonNullable<FlagsConfiguration['rules']>['response']` after a flagging-core
17-
// release contains DataDog/openfeature-js-client#344 through `41dff20`, restores
17+
// release contains DataDog/openfeature-js-client#344 through `9f794c7`, restores
1818
// 32-byte SHA digest validation, and defines or fixes integer evaluation without
1919
// global `BigInt`. Keep the `FlagsConfiguration` type import on the flagging-core
2020
// package root. PR #344 preserves protobuf integers as `bigint`, and its evaluator
@@ -130,7 +130,7 @@ const hasOwn = (value: object, key: PropertyKey): boolean =>
130130
Object.prototype.hasOwnProperty.call(value, key);
131131

132132
// TODO(FFL-2837): Delete this compatibility error store after a flagging-core
133-
// release contains DataDog/openfeature-js-client#344 through `41dff20` and fixes
133+
// release contains DataDog/openfeature-js-client#344 through `9f794c7` and fixes
134134
// or explicitly excludes integer and shard evaluation without global `BigInt`.
135135
// The generated protobuf evaluator validates the requested flag and the data
136136
// that evaluation reaches. It does not build this error map during parsing.
@@ -210,7 +210,7 @@ const validateCondition = (value: unknown): string | undefined => {
210210
try {
211211
// TODO(FFL-2837): Define a bounded regular expression policy before
212212
// dynamic offline rules leave draft state. Upstream PR #344 through
213-
// `41dff20` compiles protobuf regular expressions lazily and caches
213+
// `9f794c7` compiles protobuf regular expressions lazily and caches
214214
// them by configuration and index, but it does not limit patterns.
215215
RegExp(value.value); // dd-iac-scan ignore-line
216216
} catch {
@@ -465,7 +465,7 @@ export const prepareRulesConfiguration = (
465465
const clone = cloneValue(value);
466466

467467
// TODO(FFL-2837): Delete this legacy JSON clone and validator after a
468-
// flagging-core release contains upstream PR #344 through `41dff20` and the
468+
// flagging-core release contains upstream PR #344 through `9f794c7` and the
469469
// no-`BigInt` integer contract is fixed or declared unsupported. That
470470
// implementation preserves protobuf integers as `bigint` and validates only
471471
// the requested flag data that evaluation reaches. With `BigInt`, it returns a
@@ -521,7 +521,7 @@ const normalizeVariationType = (
521521

522522
// TODO(FFL-2837): Delete this legacy UFC v1 metadata fallback after the
523523
// flagging-core dependency contains DataDog/openfeature-js-client#344 through
524-
// `41dff20`. The protobuf evaluator maps only safely represented integer
524+
// `9f794c7`. The protobuf evaluator maps only safely represented integer
525525
// variations, and all numeric variations, to the OpenFeature type `number`.
526526
const recoverVariationType = (
527527
configuration: RulesConfigurationResponse,
@@ -548,7 +548,7 @@ export const flaggingCoreRulesEngine: RulesEngine = {
548548

549549
// TODO(FFL-2837): Delete this local compatibility guard after the
550550
// flagging-core dependency contains DataDog/openfeature-js-client#344
551-
// through `41dff20`. Keep the reserved-name contract tests.
551+
// through `9f794c7`. Keep the reserved-name contract tests.
552552
if (!hasOwn(flags, request.flagKey)) {
553553
return {
554554
value: request.defaultValue,
@@ -559,9 +559,10 @@ export const flaggingCoreRulesEngine: RulesEngine = {
559559
}
560560

561561
// TODO(FFL-2837): Delete this compatibility check with the local error
562-
// store after the published PR #344 evaluator through `41dff20` validates
563-
// reached flag data and reports deterministic errors, including unsafe
564-
// integer conversions with and without global `BigInt` when supported.
562+
// store after the published PR #344 evaluator through `9f794c7` validates
563+
// reached flag data and reports deterministic flag-scoped errors, including
564+
// unsupported feature levels and unsafe integer conversions with and
565+
// without global `BigInt` when supported.
565566
const configurationError = errorsByConfiguration
566567
.get(request.configuration)
567568
?.get(request.flagKey);

packages/core/src/flags/configuration/wire.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,19 @@ import type {
2323

2424
// TODO(FFL-2837): Delete the pending `rulesBased` types, reader, and wrappers
2525
// after a flagging-core release contains DataDog/openfeature-js-client#344
26-
// through `41dff20` plus the required SHA digest and no-`BigInt` follow-ups.
26+
// through `9f794c7` plus the required SHA digest and no-`BigInt` follow-ups.
2727
// Import and re-export the wire functions and `FlagsConfigurationWire` type from
2828
// `@datadog/flagging-core/configuration`. Keep `FlagsConfiguration` and the rules
29-
// evaluator on the package root. Use `FlagsConfiguration.rules`. The distribution
30-
// layer must put one base64 encoding of the raw dd-source#34959 protobuf response
31-
// in the version 1 `rules.response` field. Do not add that service transport or
32-
// envelope construction here. PR #344 preserves decoded protobuf flags and
33-
// protobuf integers. Its evaluator reports invalid reached data and unsafe
34-
// integer conversion as deterministic `PARSE_ERROR` results.
29+
// evaluator on the package root. The new `@datadog/flagging-core/precomputed`
30+
// subpath is protobuf-free, ignores rules, and is not the parser for this module.
31+
// Use `FlagsConfiguration.rules`. The distribution layer must put one base64
32+
// encoding of the raw dd-source#34959 protobuf response in the version 1
33+
// `rules.response` field. Record dd-source#40304 commit `071c4ad` as the schema
34+
// revision and dd-source#34959 as the service producer path. Do not add that
35+
// service transport or envelope construction here. PR #344 preserves decoded
36+
// protobuf flags and integers. Its evaluator reports invalid reached data,
37+
// unsupported feature levels, and unsafe integer conversion as deterministic
38+
// flag-scoped `PARSE_ERROR` results.
3539
type PendingRulesConfiguration = FlagsConfiguration & {
3640
rulesBased?: {
3741
response: UniversalFlagConfigurationV1;
@@ -83,7 +87,7 @@ export const configurationFromString = (source: string): FlagsConfiguration => {
8387
// validator that PR #344 removed in favor of the Protobuf-ES decoder. The
8488
// published parser must also include PR #344's unknown-field tolerance,
8589
// unknown-field serialization, and lossless integer parsing through
86-
// `41dff20`, plus the final no-`BigInt` runtime decision.
90+
// `9f794c7`, plus the final no-`BigInt` runtime decision.
8791
const pendingRules = readPendingRulesWire(source);
8892
if (pendingRules) {
8993
try {
@@ -108,7 +112,7 @@ export const configurationToString = (
108112
const pendingConfiguration = configuration as PendingRulesConfiguration;
109113

110114
// TODO(FFL-2837): Delete this legacy serialization wrapper with the pending
111-
// types above after the dependency contains PR #344 through `41dff20` and
115+
// types above after the dependency contains PR #344 through `9f794c7` and
112116
// its required follow-ups. The upstream serializer encodes generated protobuf
113117
// rules back to base64 and preserves unknown protobuf fields.
114118
// This temporary UFC v1 shim serializes its legacy JSON response instead.

0 commit comments

Comments
 (0)