Skip to content

refactor(config): decouple worker-core config types from amp-config schemars#1873

Open
mitchhs12 wants to merge 9 commits intomainfrom
mitchhs12/decouple-worker-core-config
Open

refactor(config): decouple worker-core config types from amp-config schemars#1873
mitchhs12 wants to merge 9 commits intomainfrom
mitchhs12/decouple-worker-core-config

Conversation

@mitchhs12
Copy link
Contributor

@mitchhs12 mitchhs12 commented Feb 26, 2026

Note: WIP

Summary

  • Duplicate ParquetConfig, ConfigDuration, and nested config types (CollectorConfig, CompactorConfig, CompactionAlgorithmConfig, SizeLimitConfig) in amp-config with schemars support
  • Break the feature chain amp-config[schemars]amp-worker-core/schemarscommon/schemars
  • Remove schemars dependency from both worker-core and common
  • worker-core::parquet_opts() now accepts impl Into<ParquetConfig>
  • Improved customer-facing documentation on all config fields
  • Added pub fn parse_compression to worker-core so amp-config can validate compression strings without depending on datafusion directly — needs review
  • SizeLimitConfig deserialization helpers (~55 lines) are duplicated verbatim from worker-core into amp-config — needs review on whether to deduplicate by making worker-core's versions pub

Closes #1790

…chemars

Duplicate ParquetConfig, ConfigDuration, and nested config types in
amp-config with schemars support, breaking the feature chain
amp-config[schemars] → amp-worker-core/schemars → common/schemars.
Internal crates no longer carry the schemars dependency.

Closes #1790
Define a proper Compression enum in amp-config with a curated subset of
supported algorithms (zstd, lz4, gzip, brotli, snappy, uncompressed).
Validates at the config boundary via FromStr, removing the need for
worker-core to expose parse_compression in its public API.
…ring

Reorder worker_core.rs to follow rust-modules-members guideline: main
type (ParquetConfig) first, then dependencies in order, private helpers
last. Alphabetize Cargo.toml dependencies and regenerate config schema.
Eliminates the .expect() in the From<&Compression> impl by storing
parquet_basic::ZstdLevel in the Zstd variant. Validation now happens
in FromStr where errors can be returned properly.
@mitchhs12 mitchhs12 self-assigned this Feb 27, 2026
@mitchhs12 mitchhs12 changed the title WIP: refactor(config): decouple worker-core config types from amp-config schemars refactor(config): decouple worker-core config types from amp-config schemars Feb 27, 2026
…message

Remove unnecessary pub from private SizeLimitHelper fields. Forward
the error from ZstdLevel::try_new directly instead of hardcoding the
valid range.
…onfig paths

- Remove serde::Deserialize from all worker-core config types; amp-config
  is the sole deserialization boundary
- Create local ZstdLevel newtype wrapping parquet's ZstdLevel, validated
  at parse time against parquet's own constraints (zero unwrap/expect)
- Slim amp-config SizeLimitConfig to user-configurable fields only;
  runtime fields (file_count, generation, blocks) default during From
- Revert parquet_opts signature to &ParquetConfig, removing unnecessary
  impl Into + clone at call sites
- Replace Duration::from_secs_f64 with try_from_secs_f64 to prevent
  panic on negative/NaN/infinite duration input
- DRY up SizeLimitHelper deserialization via shared deserialize_with_base
- Document Compression parsing semantics and gzip/brotli level behavior
- Remove redundant error message wrapping in FromStr for Compression
- Update ampd.spec.json to reflect slimmed SizeLimitConfig schema
@mitchhs12 mitchhs12 marked this pull request as ready for review February 27, 2026 17:14
Remove default_compression(), default_cache_size_mb(),
default_max_row_group_mb() from worker-core (no longer needed without
serde) and default_upper_limit() from amp-config (was just
Self::default()). Inline their values directly at the call sites.
Accept impl Into<ParquetConfig> per issue #1790 guidance, so callers
can pass either worker-core's own type or a foreign type that implements
Into<ParquetConfig>. Call sites now clone before passing ownership.
@mitchhs12 mitchhs12 requested a review from LNSD February 27, 2026 18:25
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.

Decouple internal crate config types from amp-config

1 participant