check and fix #9
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_auth#9
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?
first check /code_manage_development_branch
then make sure that we have $servicename_ui and $servicename
the last one is the cli which uses the $servicename_sdk
check all carrefully and fix what needs to be fixed
check /hero_proc_service_selfstart
and that we cleanly start in makefile
can always learn from e.g. ../hero_redis
Implementation Spec for Issue #9 — "check and fix"
Objective
Restructure
hero_authto match the canonical Hero service pattern as demonstrated byhero_redis:hero_auth_server(the daemon),hero_auth_ui(web admin UI binary), andhero_auth(the CLI that uses the SDK).hero_auth_sdkcrate (Rust client library for the auth service).serve,start,stop,run,status,logssubcommands).start,stop,run,restart,logs,statustargets work cleanly.Current State
Cargo.tomlat root, one binaryhero_auth_server(correct for server)HeroUiServer::run()used — lifecycle subcommands already handledhero_auth_uibinaryhero_auth_sdkcratehero_authCLI binarystart/stop/run/logstargetsRequirements
hero_authto a Cargo workspace with crates:crates/hero_auth— core library (config, crypto, state, oauth logic, rpc handlers)crates/hero_auth_server— backend daemon binary (JSON-RPC on Unix socket)crates/hero_auth_ui— web admin UI binary (HTML dashboard on separate Unix socket)crates/hero_auth_sdk— Rust client library for talking tohero_auth_servercrates/hero_auth_cli— CLI binary (binary name:hero_auth), uses SDKHeroLifecyclepattern:serve,start,stop,run,status,logsbuildenv.shmust list all installable binaries:hero_auth_server hero_auth_ui hero_authstart,stop,restart,logs,logs-ui,statustargetsFiles to Modify / Create
/Volumes/T7/code0/hero_auth/Cargo.toml— Replace with workspace definition/Volumes/T7/code0/hero_auth/src/→ move tocrates/hero_auth/src/(core lib)/Volumes/T7/code0/hero_auth/crates/hero_auth_server/— New: server binary/Volumes/T7/code0/hero_auth/crates/hero_auth_sdk/— New: client SDK/Volumes/T7/code0/hero_auth/crates/hero_auth_ui/— New: web UI binary/Volumes/T7/code0/hero_auth/crates/hero_auth_cli/— New: CLI binary (name:hero_auth)/Volumes/T7/code0/hero_auth/buildenv.sh— Update BINARIES/Volumes/T7/code0/hero_auth/Makefile— Add service management targets, update to--workspaceImplementation Plan
Step 1: Workspace Conversion
Files:
Cargo.toml,crates/hero_auth/crates/hero_auth/library crate (movesrc/into it, addlib.rs)Cargo.tomlwith workspace definitionStep 2: Server Crate
Files:
crates/hero_auth_server/crates/hero_auth_server/crate depending on core libsrc/main.rslogic hereLifecycle + Servesubcommand pattern (like hero_redis_server)Step 3: SDK Crate
Files:
crates/hero_auth_sdk/HeroAuthClientwith Unix socket HTTP transportvalidate(),health(),users_list()Step 4: UI Crate
Files:
crates/hero_auth_ui/hero_auth_servervia SDK~/hero/var/sockets/hero_auth_ui.sockStep 5: CLI Crate
Files:
crates/hero_auth_cli/hero_authhealth,users list,validate <token>,start,stophero_auth_sdkStep 6: Build System
Files:
buildenv.sh,MakefileBINARIES="hero_auth_server hero_auth_ui hero_auth"start,stop,restart,run,status,logs,logs-uitargetsbuild/check/test/fmtto use--workspaceAcceptance Criteria
make buildproduceshero_auth_server,hero_auth_ui, andhero_authbinariesmake install/make installdevinstalls all three to~/hero/bin/hero_auth_server startregisters and starts via hero_prochero_auth_server stopcleanly stops ithero_auth_ui startregisters and starts via hero_prochero_auth healthreturns successful health checkmake startstarts both server and UImake stopstops both cleanlymake runstarts server in foreground (streaming logs)make statusreports hero_proc status for both servicescargo check --workspacepassesNotes
/Volumes/T7/code0/hero_redis/hero_auth_uibinary should serve on a separate Unix socket (hero_auth_ui.sock)buildenv.shBINARIES change is load-bearing forinstall_binariesinbuild_lib.shTest Results
cargo check --workspace
PASS — no errors or warnings
cargo test --workspace
test result: okImplementation Complete ✓
Changes Made
Workspace conversion — converted single-crate project to a Cargo workspace with 5 crates:
crates/hero_authcrates/hero_auth_serverhero_auth_serverhero_auth_server.sock)crates/hero_auth_sdkcrates/hero_auth_uihero_auth_uihero_auth_ui.sock)crates/hero_auth_clihero_authSelf-start/stop pattern —
hero_auth_serverandhero_auth_uiboth implementHeroLifecyclewithserve,start,stop,run,status,logssubcommands.Makefile — added
start,stop,restart,status,logs,logs-uitargets; updatedbuild,check,test,fmt,lintto use--workspace.buildenv.sh — updated
BINARIES="hero_auth_server hero_auth_ui hero_auth"somake installinstalls all three binaries to~/hero/bin/.Test Results
cargo check --workspace: ✓ PASScargo test --workspace: ✓ PASS (4 tests, 0 failures)Usage