Skip to content

Resolve nested and module-default manage toggles in the Hiera data check#33

Merged
jcardozo-eth merged 4 commits into
mainfrom
feat/data-check-nested-module-toggles
Jul 23, 2026
Merged

Resolve nested and module-default manage toggles in the Hiera data check#33
jcardozo-eth merged 4 commits into
mainfrom
feat/data-check-nested-module-toggles

Conversation

@jcardozo-eth

@jcardozo-eth jcardozo-eth commented Jul 23, 2026

Copy link
Copy Markdown
Member

Closes #27.

Changes

The data check's advisory flags configuration you set that the module won't act on. It only inspected a top-level manage toggle in your own data, so two real cases slipped through: toggles nested in a sub-hash, and toggles left at the module's default.

Concretely, this used to pass silently:

# consumer data: point Docker's apt source at a mirror
rootless_gitlab_runner::packages:
  sources:
    docker:
      location: 'https://mirror.example.org/docker'

packages.sources.manage defaults to false (the module manages apt sources only when asked), so that location is never read: the mirror silently does nothing, and the check said nothing either.

Now the advisory catches it and names the exact toggle:

advisory (non-failing): 'rootless_gitlab_runner::packages': effective 'sources.manage'
is false, so the module does not enforce resources from these subkeys:
sources.docker.location (data/nodes/ci-runner.yaml) — ... a human judges intent

It resolves manage at any depth, reads each module's own defaults as the lowest-priority layer (so a toggle left at its default is still caught), and stays quiet when a subkey merely restates the default. Still non-failing; exit codes unchanged.

Verification

  • just check green (122 examples, 0 failures; docs-check PASS).
  • Two real-module fixtures (nested_default_sources, nested_self_update), mutation-checked against disabling nested descent, the module-data read, and the default comparison.
  • Script header stated-limits, the README "Validating Hiera data in CI" section, and the CHANGELOG entry updated to match.

The Hiera data-versus-surface advisory resolved a `manage` toggle only
at the top level of a parameter and only from the consumer's own data
layers. Toggles nested in a sub-hash (packages.sources.manage,
standalone.self_update.manage) and toggles left at their module default
were outside that model, so a value the module never reads produced no
advisory.

Resolve `manage` at any depth, judging each subkey against the nearest
enclosing toggle on its own path, and read each deployed module's own
data layer as the lowest-priority source so a toggle left at its default
resolves instead of being skipped. With defaults readable, a consumer
value that differs from the module default is flagged while a mere
restatement of the default is suppressed as inert.
Add two real-module fixtures and specs for the extended advisory
resolution: packages.sources.* with sources.manage left at the module
default, and standalone.self_update.* with the loop toggle at its module
default under an enclosing standalone.manage: true. Each asserts the
differing subkey is flagged and the restated default is spared;
mutation-checked against disabling nested descent, the module-data read,
and the default comparison.
Update the "Validating Hiera data in CI" advisory and stated-limits
bullets, and the CHANGELOG entry for the data check, to reflect that the
advisory now resolves a `manage` toggle wherever it sits (including
nested toggles and toggles left at their module default) and spares a
subkey that merely restates the default.
@jcardozo-eth jcardozo-eth self-assigned this Jul 23, 2026
The advisory said "effective 'manage' is false" even when the flagged
subkey sat under a nested toggle while the parent was enabled, pointing
at the wrong toggle. Name the toggle that disables each subkey
(`manage`, `sources.manage`, `self_update.manage`), emitting one line
per governing toggle so subkeys under different toggles of the same key
are each attributed correctly.
@jcardozo-eth
jcardozo-eth merged commit 4d1e2d4 into main Jul 23, 2026
3 checks passed
@jcardozo-eth jcardozo-eth added this to the 2.0.0 milestone Jul 24, 2026
@jcardozo-eth jcardozo-eth added the enhancement New feature or request label Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resolve nested and module-default manage toggles in the Hiera data check

1 participant