Repository navigation
feat(flags): support known-absent property keys in local evaluation - #1280
marandaneto wants to merge 35 commits into
Conversation
SDK performance: posthog-python43 changes worth reviewing: 43 observed regressions. 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.
Showing the 12 largest flagged changes; 31 more are in all results. 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 |
dustinbyrne
left a comment
There was a problem hiding this comment.
Overall the additive keyword-only API, bounded iterator validation, sentinel isolation, and compliance adapter wiring look solid. Left three inline items to address before approval (one Breaking omitted-condition-value bug on negated operators, plus two Concern gaps around eager condition-value validation on known-absent keys and type: "person_metadata" dynamic cohort filters) and one small Suggestion on Mapping/bytearray validation.
Notes on existing comments & follow-ups:
- Suggestion (benchmark allocation delta — addressing the SDK performance report): A base-vs-head
tracemalloccheck confirms zero memory leak (net_delta=416Bon both base and head). The ~+0.88 KiB/op short-lived allocation increase on the default(None, None)path comes from unconditionally calling_validate_known_absent_keys(None, None), allocatinggroup_properties or {}inClient._properties_for_local_evaluation(posthog/client.py:6268-6283), and calling_mark_known_absent_properties. Remote/fallback calls also re-run_validate_known_absent_keysa second time inside_get_flags_decision(posthog/client.py:2341-2343). Consider short-circuiting when both known-absent arguments areNoneon the local-eval hot path and accepting pre-validated lists/dicts in internal_get_flags_decision(matchingAsyncClient._get_flags_decision). - Follow-up (
PostHog/posthog.com): Once this ships,contents/docs/feature-flags/local-evaluation/index.mdx(lines 365–367, which currently stateis_not_setand early-access enrollment cannot be evaluated locally) andcontents/docs/integrate/feature-flags-code/_snippets/feature-flags-code-api.mdxwill need a follow-up docs update.
AI-assisted review.
…nt-property-keys # Conflicts: # .github/workflows/sdk-compliance.yml
dustinbyrne
left a comment
There was a problem hiding this comment.
Thanks for addressing all four prior threads across b142a176..98124ab5 — omitted/None condition values, skipping condition-value validation on known-absent keys, person_metadata isolation from known-absent listings, duplicate-key marking, and Mapping/bytearray input checks all look good now.
The filter-type scoping change in b6c0dd3b introduced two issues on group_property_keys_known_absent to address before approval (left inline): one Breaking cold-start lazy-load / snapshot-tearing bug in Client._properties_for_local_evaluation, and one Concern where legacy type: "group" / $group_key filters omitting group_type_index diverge from Rust /flags.
Notes on existing comments & follow-ups:
- Suggestion (hot-path overhead — updating the prior note on the SDK performance report): Comparing
46a88b5c→98124ab5still shows zero memory leak (tracemallocnet delta ~1.5 KiB on head vs ~1.6 KiB on base), while the CI benchmark now flags 14 regressions (+5.9–6.7% short-lived allocated memory/op onflags-single, +5.2–5.4% CPU/time onEvaluate a flag (no match)andEvaluate all 10 flags). Alongside short-circuiting(None, None)before_validate_known_absent_keys/_mark_known_absent_propertiesand avoiding re-validation in internal_get_flags_decision, consider inlining_supplied_valuein_match_property_value(posthog/feature_flags.py:1629) with a singletype(override_value) is _KnownAbsentcheck so the non-known-absent hot loop pays neither an extra function call nor a secondisinstancecheck per property. - Follow-up (
PostHog/posthog.com): Post-release docs updates noted in the prior review remain unchanged.
AI-assisted review.
Build the local evaluation property maps after definitions load, from the same snapshot that evaluates the flags, so a cold-start client marks group keys with their group type index.
Store the known-absent listing digest with the cached result under the plain flag key instead of a per-listing key. A different listing gets no fallback and a new listing replaces the old entry, so distinct listings no longer grow the cache. Redis entries without a digest read as unlisted.
…mespace Released SDKs up to 7.37.0 serve any Redis entry under the plain flag key and ignore the listing digest. Store listed results in a sibling Redis namespace those versions never read, with one listed slot per user and flag. The memory cache keeps the listed slot apart too, so a listed write never evicts the unlisted fallback.
A group flag without a usable group key no longer resolves false before its conditions run. Each condition uses its own aggregation, an explicit null meaning the person, so person conditions of a group flag still run, directly and as a dependency, and read person properties and the person bucketing value. A group flag with a holdout above 0% and no usable group key is now inconclusive with reason missing_context instead of false, since the flags service hashes an empty key for the holdout.
…ests Main #1288 (sdk-specs#251) sends a person_metadata filter to /flags instead of matching it against a supplied created_at, even when created_at is listed. The test that expected a person_metadata filter to read the supplied value is deleted; test_listed_key_does_not_resolve_a_person_metadata_filter already asserts the new behavior. The duplicate person key test used a person_metadata filter to read the value outside the listing's scope. No supported filter reads a person listing outside its scope now, so it checks that a duplicated person key still reads as absent. The group duplicate test keeps covering the out-of-scope read.
The listed namespace replaced the prefix's last character, so prefixes project-1 and project-2 both became project-_known_absent: and two apps sharing Redis could read each other's listed entries. The listed namespace now holds the full prefix behind a leading character that differs from the prefix's first one, so it still never extends the unlisted namespace. Unlisted keys are unchanged.
A filter without a type, or with a null or empty type, is a person filter (sdk-specs#251, and the flags service defaults the type to person). The person listing only applied to filters typed "person", so an untyped filter on a listed key read the supplied value. Condition filters and cohort leaves both go through the same check. Group, cohort and flag filters are unchanged.
…oups A direct match_feature_flag_properties call that passes no groups matches the flag-level group's conditions against the passed properties and bucketing value, as on main. Client paths still pass an explicit groups mapping and skip group conditions without a usable key.
ioannisj
left a comment
There was a problem hiding this comment.
🤖 An AI agent wrote this on behalf of @ioannisj.
Nothing blocking from me. The one thing worth settling is whether a bad known-absent list should drop the whole capture event. The rest are smaller: a person filter, or a filter for another group type, inside a group condition still reads the condition's group where go, js and rs don't, a docstring promises no /flags fallback in cases that still fall back, and a direct matcher call stops matching when group_type_mapping is left out.
| return properties, bucketing_value | ||
|
|
||
| group_name = group_type_mapping.get(str(condition_aggregation)) | ||
| if not group_name or not _is_usable_group_key((groups or {}).get(group_name)): |
There was a problem hiding this comment.
🤖 An AI agent wrote this on behalf of @ioannisj.
A direct match_feature_flag_properties call that passes groups but no group_type_mapping now returns False for a condition on the flag's own group. The mapping lookup comes back empty, so the condition is skipped. On main that call matched, because a condition on the flag's own aggregation never read the mapping:
match_feature_flag_properties(flag, "acme", {"plan": "pro"}, bucketing_value="acme",
groups={"company": "acme"}, group_properties={"company": {"plan": "pro"}})
# main: True, this PR: FalseThe client always passes the mapping, so only direct callers of this public helper hit it. Could the groups is None shortcut above also cover a missing mapping when the condition is on the flag's own aggregation? groups={} would still skip.
| "group_properties": send_feature_flags.get("group_properties"), | ||
| "flag_keys_filter": send_feature_flags.get("flag_keys_filter"), | ||
| } | ||
| # Validate here so invalid keys fail the whole capture call instead of |
There was a problem hiding this comment.
🤖 An AI agent wrote this on behalf of @ioannisj.
[question] Is dropping the whole event the intended contract here? With an over-limit or wrongly typed list, capture returns None and nothing is enqueued, so a bad known-absent list loses the event itself, not just the $feature/* enrichment. On main the same call still sends the event.
If it's deliberate, I'd mention it in .sampo/changesets/known-absent-property-keys.md, since that's the one path where the list costs analytics data. If not, validating inside the enrichment try in _capture and sending the event without flag properties would keep it. Which one did you have in mind?
| person_property_keys_known_absent: Person property keys the caller knows are | ||
| absent for this person. Local evaluation treats a listed key as absent, | ||
| even when ``person_properties`` supplies a value for it: ``is_not_set`` | ||
| and the negated operators match, and every other operator does not, with |
There was a problem hiding this comment.
🤖 An AI agent wrote this on behalf of @ioannisj.
[suggestion] "every other operator does not, with no remote fallback" is a bit stronger than what the matcher does. An unknown operator, or an omitted or null condition value on a listed key, still raises inconclusive and falls back to /flags (posthog/feature_flags.py:1835).
Maybe something like "for supported operators with a condition value; an unknown operator or an omitted or null value still falls back to /flags"? The same sentence is in posthog/__init__.py:1290 too.
| _evaluation_context=_evaluation_context, | ||
| ) | ||
| _assert_property_filter_type_supported(prop) | ||
| return match_property(prop, properties, property_matching_version) |
There was a problem hiding this comment.
[suggestion] A type: "person" filter in a group-aggregated condition is matched against the group's properties here, so it never sees the person properties or the person known-absent listing.
posthog-go routes that filter to the person properties in featureflags.go#L2191 (PostHog/posthog-go#461), and posthog-js does the same in feature-flags.ts#L847 (PostHog/posthog-js#5819), which is also what the spec's filter-type table says. Ruby (PostHog/posthog-ruby#369) and php (PostHog/posthog-php#328) have the same gap.
Worth reading a person filter in a group condition from the person properties and listing here too?
| filter_group_type_index = prop.get("group_type_index") | ||
| if filter_group_type_index is None: | ||
| return True | ||
| return self.group_type_index is not None and self.group_type_index == str( |
There was a problem hiding this comment.
[suggestion] When a group filter's own group_type_index names another group type, applies_to only withholds the listing, and the filter still reads the condition's group properties, so the other group type's properties and listing are never used.
posthog-rs reads that group type's properties and listing in feature_flags.rs#L1247 (PostHog/posthog-rs#388), and go and dotnet do the same. Ruby (PostHog/posthog-ruby#369), php (PostHog/posthog-php#328) and js (PostHog/posthog-js#5819) still read the condition's group.
Would it be worth routing that filter to its own group type's properties and known-absent keys?
💡 Motivation and Context
Closes the Python part of PostHog/posthog#88947.
Local flag evaluation can't tell a missing property apart from one the caller didn't pass. If a key is left out of
person_properties, the condition that reads it is inconclusive and the SDK asks/flags. Callers had no way to say "this person definitely doesn't haveplan". So a flag withplan is_not_setcould never resolve locally. The local result and the/flagsresult could also disagree.The flags service now accepts known-absent keys (PostHog/posthog#138239). This PR adds the same input to the SDK, following the cross-SDK spec in PostHog/sdk-specs#233.
New input
Two optional keyword arguments:
person_property_keys_known_absent: a collection of person property keys.group_property_keys_known_absent: a mapping from group type to a collection of group property keys.They are accepted by
evaluate_flags,get_feature_flag,get_feature_flag_result,feature_enabled,get_feature_flag_payload,get_all_flags,get_all_flags_and_payloads,get_feature_variants,get_feature_payloads,get_feature_flags_and_payloads,get_flags_decision, and the module-level wrappers. They also work incapture(send_feature_flags={...})and inAsyncClient.evaluate_flags. Existing signatures don't change.Local evaluation
distinct_idand$group_key.is_not_set,is_not,not_icontains,not_starts_with,not_ends_withandnot_regexmatch. Every other supported operator does not match. That includesis_set,exact,gt, allsemver_*operators and the date operators. The result is final, with no/flagsrequest./flagseven when the key is listed.test_cohort_leaf_unsupported_operator_falls_back_before_known_absencecovers a cohort leafplan not_between [1, 2]with and withoutnegation./flags, per docs(flags): resolve known-absent keys without reading the condition value sdk-specs#239.is_setandis_not_setkeep their known-absent result whatever the value is.__posthog_person_metadata__are ignored.personfilters and to filters with an omitted, null or empty type, group keys only apply togroupfilters of their own group type, andperson_metadatafilters (such as acreated_atcohort leaf) never resolve from a listing and fall back to/flags(main fix(flags): don't match person_metadata filters against person properties #1288, docs(flags): treat unsupported property-filter types as inconclusive sdk-specs#251). A group filter withoutgroup_type_indexreads the condition's group type.negation. Flag dependencies are evaluated in their own context with the same listed keys (see below).$feature_enrollment/<flag key>means the person is not enrolled. Evaluation then continues to holdouts and release conditions instead of returning early or falling back. Python is the only SDK with local enrollment handling.Flag dependencies and group filters without an index
Per PostHog/sdk-specs#250, a flag dependency is now evaluated in its own context: the referenced flag is evaluated as if it were evaluated directly with the same distinct id, groups, person and group properties, known-absent keys and device id, using its own aggregation, properties and bucketing value, and a dependency's conditions aggregated on a group that isn't supplied are skipped, so a group dependency with only such conditions resolves as
false. Atype: "group"filter withoutgroup_type_indexnow reads the condition's group type, including its known-absent keys, as the flags service does. This also fixes local results without known-absent keys: before, a person flag that depended on a group flag evaluated the group flag with the person's properties and distinct id, so it could differ from/flags, and a group dependency without its group fell back to/flags.Per PostHog/sdk-specs#250 a usable group key is a non-empty string or a number. An empty-string,
None, boolean, list or dict group key counts as no group key: conditions aggregated on that group type are skipped locally with no/flagsrequest (also as a dependency), so a flag with only such conditions resolves asfalse. Before, an empty string was used as the bucketing key and the other kinds fell back to/flags.Per the amended PostHog/sdk-specs#250 (matching the flags service), a group flag without a usable group key now skips only its group conditions, so a condition with
aggregation_group_type_index: nullstill runs on the person's properties and distinct id, directly and as a dependency; a group flag with a holdout above 0% and no usable key is inconclusive (missing_context) and falls back to/flags. Tested withTestGroupConditionsWithoutGroupKeyandTestGroupFlagHoldoutWithoutGroupKey(13 red before the fix, plus a person-bucketing test red on the old code), full pytest 8670 passed with the 3 known fork failures, ruff, mypy baseline andmake public_api_checkpassed./flagsrequest bodyWhen the SDK calls
/flagsand the caller listed keys, the body includesperson_property_keys_known_absent: [...]andgroup_property_keys_known_absent: {"<group type>": [...]}. This happens for local fallback, forced remote calls, and remote-only calls. A field is left out when it wasn't provided or is empty.Limits
Each list holds at most 1000 keys. Duplicates count. For groups the limit applies per group type. A longer list raises
ValueErrorfrom the flag getters. Nothing is evaluated and no request is sent. The SDK never truncates the list. Wrong types raiseTypeError, for example a plain string or a non-string group type. Abytearrayor a mapping (such as a property dict passed by mistake) also raisesTypeError, while a dict's.keys()view is accepted. Withcapture(send_feature_flags={...}), the error is handled like othercaptureerrors.capturelogs it and returnsNone, and no event is sent. Withdebug=Trueit raises.Compliance adapter
The adapter now declares
feature_flags_known_absent_v1./get_feature_flagpasses both new params to the SDK unchanged. It also acceptsallow_remote_fallback: true, which calls the default getter on the client with local definitions. That mode returns HTTP 400 when combined withforce_remote: trueoronly_evaluate_locally: true.Not included
icontains_multi,not_icontains_multi,betweenandnot_betweenoperators. The SDK doesn't support them yet, so a listed key with these operators still falls back to/flags. Tracked in Support icontains_multi and between operators in SDK local flag evaluation posthog#138581.Links
💚 How did you test it?
New tests in
posthog/test/test_feature_flags_known_absent.py:distinct_id, and$group_key./flags.negation, and a flag dependency./flagsbody including the fields on fallback and on every remote entry point, includingcapture(send_feature_flags=...)and asyncevaluate_flags. The fields are left out when not provided or empty.capturepath with default and debug settings, and wrong types./flagsbody.sdk_compliance_adapter/test_adapter.pycovers the new adapter params andallow_remote_fallback.Commands run locally with
uv run --no-syncon macOS:ruff format --check .passed.ruff check .passed.mypy --no-site-packages --config-file mypy.ini . | mypy-baseline filterpassed.make public_api_checkpassed. The snapshot is updated in this PR.python -W error -c "import posthog"passed.pytest sdk_compliance_adapter/test_adapter.pypassed.pytest --timeout=30gave 8397 passed and 3 failed. The 3 failures are fork tests inposthog/test/test_metrics_autocapture.py. They also fail on unchangedmainon macOS.After the spec revision I added the cohort-leaf test. It passed with no production change. I re-ran
ruff format --check .,ruff check ., mypy with the baseline filter,make public_api_checkandpython -W error -c "import posthog", and all passed.pytest --timeout=30gave 8399 passed and the same 3 fork test failures inposthog/test/test_metrics_autocapture.py.For PostHog/sdk-specs#239 I added
test_listed_key_with_omitted_or_null_value_stays_inconclusive(is_notwith the value omitted, andis_not,exactandgtwith"value": null) andtest_listed_key_with_null_value_resolves_presence_operator(is_not_setandis_setwith"value": null). Before the fix, theis_notomitted,is_notnull andexactnull cases failed because the known-absent table resolved them.gtnull already fell back. After the fix all 6 cases pass. In local-only mode the flag is unresolved withunsupported_definition, which matches an omitted condition value on a present key, and the default getter falls back to/flags.ruff format --check .,ruff check ., mypy with the baseline filter,make public_api_checkandpython -W error -c "import posthog"passed.pytest posthog/testgave 8467 passed and the same 3 fork test failures inposthog/test/test_metrics_autocapture.py.For filter type scoping (b6c0dd3) I added 19 cases:
test_listed_key_does_not_resolve_a_person_metadata_filter,test_person_metadata_filter_on_listed_key_reads_the_supplied_value,test_listed_key_does_not_resolve_a_person_metadata_cohort_leaf,test_person_keys_do_not_resolve_a_group_filter_in_a_person_flag,test_group_keys_do_not_resolve_a_person_filter_in_a_group_flag,test_group_keys_do_not_resolve_a_person_cohort_leaf_in_a_group_flag,test_group_keys_do_not_resolve_a_filter_for_another_group_typeandtest_flag_dependency_does_not_read_keys_of_another_aggregation. All 19 failed before the fix, and the file gave 110 passed after it. For the input check (da10384) thebytearray, person dict, empty person dict and group dict cases oftest_wrong_type_raises_without_a_requestfailed before the fix, and the file gave 117 passed after it. For repeated keys (98124ab)test_duplicate_person_key_still_reads_the_supplied_value_outside_its_scopeandtest_duplicate_group_key_still_reads_the_supplied_value_outside_its_scopefailed before the fix because a repeated key wrapped its own marker, and the file gave 119 passed after it.ruff format --check,ruff checkand mypy with the baseline filter passed.For PostHog/sdk-specs#250 I added these tests to
posthog/test/test_feature_flags_known_absent.py. Each failed before its fix and passes after it:test_group_filter_without_index_reads_the_condition_group_type(exact"enterprise"givesfalseandis_not_setgivestruewith a suppliedtier="enterprise"listed for organization, plus a null index and$group_key is_set) andtest_group_filter_without_index_reads_the_condition_level_group_type(mixed targeting). Before ddc25fa they read the supplied value.test_group_filter_without_index_ignores_keys_of_another_group_typealready passed and stays as a regression test.test_dependency_is_evaluated_with_its_own_aggregation(personregion=us, organizationregion=eu: parent and child bothfalse, no request). Before 6f71109 the child wastrue.test_group_dependency_without_its_group_resolves_as_false(no organization group,tierlisted for organization: parent and child bothfalse, no request). Before 6f71109 the child fell back to/flags.test_group_dependency_is_bucketed_by_the_group_key(50% rollout:org-0out andorg-1in, matching direct evaluation). Before 6f71109 the dependency hashed the distinct id.test_person_dependency_of_a_group_flag_reads_person_context(organization child with a person parent reads person properties and hashes the distinct id). Before 6f71109 it read the organization properties.test_property_matching_version.pyandtest_redis_flag_cache_snapshot.pynow patchposthog.feature_flags.match_feature_flag_properties, because the client delegates to the shared_compute_flag_locally.ruff format --check .,ruff check ., mypy with the baseline filter andmake public_api_checkpassed, andpytest posthog/testpassed apart from the same fork tests inposthog/test/test_metrics_autocapture.py.For cold-start group known-absent keys (7bd5a4b) I added
TestKnownAbsentColdStarttoposthog/test/test_feature_flags_known_absent.py. It uses a fresh client that never calledload_feature_flags(), liststierand$group_keyfor organization, suppliestier="gold"and allows no/flagscall. Its three tests,test_evaluate_flags_marks_group_keys_after_lazy_load,test_get_feature_flag_marks_group_keys_after_lazy_loadandtest_get_all_flags_marks_group_keys_after_lazy_load, failed before the fix because the keys were marked before the definitions loaded, so they carried no group type index (org-tier-flagwasfalseandorg-key-flagwastrue). All three pass now.ruff check,ruff format --check, mypy with the baseline filter andmake public_api_checkpassed.pytest posthog/testgave 8555 passed and the same 3 fork test failures inposthog/test/test_metrics_autocapture.py.For group cohort leaves without an index (a2e6e9e) I added
test_group_cohort_leaf_reads_the_condition_group_type(organization flag, cohort leaftier exact "enterprise"with the index omitted, null or 0,tier="enterprise"supplied and listed for organization:false, no request) andtest_group_cohort_leaf_with_another_index_ignores_the_condition_keys(leaf with index 1 reads the supplied value:true). The omitted and null cases failed before the fix because the supplied value won. A group filter without an index now reads the condition's listing everywhere, so_with_condition_group_typeis removed.ruff, mypy with the baseline filter andmake public_api_checkpassed,pytestgave 8559 passed and the same 3 fork test failures, and CI passed.For the outage fallback cache (52dd053, d96892d) I added
TestKnownAbsentFallbackCache: results are cached under the flag key plus a digest of the sorted, deduplicated person and group listings, so a result cached for one listing is not served to a call with a different listing during a/flagsoutage, and a stale result is only served for the flag it belongs to. The flags service has no such cache, so there is nothing to mirror there. The person, group and unlisted-to-listed cases and the literal-key case failed before the fix.ruff, mypy with the baseline filter andmake public_api_checkpassed, andpytestgave 8564 passed and the same 3 fork test failures.The fallback cache now keeps at most one unlisted and one listed entry per user and flag (0f352e5, 1d0b21d). The listed entry stores the listing digest and lives in a separate Redis namespace (
_posthog:flags:known_absent:for the default prefix; the full configured prefix behind a different first character), so SDKs up to 7.37.0, which ignore the digest, never read it. Testing: 2000 distinct listings left 2000 entries before and 2 after, and posthog==7.37.0 gets a cache miss on a new listed write;pytestgave 8625 passed and the same 3 fork test failures.For unusable group keys (2705b8c) I added
TestUnusableGroupKeystoposthog/test/test_feature_flags.py, parameterized over"",None,True,False,[]and{}: direct group flag, mixed flag, group dependency,_compute_flag_locally,get_all_flags,evaluate_flagsandcapture(send_feature_flags=...). All 30 cases failed before the fix and pass after it; string, integer and float keys still evaluate and bucket as before, and a usable key without the needed group properties still falls back.ruff, mypy with the baseline filter andmake public_api_checkpassed, andpytestgave 8595 passed and the same 3 fork test failures.CI now runs SDK test harness 1.34.0. The
feature_flags_known_absentsuite ran and passed 12/12 in each compliance job (gzip, deflate and zstd).Round 7 changes
project-1andproject-2no longer share listed entries (8f684cc, f510866).match_feature_flag_propertiescall withoutgroupsmatches a group flag's conditions against the passed properties again, as on main, while an explicitgroups={}skips them (9e6146b); tested withTestDirectGroupFlagMatchWithoutGroups, red then green, pytest 8716 passed with the 3 known macOS fork failures.make public_api_checkpassed; pytest 8712 passed with the 3 known macOS fork failures.📝 Checklist
If releasing new changes
sampo addto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written with Pi (Claude) and reviewed with the autoreview skill (GPT model, branch mode). Review found three real problems, which are fixed in separate commits. Validation consumed one-shot iterators before the
/flagscall. Unbounded iterables were read fully before the limit check. Non-string group types andNonegroup lists were accepted. A fourth review run was clean.capturekeeps its existing error handling for invalid known-absent keys instead of raising. This matches how it already treats an invalidsend_feature_flagsvalue.