lab publish CI broken: openrpc_client! rejects {str: any} inputs from #140 (Rule 2) #143
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_proc#143
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
After merging #140 (
feat(jobs): restore typed inputs end-to-end) intodevelopment, the lab publish CI fails to build.labdepends onhero_proc_sdkas a git dependency, and the SDK'sopenrpc_client!macro now rejects the schema introduced by #140:This cascades into ~9
E0432unresolved-import errors (HeroProcClient_,JobCreate,RunSpec,Action, etc.) because codegen aborts, and the wholehero_proc_sdklib fails to compile — breaking every downstream consumer (lab, admin, examples).Root cause
#140 modeled per-invocation typed inputs as a free-form map using the
anyvalue type, in two oschema types:crates/hero_proc_server/oschema/jobs/40_run.oschema—RunSpec.inputs: {str: any}crates/hero_proc_server/oschema/jobs/30_job.oschema—JobCreate.inputs: {str: any}{str: any}generatesHashMap<String, serde_json::Value>. Theopenrpc_server!codegen tolerated this, so #140 built and tested green locally against the server, but theopenrpc_client!codegen enforces openrpc principles Rule 2, which forbidsanyentirely (no constructor, no typed accessors, no compile-time check). The enforcement was tightened (seestopgap/openrpc-enforcement-b1), so the client-side build thatlabperforms now hard-fails.Fix
Re-model
inputswithoutany, using the existing in-repo precedent:Action.input_schemais already astrholding a JSON document (a JSON Schema). Modelinputsthe same way — astrholding a JSON object — instead of{str: any}:RunSpec.inputs: str— JSON object string of per-invocation typed values;""= noneJobCreate.inputs: str— JSON object string;""= noneThis preserves all documented §1.5 behavior with zero engine changes: the server parses the string into a
serde_json::Valueand feeds the unchangedapply_inputs/template.rsengine, so{{var}}/{{nested.path}}traversal, natural number/bool rendering, andHERO_INPUT_<UPPER>injection all keep working. The typed SDK builder API (.input(k, v: impl Into<serde_json::Value>)/.inputs(map)) is unchanged — the SDK serializes the map to a JSON string at the wire boundary.Scope of changes
{str: any}->str(the only twoanyusages in the tree).crates/hero_proc_server/openrpc/openrpc_jobs.json.jobs_impl.rs: parsereq.inputs/spec.inputsJSON string ->Value(wasto_value).factory.rs/builders.rs: serialize the builder's input map -> JSON string when constructingRunSpec/JobCreate.inputsas a JSON string literal.Acceptance criteria
hero_proc_sdkcompiles (bothopenrpc_server!andopenrpc_client!codegen pass — no Rule 2 violation).labbuilds against the SDK git dependency (CI publish job green).{{var}}/{{nested.path}}; numbers/bools render naturally; unresolved placeholders stay literal.HERO_INPUT_<UPPER>still injected for non-ai interpreters.input_schemastill persists and round-trips.cargo build+cargo clippy -D warningsclean for the feature crates.Notes
developmentHEAD14ee3eais affected.inputs(map -> JSON string), which is invisible through the SDK builder API.Implementation complete — PR #145
Root cause confirmed:
{str: any}onRunSpec.inputs/JobCreate.inputsis rejected byopenrpc_client!(Rule 2), which is whatlabcompiles via the SDK git dependency. The server macro tolerated it, so #140 built locally; the client macro did not, breaking the publish build.Fix
Modeled
inputsas astrholding a JSON object — same precedent asAction.input_schema(astrcarrying a JSON document). Zero engine changes.Changes (8 files)
oschema/jobs/40_run.oschema,oschema/jobs/30_job.oschema—inputs: {str: any}->strsrc/rpc/impls/jobs_impl.rs— parseinputsJSON string ->Valuebeforeapply_inputs(job_create + run_quick_submit);""/invalid => no-ophero_proc_sdk/src/factory.rs,hero_proc_sdk/src/builders.rs— serialize the typed input map -> JSON string at the wire boundary; builder API unchangedopenrpc/openrpc_jobs.json— regenerated (bothinputsblocks ->type: string)hero_proc_admin/docs/api.md— docs updated to the JSON-string contracttests/basic/jobs_quick.rs— e2e test passesinputsas a JSON object stringTest Results
basic::jobs_quick::typed_inputs_render_and_envPASS (isolated daemon):{{var}}/{{nested.path}}render,count=3stays a number,HERO_INPUT_NAMEinjected,input_schemaround-trips.Also verified:
hero_proc_sdkcompiles (the failing client-macro gate), full workspace builds after merging latestdevelopment(#144).Lint job — green
The lab/CI Lint job (
cargo clippy --workspace -- -D warnings) was red ondevelopmentdue to pre-existing clippy debt that had been masked: the earlier{str: any}build failure aborted the first crates, so dependent crates were never checked. Fixing the build unblocked them and surfaced the backlog. Cleared it in a follow-up commit on this branch:sort_by->sort_by_key;contains_key+insert->entry(); doc-comment blank lineRunActionEntry::Inlinevariant;RangeInclusive::containsfor the bound checkchecked_divfor the ratio; trimmed a stale doc blockmap_err;#[allow(dead_code)]on the threebase_pathdetail-template fields (threaded but not yet emitted by those partials)assert!overassert_eq!(_, bool);is_empty()overlen() >= 1; dropped uselessString -> StringconversionsVerified locally:
cargo clippy --workspace -- -D warningsexits 0,cargo build --workspaceclean, and the typed-inputs e2e test still passes.