review openrpc interface #1
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_proc#1
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?
check all content in /Volumes/T7/code0/hero_proc/docs
make sure its all up to date
then lets review
make sure there is one interface where we can do
quick_service_set
quick_service_list
quick_service_delete
quick_service_get
quick_service_start
quick_service_stop
quick_service_status
which is combination of actions & service definition
set:
everything needed to run 1 service with 1 action
simple dependency is good
the action gets this quick_service name as prepend so we can easily delete corresponding actions
then we can run it
its an easy way how to deal with simple services who have one action
quick_service_spec.md
should be the spec
Implementation Spec for Issue #1: Quick Service OpenRPC Interface
Objective
Add a
quick_serviceRPC namespace that provides a simplified interface for managing single-action services. A quick_service bundles a service definition and its single action into one atomic operation:quick_service.setcreates both the action (named{name}_action) and the service (referencing that action) in a single call.Requirements
quick_servicenamespace:quick_service.set— create/update a quick service (creates both action + service atomically)quick_service.list— list all quick servicesquick_service.delete— delete a quick service and its associated actionquick_service.get— get a quick service definitionquick_service.start— start a quick servicequick_service.stop— stop a quick servicequick_service.status— get quick service statusquick_service.settakes:name,cmd, plus optional fields (interpreter, env, dir, timeout_ms, etc.){name}_actionfor easy cleanupquick_service.deleteremoves both the service and its prefixed actionopenrpc.json, docs, and auto-generated SDK clientdocs/quick_service_spec.mdspecification document is createdactionsandservicestablesFiles to Modify/Create
crates/hero_proc_server/src/rpc/quick_service.rscrates/hero_proc_server/src/rpc/mod.rscrates/hero_proc_server/openrpc.jsondocs/hero_proc_openrpc/openrpc.mddocs/quick_service_spec.mdcrates/hero_proc_integration_test/src/tests/quick_services.rscrates/hero_proc_integration_test/src/tests/mod.rsImplementation Plan
quick_service.rswith all 7 handlersmod.rsopenrpc.jsonopenrpc.mddocs/quick_service_spec.mdcargo build+cargo testAcceptance Criteria
quick_service.setcreates both action ({name}_action) and service in one callquick_service.getreturns quick service definitionquick_service.listreturns only quick servicesquick_service.deleteremoves both service and actionquick_service.start/stop/statuswork correctlyopenrpc.jsondocs/quick_service_spec.mdexistscargo build --workspaceandcargo test --workspacesucceedUpdated Spec: Quick Service RPC Schemas (In/Out)
New Schema:
QuickServiceParamsInternal mapping:
quick_service.set(params)creates:name = "{params.name}_action",script = params.cmd, plus interpreter/dir/env/timeout/stop fieldsname = params.name,actions = ["{params.name}_action"],status = "start"Method Schemas
quick_service.set— Create or update a quick serviceParams (in):
namecmdinterpreter"bash"bash|sh|rhai|python3|bun|node|execdirenv{key: value}timeout_ms0stop_signal"SIGTERM"stop_timeout_ms10000descriptioncontext"core"Result (out):
OkResponsequick_service.get— Get a quick service definitionParams (in):
namecontext"core"Result (out):
QuickServiceInfoquick_service.list— List all quick servicesParams (in):
contextResult (out):
quick_service.delete— Delete a quick service and its actionParams (in):
namecontext"core"Result (out):
OkResponseDeletes both the service (
name) and its action ({name}_action).quick_service.start— Start a quick serviceParams (in):
namecontext"core"Result (out):
OkResponseDelegates to
service.startinternally.quick_service.stop— Stop a quick serviceParams (in):
namecontext"core"Result (out):
OkResponseDelegates to
service.stopinternally.quick_service.status— Get quick service statusParams (in):
namecontext"core"Result (out):
ServiceStatusStates:
inactive | blocked | starting | running | stopping | success | exited | failedDelegates to
service.statusinternally.Updated Spec v3: Schema Clarifications
1.
envfield — key/value mapenvis a dictionary (map) of string keys to string values. In JSON:OpenRPC schema:
2. Dependencies between quick services
Quick services support inter-service dependencies via the
depends_onfield. Since quick services are regular services under the hood, this maps directly to the existingDependencyDefsystem.New field in
quick_service.setparams:depends_on{}depends_onstructure:requiresafterwantsconflictsAll sub-fields reference service names (including other quick service names).
Full Updated
quick_service.setParamsnamecmdinterpreter"bash"bash|sh|rhai|python3|bun|node|execdirenv{}timeout_ms0stop_signal"SIGTERM"stop_timeout_ms10000descriptioncontext"core"depends_on{}Example: quick_service.set with dependencies
Result:
This creates:
api-server_action(script=node server.js, interpreter=exec, dir=/opt/api, env=...)api-server(actions=[api-server_action], dependencies={requires:[database], after:[logger]})Test Results
Implementation Summary
Changes Made
New files:
crates/hero_proc_server/src/rpc/quick_service.rs— 7 RPC handler functions for thequick_servicenamespacedocs/quick_service_spec.md— Full specification document with API reference, examples, and dependency docsModified files:
crates/hero_proc_server/src/rpc/mod.rs— Registeredquick_servicemodule + 7 dispatch armscrates/hero_proc_server/openrpc.json— Added 7 method definitions +QuickServiceInfoschemadocs/hero_proc_openrpc/openrpc.md— Added Quick Service section (7 methods),QuickServiceInfoschema, updated method count from 67 to 74Features
quick_service.setatomically creates both action ({name}_action) and service in one callenvsupport as key/value map (map<string,string>)depends_on(requires/after/wants/conflicts)quick_service.listfilters to only quick services using naming conventionquick_service.deleteremoves both action and service atomicallystart/stop/statusdelegate to existing service handlersImplementation committed:
9817253Browse:
9817253Integration Test Results
Overall: 148 passed, 14 failed, 162 total
Quick Service Tests: 17/17 PASS
set_creates_quick_serviceget_returns_all_fieldsget_nonexistent_returns_errorset_with_env_varsset_with_dependencieslist_includes_quick_serviceslist_excludes_regular_servicesset_updates_existing_quick_servicedelete_removes_service_and_actiondelete_nonexistent_returns_errorunderlying_action_accessible_via_action_getunderlying_service_accessible_via_service_getstatus_of_idle_quick_servicestart_and_stop_quick_servicecontext_isolationset_missing_name_returns_errorset_missing_cmd_returns_errorPre-existing failures (14, unrelated to quick_service)
Vec<String>deserialization issue withservice.listwrapperAll quick_service functionality verified: CRUD, env vars, dependencies, lifecycle (start/stop/status), context isolation, param validation, and underlying action/service accessibility.
Commit:
9fe0b69