Skip to content

CA-001 pilot: raise unit coverage with focused tests for 5 high-impact modules - #210

Draft
Swissystem7 with Copilot wants to merge 2 commits into
masterfrom
copilot/ca-001-raise-unit-test-coverage
Draft

Swissystem7 with Copilot wants to merge 2 commits into
masterfrom
copilot/ca-001-raise-unit-test-coverage

Conversation

Copilot AI commented Nov 2, 2026 •

Copy link
Copy Markdown

This PR advances the CA-001 pilot by increasing SmartMount unit coverage without changing runtime behavior. It adds focused tests for key low-/under-tested modules and reports coverage deltas before/after.

  • Scope: targeted coverage expansion (tests only)

    • Added test/coverage-pilot.test.js to cover five important modules:
      • tools/codecov.js
      • scripts/smoke.js
      • scripts/pr-size.js
      • scripts/sync-control-params.js
      • src/lib/sentryLoader.js
    • No production code or workflow files were modified.
  • What is now exercised

    • codecov upload non-success branches (codecov-<status>, no-upload-url)
    • smoke Chromium path resolution fallback logic
    • pr-size main() return-code behavior (0 fit / 2 invalid args path)
    • sync-control-params generator execution and emitted artifact structure
    • sentryLoader browser-global export + safe auto-init path
  • Coverage delta (full suite)

    • Before: line 97.64%, branch 89.06%, funcs 91.71%
    • After: line 97.88%, branch 89.40%, funcs 91.99%
    • Notable module lift: tools/codecov.js line coverage 57.97% → 65.22%
// example: new focused branch coverage for codecov upload flow
const postFail = await codecov.uploadReport('lcov-data', { CODECOV_TOKEN: 'token-123' }, async () => ({
  ok: false, status: 503
}));
assert.deepEqual(postFail, { ok: true, uploaded: false, reason: 'codecov-503' });

Co-authored-by: Swissystem7 <288345924+Swissystem7@users.noreply.github.com>
Copilot AI changed the title [WIP] Raise unit test coverage for SmartMount pilot CA-001 pilot: raise unit coverage with focused tests for 5 high-impact modules Nov 2, 2026
Copilot AI requested a review from Swissystem7 November 2, 2026 20:55
@Swissystem7

Copy link
Copy Markdown
Owner

חוות דעת: גוזה (Claude Team), קריאת קוד בלבד

שורה תחתונה: PR שמוסיף רק בדיקות, וזה כיוון טוב. בדיקה אחת נכשלת ב-Windows, ולכן כדאי לתקן לפני מיזוג. ה-CI עובר כי הוא רץ על Linux.

מה בדקתי: הרצתי node --test test/coverage-pilot.test.js ב-Windows (ASUS, Node 24.19): 4 עוברים ו-1 נכשל.

באג

  1. scripts/smoke findChromiumExecutable discovers default and cache paths נכשל ב-Windows (actual: null). הבדיקה מדמה את fs.existsSync עם נתיבים קבועים בסגנון POSIX ('/tmp/home/.cache/ms-playwright/...'), אבל findChromiumExecutable בונה את הנתיבים עם path.join, ולכן ב-Windows יוצאים קווים נטויים הפוכים (\tmp\home\.cache\...) ואף נתיב לא מתאים. התיקון: לבנות את הנתיבים בבדיקה עם path.join, למשל:
    const base = path.join('/tmp/home', '.cache', 'ms-playwright');
    const linuxBin = path.join(base, 'chromium-123', 'chrome-linux', 'chrome');
    ולהשוות ל-linuxBin. עוד שני דברים:
    • כדאי לדמות גם את process.env.LOCALAPPDATA, כי המיקום 'D:\Cache\ms-playwright' נבדק ראשון.
    • כדאי לשחזר את HOME כשהוא היה undefined. כרגע process.env.HOME = realHome כותב את המחרוזת "undefined".

הערות
2. הבדיקה של sync-control-params מריצה את המחולל האמיתי, והוא כותב ל-src/lib/control-params.js ול-firmware/smart_mount.ino בתוך עץ העבודה. אצלי העץ נשאר נקי, אבל אם קובץ המקור ישתנה בלי להריץ את המחולל מחדש, הרצת הבדיקות תשנה קבצים מנוהלים בשקט. עדיף להריץ את המחולל במצב --check אם יש כזה, או בתיקייה זמנית.
3. הבדיקה של sentryLoader בודקת רק שיש ייצוא ל-SM_SENTRY. השם מבטיח גם "safely auto-inits", אז כדאי להוסיף assert שלא נוצר שום Sentry/fetch ב-context.
4. pr-size main(['HEAD...HEAD', '--json']) תלוי ב-git ובהיסטוריה מקומית. זה בסדר ב-CI, אבל ייכשל ב-checkout רדוד או בלי git. אפשר לשקול t.skip כש-git לא זמין.
5. נתוני הכיסוי בתיאור הם 97.64% → 97.88% בשורות, כלומר עלייה קטנה. זה בסדר לפיילוט. tools/codecov.js עדיין רק ב-65% ושווה לחזור אליו.

לא מיזגתי, לא אישרתי ולא שיניתי קוד.

@Swissystem7 Swissystem7 mentioned this pull request Nov 3, 2026
11 of 20 tasks

This branch has not been deployed

No deployments
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.

CA-001: Raise unit test coverage (pilot)

2 participants