Skip to content

talm init --update: non-tty fails on preset template diffs (silent skip + EOF error) #174

@lexfrei

Description

@lexfrei

Motivation

talm init --update --preset cozystack is meant to refresh a project's vendored chart code so newer talm releases reach the operator. In practice it updates charts/talm/ (the talm library) silently, but for templates/_helpers.tpl and other preset-derived files it prompts:

File templates/_helpers.tpl differs from template. Overwrite? [y/N]:

In a non-tty environment (CI runner, scripted refresh, an LLM-driven session, & in the background) the read fails with failed to read user input: reading interactive overwrite confirmation: EOF and the file is left at the older version. The operator ends up with a half-updated project: talm library current, preset templates stale.

Concrete impact verified on a live v1.12.6 cluster (dev17): the chart kept emitting Layer2VIPConfig against the default-gateway link instead of the floatingIP-CIDR link from PR #163, and the floatingIP fail-fast validation from PR #163 never fired. Both were due to the preset-template overwrite being silently skipped on --update. The talm library carried the new helpers; the preset never called them.

This is the second class of "fix lands in talm, doesn't reach the operator" UX gap — the first being images shipped via Chart.yaml dependency upgrades. Worth closing.

Scope

talm init --update flags or behaviour change such that preset templates can be refreshed without an interactive prompt.

Options (not exclusive — could land more than one):

  1. --force flag that bypasses the per-file confirmation and overwrites every preset-template diff. Cheapest to add, mirrors --force in init's create path (already exists).
  2. --update defaults to non-interactive overwrite when both files are the talm-managed preset templates (not user-edited body files). Risk: silently overwrites operator local edits. Mitigation: print a one-line summary of overwritten files at the end so it's visible in non-tty output.
  3. Per-file diff output before the prompt, so operators can see what would change. Useful but doesn't fix the non-tty case.
  4. Detect non-tty and emit a single clear error like "this update refreshes preset templates which conflict with local edits; rerun under a tty, or pass --force to accept overwrites" rather than the current EOF failure mode.

I lean (1) + (4): operator gets a clear non-tty error by default, and a --force opt-in for the scripted / LLM path. (2) is the most dangerous default to flip; (3) is helpful but doesn't close the gap.

Out of scope

  • Three-way merge between operator edits and new preset templates. Useful eventually but well past the cost/benefit of an init --update polish.
  • A generic talm update command separate from talm init. Maybe later.

Tests

  • Non-tty invocation with a preset-template diff: assert it fails with a clear error message naming the offending file, not the raw EOF line.
  • Non-tty invocation with --force + a preset-template diff: assert the file is overwritten, no prompt, exit 0, summary line listing the overwritten path.
  • Existing tty path: unchanged behaviour pinned by a regression test.

Related

This surfaced during real-Talos validation of #172 / PR #173 on an OCI 3-node Talos v1.12.6 cluster. The pre-apply safety gates and #163 floatingIP fail-fast both depended on the new preset; both were latent on the test cluster until preset templates were manually overwritten.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/commandsIssues or PRs related to pkg/commands (CLI subcommands, flag parsing, root detection)kind/featureCategorizes issue or PR as related to a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions