[codex] Facet runtime API cleanup and adapter boundary hardening - #65
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR performs a one-shot facet-only compatibility sweep and then hardens the long-term public API boundary based on an adversarial audit.
Primary changes:
bamltype::compatusage from typed/runtime/macro paths.BamlAdaptertoFieldCodec.with_constraintshelper and inlines constraint attachment in generated macro output.bamltype::adapters) and moves adapter-oriented API there.BamlType*, conversion, rendering/parsing), with adapter hooks intentionally namespaced out of the top-level API.Why
The repository is early-stage and not constrained by strict back-compat requirements, so this is a deliberate cleanup to avoid carrying bridge-era artifacts forward.
The adversarial audit found that leaving registry+adapter hooks as root-level core APIs would create long-term semver lock-in around internals likely to evolve. This PR incorporates the follow-up hardening to avoid that lock-in.
Detailed changes
bamltype core
crates/bamltype/src/runtime.rsfor runtime traits/error types.crates/bamltype/src/schema_registry.rs(SchemaRegistry) and wired schema builder to it.crates/bamltype/src/adapters.rs:adapters::FieldCodecadapters::AdapterSchemaRegistrycrates/bamltype/src/compat.rs.facet_ext,convert, andschema_builderto new module boundaries.macro integration
crates/dsrs-macros/src/lib.rs:bamltype::compat::*paths.with_constraints.BamlTypeInternal::register(...)delegation.crates/bamltype-derive/src/lib.rs:runtime_crate::adapters::FieldCodecin generated adapter hooks.dspy-rs integration
tests
bamltype::adapters::*(and correspondingfacet_runtime::adapters::*paths).Validation
cargo fmt --allcargo check --workspacecargo test -p bamltype --testscargo test -p dsrs_macros --testscargo test -p dspy-rs --testscargo test --workspaceAll passed.
User impact
This is intentionally breaking for old compat paths and root-level adapter/registry imports. The result is a cleaner facet-native API surface and a clearer extension boundary for custom field codecs.