fix(jobs): model typed inputs as JSON string (Rule 2) #145

Merged
mahmoud merged 3 commits from development_fix_inputs_any into development 2026-06-08 17:41:57 +00:00
Owner

What

Fixes the lab publish CI build break introduced by #140. RunSpec.inputs and JobCreate.inputs were modeled as {str: any}, which openrpc_client! rejects under openrpc principles Rule 2 (any is forbidden). The openrpc_server! codegen tolerated it, so #140 built/tested locally, but lab (which compiles the SDK's client macro via the git dependency) hard-failed.

How

Re-model inputs as a str holding a JSON object — the same precedent as Action.input_schema, which already carries a JSON document as a str. This keeps the entire §1.5 feature working with zero engine changes:

  • oschema: RunSpec.inputs / JobCreate.inputs {str: any} -> str (the only two any usages in the tree).
  • server jobs_impl.rs: parse the inputs JSON string into a serde_json::Value before apply_inputs ("" / invalid => Null => no-op); the templating/HERO_INPUT_* engine is untouched.
  • SDK factory.rs / builders.rs: serialize the builder's typed input map to a JSON string at the wire boundary. The fluent API (.input(k, v) / .inputs(map)) is unchanged.
  • Regenerated openrpc_jobs.json (both inputs blocks -> type: string).
  • Docs + e2e test updated to the JSON-string contract.

Verification

  • hero_proc_sdk compiles — openrpc_client! accepts the schema (the failing CI gate).
  • Full workspace builds (after merging latest development / #144).
  • e2e basic::jobs_quick::typed_inputs_render_and_env passes against an isolated daemon: {{var}} / {{nested.path}} render, numbers stay numbers (count=3), HERO_INPUT_NAME injected, input_schema round-trips.
  • No-inputs path unchanged (empty string short-circuits).

Notes

  • Latest development (#144 cleanup) is merged into this branch.
  • cargo clippy -D warnings has pre-existing failures on development in files this PR does not touch (keys.rs, filter.rs, stop.rs, supervisor/mod.rs); out of scope here.

Closes #143

## What Fixes the lab publish CI build break introduced by #140. `RunSpec.inputs` and `JobCreate.inputs` were modeled as `{str: any}`, which `openrpc_client!` rejects under openrpc principles Rule 2 (`any` is forbidden). The `openrpc_server!` codegen tolerated it, so #140 built/tested locally, but `lab` (which compiles the SDK's client macro via the git dependency) hard-failed. ## How Re-model `inputs` as a `str` holding a JSON object — the same precedent as `Action.input_schema`, which already carries a JSON document as a `str`. This keeps the entire §1.5 feature working with **zero engine changes**: - oschema: `RunSpec.inputs` / `JobCreate.inputs` `{str: any}` -> `str` (the only two `any` usages in the tree). - server `jobs_impl.rs`: parse the `inputs` JSON string into a `serde_json::Value` before `apply_inputs` (`""` / invalid => `Null` => no-op); the templating/`HERO_INPUT_*` engine is untouched. - SDK `factory.rs` / `builders.rs`: serialize the builder's typed input map to a JSON string at the wire boundary. The fluent API (`.input(k, v)` / `.inputs(map)`) is unchanged. - Regenerated `openrpc_jobs.json` (both `inputs` blocks -> `type: string`). - Docs + e2e test updated to the JSON-string contract. ## Verification - `hero_proc_sdk` compiles — `openrpc_client!` accepts the schema (the failing CI gate). - Full workspace builds (after merging latest `development` / #144). - e2e `basic::jobs_quick::typed_inputs_render_and_env` passes against an isolated daemon: `{{var}}` / `{{nested.path}}` render, numbers stay numbers (`count=3`), `HERO_INPUT_NAME` injected, `input_schema` round-trips. - No-inputs path unchanged (empty string short-circuits). ## Notes - Latest `development` (#144 cleanup) is merged into this branch. - `cargo clippy -D warnings` has pre-existing failures on `development` in files this PR does not touch (`keys.rs`, `filter.rs`, `stop.rs`, `supervisor/mod.rs`); out of scope here. Closes #143
- RunSpec.inputs / JobCreate.inputs: {str: any} -> str (JSON object);
  {str: any} is rejected by openrpc_client! (Rule 2), which broke the
  lab publish build after #140
- server parses the inputs JSON string into a Value before apply_inputs;
  "" / invalid => no inputs (engine and no-inputs path unchanged)
- sdk serializes the typed input map to a JSON string at the wire
  boundary; builder API (.input/.inputs) unchanged
- regenerate openrpc_jobs.json; mirrors the input_schema precedent
  (a str carrying a JSON document)
- docs + e2e test updated to the JSON-string contract

#143
Merge remote-tracking branch 'origin/development' into development_fix_inputs_any
All checks were successful
Build and Test / build (pull_request) Successful in 16m38s
b3574aacd0
fix(lint): clear clippy -D warnings across workspace
All checks were successful
Build and Test / build (pull_request) Successful in 7m13s
a1137bec37
These pre-existing lints were masked in CI because the prior build
failure blocked dependent crates from being checked; the inputs fix
unblocks them, so resolve them to keep the lint job green.

- server: sort_by -> sort_by_key, contains_key+insert -> entry(),
  drop empty line after doc comment
- sdk: box the large RunActionEntry::Inline variant, use
  RangeInclusive::contains for the concurrency bound check
- examples: checked_div for the throughput ratio, trim a stale doc
- admin: drop identity map_err; mark base_path detail-template
  fields (threaded but not yet emitted) allow(dead_code)
- test: assert! over assert_eq!(_, bool), is_empty over len>=1,
  drop useless String->String conversions

#143
mahmoud merged commit a585ab464d into development 2026-06-08 17:41:57 +00:00
mahmoud deleted branch development_fix_inputs_any 2026-06-08 17:42:01 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_proc!145
No description provided.