Skip to content

style(delegation): metadata typing, helper banner, otel coercion note#208

Merged
miguelgfierro merged 2 commits into
mainfrom
style/delegation-nits
May 21, 2026
Merged

style(delegation): metadata typing, helper banner, otel coercion note#208
miguelgfierro merged 2 commits into
mainfrom
style/delegation-nits

Conversation

@miguelgfierro
Copy link
Copy Markdown
Contributor

Summary

Three small style nits surfaced during review of #195:

  • RoutingDecision.metadata typed as dict[str, Any] instead of Mapping[str, Any]. FallbackStrategy already calls dict(decision.metadata) to nest it; the concrete type lets that drop without a cast and matches what RoutingDecision.empty actually builds. Input-side params that accept user-supplied mappings keep Mapping.
  • _coerce_otel_value lifted to its own # -- Helpers -- section so it doesn't read as part of WeightedStrategy above it.
  • _coerce_otel_value docstring notes that nested containers are not recursed element-wise — the whole value falls through to json.dumps once. Documenting the limit prevents future maintainers from trying to "fix" it.

No behavior change.

Test plan

  • pytest tests/unit/agents/test_delegation.py -q — 39 passed.
  • ruff format --check — clean.

Note: this stacks logically with #207 (which adds Candidate.metadata); after #207 merges, Candidate.metadata should follow the same dict[str, Any] typing — easy follow-up rebase.

miguelgfierro and others added 2 commits May 21, 2026 10:24
… coercion note

- RoutingDecision.metadata typed as dict[str, Any] instead of Mapping; lets
  callers like FallbackStrategy do dict(decision.metadata) without a cast.
  Input-side params that accept user-supplied mappings keep Mapping.
- _coerce_otel_value gets its own section banner so it doesn't read as part
  of WeightedStrategy.
- Docstring on _coerce_otel_value notes that nested containers are not
  recursed element-wise — they fall through to json.dumps once.
@miguelgfierro miguelgfierro merged commit 24d3ec3 into main May 21, 2026
7 checks passed
@miguelgfierro miguelgfierro deleted the style/delegation-nits branch May 21, 2026 08:30
ancongui pushed a commit that referenced this pull request May 31, 2026
style(delegation): metadata typing, helper banner, otel coercion note
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.

1 participant