Skip to content

zookeeper_proxy: migrate config validation to exception free#46239

Merged
yanavlasov merged 1 commit into
envoyproxy:mainfrom
davidvo-lyft:davidvo/27412-zookeeper-exception-free
Jul 17, 2026
Merged

zookeeper_proxy: migrate config validation to exception free#46239
yanavlasov merged 1 commit into
envoyproxy:mainfrom
davidvo-lyft:davidvo/27412-zookeeper-exception-free

Conversation

@davidvo-lyft

Copy link
Copy Markdown
Contributor

The zookeeper_proxy network filter was one of the few remaining network filters whose config factory still threw EnvoyException instead of returning absl::StatusOr, which kept its whole directory on the tools/code_format/config.yaml exception allowlist and outside the no-throw check. This change switches ZooKeeperConfigFactory from Common::FactoryBase to Common::ExceptionFreeFactoryBase so createFilterFactoryFromProtoTyped returns absl::StatusOr<Network::FilterFactoryCb>, converts the two config-time throws (the duplicated-opcode check and the unknown-opcode lookup) to absl::InvalidArgumentError with byte-identical message text, and removes the zookeeper_proxy entry from the exception allowlist so check_format now enforces no-throw for the entire directory. The ZooKeeper filter's data plane was already made exception free in #31485; these two config-time throws were all that remained, so this finishes zookeeper_proxy specifically. It continues the exception-free migration tracked in #27412, following the same pattern as recently merged network-filter (#46111) and HTTP-filter (#46042) work.

Commit Message: zookeeper_proxy: migrate config validation to exception free

Additional Description: parseLatencyThresholdOverrides becomes a public static helper returning absl::StatusOr<LatencyThresholdOverrideMap>; the factory parses before constructing ZooKeeperFilterConfig, whose constructor now takes the parsed map and can no longer fail.

Risk Level: Low. Config-load-time only refactor with no data plane change; error messages and failure semantics are unchanged (EnvoyException becomes absl::InvalidArgumentError with identical text, surfaced through the same config rejection path).

Testing:

  • //test/extensions/filters/network/zookeeper_proxy:config_test and :filter_test pass in the CI clang docker image. The duplicated-opcode case was converted from EXPECT_THROW_WITH_REGEX to a status matcher with the identical message substring; a new UnknownOpcodeInLatencyThresholdOverrides test calls the now-public static helper directly with an out-of-range opcode and asserts InvalidArgumentError with the identical text, covering the error branch so per-directory coverage does not regress. filter_test's existing tests run unchanged through the updated initialize() helper.
  • Countable metric: throw sites in the directory go from 2 to 0 (grep -rE 'throw|THROW'), and the allowlist entry is removed. Mutation proof: with the allowlist entry removed, injecting a throw into filter.cc makes check_format fail with "Don't introduce throws into exception-free files"; at the parent commit the same injected throw passes, confirming the directory is now enforced.

Docs Changes: N/A

Release Notes: N/A (internal refactor, no behavior change; matches the no-changelog precedent of #46111 and #46042)

Platform Specific Features: N/A

Part of #27412

Generative AI disclosure: Developed with AI assistance (Claude Code); I reviewed and understand every line and take full ownership of the submission.

Migrate the zookeeper_proxy network filter config factory from the throwing Common::FactoryBase to Common::ExceptionFreeFactoryBase, so config validation returns absl::StatusOr instead of throwing. The duplicated opcode and unknown opcode throws become absl::InvalidArgumentError with identical message text, and parseLatencyThresholdOverrides becomes a static helper whose parsed map is passed to the ZooKeeperFilterConfig constructor. The data plane was already exception free (envoyproxy#31485), so this finishes the filter and the directory entry is removed from the tools/code_format/config.yaml exception allowlist, locking the whole directory throw free via check_format. No behavior change. Part of envoyproxy#27412.

Signed-off-by: David Vo <davidvo@lyft.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@yanavlasov
yanavlasov merged commit b3c44cc into envoyproxy:main Jul 17, 2026
27 of 28 checks passed
@davidvo-lyft

Copy link
Copy Markdown
Contributor Author

/retest

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