Skip to content

fix(toolkit): contract-address --untagged handling and stdout cleanliness (#1402)#1486

Draft
m2ux wants to merge 4 commits into
mainfrom
fix/1402-toolkit-contract-address-untagged-flag
Draft

fix(toolkit): contract-address --untagged handling and stdout cleanliness (#1402)#1486
m2ux wants to merge 4 commits into
mainfrom
fix/1402-toolkit-contract-address-untagged-flag

Conversation

@m2ux
Copy link
Copy Markdown
Contributor

@m2ux m2ux commented May 11, 2026

Summary

Align midnight-node-toolkit contract-address help output with runtime behaviour. Hide the deprecated --untagged flag from --help, move its deprecation warning from eprintln! to log::warn! so it participates in the toolkit's logging contract (RUST_LOG, --quiet, --verbose), and reject --tagged --untagged at parse time via conflicts_with. Success path now emits empty stderr, matching the show-address sister-command pattern.

🐛 Issue 📐 Engineering

Jira: PM-19934


Motivation

The toolkit contract-address command advertises an --untagged option in its --help output, but the implementation already moved to untagged-by-default. Passing --untagged emits Warning: \--untagged` flag is deprecated (now default)viaeprintln!on stderr while still returning the same address--no-flagwould have returned. Help text and runtime behaviour disagree, and the warning channel bypasses the toolkit'stracing_subscriberlogging contract — so it is not suppressible viaRUST_LOG, not gated by --quiet`, and does not pick up the standard log prefix. Downstream consumers that merge stdout/stderr observe the warning mixed in with the address.

The sister command show-address already handles its own deprecated alias (--unshielded-user-address-untagged) cleanly by pairing conflicts_with declarations on the current and deprecated flags and emitting log::warn! only when the deprecated alias is selected. This PR brings contract-address into alignment with that pattern.


Changes

Implementation (Path A — backward-compatible cleanup):

  • Mark ContractAddressArgs::untagged with hide = true so it disappears from --help while remaining parseable for existing callers
  • Add conflicts_with declarations between --tagged and --untagged so passing both is a clap parse error rather than a silent "tagged wins" outcome
  • Replace eprintln! deprecation warning with log::warn! matching the show-address idiom; the warning is now suppressible via RUST_LOG=error and picks up the standard toolkit log prefix
  • Rewrite the doc-comment on the deprecated field to explicitly state "kept for backward compatibility; will be removed in a future major version"
  • Add trycmd snapshot tests under util/toolkit/tests/cmd/ covering: (a) --help does not advertise --untagged, (b) success path emits empty stderr, (c) --untagged alone still works but logs a warning, (d) --tagged --untagged is rejected by clap
  • Add changes/toolkit/changed/contract-address-untagged-flag-cleanup.md change-file entry

The --tagged alternative output mode and the default-no-flag output are unchanged. Path B (full flag removal) was considered and rejected for this Low-priority UX bug on external-caller-risk grounds; see the linked Engineering README for the design rationale.


📌 Submission Checklist

  • Changes are backward-compatible (or flagged if breaking)
  • Pull request description explains why the change is needed
  • Self-reviewed the diff
  • I have included a change file, or skipped for this reason: [reason]
  • If the changes introduce a new feature, I have bumped the node minor version
  • Update documentation (if relevant)
  • No new todos introduced

🔱 Fork Strategy

  • Node Runtime Update
  • Node Client Update
  • Other
  • N/A

🗹 TODO before merging

  • Ready for review

Closes #1402

Initial empty commit to open a draft PR tracking work on the
toolkit `contract-address` --untagged option deprecation warning.

Refs #1402

Signed-off-by: Mike Clay <mike.clay@shielded.io>
@m2ux m2ux self-assigned this May 11, 2026
m2ux and others added 3 commits May 11, 2026 13:57
- Hide the deprecated --untagged flag from --help via `hide = true`.
- Declare --tagged and --untagged as `conflicts_with` so passing both
  is a clap parse error rather than a silent "tagged wins" outcome.
- Replace the eprintln! deprecation warning with log::warn! so it
  participates in the toolkit's logging contract (RUST_LOG, --quiet,
  --verbose), matching the show-address sister-command pattern.
- Update the inline unit test to set `untagged: false` for the tagged
  case (the field has no runtime effect under --tagged and the new
  conflict relation makes `tagged: true, untagged: true` semantically
  inconsistent at the CLI layer).

Refs: #1402

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Mike Clay <mike.clay@shielded.io>
Establish the tests/cmd/ directory (picked up by the existing trycmd
glob in tests/cli_tests.rs) and add five snapshot cases covering the
contract-address subcommand's output discipline:

- contract-address-help.toml: --help no longer advertises --untagged.
- contract-address-default.toml: no-flag path emits the bare untagged
  address on stdout and empty stderr.
- contract-address-tagged.toml: --tagged emits the tagged hex form on
  stdout and empty stderr.
- contract-address-untagged-deprecated.toml: --untagged still works
  (writes the untagged address on stdout) but emits the log::warn
  deprecation line on stderr.
- contract-address-tagged-untagged-conflict.toml: passing both flags
  is rejected by clap with exit code 2.

Refs: #1402

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Mike Clay <mike.clay@shielded.io>
…leanup (#1402)

Record the behaviour change under changes/toolkit/changed/. The slot
matches the closest precedent (audit-remove-verbose-logging.md).

Refs: #1402

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Mike Clay <mike.clay@shielded.io>
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.

[node-toolkit] contract-address command rejects --untagged option even if documented

1 participant