Repository navigation
Conversation
Copy the vendored feature flag rules v2 contract files from harness release 1.38.0 (contract 11.0.0). Only the $feature_flag_called context schema changed: $feature_flag_response may now be absent or null, and a config version 2 call may leave it out only when $feature_flag_error lists evaluation_failed. The exposure tests skipped the schema for failed and missing-flag reads, because the old schema required a non-null response. They now validate every $feature_flag_called through the same projection, and a new case checks that the schema still rejects a config version 2 call with no value whose error does not list evaluation_failed.
SDK performance: posthog-python1 change worth reviewing: 1 observed regression. Flags require at least a 5% change in the median and all six pairs agreeing on direction. This is a noise filter, not proof of a performance change or a CI gate.
View all results
Values are medians of paired measurements. Not flagged does not mean unchanged. Unavailable means a measurement could not be provided, not zero. Estimated allocation measurements retain their instrumentation uncertainty. RSS measures the whole process, not just SDK allocations; observed peaks are sampled checkpoints. Paired ranges in the diagnostics describe variability, not confidence intervals. Each shard uses its own runner; compare Before PR against With PR within a row, not across shards. Compared 102 metric rows; 102 rows shown in all results. Omitted or shortened data remain in |
PR overviewNo security issues were found in this pull request. Reviews
|
There was a problem hiding this comment.
Approved.
Contained test and fixture updates with no production behavior changes or open substantive review concerns. The schema is used for test validation, not to alter a public API or runtime data model.
- PostHog Review (Standard) reviewed the current head: no findings.
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| every_file_attested | ✓ | not a bot PR |
| size | ✓ | 0L, 0F substantive, 92L/4F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T0 auto-approve: T0-deterministic (92L, 4F, single-area, test) |
| stamphog 2.9.1 | .stamphog/policy.yml @ eb4b4e4 · reviewed head eb4b4e4 |
💡 Motivation and Context
The
$feature_flag_calledtests skipped the contract schema for failed and missing-flag reads, because the vendored schema required a non-null$feature_flag_response. Contract 11.0.0 (harness 1.38.0, PostHog/posthog-sdk-test-harness#116) allows a read without a value. This PR copies that release and validates those reads too. Test-only, no release.Details
Re-vendor. Every file listed in
posthog/test/fixtures/feature_flag_rules_v2/SOURCE.jsonis copied unchanged from harness tag1.38.0(9637117). Onlyfeature_flag_called_context.schema.jsondiffers from 1.30.0:$feature_flag_responseis no longer required, and it may benull.$feature_flag_erroris declared as a string, so the test projection now keeps it.$feature_flag_errorlistsevaluation_failed.SOURCE.jsonand the digest test now name release 1.38.0, contract 11.0.0.Tests that now validate failed reads (all in
test_experiment_exposure.py):test_reader_cases_...andtest_async_reader_cases_...: the reader casesdependency_error,error,error_with_value,missing_flagandv1_failed.test_flag_called_attribution_follows_the_record:dependency_error,error.test_rule_fields_are_sent_only_for_reasons_that_name_a_rule: the faileddependency_error,error,experiment_splitandholdoutrows.test_async_a_failed_split_sends_no_exposure.test_a_config_version_2_call_reports_its_reason_by_code_only[failed-*].The existing
$feature_flag_errorassertions stay.The new schema does the work. With the 1.30.0 schema swapped back in, these 54 test cases fail with "None is not valid under any of the given schemas". With 1.38.0, all of them pass. A new parametrized test,
test_a_config_version_2_call_without_a_value_must_list_evaluation_failed, takes a real failed read and checks that the schema rejects it when$feature_flag_erroris removed or does not listevaluation_failed, with the response null or absent.The new schema rejected nothing the SDK sends: v2 failed reads, v1 failed reads and missing flags all pass. No SDK source changed.
💚 How did you test it?
pytest posthog/test/test_experiment_exposure.py posthog/test/test_flags_v4_response.py posthog/test/test_failed_flag_records.py --timeout=30pytest --timeout=30,ruff format --check .,ruff check .,mypy --no-site-packages --config-file mypy.ini . | mypy-baseline filter.📝 Checklist
If releasing new changes
sampo addto generate a changeset fileNo changeset: this changes tests and test fixtures only.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written with Claude Code. The vendored files are byte copies from the harness tag, checked against
SOURCE.json's digests. No SDK source changed.🤖 Generated with Claude Code