You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3dc254a
Browse filesBrowse the repository at this point in the historyBrowse files
fix(cli): make strict mode block on unverifiable or missing drift baselines
decideDrift downgraded every check failure to a non-fatal warning even
with strictCharts enforcement on, and a missing baseline passed even
more quietly: deleting .talm-preset.lock or charts/talm/ was the
cheapest bypass of the check. Under strict, a corrupted or unreadable
baseline now aborts with a repair hint, and a missing one aborts with
a pin-the-baseline hint (via an ErrNoBaseline sentinel the checks
return); without strict the contracts are unchanged — failures degrade
to a neutral "could not check drift" warning and a missing baseline
stays silent, so pre-pinning projects are not nagged. The strict drift
error no longer carries the warning's "(or ignore if this is
intentional)" suffix, which contradicted the refusal to run. Touched
not-exist checks moved to the unwrap-tolerant errors.Is idiom.
Documented in README and the manual test plan.
Assisted-By: Claude <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -259,7 +259,7 @@ WARN: project's vendored charts/talm/ library differs from the copy built into t
259
259
260
260
The remediation needs the preset name because `talm init --update` resolves the preset from `Chart.yaml`, which an init'd project does not record — pass `--preset <your-preset>` (the one you ran `talm init` with) explicitly.
261
261
262
-
Teams that want this enforced can turn the warning into a hard error (exit 1): set `strictCharts: true` in `Chart.yaml` so the whole team and CI inherit it, or pass `--strict-charts` for a single run. Strict mode applies to every config-loading command, including read-only ones such as `talm get` — run `talm init --update --preset <preset>`, or drop the flag / unset `strictCharts`, to unblock. The check stays silent for `dev`/source builds, whose embedded charts are a moving target the developer controls.
262
+
Teams that want this enforced can turn the warning into a hard error (exit 1): set `strictCharts: true` in `Chart.yaml` so the whole team and CI inherit it, or pass `--strict-charts` for a single run. Strict mode applies to every config-loading command, including read-only ones such as `talm get` — run `talm init --update --preset <preset>`, or drop the flag / unset `strictCharts`, to unblock. Strict mode also escalates a check that cannot run at all — an unreadable `charts/talm/` or a corrupted `.talm-preset.lock` — into the same hard error, where the default behaviour degrades it to a `WARN: could not check drift` line: an unverifiable baseline passing silently would defeat the enforcement. A *missing* baseline (no `charts/talm/`, no `.talm-preset.lock`) blocks under strict for the same reason — deleting the baseline must not be a quieter bypass than corrupting it — while staying silent without strict, so projects generated before baseline pinning are not nagged. The check stays silent for `dev`/source builds, whose embedded charts are a moving target the developer controls.
263
263
264
264
### Preset drift
265
265
@@ -276,7 +276,7 @@ A release build then compares the binary's *current* preset hash against that pi
276
276
WARN: project's cozystack preset differs from the copy built into talm <version>; run `talm init --update --preset cozystack` to pull the new preset defaults (your templates/ edits are preserved via the interactive diff)
277
277
```
278
278
279
-
`talm init --update --preset <preset>` shows you an interactive diff of the new preset against your `templates/`, lets you merge what you want, and advances the baseline — which clears the warning even if you decline individual diffs to keep your customizations. `--strict-charts` / `strictCharts: true` escalate this to a hard error exactly as for the library. Projects with no `.talm-preset.lock` (generated before preset pinning) stay silent — there is no baseline to compare. Commit `.talm-preset.lock` so the baseline is shared across your team.
279
+
`talm init --update --preset <preset>` shows you an interactive diff of the new preset against your `templates/`, lets you merge what you want, and advances the baseline — which clears the warning even if you decline individual diffs to keep your customizations. `--strict-charts` / `strictCharts: true` escalate this to a hard error exactly as for the library. Projects with no `.talm-preset.lock` (generated before preset pinning) stay silent — there is no baseline to compare — unless strict mode is on, which treats a missing baseline as a blocker. Commit `.talm-preset.lock` so the baseline is shared across your team.
`init --update` rewrites `.talm-preset.lock` to the current baseline, so the warning clears even if you declined individual preset-file diffs. Expected: `OK: preset drift cleared`.
274
274
275
-
Regression anchors: `TestPresetLock_RoundTrip_NoDrift`, `TestCheckPresetDrift_StaleBaseline_Drift`, `TestCheckPresetDrift_OperatorEditedTemplates_NoDrift` (the false-positive guard), `TestCheckPresetDrift_NoLock_Silent`, and `TestEvaluatePresetDrift` pin every branch above.
275
+
Regression anchors: `TestPresetLock_RoundTrip_NoDrift`, `TestCheckPresetDrift_StaleBaseline_Drift`, `TestCheckPresetDrift_OperatorEditedTemplates_NoDrift` (the false-positive guard), `TestCheckPresetDrift_NoLock_NoBaselineSentinel`, and `TestEvaluatePresetDrift` pin every branch above.
276
276
277
277
Strict mode turns the same drift into a hard error (exit 1) raised before the command body runs. Opt in per project via `strictCharts: true` in `Chart.yaml`, or per invocation via `--strict-charts`:
Expected: exit 1, the drift message plus a hint pointing at `talm init --update --preset <preset>`, and no rendered output — the command body never runs (no modeline/render errors follow the hint).
284
284
285
+
### B5b. Drift check failure: warn by default, block under strict
286
+
287
+
A check that cannot run at all (corrupted `.talm-preset.lock`, unreadable `charts/talm/`) degrades to a non-fatal warning by default, but under strict mode it is a hard error — an unverifiable baseline silently passing would defeat the enforcement the team opted into:
288
+
289
+
```bash
290
+
printf'preset: [unclosed\n'> .talm-preset.lock
291
+
talm template -f nodes/node0.yaml --offline 2>&1>/dev/null | grep '^WARN: could not check drift';echo"exit=$?"
Expected: the first render prints `WARN: could not check drift: ...` and exits 0; the `--strict-charts` render fails (exit 1) with `drift check failed under strict mode` and a hint to repair the baseline; `init --update` rewrites a valid lock. Regression anchors: the error-path subtests of `TestEvaluateChartDrift` / `TestEvaluatePresetDrift`.
297
+
298
+
A *missing* baseline follows the same split — silent by default (projects generated before baseline pinning are not nagged), blocked under strict (deleting the baseline must not bypass enforcement):
299
+
300
+
```bash
301
+
rm .talm-preset.lock
302
+
talm template -f nodes/node0.yaml --offline 2>&1>/dev/null | grep '^WARN:';echo"exit=$?"# no WARN, exit 0 from talm
talm init --update --preset <your-preset> --force # re-pin the baseline
305
+
```
306
+
307
+
Regression anchors: the missing-baseline subtests of `TestEvaluateChartDrift` / `TestEvaluatePresetDrift`, `TestCheckChartDrift_MissingVendoredDir_NoBaselineSentinel`, `TestCheckPresetDrift_NoLock_NoBaselineSentinel`.
308
+
285
309
No-false-alarm checks — each MUST stay silent (no `WARN:` line):
286
310
287
311
- A project vendored by an older release, run under a newer binary whose `charts/talm/` is byte-identical: the version stamp differs but the content does not.
288
312
- A `dev`/source build: its embedded charts are a moving target the developer controls, so the check is a no-op.
289
313
- A freshly synced project (`talm init --update --preset <preset>`) under the matching binary.
314
+
- A vendored `charts/talm/` whose files carry CRLF line endings (a Windows clone with `core.autocrlf=true`): line endings are checkout artifacts, not content (pinned by `TestCheckChartDrift_CRLFVendoredCopy_NoDrift`).
290
315
291
316
### B6. Scope-filter symmetry across v1.11 and v1.12 renders
0 commit comments