Skip to content

feat(cli): service_routes derives commands from service operations (V8 S5) - #205

Merged
marlon-costa-dc merged 6 commits into
0.12.0-devfrom
feat/v8-s5-service-routes
Sep 26, 2026
Merged

marlon-costa-dc merged 6 commits into
0.12.0-devfrom
feat/v8-s5-service-routes

Conversation

@marlon-costa-dc

@marlon-costa-dc marlon-costa-dc commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Slice S5 of plan V8 (bead flext-4jtcb.4).

  • 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); generic in the service result (R: p.Base) because FlextCliServiceBase is invariant in it.
  • The service is built only at execution through provide: --help builds no adapter.
  • Success renders the value; invalid input exits non-zero with the ValidationError cause; common-param failures leave through the result border with their cause.
  • Duplicate model_commands utility and derive_model removed (zero fleet uses); next params built by validating through CliParamsConfig instead of model_copy(update=) (R22).
  • Locked to flext-core 150f3c75 (S2 + S3 merged).

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 a FlextCliService's public operations become the command-line interface.

New Features

  • cli.service_routes(Service, provide=...) builds a result route per u.service_operations entry: kebab-case name, summary as help, and the request model or the shared m.Cli.EmptyRequest.
  • The service is built only at execution via provide, so --help constructs no adapter.
  • Successful results render as text or JSON; rejected input exits non-zero with the ValidationError cause.
  • Removed the duplicate model_commands utility and derive_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.

Review in cubic

Marlon Costa and others added 6 commits September 26, 2026 15:30
…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>
@sonarqubecloud

Copy link
Copy Markdown

@marlon-costa-dc
marlon-costa-dc merged commit 6159084 into 0.12.0-dev Sep 26, 2026
7 of 9 checks passed
@marlon-costa-dc
marlon-costa-dc deleted the feat/v8-s5-service-routes branch September 26, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant