Skip to content

cowork: scan fails loudly when no config files load (silent-green guard) - #46

Draft
Coding-Dev-Tools wants to merge 2 commits into
mainfrom
cowork/improve-configdrift-2
Draft

cowork: scan fails loudly when no config files load (silent-green guard)#46
Coding-Dev-Tools wants to merge 2 commits into
mainfrom
cowork/improve-configdrift-2

Conversation

@Coding-Dev-Tools

Copy link
Copy Markdown
Owner

Fixes a silent-failure trap in configdrift scan: if every configured environment directory was missing or empty, the CLI printed warnings and exited 0 reporting 'no drift' — a false green for CI gating.

Changes:

  • Exit 1 when zero config files could be loaded across all environment directories.
  • Exit 1 when the baseline environment loaded no config keys (diffing against an empty baseline would flag every key as drift).
  • 5 regression tests (TestScanEmptyGuards); suite: 148 passed; ruff clean.

…nt-green guard)

- exit 1 if zero config files loaded across all environment dirs
- exit 1 if baseline env loaded no keys (empty-baseline diff would flag everything)
- +5 regression tests in TestScanEmptyGuards; suite 148 passed, ruff clean
@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown

🤖 Automated Code Review

✅ Ruff Lint — No issues

⚠️ Ruff Format — Formatting needed

unformatted: File would be reformatted
   --> src/configdrift/cli.py:18:19
    |
17  |
    -     warnings.warn(
    -         "revenueholdings-license not installed; license checks skipped", stacklevel=2
    -     )
18  +     warnings.warn("revenueholdings-license not installed; license checks skipped", stacklevel=2)
19  |
--------------------------------------------------------------------------------
68  |     global _require_license_strict
    -     _require_license_strict = require_license_flag or bool(
    -         os.environ.get("REVENUEHOLDINGS_REQUIRE_LICENSE")
    -     )
69  +     _require_license_strict = require_license_flag or bool(os.environ.get("REVENUEHOLDINGS_REQUIRE_LICENSE"))
70  |     if _require_license_strict:
71  |         try:
72  |             from revenueholdings_license import require_license as _rl
73  +
74  |             _rl("configdrift")
--------------------------------------------------------------------------------
96  | _DEFAULT_STRICT = False
    - _FILES_ARG = typer.Argument(
    -     ..., help="Config files to compare (2+ files; first file is baseline)."
    - )
97  + _FILES_ARG = typer.Argument(..., help="Config files to compare (2+ files; first file is baseline).")
98  | _BASELINE_OPT = typer.Option(
--------------------------------------------------------------------------------
115 | )
    - _STRICT_OPT = typer.Option(

✅ Secret Detection — Clean

✅ Large Files — Within limits

📊 Diff Stats — 4 file(s) changed

 src/configdrift/cli.py  | 18 +++++++++++++++
 src/configdrift/diff.py | 15 ++++++++++++-
 tests/test_cli.py       | 58 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/test_diff.py      | 34 +++++++++++++++++++++++++++++
 4 files changed, 124 insertions(+), 1 deletion(-)

Verdict: ⚠️ Warnings — Lint/format issues found. Recommend fixing before merge.

Automated by Coding-Dev-Tools/.github reusable workflow.

…ype drift

Python's == treats True == 1, so a config change like 'debug: true -> debug: 1'
silently compared as no drift. _values_differ() now flags cross-type changes
(bool vs number) while same-type comparisons are unchanged.
+7 regression tests in TestTypeSensitiveComparison; suite 155 passed, ruff clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants