Skip to content

apollo_config,apollo_node_config: make config fields with custom deserializers serialize symmetrically#14630

Draft
nimrod-starkware wants to merge 1 commit into
nimrod/jsonnet/harness-native-configfrom
nimrod/jsonnet/config-serde-symmetric
Draft

apollo_config,apollo_node_config: make config fields with custom deserializers serialize symmetrically#14630
nimrod-starkware wants to merge 1 commit into
nimrod/jsonnet/harness-native-configfrom
nimrod/jsonnet/config-serde-symmetric

Conversation

@nimrod-starkware

Copy link
Copy Markdown
Contributor

Several config-struct fields use #[serde(deserialize_with = ...)] for a string/scalar
wire format (comma-separated lists; Duration as millis/seconds/float-seconds) but derive
a mismatched Serialize (array, or {secs,nanos}), so serde_json::to_value(&config) does not
round-trip them. Add a matching serialize_with to each (~39 fields across 14 crates),
authoring the missing converters in apollo_config. This aligns the derived Serialize with
the wire/jsonnet form the deserializers expect, so the native-config harness and
startup-log presentation round-trip faithfully.

Guarded by two tests: a converter-level round-trip (apollo_config/converters_test) and a
config-level round-trip in apollo_node_config that serializes->deserializes the real
component config structs with non-default values, catching a mispaired or missing
serialize_with. Sensitive fields are intentionally left asymmetric (serialize redacts;
symmetry would leak secrets) and excluded from the config-level guard.

Only the derived Serialize changes; the hand-written SerializeConfig::dump() and the
committed config_schema.json / app_configs are untouched (no up-to-date guard flips).

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

nimrod-starkware commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@nimrod-starkware nimrod-starkware left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

why is it needed again??

@nimrod-starkware made 1 comment.
Reviewable status: 0 of 21 files reviewed, all discussions resolved.

@nimrod-starkware nimrod-starkware force-pushed the nimrod/jsonnet/harness-native-config branch from ad01662 to 81e18a7 Compare June 28, 2026 08:19
@nimrod-starkware nimrod-starkware force-pushed the nimrod/jsonnet/config-serde-symmetric branch from 22984a6 to 407157e Compare June 28, 2026 08:19
@nimrod-starkware nimrod-starkware force-pushed the nimrod/jsonnet/config-serde-symmetric branch from 407157e to 9b677ae Compare June 28, 2026 10:14
@nimrod-starkware nimrod-starkware force-pushed the nimrod/jsonnet/harness-native-config branch from 81e18a7 to 4614c66 Compare June 28, 2026 10:14
@nimrod-starkware nimrod-starkware force-pushed the nimrod/jsonnet/config-serde-symmetric branch from 9b677ae to de0822e Compare June 28, 2026 10:30
…rializers serialize symmetrically

Several config-struct fields use #[serde(deserialize_with = ...)] for a string/scalar
wire format (comma-separated lists; Duration as millis/seconds/float-seconds) but derive
a mismatched Serialize (array, or {secs,nanos}), so serde_json::to_value(&config) does not
round-trip them. Add a matching serialize_with to each (~39 fields across 14 crates),
authoring the missing converters in apollo_config. This aligns the derived Serialize with
the wire/jsonnet form the deserializers expect, so the native-config harness and
startup-log presentation round-trip faithfully.

Guarded by two tests: a converter-level round-trip (apollo_config/converters_test) and a
config-level round-trip in apollo_node_config that serializes->deserializes the real
component config structs with non-default values, catching a mispaired or missing
serialize_with. Sensitive<T> fields are intentionally left asymmetric (serialize redacts;
symmetry would leak secrets) and excluded from the config-level guard.

Only the derived Serialize changes; the hand-written SerializeConfig::dump() and the
committed config_schema.json / app_configs are untouched (no up-to-date guard flips).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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