Repository navigation
feat(behavior): the endpoint layer makes behavior commands - #845
Merged
Merged
Conversation
Step 3 of #826. A behavior's commands come from its endpoint group, as an endpoint's do, and run on the endpoint command runtime. The behavior's own Build, Call, Run and Attach go. - the endpoint generator's command writer moves to internal/controller/endpoint/gen/commandgen, beside routegen, with their shared helpers in gen/genutil; the behavior generator writes each group's gen/cli.go with it - the endpoint DSL gains an example's doc (.Example(flags, doc)), CommandNotes, and Group.CommandPath: a group attaches under the fixed segments of its prefix, such as next node - a field with a default is not a required flag; a map field is a key=value flag; a secret field says so in its help - --target is the flag of the request's hostname field, default _all, on each command instead of a global flag of next node - the endpoint command runtime gives a renderer the trace ID of its call; each behavior method renders with the behavior's result table - the generated CLI tests build their expected request with the endpoint runtime's Build, from each example's input - the second generation step is internal/behavior/gen/group: it writes each behavior's spec, routes, decoders and commands The help of each sysctl command is the same as before, but for --target, which moved from the global flags to the command's flags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #845 +/- ##
===========================================
Coverage 100.00% 100.00%
===========================================
Files 550 548 -2
Lines 30173 36538 +6365
===========================================
+ Hits 30173 36538 +6365
... and 539 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
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.
Step 3 of #826, the last: a behavior's commands come from its endpoint group and run on the endpoint command runtime. The behavior's own
Build,Call,RunandAttachare deleted.internal/controller/endpoint/gen/commandgen, next toroutegen; their shared helpers are ingen/genutil. The behavior generator writes each group'sgen/cli.gowith it. The endpoint generator's own output is unchanged..Example(flags, doc)(a# docline above the example),CommandNotes(text), andGroup.CommandPath(): a group attaches under the fixed segments of its prefix, so sysctl is undernext node. A field with adefaultis not a required flag; a map field is akey=valueflag; asecretfield says so in its help.--targetis the flag of the request'shostnamefield (default_all), on each command instead of a global flag ofnext node.command.TraceID()); each behavior method renders with the behavior's result table (command.Print).Buildfrom each example's input;commandtestfakes the endpointCaller.internal/behavior/gen/group: it writes each behavior's spec, routes, decoders and commands.Proof: the
--helpof each sysctl command, saved from main before the change, is identical except that--targetmoved from Global Flags to Flags (same text and default). sysctl's generated API and CLI tests pass; both scaffold checks and the generate check pass; lint is clean; the touched runtime packages are at 100%.The file writer and the spec writer that both generators still repeat go into shared packages in the next PR.
Specs: osapi-io/specs#355
🤖 Generated with Claude Code