Skip to content

feat(commands): retire talm dmesg ahead of upstream + merge test plans#207

Merged
lexfrei merged 2 commits into
mainfrom
feat/remove-dmesg-redirect-to-logs-kernel
May 14, 2026
Merged

feat(commands): retire talm dmesg ahead of upstream + merge test plans#207
lexfrei merged 2 commits into
mainfrom
feat/remove-dmesg-redirect-to-logs-kernel

Conversation

@lexfrei
Copy link
Copy Markdown
Contributor

@lexfrei lexfrei commented May 14, 2026

Closes the dmesg footgun for good and consolidates the test plan into one file. Two independent commits in this PR; the second is pure docs refactor.

Commits

feat(commands): retire talm dmesg ahead of upstream, redirect operators to logs kernel

Upstream Talos signaled retirement of the dmesg command in siderolabs/talos#13333 ("Kernel logs are available with talosctl logs kernel which supports --tail=N, we will probably retire dmesg command"). The wrapper-side cushion for the --tail=N ParseBool footgun (#197) pointed operators at a pipe workaround that becomes obsolete the moment upstream removes the command — and logs kernel --tail=N is the better target right now anyway, because it matches the line-count semantics operators reach for.

Removes talm dmesg proactively:

  • Adds dmesg to excludedCommands in the talosctl-wrapper init so the upstream dmesg is no longer imported.
  • Replaces pkg/commands/dmesg_handler.go with a hidden cobra migration stub. Every talm dmesg ... invocation errors with "talm dmesg has been removed" + a hint pointing at talm logs kernel --tail=N --nodes <node> for the last N lines, or talm logs kernel --follow --nodes <node> to stream new messages.
  • Adds dmesg to skipConfigCommands so the migration hint fires even outside a talm project.
  • Stub is Hidden: true (drops from talm --help) and uses DisableFlagParsing: true (any operator-supplied flags pass through to RunE).

Contract pins: TestDmesgRemoved_StubSurfacesMigrationHint, TestDmesgExcludedFromTalosctlWrap, TestSkipConfigCommands/dmesg.

docs: merge apply-safety-gates checklist into the manual test plan

docs/manual-test-plan.md and docs/apply-safety-gates-test-plan.md were drifting independently. Fold the safety-gate matrix into the main plan as a new Section C-safety. Drop the separate file. Also sweep /tmp/talm-safety binary references → bare talm (assumes PATH); build instructions now use go install ./ or local build + PATH export.

Test plan

docs/manual-test-plan.md:

  • I0-1: dmesg --taillogs kernel --tail 3 in the read-only command sweep.
  • I0-1a (new): pins the dmesg-removal migration-stub UX (bare + --tail invocations error with the hint; hidden from --help; cwd-independent).
  • H2b regression anchor: dmesg | grep ephemerallogs kernel | grep ephemeral.
  • Section C-safety (new): per-gate matrix absorbed from the deleted safety doc.

Validation

  • go build ./... clean
  • go test ./... -count=1 all green
  • golangci-lint run ./... 0 issues
  • Smoke on built binary: talm dmesg --tail=3, talm dmesg --nodes 1.2.3.4, talm dmesg --help, talm dmesg outside a Chart.yaml dir — all four exit 1 with the migration hint; talm --help does not list dmesg.

Summary by CodeRabbit

  • Documentation

    • Expanded manual test plan with comprehensive safety gate validation, apply modes, and operational workflows.
    • Removed obsolete apply-safety-gates test plan.
  • Chores

    • Deprecated talm dmesg command; users should migrate to talm logs kernel for kernel log access.

lexfrei added 2 commits May 14, 2026 16:11
…rs to logs kernel

Upstream Talos signaled retirement of the `dmesg` command in
siderolabs/talos#13333 ("Kernel logs are available with
`talosctl logs kernel` which supports `--tail=N`, we will
probably retire `dmesg` command"). The current wrapper-side
cushion for the `--tail=N` ParseBool footgun points operators
at a pipe workaround that becomes obsolete the moment upstream
removes the surface — and `logs kernel --tail=N` is the better
target right now anyway, because it matches the line-count
semantics operators reach for.

Removes `talm dmesg` proactively:

- Adds `dmesg` to `excludedCommands` in the talosctl-wrapper
  init so the upstream `dmesg` command is no longer imported.
- Replaces the cushion in `pkg/commands/dmesg_handler.go` with
  a hidden migration stub. Every `talm dmesg ...` invocation
  errors with "talm dmesg has been removed" plus a hint
  pointing at `talm logs kernel --tail=N --nodes <node>` and a
  reference to siderolabs/talos#13333.
- `DisableFlagParsing` on the stub lets operator-supplied
  flags pass through to RunE so the hint surfaces regardless
  of what arguments accompanied the call.
- Adds `dmesg` to `skipConfigCommands` in main.go so the
  migration hint fires even when the operator runs the command
  outside a talm project (mirrors the init / completion
  treatment).

The stub is `Hidden: true` so operators reading `talm --help`
don't see a retired command as available. Existing scripts that
call `talm dmesg <flags>` get an immediate, actionable
migration nudge instead of a silent break on the next Talos
bump.

Contract pins (TestDmesgRemoved_StubSurfacesMigrationHint,
TestDmesgExcludedFromTalosctlWrap):
  - exactly one `dmesg` entry registered (the stub, not the
    upstream wrap),
  - stub is hidden + always-erroring,
  - error names the migration target (logs kernel + --tail).

Test plan (docs/manual-test-plan.md):
  - I0-1 read-only command sweep: `dmesg --tail` replaced with
    `logs kernel --tail 3` so the bake hits the new supported
    path.
  - I0-1a new entry pinning the migration-stub UX (both
    bare-invocation and `--tail` invocations error with the
    hint; stub is hidden from --help; cwd-independent).
  - H2b regression anchor for reset: `dmesg | grep ephemeral`
    swapped for `logs kernel | grep ephemeral`.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
Two test plans (manual-test-plan.md + apply-safety-gates-test-plan.md)
were drifting independently and the operator entry-point was
unclear: the main plan smoke-tested apply at section C and
forwarded "go read the other file" for the per-gate matrix.

Fold the safety-gate matrix into manual-test-plan.md as a new
Section C-safety placed right after the C. Apply smoke-test
section. Each Phase (1 / 2A / 2B / 2C) becomes a subsection
(### Phase X), with the Build-under-test boilerplate dropped
(already covered by the main plan's "How to use this plan"
block) and the Real-Talos-validation / Implementation-health /
Known-limitations tail sections preserved.

Also sweeps `/tmp/talm-safety` references everywhere in the
docs to bare `talm` — the binary convention assumed a personal
build path that made no sense in a public test plan. Build
instructions now point at `go install ./` or a local build with
PATH export.

The separate `docs/apply-safety-gates-test-plan.md` file is
removed via `git rm`. The cross-reference in section C and the
top-level intro line are rewritten to point at the new
in-document anchor.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 76aa96ba-39ea-43db-b644-07eac041d4e0

📥 Commits

Reviewing files that changed from the base of the PR and between fa94120 and 320768f.

📒 Files selected for processing (7)
  • docs/apply-safety-gates-test-plan.md
  • docs/manual-test-plan.md
  • main.go
  • main_test.go
  • pkg/commands/dmesg_handler.go
  • pkg/commands/talosctl_wrapper.go
  • pkg/commands/talosctl_wrapper_test.go

📝 Walkthrough

Walkthrough

This PR retires the talm dmesg command by replacing it with a hidden migration stub, updates the manual test plan with comprehensive safety gate validation matrices and current CLI examples, and removes the separate apply-safety-gates test plan. The dmesg stub bypasses config loading, always errors with migration hints to talm logs kernel, and is excluded from talosctl wrapping.

Changes

Documentation and Test Plan Updates

Layer / File(s) Summary
Apply safety gates test plan removal
docs/apply-safety-gates-test-plan.md
Removes the dedicated 254-line reference checklist covering build/test matrix, Phase 1-2 safety gate validations, Real-Talos validation, and implementation notes; content is folded into Section C-safety of the manual test plan.
Manual test plan comprehensive rewrite
docs/manual-test-plan.md
Consolidates apply-safety-gates validation into new Section C-safety with detailed per-gate matrix across Phase 1 (declared-resource existence), Phase 2A (pre-apply drift preview), Phase 2B (post-apply verification), and Phase 2C (post-upgrade version verification). Updates all command examples from prior /tmp/talm-safety references to talm binary, refreshes build/bootstrap instructions, and adds expanded coverage of secret redaction, side-patch chaining, modeline dispatch rules, orphan detection, multi-node scenarios, CA rotation, META partition operations, reset/recovery wipe modes, shell completion, overlay flag variations, and boundary case handling.

Dmesg Command Retirement and Migration Stub

Layer / File(s) Summary
Dmesg stub command definition
pkg/commands/dmesg_handler.go
Replaces the prior --tail error-rewriting wrapper with a new hidden cobra.Command that always returns an error with migration hint directing to talm logs kernel. Sets DisableFlagParsing: true to ensure the hint is surfaced regardless of flag arguments, removing the prior wrapDmesgCommand error translator.
Config loading skip and talosctl wrapper exclusion
main.go, pkg/commands/talosctl_wrapper.go
Adds dmesgSubcommandName constant to skipConfigCommands list in rootCmd.PersistentPreRunE so the stub can run outside a project root; excludes the upstream dmesg from talosctl wrapping so the talm-provided stub is the only dmesg entry in Commands.
Dmesg migration and wrapping tests
main_test.go, pkg/commands/talosctl_wrapper_test.go
Extends TestSkipConfigCommands to verify talm dmesg skips config loading; introduces TestDmesgRemoved_StubSurfacesMigrationHint to assert the stub errors with hints covering --tail and --follow variants; adds TestDmesgExcludedFromTalosctlWrap to confirm only the talm-provided stub exists in Commands and the upstream entry is excluded. Removes prior test validating --tail=<n> error rewriting.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • cozystack/talm#197: Directly connected to this PR's dmesg retirement—both modify pkg/commands/dmesg_handler.go and pkg/commands/talosctl_wrapper.go plus tests, with this PR replacing an earlier dmesg "tail ParseBool" hint wrapper with a simpler hidden migration stub.

Poem

🐰 A dmesg once lived in our CLI,
Now it whispers a gentle goodbye,
"Use logs kernel," the stub gently cries,
While test plans bloom beneath the skies,
Migration hints wing through the night! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/remove-dmesg-redirect-to-logs-kernel

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@lexfrei lexfrei marked this pull request as ready for review May 14, 2026 13:23
@lexfrei lexfrei added kind/feature Categorizes issue or PR as related to a new feature area/commands Issues or PRs related to pkg/commands (CLI subcommands, flag parsing, root detection) area/docs Documentation / README / inline help / hint copy labels May 14, 2026
@lexfrei lexfrei merged commit e8dcbc6 into main May 14, 2026
7 of 8 checks passed
@lexfrei lexfrei deleted the feat/remove-dmesg-redirect-to-logs-kernel branch May 14, 2026 13:23
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request retires the dmesg command in favor of logs kernel, aligning with upstream Talos changes. The dmesg command is replaced by a hidden stub that provides an actionable migration hint and is configured to run without requiring a project configuration. Additionally, the manual test plan is updated to reflect these changes and now includes the detailed apply-time safety gate matrix. I have no feedback to provide.

@lexfrei lexfrei self-assigned this May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/commands Issues or PRs related to pkg/commands (CLI subcommands, flag parsing, root detection) area/docs Documentation / README / inline help / hint copy kind/feature Categorizes issue or PR as related to a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant