Skip to content

fix(core): reject transform/join input type mismatches at build() (#330) - #336

Merged
lxsaah merged 4 commits into
mainfrom
fix/330-transform-input-type-check
Oct 24, 2026
Merged

lxsaah merged 4 commits into
mainfrom
fix/330-transform-input-type-check

Conversation

@lxsaah

@lxsaah lxsaah commented Oct 24, 2026

Copy link
Copy Markdown
Member

Description

AimDbBuilder::build() checked that a transform's input key exists, but not its type. A .transform::<Pascal, _>("temp", …) on a Celsius record built fine. At runtime the transform's consumer failed to resolve, so the output never got a value and a join ran without that input. With default features nothing was logged, because log_error! compiles to nothing without tracing/log.

build() now reports such a configuration in DbError::InvalidConfiguration, alongside every other finding:

record 'temp_doubled': transform reads input 'temp' as <crate>::Pascal, but that record holds <crate>::Celsius

Changes

  • TransformDescriptor records each input's TypeId and type name (input_types, in the same order as input_keys). Single transforms and JoinBuilder::input::<I> fill it.
  • AnyRecord gains transform_input_types() and type_name().
  • build() checks each input against the record registry's type_id right after the registry is built. Unregistered inputs are still reported by the dependency graph (TransformInputNotFound).
  • No new DbError variant. A four-String variant would grow DbError past its 64-byte embedded budget (test_error_size_constraint), and build() reports findings as ConfigError messages anyway.
  • Changelog entry under [Unreleased] / Changed: this is a behaviour change, because such configurations now fail at build() instead of running without the transform.

Tests (aimdb-tokio-adapter/tests/transform_validation.rs)

  • A mistyped single-transform input is rejected, and the error names the output record, the input key and both types.
  • A join with one mistyped input is rejected, and the error names only that input.
  • With the input type corrected, the transform builds and runs.
  • A unit conversion (Celsius → Fahrenheit) builds and runs: input and output types may differ.
  • Without the builder change, both rejection tests fail.

Verified locally: cargo test -p aimdb-core, cargo test -p aimdb-tokio-adapter, clippy on both crates, cargo check -p aimdb-core --no-default-features, cargo check -p aimdb-wasm-adapter --target wasm32-unknown-unknown --tests, and cargo check -p aimdb-embassy-adapter. The full make check is left to CI.

Related Issue

Checklist

  • I have read the CONTRIBUTING.md document.
  • My code follows the project's coding standards.
  • I have added tests to cover my changes.
  • All new and existing tests passed (make check). Left to CI.
  • I have updated the documentation accordingly.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YPDjQ947yKjLLAq3Xzgu3e

@lxsaah
lxsaah force-pushed the fix/330-transform-input-type-check branch from 7d0a913 to 08416a7 Compare October 24, 2026 09:56
@lxsaah
lxsaah merged commit cafdc63 into main Oct 24, 2026
12 checks passed
@lxsaah
lxsaah deleted the fix/330-transform-input-type-check branch October 24, 2026 10:36
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.

[BUG] A transform whose input type does not match its input record builds, and then never runs

1 participant