Skip to content

Flag-bound settings keep the flag's hyphen: --dry-run binds dry-run, and the documented dry_run is never read #1011

Open

Description

@David-Noble-at-work

BindFlags binds each persistent flag to <program>.<flag name> (cmd/internal/cli/viper.go:111-113), hyphen and all, and the environment replacer turns only . into _ (viper.go:83). So --dry-run is the setting writ.dry-run, and its environment name keeps a hyphen, which a POSIX shell cannot export. The documented spelling is dry_run: schema/defaults/lore.yaml, schema/defaults/star.yaml, and the typed Config.DryRun (yaml:"dry_run", cmd/internal/config/config.go:36). A user who writes writ: {dry_run: true} gets nothing.

The owner, 2026-10-02: "we convert - to _ when mapping to environment variables and configuration setting names. the docs are right."

Every hyphenated persistent flag on the shared root is affected, on all four programs; --dry-run is the one users reach for. The model flags are #1010's, which maps them to the global model section.

Found 2026-10-02 at 01634491, checking that every program holds its own defaults (#1009). Lane 8 of #916 (#927) fixes the doubled prefix in the same function.

Resolution

A flag's name maps to its setting and its environment variable with - → _: --dry-run is dry_run, and its variable ends _DRY_RUN. A test asserts the mapping for every persistent flag.

Plan and design documents

Kind Document
Plan docs/plans/fix/927-env-prefix-doubled.md, lane 8 of #916, which takes this lane in with lane 24, #1010 (its ruling 18, 2026-10-03)
Design docs/architecture/configuration.md

Epic: #441 · Feature: #456 · Schedule: #916, lane 23, PR C, in lane 8

Activity

  1. David-Noble-at-work commented on Oct 3, 2026

    @David-Noble-at-work
    ContributorAuthor

    Joins lane 8 (#927), 2026-10-02

    The owner: "Lane 23 should join lane 8." Both change how a setting's name maps to its variable, in InitViper and BindFlags, so they land together, in PR C. Lane 8's plan carries this issue's resolution: BindFlags binds --dry-run as <program>.dry_run, the variable is WRIT_DRY_RUN, every read of writ.dry-run and lore.dry-run reads the underscored setting, and a test asserts the mapping for every persistent flag.

  2. David-Noble-at-work commented on Oct 3, 2026

    @David-Noble-at-work
    ContributorAuthor

    Goes with lane 24 (#1010), 2026-10-02

    This issue joined lane 8 earlier today, then the owner ruled the shared root's flags global settings, built in lane 24: "yes, global in lane 24", and "split confirmed". --dry-run is one of those flags, so its setting and variable are named where lane 24 binds it globally: dry_run, read from DEVLORE_DRY_RUN. The rule this issue states stands, and lane 8 applies it to the settings only one program has: a hyphen becomes _, not squeezed ("keep _").

  3. David-Noble-at-work commented on Oct 3, 2026

    @David-Noble-at-work
    ContributorAuthor

    2026-10-02: lane 8 (#927) delivered this issue's environment half. A flag-bound setting's environment variable now turns - into _: writ.dry-run reads WRIT_DRY_RUN (50e03403), and cmd/internal/cli/environment_test.go maps every persistent flag of the four programs and fails when two settings share a variable (6644c382). The setting's own key still keeps the hyphen (writ.dry-run), so the documented dry_run in the file is still not read; that half stays with lane 24 (#1010).

  4. David-Noble-at-work commented on Oct 3, 2026

    @David-Noble-at-work
    ContributorAuthor

    2026-10-03: done in lane 8, PR C, with #1026. The owner ruled: "EVERY ONE of the DEVLORE_ settings must be in config. add that task to lane 8." This issue's substance is part of that task: the shared root's flags bind global settings whose keys keep no hyphen (--dry-run binds dry_run, read from DEVLORE_DRY_RUN). Its lane on #916 now reads "PR C, in lane 8".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions