sdk: drop filtered per-domain spec duplication — single source of truth #139
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_aibroker#139
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?
Problem
hero_aibroker_sdkcurrently ships a filtered copy of each per-domain OpenRPC spec atcrates/hero_aibroker_sdk/specs/<domain>.openrpc.json(added in #131). The SDK'sopenrpc_client!macro reads from there instead of from the server's canonicalcrates/hero_aibroker_server/specs/<domain>.openrpc.json. Two reasons today:openrpc_client!macro (hero_rpc_derive) doesn't support JSON-schemaallOf, so the SDK copies strip the two methods that use it:memory.search(allOf on result item) andai.transcribe_verbose(allOf onTranscriptionVerbose).Both reasons are workarounds. The
hero_macro_openrpcskill is explicit (line 211): "Place the spec atsrc/<service_name>/openrpc.jsoninside the target crate, or use the one from the server crate." — single source of truth.Cost of the current state
memory.searchandai.transcribe_verbosearen't reachable through the typed SDK.Proposal
Pick one of three:
Option A — flatten
allOfin the server-side specs (simplest, smallest blast radius)Two specs use
allOf:Inline the
$ref'd schema's properties into a single object schema. No semantic change on the wire; the typed Rust output is the same shape.Then SDK can do:
and the
crates/hero_aibroker_sdk/specs/directory disappears.Option B —
build.rsfilterSDK has a
build.rsthat reads from../hero_aibroker_server/specs/, transformsallOf(flatten or strip), writes toOUT_DIR, then the macro reads from there. Server specs stay authoritative; SDK doesn't commit copies.Option C — add
allOfsupport toopenrpc_client!The proper fix. Adds
allOf→ flat-struct generation tohero_rpc_deriveso any spec usingallOfworks out of the box. Largest scope (toucheshero_rpc).Recommendation
A for this cycle (small, contained, ships fast). File C as a longer-term follow-up against
hero_rpc.Acceptance
crates/hero_aibroker_sdk/specs/deleteddomain_client!()invocation incrates/hero_aibroker_sdk/src/lib.rspoints at../hero_aibroker_server/specs/<domain>.openrpc.jsonmemory::Client::memory_searchandspeech::Client::ai_transcribe_verboseexist and compilecargo build -p hero_aibroker_sdkclean,cargo test -p hero_aibroker_sdk --docgreenRefs #127, #131.
Implemented in #141 — #141.
Live-verified against a rebuilt broker (real Groq round-trip).