Skip to content

[FFL-3536] Test standalone Node rules precomputation - #8267

Open
sameerank wants to merge 3 commits into
mainfrom
sameerank/FFL-3536-node-precompute-system-tests
Open

sameerank wants to merge 3 commits into
mainfrom
sameerank/FFL-3536-node-precompute-system-tests

Conversation

@sameerank

@sameerank sameerank commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Extend the standalone rules-helper coverage merged in #8115 with local precomputeConfiguration() coverage for the merged openfeature-js-client #448 (FFL-3536).

Reports to Offline initialization and portable configuration helpers (#562).

Related PRs

PR Coverage Branch relationship
#8267 (this PR) Produce precomputed snapshots locally from rules with precomputeConfiguration() Targets main; independent of the other two PRs
#8604 Consume portable rules/precomputed configurations with DatadogCoreProvider; codecs, lifecycle, updates, and opt-in exposure tracking Targets main; base for #8630
#8630 Fetch precomputed snapshots over HTTP with fetchPrecomputedConfiguration() and consume them with the provider Stacked on #8604; does not depend on #8267

These are complementary slices, not a three-PR stack. #8604 precedes #8630; this PR can merge independently. The other two PRs do not replace this PR's multi-context precomputation, partial-flag-error, and producer-policy coverage.

Changes

  • Add POST /ffe/precompute-configuration and its shared Python client method, reusing the existing fresh-process endpoint handling without initializing a tracer or OpenFeature provider.
  • Accept portable rules wire or a single rules fetch, then precompute several contexts from the same parsed configuration.
  • Cover context-specific assignments with strict boolean checks, false/default-reason and JSON-null values, assignment metadata/features, and successful flags before and after a failed flag with sanitized per-flag diagnostics.
  • Pin the disabled experimentation opt-out default, including when a timestamp is present but no mode is supplied. Cover immediate opt-out, its literal-true acknowledgement, the non-experiment fallback, and invalid timestamps.
  • Verify rules/ETags are not forwarded, and invalid configuration/context/options produce typed, sanitized errors. Cover HTTP fetch failures before precomputation, including status and request counts.
  • Observe Node HTTP diagnostics and ffe:exposure:submit until child-process exit: zero requests/exposures for local precomputation and exactly one request when fetching once for multiple contexts. Queued evaluation telemetry is not directly observed.
  • Include a small protobuf wire fixture with readable JSON source and provenance; no browser dependency or handoff.
  • Bind each standalone route to its helper script, including case/trailing-slash variants, and preserve the original diagnostic when required SDK exports are absent.
  • Group related cases in four tests to share container startup.

Activation And Remaining Work

The new class remains missing_feature in the Node manifest. The adapter imports dd-trace/openfeature/rules-based, so it requires the public tracer wrapper and its bundled SDK implementation, not just an updated standalone Node package. Existing non-Node file-level gates remain unchanged.

An enabled-SDK positive control for this child's exposure observer remains follow-up coverage. Its zero-count assertions alone do not prove that the observer is connected to the SDK's exposure producer.

Before enabling the tests:

  1. Integrate the containing Node/Core releases into dd-trace-js, including the normal and vendored dependency updates and regenerated vendor bundle. Ensure configurationFromString, precomputeConfiguration, and ConfigurationPrecomputeError are exported from dd-trace/openfeature/rules-based.
  2. Repeat the full container-backed parametric validation against the actual packed tracer build and bundled implementation. The rebased tests pass in the host checks below, but those checks use a temporary public-export shim rather than the real tracer wrapper.
  3. Update the class gate and existing file-level version restriction together once the containing tracer release is confirmed. This is a manual activation step: @slow plus missing_feature means no automatic XPASS signal is expected. No release version is assumed here.

For local testing with a containing custom tracer build:

PYTEST_XDIST_AUTO_NUM_WORKERS=1 TEST_LIBRARY=nodejs ./run.sh PARAMETRIC \
  tests/parametric/test_ffe/test_rules_configuration.py::Test_FFE_Rules_Configuration_Precompute \
  -F tests/parametric/test_ffe/test_rules_configuration.py::Test_FFE_Rules_Configuration_Precompute

Local Validation

  • Rebased onto main at a59bae5997634e9fcb05d0b7aa83136f3618321c, preserving the newer selection coverage/client APIs and manifest ordering.
  • All four precompute test groups passed on Node 18.20.8 and 20.20.2, with released Node 2.8.0 / Core 3.5.0. Each run executed 11 fresh child processes against the shared HTTP mock. The same groups passed with locally packed Allow tailing 0 to be a string in WAF output #469 artifacts at d50b38c2e4040946af79ec3d19f6483589a7ce13 on Node 20.
  • Host validation runs the actual Python methods and unchanged child adapter through a temporary dd-trace/openfeature/rules-based export shim. It is not a full container-backed parametric or actual vendored-tracer integration run.
  • Changing the default to immediate opt-out and removing ConfigurationFetchError handling each failed the corresponding regression. Restoring the original adapter made the fetch-failure case pass again.
  • Temporary real-Express checks of the standalone-handler source passed for six canonical/case/trailing-slash routes and verified preload isolation. A VM check with missing SDK exports preserved the original configurationFromString is not a function diagnostic. These checks do not start the full tracer-instrumented parent server.
  • 41 shared rules-mock and parametric-interface documentation checks passed with the Python 3.12.16 runner.
  • Full ./format.sh --check passed on a clean archive with the exact fixes applied, including typing, import policy, Ruff, YAML/manifest validation, fixture checks, ShellCheck, and both Node linters. JavaScript syntax and whitespace checks passed.
  • No live Datadog endpoint or browser SDK used. Fetch logger/diagnostics parity remains outside this change.

Historical Container Validation

The earlier container result below predates this rebase and the fourth precompute test. It is not evidence that the current branch passes against a released tracer:

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

tests/parametric/test_ffe/precompute-rules-wire.json                    @DataDog/feature-flagging-and-experimentation-sdk
tests/parametric/test_ffe/precompute-rules.json                         @DataDog/feature-flagging-and-experimentation-sdk
utils/build/docker/nodejs/parametric/ffe-precompute-configuration.js    @DataDog/system-tests-reviewers
docs/understand/scenarios/parametric.md                                 @DataDog/system-tests-core
docs/understand/weblogs/parametric_weblog.md                            @DataDog/system-tests-core
manifests/nodejs.yml                                                    @DataDog/system-tests-reviewers
tests/ffe/README.md                                                     @DataDog/feature-flagging-and-experimentation-sdk
tests/parametric/test_ffe/test_rules_configuration.py                   @DataDog/feature-flagging-and-experimentation-sdk
utils/build/docker/nodejs/parametric/server.js                          @DataDog/system-tests-reviewers
utils/docker_fixtures/_test_clients/_test_client_parametric.py          @DataDog/system-tests-core

@datadog-datadog-us1-prod

datadog-datadog-us1-prod Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Pipelines  Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: d6458fb | Docs | View more details | Give us feedback!

@sameerank sameerank added crucible: reviewing A Crucible review has started; this PR has reviewer attention. and removed crucible: reviewing A Crucible review has started; this PR has reviewer attention. labels Nov 20, 2026
Observe actual exposure diagnostics through child-process exit and clarify telemetry limits. Add strict boolean checks, continuation after flag errors, and valid experimentation opt-out coverage.
Pin the disabled opt-out default and cover fetch failures, invalid timestamps, and assignment metadata. Preserve HTTP status and original missing-export diagnostics, bind helper scripts to routes, and correct the endpoint documentation.
@sameerank
sameerank force-pushed the sameerank/FFL-3536-node-precompute-system-tests branch from 9ef7c05 to d6458fb Compare November 20, 2026 22:33
@sameerank
sameerank marked this pull request as ready for review November 21, 2026 02:24
@sameerank
sameerank requested review from a team as code owners November 21, 2026 02:24
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T02:26:47.560521Z d6458fb Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d6458fb6b8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


assert "error" not in result, result
assert result["httpRequests"] == 0, result
assert result["exposureEvents"] == 0, result

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add an enabled control for the exposure-event observer

TEST-002: The new precomputation cases only assert that exposureEvents is zero; none exercises an exposure-producing SDK operation through this child's ffe:exposure:submit observer. A disconnected or incompatible diagnostic-channel subscription therefore passes every exposure assertion, leaving accidental exposure submission undetected. Add a paired enabled-SDK evaluation using the same build and capture path, and assert that the observer captures an exposure before relying on these zero counts.

AGENTS.md reference: AGENTS.md:L44-L46

Useful? React with 👍 / 👎.

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.

2 participants