Skip to content

fix: separate canonical model metadata from route policy#2367

Merged
jolestar merged 1 commit into
mainfrom
fix/issue-2363-canonical-model-metadata
Jul 21, 2026
Merged

fix: separate canonical model metadata from route policy#2367
jolestar merged 1 commit into
mainfrom
fix/issue-2363-canonical-model-metadata

Conversation

@jolestar

Copy link
Copy Markdown
Collaborator

Summary

  • store canonical built-in model metadata once and represent endpoint-specific built-ins as sparse route policies
  • enforce that route capability policy can only narrow intrinsic model capabilities, with endpoint constraint evidence
  • retain a compatibility adapter for unmigrated duplicate provider catalogs
  • migrate StepFun default/plan routes to shared canonical metadata without changing refs, aliases, discovery, or models.catalog
  • document the resolver and migration contract

This is the first narrow implementation PR for #2363. The remaining provider catalog audit and migration will follow separately, so this PR does not close the issue.

Verification

  • cargo fmt --all -- --check
  • cargo test model_catalog
  • RUSTFLAGS="-D warnings" cargo check --all-targets

@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
holon Ready Ready Preview, Comment Jul 21, 2026 11:11pm

@jolestar jolestar left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by holon-reviewer ✅

Summary

This PR introduces a clean separation between canonical built-in model metadata and endpoint-specific route policy. The design is sound — BuiltInModelRoutePolicy as a sparse overlay that can only narrow (not widen) intrinsic capabilities is the right abstraction.

Code Review

Correctness:

  • field_diff + double-Option pattern for nullable sparse fields is clean and correct
  • validate_narrowing enforcement at catalog construction (panic on violation) is appropriate for built-in data integrity
  • apply_route_capability_constraint correctly handles post-resolution narrowing with proper EndpointPolicy constraint evidence
  • resolve_capability_field signature simplified by removing route_builtin — capabilities now resolve from model_builtin only, with route constraints applied separately. Cleaner separation of concerns.
  • Legacy adapter path (from_legacy_route_entry) provides smooth migration without breaking existing provider catalogs

Design:

  • The sparse policy design (None = inherit, Some(value) = override) is idiomatic and well-documented
  • StepFun migration to canonical metadata with empty route policies correctly inherits identical metadata without duplication
  • ModelMetadataConstraintSource::EndpointPolicy properly distinguishes route policy constraints from transport constraints in evidence

Tests:

  • route_policy_cannot_enable_an_intrinsic_capability — validates narrowing invariant ✅
  • capability_precedence_treats_discovered_false_as_unknown_but_preserves_explicit_false — tests new constraint-as-narrowing semantics with evidence ✅
  • StepFun registration test verifies default/plan route parity ✅

Documentation:

  • Decision doc 099, RFC updates consistent with implementation ✅

Minor observation (non-blocking):

  • reasoning_effort_options filtering changed: old code filtered empty lists, new code treats Some(vec![]) as a valid sparse override. Correct for sparse policy semantics but a subtle behavioral change to be aware of.

Verdict: No blocking issues. Ready to merge once CI passes.

@holonbot

holonbot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Holon Run Report

@jolestar
jolestar merged commit cdef963 into main Jul 21, 2026
8 checks passed
@jolestar
jolestar deleted the fix/issue-2363-canonical-model-metadata branch July 21, 2026 23:27
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