fix(collect-worker-interface): collect function schemas from engine::functions::info - #285
Conversation
…functions::info
engine::functions::list returns only a FunctionSummary
(function_id/worker_name/description) — the typed request/response schemas
live solely on engine::functions::info (FunctionDetail), keyed
request_schema/response_schema. The collector read schemas from ::list under
the never-present request_format key, so every function normalized to an empty
{} schema and the --assert-typed-schemas publish check failed for every worker
regardless of how its handlers were typed.
Enrich each target function's row from engine::functions::info before
normalizing, and read request_schema/response_schema (with a request_format
fallback). Adds unit coverage for the enrichment merge and the normalize path.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds ChangesTyped Schema Enrichment Pipeline
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
skill-check — worker0 verified, 22 skipped (no docs/).
Four for four. Nicely done. |
…290) Every published worker trigger showed empty invocation_schema/return_schema (rendered "unknown" in the registry). The publish pipeline collected trigger types from engine::triggers::list, which returns only a TriggerTypeSummary (id/worker_name/description) with no schemas, and build_publish_payload read the obsolete trigger_request_format/call_request_format keys. The typed schemas live solely on engine::triggers::info (TriggerTypeDetail), under configuration_schema (binding config) and request_schema (delivered payload). This is the trigger-side twin of the function-schema fix (#285), which enriched functions from engine::functions::info but left triggers behind. - collect_worker_interface.py: enrich each publishable trigger type from engine::triggers::info before normalizing (mirrors enrich_functions_with_schemas); warn (non-fatal) on triggers still publishing without a typed invocation_schema. - build_publish_payload.py: read configuration_schema -> invocation_schema and request_schema -> return_schema, with the legacy keys as fallback. - tests: trigger enrichment + normalize field-mapping coverage. Trigger schemas are a warning, not a hard gate: some trigger types take no binding config (e.g. iii-directory's directory::*::on-change) and are legitimately schema-less. Claude-Session: https://claude.ai/code/session_017CciKnWZzsLprzZ6XFHZJ2
Problem
The publish-time
--assert-typed-schemascheck (collect_worker_interface.py) fails for every worker, reporting allrequest_schema/response_schemaas untyped (empty{}). It surfaced when releasingllm-router/v0.2.3, whose handlers are in fact correctly typed.Root cause
The collector gathers each function's schema from
engine::functions::list, but that endpoint returns only aFunctionSummary—function_id,worker_name,description, with no schema fields. The typed request/response schemas are exposed solely byengine::functions::info(FunctionDetail), under the keysrequest_schema/response_schema.normalize_worker_interfacealso read the never-presentrequest_formatkey.Result:
details.get("request_format")→None→{}for every function of every worker, so the assertion can never pass against a live engine. The schemas are correctly extracted by the SDK and stored by the engine — only the collection queried the wrong endpoint/keys.Confirmed on a live engine:
functions::listreturns 3 keys (no schemas);functions::inforeturns the full typed schemas.Fix
collect_worker_interface.py: enrich each target function's row fromengine::functions::info(best-effort, per function) before normalizing.build_publish_payload.py: readrequest_schema/response_schema(info-API key names), falling back torequest_formatfor back-compat.Verification
--assert-typed-schemasexits 0 (was 1).Note
The reusable publish workflow runs at the release tag's ref, so this needs a new tag (e.g.
llm-router/v0.2.4) to take effect in the pipeline — re-running the old job re-runs the pre-fix script.Summary by CodeRabbit
New Features
Tests