Skip to content

fix(tests): repair extension summary assertion in doctor diagnostics test#1014

Merged
Lightheartdevs merged 1 commit intoLight-Heart-Labs:mainfrom
yasinBursali:fix/doctor-extension-diagnostics-test
Apr 27, 2026
Merged

fix(tests): repair extension summary assertion in doctor diagnostics test#1014
Lightheartdevs merged 1 commit intoLight-Heart-Labs:mainfrom
yasinBursali:fix/doctor-extension-diagnostics-test

Conversation

@yasinBursali
Copy link
Copy Markdown
Contributor

What

Replaces the order-dependent regex in tests/test-doctor-extension-diagnostics.sh test #9 ("Extension summary output present") with two order-independent chained greps.

Why

The existing assertion

grep -q "ext_total.*ext_healthy" "$ROOT_DIR/scripts/dream-doctor.sh"

requires ext_total to appear first on the matched line. But scripts/dream-doctor.sh:364 emits

print(f"  Extensions:    {ext_healthy}/{ext_total} healthy, {ext_issues} with issues")

ext_healthy comes first. The grep has been permanently failing since the format was introduced; test #9 has been broken on every branch that inherits from main.

How

Switches to the chained-grep idiom already used elsewhere in the same file (test #7, lines 74–80, which checks for extensions_total, extensions_healthy, and extensions_issues):

if grep -q "ext_total" "$ROOT_DIR/scripts/dream-doctor.sh" && \
   grep -q "ext_healthy" "$ROOT_DIR/scripts/dream-doctor.sh"; then

Order-independent and future-proof against either variable being reordered in the print statement.

Testing

  • bash -n tests/test-doctor-extension-diagnostics.sh — clean
  • shellcheck tests/test-doctor-extension-diagnostics.sh — no new warnings
  • bash tests/test-doctor-extension-diagnostics.sh — all 9 tests pass (was 8/9 before this change)
  • Pre-commit (gitleaks / private-key / large-file) — clean

Platform Impact

  • macOS: passes
  • Linux: passes (CI runs on Ubuntu — confirmed via identical bash+grep semantics)
  • Windows (WSL2): not exercised — tests are Linux/macOS only

…test

tests/test-doctor-extension-diagnostics.sh test #9 used
grep -q "ext_total.*ext_healthy" which requires ext_total to appear
FIRST on a single line. But scripts/dream-doctor.sh:364 emits
"{ext_healthy}/{ext_total} healthy, {ext_issues} with issues" —
ext_healthy comes first. The test has been permanently failing since
the format was introduced.

Switches to two chained order-independent substring greps, matching
the idiom already used in the same file at test #7 (extensions_total +
extensions_healthy + extensions_issues). Future-proof against either
variable being reordered in the print statement.

All 9 tests now pass (was 8/9 before).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Lightheartdevs Lightheartdevs merged commit 1c63e52 into Light-Heart-Labs:main Apr 27, 2026
26 of 27 checks passed
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