fix: per-rootobject Create input schema; drop bogus *.find from spec #46

Merged
timur merged 2 commits from fix/input-schema-and-find into development 2026-05-12 12:40:07 +00:00
Owner

Why

Two OpenRPC-surface cleanups so the spec matches what callers can actually do.

1. Per-rootobject Create input schema

Reusing the full Task schema (with sid / created_at / updated_at injected as required) for *_set.data forced clients to ship placeholder values (sid="0000", created_at=0, ...) for fields the server overwrites anyway. Generated Python dataclasses inherited the noise.

The openrpc generator now also emits <Name>Create for every rootobject — same shape minus the server-managed base fields and minus them in required[]. unified_server wires *_set.data to <Name>Create; reads keep returning the full <Name> so round-trips stay clean.

2. Removed *.find from the auto-CRUD spec

rust_osis.rs::generate_rpc_methods only generates _rpc_new, _rpc_get, _rpc_set, _rpc_delete, _rpc_list, _rpc_exists. There is no _rpc_find handler. Listing *.find in the spec returned -32601 Method not found to anyone who tried it (LLM agents in particular). Re-add when DBTyped grows a real query API.

Verified

  • cargo build --release clean.
  • cargo test --release --lib --bins passes (the broken examples/ are stale generated code unrelated to this PR).
  • recipe_server openrpc.json regenerated and includes the new *Create companion schemas.

Downstream

hero_osis pulls this via git; rebuilding hero_osis will regenerate its static spec to include <Name>Create schemas, and the runtime CRUD spec will reference them automatically. Python clients regenerated by hero_router will then emit dataclasses without the placeholder base fields.

🤖 Generated with Claude Code

## Why Two OpenRPC-surface cleanups so the spec matches what callers can actually do. ### 1. Per-rootobject Create input schema Reusing the full `Task` schema (with `sid` / `created_at` / `updated_at` injected as required) for `*_set.data` forced clients to ship placeholder values (`sid="0000"`, `created_at=0`, ...) for fields the server overwrites anyway. Generated Python dataclasses inherited the noise. The openrpc generator now also emits `<Name>Create` for every rootobject — same shape minus the server-managed base fields and minus them in `required[]`. `unified_server` wires `*_set.data` to `<Name>Create`; reads keep returning the full `<Name>` so round-trips stay clean. ### 2. Removed `*.find` from the auto-CRUD spec `rust_osis.rs::generate_rpc_methods` only generates `_rpc_new`, `_rpc_get`, `_rpc_set`, `_rpc_delete`, `_rpc_list`, `_rpc_exists`. There is no `_rpc_find` handler. Listing `*.find` in the spec returned `-32601 Method not found` to anyone who tried it (LLM agents in particular). Re-add when DBTyped grows a real query API. ## Verified - `cargo build --release` clean. - `cargo test --release --lib --bins` passes (the broken `examples/` are stale generated code unrelated to this PR). - recipe_server openrpc.json regenerated and includes the new `*Create` companion schemas. ## Downstream hero_osis pulls this via git; rebuilding hero_osis will regenerate its static spec to include `<Name>Create` schemas, and the runtime CRUD spec will reference them automatically. Python clients regenerated by hero_router will then emit dataclasses without the placeholder base fields. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix: emit per-rootobject Create input schema; remove bogus *.find from spec
Some checks failed
Test / test (pull_request) Failing after 1s
50ec10c48f
Two related cleanups so the OpenRPC surface matches what callers can
actually do:

1. **Per-rootobject Create input schema.** The previous design reused
   the full `Task` schema (with sid / created_at / updated_at marked
   required) as the `data` param schema for `task.set`. Generated
   Python clients then forced callers to pass placeholder values
   (`sid="0000"`, `created_at=0`, `updated_at=0`) for fields the
   server overwrites anyway — incidental ceremony with no upside.

   The generator now also emits a `<Name>Create` companion (e.g.
   `TaskCreate`) that is `Task` minus the three server-managed base
   fields and minus them in `required[]`. The unified_server's CRUD
   spec wires `*_set.data` to `<Name>Create`; reads still return the
   full `Task` so dataclass round-trips stay clean.

2. **Removed `*.find` from the auto-CRUD spec.** rust_osis.rs only
   generates `_rpc_new`, `_rpc_get`, `_rpc_set`, `_rpc_delete`,
   `_rpc_list`, `_rpc_exists` — there is no `_rpc_find` handler.
   Listing `*.find` in the spec was a lie that returned `-32601
   Method not found` to anyone who tried it (LLM agents in
   particular). Re-add when DBTyped grows a real query API.

Also regenerated `recipe_server/openrpc.json` to pick up the new
`*Create` schemas alongside the existing rootobject schemas.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix: drop OTOML legacy fallback from generated *_rpc_set handlers
Some checks failed
Test / test (pull_request) Failing after 2s
071dbd45ce
The auto-CRUD `*_rpc_set` handler used to accept either a JSON `data`
param or a legacy OTOML `obj` string and fall back transparently
between the two. The OTOML fallback no longer pulls its weight: every
generated client (Rust/Python/JS) ships JSON, the server returns JSON
on every CRUD path (per recent work), and the dual-shape handler
muddies error messages — callers who forget the `data` kwarg get
"Missing required parameter: data (JSON object) or obj (OTOML
string)" pointing at a wire format they shouldn't think about.

The generated handler is now JSON-only:

    Missing required parameter: data
    (JSON object matching <TypeName>Create schema)

The error message names the exact dataclass to construct, so
prescriptive error_debug feedback in the agent retry loop can map
the failure straight to the right fix.

`*_new_from_otoml` still exists on the server-side generated impl
for in-process callers (seed scripts, tests). It just isn't reachable
through the RPC surface anymore. Co-evolves with hero_rpc PR #46.

Recipe_server's regenerated osis_server_generated.rs picks up the
slimmer handler shape (~30 lines smaller per rootobject).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
timur merged commit b55a0ae60d into development 2026-05-12 12:40:07 +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_rpc!46
No description provided.