Skip to content

Conversation

@darinkishore
Copy link
Collaborator

Summary

Adds comprehensive test coverage, documents architectural decisions in an ADR, and implements input format control for typed signatures.

Tests Added

Integration tests (typed_integration.rs):

  • Happy path with metadata access
  • Check constraint recording (soft failures)
  • Assert constraint failures (hard failures)
  • Missing field error handling
  • Integer parsing edge cases

Input format tests (test_input_format.rs):

  • YAML/JSON/TOON format verification
  • Alias preservation across formats
  • Default format behavior (strings raw, others JSON)

Trybuild compile-fail tests:

  • Duplicate #[format] rejection
  • Invalid format values
  • #[format] on output fields

ADR Coverage

Documents 9 key architectural decisions:

  1. Three generated structs pattern for derive compatibility
  2. ToBamlValue for prompt rendering
  3. Function pointers for TypeIR in FieldSpec
  4. ParseError::Multiple with partial results
  5. Marker protocol [[ ## field ## ]]
  6. BamlValue as optimizer interchange
  7. Check vs Assert constraint semantics
  8. Separate ToBamlValue trait design
  9. Removal of PromptParts trait

Input Format Feature

#[derive(Signature)]
struct MySignature {
    #[input]
    #[format("yaml")]  // or "json", "toon"
    context: MyStruct,

    #[output]
    answer: String,
}

Test plan

  • cargo test -p dspy-rs passes
  • cargo test -p dsrs-macros passes (including trybuild)
  • ADR is readable and accurate

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