Skip to content

Rename main to passthrough#284

Open
RiSKeD wants to merge 1 commit intomainfrom
feat/rename-main-to-forwardArgs
Open

Rename main to passthrough#284
RiSKeD wants to merge 1 commit intomainfrom
feat/rename-main-to-forwardArgs

Conversation

@RiSKeD
Copy link
Copy Markdown
Contributor

@RiSKeD RiSKeD commented Feb 26, 2026

  • Rename the main module flag to passthrough across all Go source, tests, YAML configs, example configs, testdata, and documentation
  • "Main" implied rank rather than function; "passthrough" describes what actually happens — args pass through the command layer into that module
  • Single-word root composes cleanly in Go identifiers (HasPassthrough, ErrMultiplePassthroughModules), reads naturally in prose, and looks clean in YAML (passthrough: true)

Copilot AI review requested due to automatic review settings February 26, 2026 12:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces the previous “main module” concept with an explicit forwardArgs flag for modules that should receive forwarded runtime arguments, and introduces command-level named argument templating + improved help text generation for commands.

Changes:

  • Rename config/API semantics from mainforwardArgs across code, docs, and example configs.
  • Add command argument templating (args: + ${name} substitution) and HelpText() generation in pkg/dut.
  • Update dutagent execution to pre-resolve per-module arguments via the new ModuleArgs() logic; add/adjust tests and docs.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
pkg/module/wifisocket/wifisocket-example-cfg.yml Updates example config to use forwardArgs: true.
pkg/module/time/time-example-cfg.yml Updates example config to forwardArgs (but leaves one command without it).
pkg/module/ssh/ssh-example-cfg.yml Updates example wording + config to forwardArgs: true.
pkg/module/shell/shell-example-cfg.yml Updates example config to use forwardArgs: true.
pkg/module/serial/serial-example-cfg.yml Updates example wording + config to forwardArgs: true.
pkg/module/pdu/pdu-example-cfg.yml Updates example config to use forwardArgs: true.
pkg/module/gpio/gpio-example-cfg.yml Updates example config to use forwardArgs: true.
pkg/module/flash/flash-example-cfg.yml Updates example config to use forwardArgs: true.
pkg/module/file/file-example-cfg.yml Updates multiple example commands to use forwardArgs: true.
pkg/module/agent/README.md Updates README snippet to use forwardArgs: true.
pkg/dut/templating_test.go Adds tests for template reference extraction, validation, and substitution.
pkg/dut/templating.go Implements template validation + substitution logic for command args.
pkg/dut/dut_test.go Updates tests for new errors/flags and adds tests for ModuleArgs() and help text.
pkg/dut/dut.go Introduces forwardArgs, args: declarations, ModuleArgs(), and HelpText(); adjusts command validation + errors.
docs/dutagent-config.md Updates schema docs for forwardArgs + adds args: documentation.
docs/command-arg-templating.md Adds new documentation describing templating + forwardArgs behavior (examples currently use wrong YAML key).
contrib/dutagent-cfg-example.yaml Updates example configs to forwardArgs and demonstrates templated args: usage.
cmds/exp/contrib/config-2.yaml Updates experimental example to use forwardArgs: true.
cmds/exp/contrib/config-1.yaml Updates experimental example to use forwardArgs: true.
cmds/dutagent/states_test.go Updates dutagent tests for forwardArgs behavior and execution expectations.
cmds/dutagent/states.go Switches module execution to use precomputed cmd.ModuleArgs() results.
cmds/dutagent/rpc.go Uses cmd.HelpText() to provide Details output rather than scanning for “main”.
Comments suppressed due to low confidence (1)

pkg/module/time/time-example-cfg.yml:20

  • just-wait's time-wait module no longer has forwardArgs: true, but the command description says it should finish after the provided amount of time. With the new semantics, runtime args will be ignored unless a module is marked forwardArgs (or the command declares args: and uses templates). Update this example to either mark the module forwardArgs: true or declare a named argument (e.g., duration) and reference it via ${duration} in module args / with.
      just-wait:
        desc: "Do nothing and finish after the provided amount of time"
        uses:
          - module: time-wait


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/command-arg-templating.md Outdated
Comment thread docs/command-arg-templating.md
Comment thread docs/command-arg-templating.md
Comment thread pkg/dut/templating.go Outdated
Comment thread pkg/dut/dut_test.go Outdated
Comment thread docs/command-arg-templating.md
@jenstopp jenstopp changed the title Feat: rename main to forward args Rename main to forward args Mar 27, 2026
@jenstopp jenstopp force-pushed the feat/rename-main-to-forwardArgs branch from 61a5d42 to 43cb767 Compare April 1, 2026 14:54
@jenstopp jenstopp changed the title Rename main to forward args Rename main to passthrough Apr 1, 2026
The "main" flag on modules was misleading — it implied importance or
rank rather than describing the actual role: routing runtime arguments
to a specific module. Rename to "passthrough" across Go source, tests,
YAML configs, testdata, and documentation.

BREAKING CHANGE: The `main` YAML config key on modules is replaced by
`passthrough`. Existing config files must be updated.

Co-Authored-By: Jens Topp <jens.topp@blindspot.software>
Signed-off-by: Fabian Wienand <fabian.wienand@9elements.com>
@jenstopp jenstopp force-pushed the feat/rename-main-to-forwardArgs branch from 43cb767 to b7e0565 Compare April 12, 2026 15:12
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.

3 participants