feat(cli): service_routes derives commands from service operations (V8 S5) - #205
Merged
Merged
Conversation
…ted checkpoint) Checkpoint of the interrupted S5 lane before review against R26-R32. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…8 S5) cli.service_routes(Service, provide=...) builds one m.Cli.ResultCommandRoute per u.service_operations entry (kebab name, summary help, request model or the shared m.Cli.EmptyRequest); the service is built only at execution through provide, so --help builds no adapter; success renders the value; invalid input exits non-zero with the ValidationError cause. The duplicate model_commands utility and derive_model are removed (zero uses in the fleet). The test service returns models, never loose dicts (R29). Locked to flext-core 150f3c75 (S2+S3 merged). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…mes avoid base members Applying common params unwraps the settings result (the cause travels with the raised error) instead of routing a Settings result through the ResultValue-bounded exit path; next params are built by validating through CliParamsConfig, not model_copy(update=) (R22). The route test's input-less operation is named report: status is a member every FlextCliServiceBase inherits, so discovery excludes it by design; execute carries @OverRide. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
FlextCliServiceBase requires a p.Base result, so the route builder bounds services by s[p.Base] (the flext-cli service contract) instead of the bare base, whose default parameter rejected every other result model. The test service returns its Status model from execute (R29). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
FlextCliServiceBase is invariant in its result, like every generic Pydantic model, so s[Status] is not s[p.Base]. The route builder binds R: p.Base and accepts type[s[R]] with a provider of s[R], so any model-returning service resolves R exactly. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…heir cause Raising through unwrap lost the rendered cause at the CLI border (the rejected --trace without --debug exited non-zero with empty output). The failure is re-typed with r[bool].from_failure, the result API for carrying a failure across value types, and leaves through _exit_failure, which renders it and exits non-zero. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Slice S5 of plan V8 (bead flext-4jtcb.4).
Local pre-push gate GREEN on the committed head: make gen (clean tree), make audit, make check, make test (1191 passed). Runtime: real Typer app tests for valid, invalid, input-less and --help paths.
🤖 Generated with Claude Code
Summary by cubic
Adds
cli.service_routes, which derives one CLI command per service operation so aFlextCliService's public operations become the command-line interface.New Features
cli.service_routes(Service, provide=...)builds a result route peru.service_operationsentry: kebab-case name, summary as help, and the request model or the sharedm.Cli.EmptyRequest.provide, so--helpconstructs no adapter.ValidationErrorcause.model_commandsutility andderive_model(no fleet uses); required excluded fields now fail at build time with a clear error.Written for commit aafe0d7. Summary will update on new commits.