test(cli-app): close the branch-coverage gap and add the package to CI - #2402

Merged
aryanku-dev merged 1 commit into
masterfrom
fix/cli-app-coverage-and-ci
Sep 1, 2026
Merged

test(cli-app): close the branch-coverage gap and add the package to CI#2402
aryanku-dev merged 1 commit into
masterfrom
fix/cli-app-coverage-and-ci

Conversation

@aryanku-dev

Copy link
Copy Markdown
Contributor

Adds @percy/cli-app to CI. It was the only one of 18 packages missing from both the test.yml and windows.yml matrices, so its 81 specs have never run in CI on any platform.

Adding it as-is would have turned CI red — the package sits at 98.44% branch coverage against the repo's 100% threshold:

maestro-inject.js | 100% stmts | 98.44% branch | uncovered: 157, 273
ERROR: Coverage for branches (98.44%) does not meet global threshold (100%)

The uncovered branch is not the one it looks like

Both lines contain a log?. optional call, which is the obvious suspect. It isn't that. The gap is err.code || err.message, interpolated into the warning at maestro-inject.js:157 and the debug line at :273. Every existing spec throws an error carrying a code (EACCES, EROFS, EEXIST, ENOENT), so the err.message arm is unreachable.

Worth stating explicitly because it is a trap for the next fallback spec: adding another coded-error case moves no coverage at all.

Two specs throw codeless errors to cover it, and cli-app joins both matrices in the same commit so CI never observes a failing job.

Verification

Run the way these workflows currently do — Node 14:

Executed 83 of 83 specs SUCCESS
All files | 100 | 100 | 100 | 100
maestro-inject.js | 100 | 100 | 100 | 100
EXIT=0

Found via, but deliberately separate from, the Node 20 work

Surfaced while auditing package coverage for #2386. It is unrelated to that migration — the gap is version-agnostic and would fail identically on any Node — so it is kept off that branch rather than widening a release-bound PR.

One note for reviewers of #2386: running this same suite on master + Node 20 reports All files | 0 | 0 | 0 | 0 and still exits 0. That is the vacuous-coverage failure mode #2386 fixes, reproduced here incidentally. It is why the verification above was run on Node 14.

🤖 Generated with Claude Code

@percy/cli-app was the only one of 18 packages missing from both the test.yml
and windows.yml matrices, so its 81 specs have never run in CI on any platform.
Adding it as-is would have turned CI red: the package sits at 98.44% branch
coverage against the repo's 100% threshold.
The gap is `err.code || err.message`, interpolated into the warning at
maestro-inject.js:157 and the debug line at :273. Every existing spec throws an
error carrying a code (EACCES, EROFS, EEXIST, ENOENT), so the `err.message` arm
was unreachable — a trap for whoever writes the next fallback spec, since the
obvious reading is that the `log?.` optional call is what's uncovered.
Two specs throw codeless errors to cover it, then cli-app joins both matrices in
the same commit so CI never observes a failing job.
Verified on Node 14 (what these workflows currently run): 83/83, 100%
statements/branches/functions/lines, exit 0.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@aryanku-dev
aryanku-dev requested a review from a team as a code ownerAugust 26, 2026 20:10
@rishigupta1599

Copy link
Copy Markdown
Contributor

Claude Code PR Review

PR:#2402Head:fd29784Reviewers: stack-code-reviewer

Summary

Adds @percy/cli-app to the Linux (test.yml) and Windows (windows.yml) CI test matrices, and adds two specs to packages/cli-app/test/exec.test.js covering the err.code || err.message fallback arms in maestro-inject.js — the branch-coverage gap that kept the package out of the coverage-gated matrix. Test-and-CI only; no production code changes.

Review Table

PriorityCategoryCheckStatusNotes
HighSecurityNo hardcoded secrets or credentialsPassNo credentials introduced; diff is specs + two matrix entries.
HighSecurityAuthentication/authorization checks presentN/ANo auth surface touched.
HighSecurityInput validation and sanitizationN/ANo user input handling introduced.
HighSecurityNo IDOR — resource ownership validatedN/ANo resource access.
HighSecurityNo SQL injection (parameterized queries)N/ANo database access.
HighCorrectnessLogic is correct, handles edge casesPassBoth specs verified to reach their intended err.code || err.message arms (maestro-inject.js:157 and :273).
HighCorrectnessError handling is explicit, no swallowed exceptionsPassThe specs assert on the warn/debug payload rather than only that it was called.
HighCorrectnessNo race conditions or concurrency issuesN/ASynchronous spec additions.
MediumTestingNew code has corresponding testsPassThe change is test coverage; 81/81 specs pass locally.
MediumTestingError paths and edge cases testedPassPrecisely the intent — the codeless-error arms were previously unreachable.
MediumTestingExisting tests still pass (no regressions)PassAll 49 checks green on PR CI, including Test @percy/cli-app on Linux and Windows.
MediumPerformanceNo N+1 queries or unbounded data fetchingN/ANo data access.
MediumPerformanceLong-running tasks use background jobsN/ANot applicable.
MediumQualityFollows existing codebase patternsPassMirrors the sibling EACCES/EROFS/EEXIST specs and the file's ctxFor + jasmine.createSpy idiom.
MediumQualityChanges are focused (single concern)PassOne concern: close the gap, then enable the gate.
LowQualityMeaningful names, no dead codePassSpec names state the condition under test.
LowQualityComments explain why, not whatPassBoth specs explain why the arm was unreachable, which is the useful half.
LowQualityNo unnecessary dependencies addedPassNo dependency changes.

Findings

  • File:packages/cli-app/src/maestro-inject.js:87 (also :126, :298)

  • Severity: Low

  • Reviewer: stack-code-reviewer

  • Issue: The injection helpers gate on path.basename(args[0]) !== 'maestro'. On Windows a real Maestro invocation may resolve to maestro.exe, maestro.cmd or maestro.bat, whose basename is not the literal maestro, so all three helpers would silently no-op. Pre-existing production code, untouched by this diff — but this PR is what starts exercising the package on the Windows matrix, so it becomes newly relevant.

  • Suggestion: Strip a known executable extension before comparing (e.g. compare path.basename(args[0], path.extname(args[0]))), or match case-insensitively against maestro(\.(exe|cmd|bat))?$. Worth a follow-up ticket rather than expanding this PR.

  • File:packages/cli-app/test/exec.test.js:35

  • Severity: Low

  • Reviewer: stack-code-reviewer

  • Issue: The pre-existing spec degrades unrecognized exec options into the command (loose parsing trade-off) was observed timing out (10s Jasmine limit) on one local run under coverage instrumentation, with a toBeRejectedWithError assertion firing after the spec had already been marked failed. Untouched by this diff, and the workflows' spec-level retry (PER-9011) is designed to absorb exactly this — but the package is now gated in CI, so latent timing flakiness has somewhere to bite.

  • Suggestion: No action required for this PR. If it recurs on CI, raise the spec's timeout or make the assertion await the rejection deterministically.

Dismissed after verification

  • packages/cli-app/src/maestro-inject.js:151-154High — untested nested catch will fail the 100% lines/statements gate this PR enablesDismissed — not a coverage gap. Refuted on two independent grounds:

    1. Mechanism: that catch (_) body contains only comments — no statements, no functions — so it contributes nothing to statements/lines, and Istanbul does not instrument try/catch as a branch. The surrounding lines (const fallback = …, fs.mkdirSync(fallback, …), resolved = fallback) sit in the outer catch, which the existing EACCES/EROFS/EEXIST specs already exercise.
    2. Evidence:Test @percy/cli-apppasses on this PR's own CI, on both the Linux and Windows matrices — the very job this PR adds and the finding predicted would "fail outright". All 49 checks are green.

    Recorded here rather than dropped, since it was the reviewer's gating finding. The reviewer flagged that its local nyc run collected no coverage data (All files 0 0 0 0), so the claim rested on static analysis; I reproduced that same empty-data condition locally, which is why CI is the authority here.


Verdict: PASS — test-and-CI-only change, correctly targeted and green on CI; the two Low items are pre-existing and out of scope for this diff.

@aryanku-dev
aryanku-dev merged commit 3b55840 into masterSep 1, 2026
50 checks passed
@aryanku-dev
aryanku-dev deleted the fix/cli-app-coverage-and-ci branch September 1, 2026 14:27
Sign up for freeto 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

@aryanku-dev@rishigupta1599
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

test(cli-app): close the branch-coverage gap and add the package to CI - #2402

Merged
aryanku-dev merged 1 commit into
masterfrom
fix/cli-app-coverage-and-ci
Sep 1, 2026
Merged

test(cli-app): close the branch-coverage gap and add the package to CI#2402
aryanku-dev merged 1 commit into
masterfrom
fix/cli-app-coverage-and-ci

Conversation

@aryanku-dev

Copy link
Copy Markdown
Contributor

Adds @percy/cli-app to CI. It was the only one of 18 packages missing from both the test.yml and windows.yml matrices, so its 81 specs have never run in CI on any platform.

Adding it as-is would have turned CI red — the package sits at 98.44% branch coverage against the repo's 100% threshold:

maestro-inject.js | 100% stmts | 98.44% branch | uncovered: 157, 273
ERROR: Coverage for branches (98.44%) does not meet global threshold (100%)

The uncovered branch is not the one it looks like

Both lines contain a log?. optional call, which is the obvious suspect. It isn't that. The gap is err.code || err.message, interpolated into the warning at maestro-inject.js:157 and the debug line at :273. Every existing spec throws an error carrying a code (EACCES, EROFS, EEXIST, ENOENT), so the err.message arm is unreachable.

Worth stating explicitly because it is a trap for the next fallback spec: adding another coded-error case moves no coverage at all.

Two specs throw codeless errors to cover it, and cli-app joins both matrices in the same commit so CI never observes a failing job.

Verification

Run the way these workflows currently do — Node 14:

Executed 83 of 83 specs SUCCESS
All files | 100 | 100 | 100 | 100
maestro-inject.js | 100 | 100 | 100 | 100
EXIT=0

Found via, but deliberately separate from, the Node 20 work

Surfaced while auditing package coverage for #2386. It is unrelated to that migration — the gap is version-agnostic and would fail identically on any Node — so it is kept off that branch rather than widening a release-bound PR.

One note for reviewers of #2386: running this same suite on master + Node 20 reports All files | 0 | 0 | 0 | 0 and still exits 0. That is the vacuous-coverage failure mode #2386 fixes, reproduced here incidentally. It is why the verification above was run on Node 14.

🤖 Generated with Claude Code

@percy/cli-app was the only one of 18 packages missing from both the test.yml
and windows.yml matrices, so its 81 specs have never run in CI on any platform.
Adding it as-is would have turned CI red: the package sits at 98.44% branch
coverage against the repo's 100% threshold.
The gap is `err.code || err.message`, interpolated into the warning at
maestro-inject.js:157 and the debug line at :273. Every existing spec throws an
error carrying a code (EACCES, EROFS, EEXIST, ENOENT), so the `err.message` arm
was unreachable — a trap for whoever writes the next fallback spec, since the
obvious reading is that the `log?.` optional call is what's uncovered.
Two specs throw codeless errors to cover it, then cli-app joins both matrices in
the same commit so CI never observes a failing job.
Verified on Node 14 (what these workflows currently run): 83/83, 100%
statements/branches/functions/lines, exit 0.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@aryanku-dev
aryanku-dev requested a review from a team as a code ownerAugust 26, 2026 20:10
@rishigupta1599

Copy link
Copy Markdown
Contributor

Claude Code PR Review

PR:#2402Head:fd29784Reviewers: stack-code-reviewer

Summary

Adds @percy/cli-app to the Linux (test.yml) and Windows (windows.yml) CI test matrices, and adds two specs to packages/cli-app/test/exec.test.js covering the err.code || err.message fallback arms in maestro-inject.js — the branch-coverage gap that kept the package out of the coverage-gated matrix. Test-and-CI only; no production code changes.

Review Table

PriorityCategoryCheckStatusNotes
HighSecurityNo hardcoded secrets or credentialsPassNo credentials introduced; diff is specs + two matrix entries.
HighSecurityAuthentication/authorization checks presentN/ANo auth surface touched.
HighSecurityInput validation and sanitizationN/ANo user input handling introduced.
HighSecurityNo IDOR — resource ownership validatedN/ANo resource access.
HighSecurityNo SQL injection (parameterized queries)N/ANo database access.
HighCorrectnessLogic is correct, handles edge casesPassBoth specs verified to reach their intended err.code || err.message arms (maestro-inject.js:157 and :273).
HighCorrectnessError handling is explicit, no swallowed exceptionsPassThe specs assert on the warn/debug payload rather than only that it was called.
HighCorrectnessNo race conditions or concurrency issuesN/ASynchronous spec additions.
MediumTestingNew code has corresponding testsPassThe change is test coverage; 81/81 specs pass locally.
MediumTestingError paths and edge cases testedPassPrecisely the intent — the codeless-error arms were previously unreachable.
MediumTestingExisting tests still pass (no regressions)PassAll 49 checks green on PR CI, including Test @percy/cli-app on Linux and Windows.
MediumPerformanceNo N+1 queries or unbounded data fetchingN/ANo data access.
MediumPerformanceLong-running tasks use background jobsN/ANot applicable.
MediumQualityFollows existing codebase patternsPassMirrors the sibling EACCES/EROFS/EEXIST specs and the file's ctxFor + jasmine.createSpy idiom.
MediumQualityChanges are focused (single concern)PassOne concern: close the gap, then enable the gate.
LowQualityMeaningful names, no dead codePassSpec names state the condition under test.
LowQualityComments explain why, not whatPassBoth specs explain why the arm was unreachable, which is the useful half.
LowQualityNo unnecessary dependencies addedPassNo dependency changes.

Findings

  • File:packages/cli-app/src/maestro-inject.js:87 (also :126, :298)

  • Severity: Low

  • Reviewer: stack-code-reviewer

  • Issue: The injection helpers gate on path.basename(args[0]) !== 'maestro'. On Windows a real Maestro invocation may resolve to maestro.exe, maestro.cmd or maestro.bat, whose basename is not the literal maestro, so all three helpers would silently no-op. Pre-existing production code, untouched by this diff — but this PR is what starts exercising the package on the Windows matrix, so it becomes newly relevant.

  • Suggestion: Strip a known executable extension before comparing (e.g. compare path.basename(args[0], path.extname(args[0]))), or match case-insensitively against maestro(\.(exe|cmd|bat))?$. Worth a follow-up ticket rather than expanding this PR.

  • File:packages/cli-app/test/exec.test.js:35

  • Severity: Low

  • Reviewer: stack-code-reviewer

  • Issue: The pre-existing spec degrades unrecognized exec options into the command (loose parsing trade-off) was observed timing out (10s Jasmine limit) on one local run under coverage instrumentation, with a toBeRejectedWithError assertion firing after the spec had already been marked failed. Untouched by this diff, and the workflows' spec-level retry (PER-9011) is designed to absorb exactly this — but the package is now gated in CI, so latent timing flakiness has somewhere to bite.

  • Suggestion: No action required for this PR. If it recurs on CI, raise the spec's timeout or make the assertion await the rejection deterministically.

Dismissed after verification

  • packages/cli-app/src/maestro-inject.js:151-154High — untested nested catch will fail the 100% lines/statements gate this PR enablesDismissed — not a coverage gap. Refuted on two independent grounds:

    1. Mechanism: that catch (_) body contains only comments — no statements, no functions — so it contributes nothing to statements/lines, and Istanbul does not instrument try/catch as a branch. The surrounding lines (const fallback = …, fs.mkdirSync(fallback, …), resolved = fallback) sit in the outer catch, which the existing EACCES/EROFS/EEXIST specs already exercise.
    2. Evidence:Test @percy/cli-apppasses on this PR's own CI, on both the Linux and Windows matrices — the very job this PR adds and the finding predicted would "fail outright". All 49 checks are green.

    Recorded here rather than dropped, since it was the reviewer's gating finding. The reviewer flagged that its local nyc run collected no coverage data (All files 0 0 0 0), so the claim rested on static analysis; I reproduced that same empty-data condition locally, which is why CI is the authority here.


Verdict: PASS — test-and-CI-only change, correctly targeted and green on CI; the two Low items are pre-existing and out of scope for this diff.

@aryanku-dev
aryanku-dev merged commit 3b55840 into masterSep 1, 2026
50 checks passed
@aryanku-dev
aryanku-dev deleted the fix/cli-app-coverage-and-ci branch September 1, 2026 14:27
Sign up for freeto 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

@aryanku-dev@rishigupta1599
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

test(cli-app): close the branch-coverage gap and add the package to CI - #2402

Merged
aryanku-dev merged 1 commit into
masterfrom
fix/cli-app-coverage-and-ci
Sep 1, 2026
Merged

test(cli-app): close the branch-coverage gap and add the package to CI#2402
aryanku-dev merged 1 commit into
masterfrom
fix/cli-app-coverage-and-ci

Conversation

@aryanku-dev

Copy link
Copy Markdown
Contributor

Adds @percy/cli-app to CI. It was the only one of 18 packages missing from both the test.yml and windows.yml matrices, so its 81 specs have never run in CI on any platform.

Adding it as-is would have turned CI red — the package sits at 98.44% branch coverage against the repo's 100% threshold:

maestro-inject.js | 100% stmts | 98.44% branch | uncovered: 157, 273
ERROR: Coverage for branches (98.44%) does not meet global threshold (100%)

The uncovered branch is not the one it looks like

Both lines contain a log?. optional call, which is the obvious suspect. It isn't that. The gap is err.code || err.message, interpolated into the warning at maestro-inject.js:157 and the debug line at :273. Every existing spec throws an error carrying a code (EACCES, EROFS, EEXIST, ENOENT), so the err.message arm is unreachable.

Worth stating explicitly because it is a trap for the next fallback spec: adding another coded-error case moves no coverage at all.

Two specs throw codeless errors to cover it, and cli-app joins both matrices in the same commit so CI never observes a failing job.

Verification

Run the way these workflows currently do — Node 14:

Executed 83 of 83 specs SUCCESS
All files | 100 | 100 | 100 | 100
maestro-inject.js | 100 | 100 | 100 | 100
EXIT=0

Found via, but deliberately separate from, the Node 20 work

Surfaced while auditing package coverage for #2386. It is unrelated to that migration — the gap is version-agnostic and would fail identically on any Node — so it is kept off that branch rather than widening a release-bound PR.

One note for reviewers of #2386: running this same suite on master + Node 20 reports All files | 0 | 0 | 0 | 0 and still exits 0. That is the vacuous-coverage failure mode #2386 fixes, reproduced here incidentally. It is why the verification above was run on Node 14.

🤖 Generated with Claude Code

@percy/cli-app was the only one of 18 packages missing from both the test.yml
and windows.yml matrices, so its 81 specs have never run in CI on any platform.
Adding it as-is would have turned CI red: the package sits at 98.44% branch
coverage against the repo's 100% threshold.
The gap is `err.code || err.message`, interpolated into the warning at
maestro-inject.js:157 and the debug line at :273. Every existing spec throws an
error carrying a code (EACCES, EROFS, EEXIST, ENOENT), so the `err.message` arm
was unreachable — a trap for whoever writes the next fallback spec, since the
obvious reading is that the `log?.` optional call is what's uncovered.
Two specs throw codeless errors to cover it, then cli-app joins both matrices in
the same commit so CI never observes a failing job.
Verified on Node 14 (what these workflows currently run): 83/83, 100%
statements/branches/functions/lines, exit 0.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@aryanku-dev
aryanku-dev requested a review from a team as a code ownerAugust 26, 2026 20:10
@rishigupta1599

Copy link
Copy Markdown
Contributor

Claude Code PR Review

PR:#2402Head:fd29784Reviewers: stack-code-reviewer

Summary

Adds @percy/cli-app to the Linux (test.yml) and Windows (windows.yml) CI test matrices, and adds two specs to packages/cli-app/test/exec.test.js covering the err.code || err.message fallback arms in maestro-inject.js — the branch-coverage gap that kept the package out of the coverage-gated matrix. Test-and-CI only; no production code changes.

Review Table

PriorityCategoryCheckStatusNotes
HighSecurityNo hardcoded secrets or credentialsPassNo credentials introduced; diff is specs + two matrix entries.
HighSecurityAuthentication/authorization checks presentN/ANo auth surface touched.
HighSecurityInput validation and sanitizationN/ANo user input handling introduced.
HighSecurityNo IDOR — resource ownership validatedN/ANo resource access.
HighSecurityNo SQL injection (parameterized queries)N/ANo database access.
HighCorrectnessLogic is correct, handles edge casesPassBoth specs verified to reach their intended err.code || err.message arms (maestro-inject.js:157 and :273).
HighCorrectnessError handling is explicit, no swallowed exceptionsPassThe specs assert on the warn/debug payload rather than only that it was called.
HighCorrectnessNo race conditions or concurrency issuesN/ASynchronous spec additions.
MediumTestingNew code has corresponding testsPassThe change is test coverage; 81/81 specs pass locally.
MediumTestingError paths and edge cases testedPassPrecisely the intent — the codeless-error arms were previously unreachable.
MediumTestingExisting tests still pass (no regressions)PassAll 49 checks green on PR CI, including Test @percy/cli-app on Linux and Windows.
MediumPerformanceNo N+1 queries or unbounded data fetchingN/ANo data access.
MediumPerformanceLong-running tasks use background jobsN/ANot applicable.
MediumQualityFollows existing codebase patternsPassMirrors the sibling EACCES/EROFS/EEXIST specs and the file's ctxFor + jasmine.createSpy idiom.
MediumQualityChanges are focused (single concern)PassOne concern: close the gap, then enable the gate.
LowQualityMeaningful names, no dead codePassSpec names state the condition under test.
LowQualityComments explain why, not whatPassBoth specs explain why the arm was unreachable, which is the useful half.
LowQualityNo unnecessary dependencies addedPassNo dependency changes.

Findings

  • File:packages/cli-app/src/maestro-inject.js:87 (also :126, :298)

  • Severity: Low

  • Reviewer: stack-code-reviewer

  • Issue: The injection helpers gate on path.basename(args[0]) !== 'maestro'. On Windows a real Maestro invocation may resolve to maestro.exe, maestro.cmd or maestro.bat, whose basename is not the literal maestro, so all three helpers would silently no-op. Pre-existing production code, untouched by this diff — but this PR is what starts exercising the package on the Windows matrix, so it becomes newly relevant.

  • Suggestion: Strip a known executable extension before comparing (e.g. compare path.basename(args[0], path.extname(args[0]))), or match case-insensitively against maestro(\.(exe|cmd|bat))?$. Worth a follow-up ticket rather than expanding this PR.

  • File:packages/cli-app/test/exec.test.js:35

  • Severity: Low

  • Reviewer: stack-code-reviewer

  • Issue: The pre-existing spec degrades unrecognized exec options into the command (loose parsing trade-off) was observed timing out (10s Jasmine limit) on one local run under coverage instrumentation, with a toBeRejectedWithError assertion firing after the spec had already been marked failed. Untouched by this diff, and the workflows' spec-level retry (PER-9011) is designed to absorb exactly this — but the package is now gated in CI, so latent timing flakiness has somewhere to bite.

  • Suggestion: No action required for this PR. If it recurs on CI, raise the spec's timeout or make the assertion await the rejection deterministically.

Dismissed after verification

  • packages/cli-app/src/maestro-inject.js:151-154High — untested nested catch will fail the 100% lines/statements gate this PR enablesDismissed — not a coverage gap. Refuted on two independent grounds:

    1. Mechanism: that catch (_) body contains only comments — no statements, no functions — so it contributes nothing to statements/lines, and Istanbul does not instrument try/catch as a branch. The surrounding lines (const fallback = …, fs.mkdirSync(fallback, …), resolved = fallback) sit in the outer catch, which the existing EACCES/EROFS/EEXIST specs already exercise.
    2. Evidence:Test @percy/cli-apppasses on this PR's own CI, on both the Linux and Windows matrices — the very job this PR adds and the finding predicted would "fail outright". All 49 checks are green.

    Recorded here rather than dropped, since it was the reviewer's gating finding. The reviewer flagged that its local nyc run collected no coverage data (All files 0 0 0 0), so the claim rested on static analysis; I reproduced that same empty-data condition locally, which is why CI is the authority here.


Verdict: PASS — test-and-CI-only change, correctly targeted and green on CI; the two Low items are pre-existing and out of scope for this diff.

@aryanku-dev
aryanku-dev merged commit 3b55840 into masterSep 1, 2026
50 checks passed
@aryanku-dev
aryanku-dev deleted the fix/cli-app-coverage-and-ci branch September 1, 2026 14:27
Sign up for freeto 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

@aryanku-dev@rishigupta1599
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

test(cli-app): close the branch-coverage gap and add the package to CI - #2402

Merged
aryanku-dev merged 1 commit into
masterfrom
fix/cli-app-coverage-and-ci
Sep 1, 2026
Merged

test(cli-app): close the branch-coverage gap and add the package to CI#2402
aryanku-dev merged 1 commit into
masterfrom
fix/cli-app-coverage-and-ci

Conversation

@aryanku-dev

Copy link
Copy Markdown
Contributor

Adds @percy/cli-app to CI. It was the only one of 18 packages missing from both the test.yml and windows.yml matrices, so its 81 specs have never run in CI on any platform.

Adding it as-is would have turned CI red — the package sits at 98.44% branch coverage against the repo's 100% threshold:

maestro-inject.js | 100% stmts | 98.44% branch | uncovered: 157, 273
ERROR: Coverage for branches (98.44%) does not meet global threshold (100%)

The uncovered branch is not the one it looks like

Both lines contain a log?. optional call, which is the obvious suspect. It isn't that. The gap is err.code || err.message, interpolated into the warning at maestro-inject.js:157 and the debug line at :273. Every existing spec throws an error carrying a code (EACCES, EROFS, EEXIST, ENOENT), so the err.message arm is unreachable.

Worth stating explicitly because it is a trap for the next fallback spec: adding another coded-error case moves no coverage at all.

Two specs throw codeless errors to cover it, and cli-app joins both matrices in the same commit so CI never observes a failing job.

Verification

Run the way these workflows currently do — Node 14:

Executed 83 of 83 specs SUCCESS
All files | 100 | 100 | 100 | 100
maestro-inject.js | 100 | 100 | 100 | 100
EXIT=0

Found via, but deliberately separate from, the Node 20 work

Surfaced while auditing package coverage for #2386. It is unrelated to that migration — the gap is version-agnostic and would fail identically on any Node — so it is kept off that branch rather than widening a release-bound PR.

One note for reviewers of #2386: running this same suite on master + Node 20 reports All files | 0 | 0 | 0 | 0 and still exits 0. That is the vacuous-coverage failure mode #2386 fixes, reproduced here incidentally. It is why the verification above was run on Node 14.

🤖 Generated with Claude Code

@percy/cli-app was the only one of 18 packages missing from both the test.yml
and windows.yml matrices, so its 81 specs have never run in CI on any platform.
Adding it as-is would have turned CI red: the package sits at 98.44% branch
coverage against the repo's 100% threshold.
The gap is `err.code || err.message`, interpolated into the warning at
maestro-inject.js:157 and the debug line at :273. Every existing spec throws an
error carrying a code (EACCES, EROFS, EEXIST, ENOENT), so the `err.message` arm
was unreachable — a trap for whoever writes the next fallback spec, since the
obvious reading is that the `log?.` optional call is what's uncovered.
Two specs throw codeless errors to cover it, then cli-app joins both matrices in
the same commit so CI never observes a failing job.
Verified on Node 14 (what these workflows currently run): 83/83, 100%
statements/branches/functions/lines, exit 0.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@aryanku-dev
aryanku-dev requested a review from a team as a code ownerAugust 26, 2026 20:10
@rishigupta1599

Copy link
Copy Markdown
Contributor

Claude Code PR Review

PR:#2402Head:fd29784Reviewers: stack-code-reviewer

Summary

Adds @percy/cli-app to the Linux (test.yml) and Windows (windows.yml) CI test matrices, and adds two specs to packages/cli-app/test/exec.test.js covering the err.code || err.message fallback arms in maestro-inject.js — the branch-coverage gap that kept the package out of the coverage-gated matrix. Test-and-CI only; no production code changes.

Review Table

PriorityCategoryCheckStatusNotes
HighSecurityNo hardcoded secrets or credentialsPassNo credentials introduced; diff is specs + two matrix entries.
HighSecurityAuthentication/authorization checks presentN/ANo auth surface touched.
HighSecurityInput validation and sanitizationN/ANo user input handling introduced.
HighSecurityNo IDOR — resource ownership validatedN/ANo resource access.
HighSecurityNo SQL injection (parameterized queries)N/ANo database access.
HighCorrectnessLogic is correct, handles edge casesPassBoth specs verified to reach their intended err.code || err.message arms (maestro-inject.js:157 and :273).
HighCorrectnessError handling is explicit, no swallowed exceptionsPassThe specs assert on the warn/debug payload rather than only that it was called.
HighCorrectnessNo race conditions or concurrency issuesN/ASynchronous spec additions.
MediumTestingNew code has corresponding testsPassThe change is test coverage; 81/81 specs pass locally.
MediumTestingError paths and edge cases testedPassPrecisely the intent — the codeless-error arms were previously unreachable.
MediumTestingExisting tests still pass (no regressions)PassAll 49 checks green on PR CI, including Test @percy/cli-app on Linux and Windows.
MediumPerformanceNo N+1 queries or unbounded data fetchingN/ANo data access.
MediumPerformanceLong-running tasks use background jobsN/ANot applicable.
MediumQualityFollows existing codebase patternsPassMirrors the sibling EACCES/EROFS/EEXIST specs and the file's ctxFor + jasmine.createSpy idiom.
MediumQualityChanges are focused (single concern)PassOne concern: close the gap, then enable the gate.
LowQualityMeaningful names, no dead codePassSpec names state the condition under test.
LowQualityComments explain why, not whatPassBoth specs explain why the arm was unreachable, which is the useful half.
LowQualityNo unnecessary dependencies addedPassNo dependency changes.

Findings

  • File:packages/cli-app/src/maestro-inject.js:87 (also :126, :298)

  • Severity: Low

  • Reviewer: stack-code-reviewer

  • Issue: The injection helpers gate on path.basename(args[0]) !== 'maestro'. On Windows a real Maestro invocation may resolve to maestro.exe, maestro.cmd or maestro.bat, whose basename is not the literal maestro, so all three helpers would silently no-op. Pre-existing production code, untouched by this diff — but this PR is what starts exercising the package on the Windows matrix, so it becomes newly relevant.

  • Suggestion: Strip a known executable extension before comparing (e.g. compare path.basename(args[0], path.extname(args[0]))), or match case-insensitively against maestro(\.(exe|cmd|bat))?$. Worth a follow-up ticket rather than expanding this PR.

  • File:packages/cli-app/test/exec.test.js:35

  • Severity: Low

  • Reviewer: stack-code-reviewer

  • Issue: The pre-existing spec degrades unrecognized exec options into the command (loose parsing trade-off) was observed timing out (10s Jasmine limit) on one local run under coverage instrumentation, with a toBeRejectedWithError assertion firing after the spec had already been marked failed. Untouched by this diff, and the workflows' spec-level retry (PER-9011) is designed to absorb exactly this — but the package is now gated in CI, so latent timing flakiness has somewhere to bite.

  • Suggestion: No action required for this PR. If it recurs on CI, raise the spec's timeout or make the assertion await the rejection deterministically.

Dismissed after verification

  • packages/cli-app/src/maestro-inject.js:151-154High — untested nested catch will fail the 100% lines/statements gate this PR enablesDismissed — not a coverage gap. Refuted on two independent grounds:

    1. Mechanism: that catch (_) body contains only comments — no statements, no functions — so it contributes nothing to statements/lines, and Istanbul does not instrument try/catch as a branch. The surrounding lines (const fallback = …, fs.mkdirSync(fallback, …), resolved = fallback) sit in the outer catch, which the existing EACCES/EROFS/EEXIST specs already exercise.
    2. Evidence:Test @percy/cli-apppasses on this PR's own CI, on both the Linux and Windows matrices — the very job this PR adds and the finding predicted would "fail outright". All 49 checks are green.

    Recorded here rather than dropped, since it was the reviewer's gating finding. The reviewer flagged that its local nyc run collected no coverage data (All files 0 0 0 0), so the claim rested on static analysis; I reproduced that same empty-data condition locally, which is why CI is the authority here.


Verdict: PASS — test-and-CI-only change, correctly targeted and green on CI; the two Low items are pre-existing and out of scope for this diff.

@aryanku-dev
aryanku-dev merged commit 3b55840 into masterSep 1, 2026
50 checks passed
@aryanku-dev
aryanku-dev deleted the fix/cli-app-coverage-and-ci branch September 1, 2026 14:27
Sign up for freeto 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

@aryanku-dev@rishigupta1599
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

test(cli-app): close the branch-coverage gap and add the package to CI - #2402

Merged
aryanku-dev merged 1 commit into
masterfrom
fix/cli-app-coverage-and-ci
Sep 1, 2026
Merged

test(cli-app): close the branch-coverage gap and add the package to CI#2402
aryanku-dev merged 1 commit into
masterfrom
fix/cli-app-coverage-and-ci

Conversation

@aryanku-dev

Copy link
Copy Markdown
Contributor

Adds @percy/cli-app to CI. It was the only one of 18 packages missing from both the test.yml and windows.yml matrices, so its 81 specs have never run in CI on any platform.

Adding it as-is would have turned CI red — the package sits at 98.44% branch coverage against the repo's 100% threshold:

maestro-inject.js | 100% stmts | 98.44% branch | uncovered: 157, 273
ERROR: Coverage for branches (98.44%) does not meet global threshold (100%)

The uncovered branch is not the one it looks like

Both lines contain a log?. optional call, which is the obvious suspect. It isn't that. The gap is err.code || err.message, interpolated into the warning at maestro-inject.js:157 and the debug line at :273. Every existing spec throws an error carrying a code (EACCES, EROFS, EEXIST, ENOENT), so the err.message arm is unreachable.

Worth stating explicitly because it is a trap for the next fallback spec: adding another coded-error case moves no coverage at all.

Two specs throw codeless errors to cover it, and cli-app joins both matrices in the same commit so CI never observes a failing job.

Verification

Run the way these workflows currently do — Node 14:

Executed 83 of 83 specs SUCCESS
All files | 100 | 100 | 100 | 100
maestro-inject.js | 100 | 100 | 100 | 100
EXIT=0

Found via, but deliberately separate from, the Node 20 work

Surfaced while auditing package coverage for #2386. It is unrelated to that migration — the gap is version-agnostic and would fail identically on any Node — so it is kept off that branch rather than widening a release-bound PR.

One note for reviewers of #2386: running this same suite on master + Node 20 reports All files | 0 | 0 | 0 | 0 and still exits 0. That is the vacuous-coverage failure mode #2386 fixes, reproduced here incidentally. It is why the verification above was run on Node 14.

🤖 Generated with Claude Code

@percy/cli-app was the only one of 18 packages missing from both the test.yml
and windows.yml matrices, so its 81 specs have never run in CI on any platform.
Adding it as-is would have turned CI red: the package sits at 98.44% branch
coverage against the repo's 100% threshold.
The gap is `err.code || err.message`, interpolated into the warning at
maestro-inject.js:157 and the debug line at :273. Every existing spec throws an
error carrying a code (EACCES, EROFS, EEXIST, ENOENT), so the `err.message` arm
was unreachable — a trap for whoever writes the next fallback spec, since the
obvious reading is that the `log?.` optional call is what's uncovered.
Two specs throw codeless errors to cover it, then cli-app joins both matrices in
the same commit so CI never observes a failing job.
Verified on Node 14 (what these workflows currently run): 83/83, 100%
statements/branches/functions/lines, exit 0.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@aryanku-dev
aryanku-dev requested a review from a team as a code ownerAugust 26, 2026 20:10
@rishigupta1599

Copy link
Copy Markdown
Contributor

Claude Code PR Review

PR:#2402Head:fd29784Reviewers: stack-code-reviewer

Summary

Adds @percy/cli-app to the Linux (test.yml) and Windows (windows.yml) CI test matrices, and adds two specs to packages/cli-app/test/exec.test.js covering the err.code || err.message fallback arms in maestro-inject.js — the branch-coverage gap that kept the package out of the coverage-gated matrix. Test-and-CI only; no production code changes.

Review Table

PriorityCategoryCheckStatusNotes
HighSecurityNo hardcoded secrets or credentialsPassNo credentials introduced; diff is specs + two matrix entries.
HighSecurityAuthentication/authorization checks presentN/ANo auth surface touched.
HighSecurityInput validation and sanitizationN/ANo user input handling introduced.
HighSecurityNo IDOR — resource ownership validatedN/ANo resource access.
HighSecurityNo SQL injection (parameterized queries)N/ANo database access.
HighCorrectnessLogic is correct, handles edge casesPassBoth specs verified to reach their intended err.code || err.message arms (maestro-inject.js:157 and :273).
HighCorrectnessError handling is explicit, no swallowed exceptionsPassThe specs assert on the warn/debug payload rather than only that it was called.
HighCorrectnessNo race conditions or concurrency issuesN/ASynchronous spec additions.
MediumTestingNew code has corresponding testsPassThe change is test coverage; 81/81 specs pass locally.
MediumTestingError paths and edge cases testedPassPrecisely the intent — the codeless-error arms were previously unreachable.
MediumTestingExisting tests still pass (no regressions)PassAll 49 checks green on PR CI, including Test @percy/cli-app on Linux and Windows.
MediumPerformanceNo N+1 queries or unbounded data fetchingN/ANo data access.
MediumPerformanceLong-running tasks use background jobsN/ANot applicable.
MediumQualityFollows existing codebase patternsPassMirrors the sibling EACCES/EROFS/EEXIST specs and the file's ctxFor + jasmine.createSpy idiom.
MediumQualityChanges are focused (single concern)PassOne concern: close the gap, then enable the gate.
LowQualityMeaningful names, no dead codePassSpec names state the condition under test.
LowQualityComments explain why, not whatPassBoth specs explain why the arm was unreachable, which is the useful half.
LowQualityNo unnecessary dependencies addedPassNo dependency changes.

Findings

  • File:packages/cli-app/src/maestro-inject.js:87 (also :126, :298)

  • Severity: Low

  • Reviewer: stack-code-reviewer

  • Issue: The injection helpers gate on path.basename(args[0]) !== 'maestro'. On Windows a real Maestro invocation may resolve to maestro.exe, maestro.cmd or maestro.bat, whose basename is not the literal maestro, so all three helpers would silently no-op. Pre-existing production code, untouched by this diff — but this PR is what starts exercising the package on the Windows matrix, so it becomes newly relevant.

  • Suggestion: Strip a known executable extension before comparing (e.g. compare path.basename(args[0], path.extname(args[0]))), or match case-insensitively against maestro(\.(exe|cmd|bat))?$. Worth a follow-up ticket rather than expanding this PR.

  • File:packages/cli-app/test/exec.test.js:35

  • Severity: Low

  • Reviewer: stack-code-reviewer

  • Issue: The pre-existing spec degrades unrecognized exec options into the command (loose parsing trade-off) was observed timing out (10s Jasmine limit) on one local run under coverage instrumentation, with a toBeRejectedWithError assertion firing after the spec had already been marked failed. Untouched by this diff, and the workflows' spec-level retry (PER-9011) is designed to absorb exactly this — but the package is now gated in CI, so latent timing flakiness has somewhere to bite.

  • Suggestion: No action required for this PR. If it recurs on CI, raise the spec's timeout or make the assertion await the rejection deterministically.

Dismissed after verification

  • packages/cli-app/src/maestro-inject.js:151-154High — untested nested catch will fail the 100% lines/statements gate this PR enablesDismissed — not a coverage gap. Refuted on two independent grounds:

    1. Mechanism: that catch (_) body contains only comments — no statements, no functions — so it contributes nothing to statements/lines, and Istanbul does not instrument try/catch as a branch. The surrounding lines (const fallback = …, fs.mkdirSync(fallback, …), resolved = fallback) sit in the outer catch, which the existing EACCES/EROFS/EEXIST specs already exercise.
    2. Evidence:Test @percy/cli-apppasses on this PR's own CI, on both the Linux and Windows matrices — the very job this PR adds and the finding predicted would "fail outright". All 49 checks are green.

    Recorded here rather than dropped, since it was the reviewer's gating finding. The reviewer flagged that its local nyc run collected no coverage data (All files 0 0 0 0), so the claim rested on static analysis; I reproduced that same empty-data condition locally, which is why CI is the authority here.


Verdict: PASS — test-and-CI-only change, correctly targeted and green on CI; the two Low items are pre-existing and out of scope for this diff.

@aryanku-dev
aryanku-dev merged commit 3b55840 into masterSep 1, 2026
50 checks passed
@aryanku-dev
aryanku-dev deleted the fix/cli-app-coverage-and-ci branch September 1, 2026 14:27
Sign up for freeto 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

@aryanku-dev@rishigupta1599
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

test(cli-app): close the branch-coverage gap and add the package to CI - #2402

Merged
aryanku-dev merged 1 commit into
masterfrom
fix/cli-app-coverage-and-ci
Sep 1, 2026
Merged

test(cli-app): close the branch-coverage gap and add the package to CI#2402
aryanku-dev merged 1 commit into
masterfrom
fix/cli-app-coverage-and-ci

Conversation

@aryanku-dev

Copy link
Copy Markdown
Contributor

Adds @percy/cli-app to CI. It was the only one of 18 packages missing from both the test.yml and windows.yml matrices, so its 81 specs have never run in CI on any platform.

Adding it as-is would have turned CI red — the package sits at 98.44% branch coverage against the repo's 100% threshold:

maestro-inject.js | 100% stmts | 98.44% branch | uncovered: 157, 273
ERROR: Coverage for branches (98.44%) does not meet global threshold (100%)

The uncovered branch is not the one it looks like

Both lines contain a log?. optional call, which is the obvious suspect. It isn't that. The gap is err.code || err.message, interpolated into the warning at maestro-inject.js:157 and the debug line at :273. Every existing spec throws an error carrying a code (EACCES, EROFS, EEXIST, ENOENT), so the err.message arm is unreachable.

Worth stating explicitly because it is a trap for the next fallback spec: adding another coded-error case moves no coverage at all.

Two specs throw codeless errors to cover it, and cli-app joins both matrices in the same commit so CI never observes a failing job.

Verification

Run the way these workflows currently do — Node 14:

Executed 83 of 83 specs SUCCESS
All files | 100 | 100 | 100 | 100
maestro-inject.js | 100 | 100 | 100 | 100
EXIT=0

Found via, but deliberately separate from, the Node 20 work

Surfaced while auditing package coverage for #2386. It is unrelated to that migration — the gap is version-agnostic and would fail identically on any Node — so it is kept off that branch rather than widening a release-bound PR.

One note for reviewers of #2386: running this same suite on master + Node 20 reports All files | 0 | 0 | 0 | 0 and still exits 0. That is the vacuous-coverage failure mode #2386 fixes, reproduced here incidentally. It is why the verification above was run on Node 14.

🤖 Generated with Claude Code

@percy/cli-app was the only one of 18 packages missing from both the test.yml
and windows.yml matrices, so its 81 specs have never run in CI on any platform.
Adding it as-is would have turned CI red: the package sits at 98.44% branch
coverage against the repo's 100% threshold.
The gap is `err.code || err.message`, interpolated into the warning at
maestro-inject.js:157 and the debug line at :273. Every existing spec throws an
error carrying a code (EACCES, EROFS, EEXIST, ENOENT), so the `err.message` arm
was unreachable — a trap for whoever writes the next fallback spec, since the
obvious reading is that the `log?.` optional call is what's uncovered.
Two specs throw codeless errors to cover it, then cli-app joins both matrices in
the same commit so CI never observes a failing job.
Verified on Node 14 (what these workflows currently run): 83/83, 100%
statements/branches/functions/lines, exit 0.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@aryanku-dev
aryanku-dev requested a review from a team as a code ownerAugust 26, 2026 20:10
@rishigupta1599

Copy link
Copy Markdown
Contributor

Claude Code PR Review

PR:#2402Head:fd29784Reviewers: stack-code-reviewer

Summary

Adds @percy/cli-app to the Linux (test.yml) and Windows (windows.yml) CI test matrices, and adds two specs to packages/cli-app/test/exec.test.js covering the err.code || err.message fallback arms in maestro-inject.js — the branch-coverage gap that kept the package out of the coverage-gated matrix. Test-and-CI only; no production code changes.

Review Table

PriorityCategoryCheckStatusNotes
HighSecurityNo hardcoded secrets or credentialsPassNo credentials introduced; diff is specs + two matrix entries.
HighSecurityAuthentication/authorization checks presentN/ANo auth surface touched.
HighSecurityInput validation and sanitizationN/ANo user input handling introduced.
HighSecurityNo IDOR — resource ownership validatedN/ANo resource access.
HighSecurityNo SQL injection (parameterized queries)N/ANo database access.
HighCorrectnessLogic is correct, handles edge casesPassBoth specs verified to reach their intended err.code || err.message arms (maestro-inject.js:157 and :273).
HighCorrectnessError handling is explicit, no swallowed exceptionsPassThe specs assert on the warn/debug payload rather than only that it was called.
HighCorrectnessNo race conditions or concurrency issuesN/ASynchronous spec additions.
MediumTestingNew code has corresponding testsPassThe change is test coverage; 81/81 specs pass locally.
MediumTestingError paths and edge cases testedPassPrecisely the intent — the codeless-error arms were previously unreachable.
MediumTestingExisting tests still pass (no regressions)PassAll 49 checks green on PR CI, including Test @percy/cli-app on Linux and Windows.
MediumPerformanceNo N+1 queries or unbounded data fetchingN/ANo data access.
MediumPerformanceLong-running tasks use background jobsN/ANot applicable.
MediumQualityFollows existing codebase patternsPassMirrors the sibling EACCES/EROFS/EEXIST specs and the file's ctxFor + jasmine.createSpy idiom.
MediumQualityChanges are focused (single concern)PassOne concern: close the gap, then enable the gate.
LowQualityMeaningful names, no dead codePassSpec names state the condition under test.
LowQualityComments explain why, not whatPassBoth specs explain why the arm was unreachable, which is the useful half.
LowQualityNo unnecessary dependencies addedPassNo dependency changes.

Findings

  • File:packages/cli-app/src/maestro-inject.js:87 (also :126, :298)

  • Severity: Low

  • Reviewer: stack-code-reviewer

  • Issue: The injection helpers gate on path.basename(args[0]) !== 'maestro'. On Windows a real Maestro invocation may resolve to maestro.exe, maestro.cmd or maestro.bat, whose basename is not the literal maestro, so all three helpers would silently no-op. Pre-existing production code, untouched by this diff — but this PR is what starts exercising the package on the Windows matrix, so it becomes newly relevant.

  • Suggestion: Strip a known executable extension before comparing (e.g. compare path.basename(args[0], path.extname(args[0]))), or match case-insensitively against maestro(\.(exe|cmd|bat))?$. Worth a follow-up ticket rather than expanding this PR.

  • File:packages/cli-app/test/exec.test.js:35

  • Severity: Low

  • Reviewer: stack-code-reviewer

  • Issue: The pre-existing spec degrades unrecognized exec options into the command (loose parsing trade-off) was observed timing out (10s Jasmine limit) on one local run under coverage instrumentation, with a toBeRejectedWithError assertion firing after the spec had already been marked failed. Untouched by this diff, and the workflows' spec-level retry (PER-9011) is designed to absorb exactly this — but the package is now gated in CI, so latent timing flakiness has somewhere to bite.

  • Suggestion: No action required for this PR. If it recurs on CI, raise the spec's timeout or make the assertion await the rejection deterministically.

Dismissed after verification

  • packages/cli-app/src/maestro-inject.js:151-154High — untested nested catch will fail the 100% lines/statements gate this PR enablesDismissed — not a coverage gap. Refuted on two independent grounds:

    1. Mechanism: that catch (_) body contains only comments — no statements, no functions — so it contributes nothing to statements/lines, and Istanbul does not instrument try/catch as a branch. The surrounding lines (const fallback = …, fs.mkdirSync(fallback, …), resolved = fallback) sit in the outer catch, which the existing EACCES/EROFS/EEXIST specs already exercise.
    2. Evidence:Test @percy/cli-apppasses on this PR's own CI, on both the Linux and Windows matrices — the very job this PR adds and the finding predicted would "fail outright". All 49 checks are green.

    Recorded here rather than dropped, since it was the reviewer's gating finding. The reviewer flagged that its local nyc run collected no coverage data (All files 0 0 0 0), so the claim rested on static analysis; I reproduced that same empty-data condition locally, which is why CI is the authority here.


Verdict: PASS — test-and-CI-only change, correctly targeted and green on CI; the two Low items are pre-existing and out of scope for this diff.

@aryanku-dev
aryanku-dev merged commit 3b55840 into masterSep 1, 2026
50 checks passed
@aryanku-dev
aryanku-dev deleted the fix/cli-app-coverage-and-ci branch September 1, 2026 14:27
Sign up for freeto 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

@aryanku-dev@rishigupta1599
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

test(cli-app): close the branch-coverage gap and add the package to CI - #2402

Merged
aryanku-dev merged 1 commit into
masterfrom
fix/cli-app-coverage-and-ci
Sep 1, 2026
Merged

test(cli-app): close the branch-coverage gap and add the package to CI#2402
aryanku-dev merged 1 commit into
masterfrom
fix/cli-app-coverage-and-ci

Conversation

@aryanku-dev

Copy link
Copy Markdown
Contributor

Adds @percy/cli-app to CI. It was the only one of 18 packages missing from both the test.yml and windows.yml matrices, so its 81 specs have never run in CI on any platform.

Adding it as-is would have turned CI red — the package sits at 98.44% branch coverage against the repo's 100% threshold:

maestro-inject.js | 100% stmts | 98.44% branch | uncovered: 157, 273
ERROR: Coverage for branches (98.44%) does not meet global threshold (100%)

The uncovered branch is not the one it looks like

Both lines contain a log?. optional call, which is the obvious suspect. It isn't that. The gap is err.code || err.message, interpolated into the warning at maestro-inject.js:157 and the debug line at :273. Every existing spec throws an error carrying a code (EACCES, EROFS, EEXIST, ENOENT), so the err.message arm is unreachable.

Worth stating explicitly because it is a trap for the next fallback spec: adding another coded-error case moves no coverage at all.

Two specs throw codeless errors to cover it, and cli-app joins both matrices in the same commit so CI never observes a failing job.

Verification

Run the way these workflows currently do — Node 14:

Executed 83 of 83 specs SUCCESS
All files | 100 | 100 | 100 | 100
maestro-inject.js | 100 | 100 | 100 | 100
EXIT=0

Found via, but deliberately separate from, the Node 20 work

Surfaced while auditing package coverage for #2386. It is unrelated to that migration — the gap is version-agnostic and would fail identically on any Node — so it is kept off that branch rather than widening a release-bound PR.

One note for reviewers of #2386: running this same suite on master + Node 20 reports All files | 0 | 0 | 0 | 0 and still exits 0. That is the vacuous-coverage failure mode #2386 fixes, reproduced here incidentally. It is why the verification above was run on Node 14.

🤖 Generated with Claude Code

@percy/cli-app was the only one of 18 packages missing from both the test.yml
and windows.yml matrices, so its 81 specs have never run in CI on any platform.
Adding it as-is would have turned CI red: the package sits at 98.44% branch
coverage against the repo's 100% threshold.
The gap is `err.code || err.message`, interpolated into the warning at
maestro-inject.js:157 and the debug line at :273. Every existing spec throws an
error carrying a code (EACCES, EROFS, EEXIST, ENOENT), so the `err.message` arm
was unreachable — a trap for whoever writes the next fallback spec, since the
obvious reading is that the `log?.` optional call is what's uncovered.
Two specs throw codeless errors to cover it, then cli-app joins both matrices in
the same commit so CI never observes a failing job.
Verified on Node 14 (what these workflows currently run): 83/83, 100%
statements/branches/functions/lines, exit 0.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@aryanku-dev
aryanku-dev requested a review from a team as a code ownerAugust 26, 2026 20:10
@rishigupta1599

Copy link
Copy Markdown
Contributor

Claude Code PR Review

PR:#2402Head:fd29784Reviewers: stack-code-reviewer

Summary

Adds @percy/cli-app to the Linux (test.yml) and Windows (windows.yml) CI test matrices, and adds two specs to packages/cli-app/test/exec.test.js covering the err.code || err.message fallback arms in maestro-inject.js — the branch-coverage gap that kept the package out of the coverage-gated matrix. Test-and-CI only; no production code changes.

Review Table

PriorityCategoryCheckStatusNotes
HighSecurityNo hardcoded secrets or credentialsPassNo credentials introduced; diff is specs + two matrix entries.
HighSecurityAuthentication/authorization checks presentN/ANo auth surface touched.
HighSecurityInput validation and sanitizationN/ANo user input handling introduced.
HighSecurityNo IDOR — resource ownership validatedN/ANo resource access.
HighSecurityNo SQL injection (parameterized queries)N/ANo database access.
HighCorrectnessLogic is correct, handles edge casesPassBoth specs verified to reach their intended err.code || err.message arms (maestro-inject.js:157 and :273).
HighCorrectnessError handling is explicit, no swallowed exceptionsPassThe specs assert on the warn/debug payload rather than only that it was called.
HighCorrectnessNo race conditions or concurrency issuesN/ASynchronous spec additions.
MediumTestingNew code has corresponding testsPassThe change is test coverage; 81/81 specs pass locally.
MediumTestingError paths and edge cases testedPassPrecisely the intent — the codeless-error arms were previously unreachable.
MediumTestingExisting tests still pass (no regressions)PassAll 49 checks green on PR CI, including Test @percy/cli-app on Linux and Windows.
MediumPerformanceNo N+1 queries or unbounded data fetchingN/ANo data access.
MediumPerformanceLong-running tasks use background jobsN/ANot applicable.
MediumQualityFollows existing codebase patternsPassMirrors the sibling EACCES/EROFS/EEXIST specs and the file's ctxFor + jasmine.createSpy idiom.
MediumQualityChanges are focused (single concern)PassOne concern: close the gap, then enable the gate.
LowQualityMeaningful names, no dead codePassSpec names state the condition under test.
LowQualityComments explain why, not whatPassBoth specs explain why the arm was unreachable, which is the useful half.
LowQualityNo unnecessary dependencies addedPassNo dependency changes.

Findings

  • File:packages/cli-app/src/maestro-inject.js:87 (also :126, :298)

  • Severity: Low

  • Reviewer: stack-code-reviewer

  • Issue: The injection helpers gate on path.basename(args[0]) !== 'maestro'. On Windows a real Maestro invocation may resolve to maestro.exe, maestro.cmd or maestro.bat, whose basename is not the literal maestro, so all three helpers would silently no-op. Pre-existing production code, untouched by this diff — but this PR is what starts exercising the package on the Windows matrix, so it becomes newly relevant.

  • Suggestion: Strip a known executable extension before comparing (e.g. compare path.basename(args[0], path.extname(args[0]))), or match case-insensitively against maestro(\.(exe|cmd|bat))?$. Worth a follow-up ticket rather than expanding this PR.

  • File:packages/cli-app/test/exec.test.js:35

  • Severity: Low

  • Reviewer: stack-code-reviewer

  • Issue: The pre-existing spec degrades unrecognized exec options into the command (loose parsing trade-off) was observed timing out (10s Jasmine limit) on one local run under coverage instrumentation, with a toBeRejectedWithError assertion firing after the spec had already been marked failed. Untouched by this diff, and the workflows' spec-level retry (PER-9011) is designed to absorb exactly this — but the package is now gated in CI, so latent timing flakiness has somewhere to bite.

  • Suggestion: No action required for this PR. If it recurs on CI, raise the spec's timeout or make the assertion await the rejection deterministically.

Dismissed after verification

  • packages/cli-app/src/maestro-inject.js:151-154High — untested nested catch will fail the 100% lines/statements gate this PR enablesDismissed — not a coverage gap. Refuted on two independent grounds:

    1. Mechanism: that catch (_) body contains only comments — no statements, no functions — so it contributes nothing to statements/lines, and Istanbul does not instrument try/catch as a branch. The surrounding lines (const fallback = …, fs.mkdirSync(fallback, …), resolved = fallback) sit in the outer catch, which the existing EACCES/EROFS/EEXIST specs already exercise.
    2. Evidence:Test @percy/cli-apppasses on this PR's own CI, on both the Linux and Windows matrices — the very job this PR adds and the finding predicted would "fail outright". All 49 checks are green.

    Recorded here rather than dropped, since it was the reviewer's gating finding. The reviewer flagged that its local nyc run collected no coverage data (All files 0 0 0 0), so the claim rested on static analysis; I reproduced that same empty-data condition locally, which is why CI is the authority here.


Verdict: PASS — test-and-CI-only change, correctly targeted and green on CI; the two Low items are pre-existing and out of scope for this diff.

@aryanku-dev
aryanku-dev merged commit 3b55840 into masterSep 1, 2026
50 checks passed
@aryanku-dev
aryanku-dev deleted the fix/cli-app-coverage-and-ci branch September 1, 2026 14:27
Sign up for freeto 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

@aryanku-dev@rishigupta1599
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

test(cli-app): close the branch-coverage gap and add the package to CI - #2402

Merged
aryanku-dev merged 1 commit into
masterfrom
fix/cli-app-coverage-and-ci
Sep 1, 2026
Merged

test(cli-app): close the branch-coverage gap and add the package to CI#2402
aryanku-dev merged 1 commit into
masterfrom
fix/cli-app-coverage-and-ci

Conversation

@aryanku-dev

Copy link
Copy Markdown
Contributor

Adds @percy/cli-app to CI. It was the only one of 18 packages missing from both the test.yml and windows.yml matrices, so its 81 specs have never run in CI on any platform.

Adding it as-is would have turned CI red — the package sits at 98.44% branch coverage against the repo's 100% threshold:

maestro-inject.js | 100% stmts | 98.44% branch | uncovered: 157, 273
ERROR: Coverage for branches (98.44%) does not meet global threshold (100%)

The uncovered branch is not the one it looks like

Both lines contain a log?. optional call, which is the obvious suspect. It isn't that. The gap is err.code || err.message, interpolated into the warning at maestro-inject.js:157 and the debug line at :273. Every existing spec throws an error carrying a code (EACCES, EROFS, EEXIST, ENOENT), so the err.message arm is unreachable.

Worth stating explicitly because it is a trap for the next fallback spec: adding another coded-error case moves no coverage at all.

Two specs throw codeless errors to cover it, and cli-app joins both matrices in the same commit so CI never observes a failing job.

Verification

Run the way these workflows currently do — Node 14:

Executed 83 of 83 specs SUCCESS
All files | 100 | 100 | 100 | 100
maestro-inject.js | 100 | 100 | 100 | 100
EXIT=0

Found via, but deliberately separate from, the Node 20 work

Surfaced while auditing package coverage for #2386. It is unrelated to that migration — the gap is version-agnostic and would fail identically on any Node — so it is kept off that branch rather than widening a release-bound PR.

One note for reviewers of #2386: running this same suite on master + Node 20 reports All files | 0 | 0 | 0 | 0 and still exits 0. That is the vacuous-coverage failure mode #2386 fixes, reproduced here incidentally. It is why the verification above was run on Node 14.

🤖 Generated with Claude Code

@percy/cli-app was the only one of 18 packages missing from both the test.yml
and windows.yml matrices, so its 81 specs have never run in CI on any platform.
Adding it as-is would have turned CI red: the package sits at 98.44% branch
coverage against the repo's 100% threshold.
The gap is `err.code || err.message`, interpolated into the warning at
maestro-inject.js:157 and the debug line at :273. Every existing spec throws an
error carrying a code (EACCES, EROFS, EEXIST, ENOENT), so the `err.message` arm
was unreachable — a trap for whoever writes the next fallback spec, since the
obvious reading is that the `log?.` optional call is what's uncovered.
Two specs throw codeless errors to cover it, then cli-app joins both matrices in
the same commit so CI never observes a failing job.
Verified on Node 14 (what these workflows currently run): 83/83, 100%
statements/branches/functions/lines, exit 0.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@aryanku-dev
aryanku-dev requested a review from a team as a code ownerAugust 26, 2026 20:10
@rishigupta1599

Copy link
Copy Markdown
Contributor

Claude Code PR Review

PR:#2402Head:fd29784Reviewers: stack-code-reviewer

Summary

Adds @percy/cli-app to the Linux (test.yml) and Windows (windows.yml) CI test matrices, and adds two specs to packages/cli-app/test/exec.test.js covering the err.code || err.message fallback arms in maestro-inject.js — the branch-coverage gap that kept the package out of the coverage-gated matrix. Test-and-CI only; no production code changes.

Review Table

PriorityCategoryCheckStatusNotes
HighSecurityNo hardcoded secrets or credentialsPassNo credentials introduced; diff is specs + two matrix entries.
HighSecurityAuthentication/authorization checks presentN/ANo auth surface touched.
HighSecurityInput validation and sanitizationN/ANo user input handling introduced.
HighSecurityNo IDOR — resource ownership validatedN/ANo resource access.
HighSecurityNo SQL injection (parameterized queries)N/ANo database access.
HighCorrectnessLogic is correct, handles edge casesPassBoth specs verified to reach their intended err.code || err.message arms (maestro-inject.js:157 and :273).
HighCorrectnessError handling is explicit, no swallowed exceptionsPassThe specs assert on the warn/debug payload rather than only that it was called.
HighCorrectnessNo race conditions or concurrency issuesN/ASynchronous spec additions.
MediumTestingNew code has corresponding testsPassThe change is test coverage; 81/81 specs pass locally.
MediumTestingError paths and edge cases testedPassPrecisely the intent — the codeless-error arms were previously unreachable.
MediumTestingExisting tests still pass (no regressions)PassAll 49 checks green on PR CI, including Test @percy/cli-app on Linux and Windows.
MediumPerformanceNo N+1 queries or unbounded data fetchingN/ANo data access.
MediumPerformanceLong-running tasks use background jobsN/ANot applicable.
MediumQualityFollows existing codebase patternsPassMirrors the sibling EACCES/EROFS/EEXIST specs and the file's ctxFor + jasmine.createSpy idiom.
MediumQualityChanges are focused (single concern)PassOne concern: close the gap, then enable the gate.
LowQualityMeaningful names, no dead codePassSpec names state the condition under test.
LowQualityComments explain why, not whatPassBoth specs explain why the arm was unreachable, which is the useful half.
LowQualityNo unnecessary dependencies addedPassNo dependency changes.

Findings

  • File:packages/cli-app/src/maestro-inject.js:87 (also :126, :298)

  • Severity: Low

  • Reviewer: stack-code-reviewer

  • Issue: The injection helpers gate on path.basename(args[0]) !== 'maestro'. On Windows a real Maestro invocation may resolve to maestro.exe, maestro.cmd or maestro.bat, whose basename is not the literal maestro, so all three helpers would silently no-op. Pre-existing production code, untouched by this diff — but this PR is what starts exercising the package on the Windows matrix, so it becomes newly relevant.

  • Suggestion: Strip a known executable extension before comparing (e.g. compare path.basename(args[0], path.extname(args[0]))), or match case-insensitively against maestro(\.(exe|cmd|bat))?$. Worth a follow-up ticket rather than expanding this PR.

  • File:packages/cli-app/test/exec.test.js:35

  • Severity: Low

  • Reviewer: stack-code-reviewer

  • Issue: The pre-existing spec degrades unrecognized exec options into the command (loose parsing trade-off) was observed timing out (10s Jasmine limit) on one local run under coverage instrumentation, with a toBeRejectedWithError assertion firing after the spec had already been marked failed. Untouched by this diff, and the workflows' spec-level retry (PER-9011) is designed to absorb exactly this — but the package is now gated in CI, so latent timing flakiness has somewhere to bite.

  • Suggestion: No action required for this PR. If it recurs on CI, raise the spec's timeout or make the assertion await the rejection deterministically.

Dismissed after verification

  • packages/cli-app/src/maestro-inject.js:151-154High — untested nested catch will fail the 100% lines/statements gate this PR enablesDismissed — not a coverage gap. Refuted on two independent grounds:

    1. Mechanism: that catch (_) body contains only comments — no statements, no functions — so it contributes nothing to statements/lines, and Istanbul does not instrument try/catch as a branch. The surrounding lines (const fallback = …, fs.mkdirSync(fallback, …), resolved = fallback) sit in the outer catch, which the existing EACCES/EROFS/EEXIST specs already exercise.
    2. Evidence:Test @percy/cli-apppasses on this PR's own CI, on both the Linux and Windows matrices — the very job this PR adds and the finding predicted would "fail outright". All 49 checks are green.

    Recorded here rather than dropped, since it was the reviewer's gating finding. The reviewer flagged that its local nyc run collected no coverage data (All files 0 0 0 0), so the claim rested on static analysis; I reproduced that same empty-data condition locally, which is why CI is the authority here.


Verdict: PASS — test-and-CI-only change, correctly targeted and green on CI; the two Low items are pre-existing and out of scope for this diff.

@aryanku-dev
aryanku-dev merged commit 3b55840 into masterSep 1, 2026
50 checks passed
@aryanku-dev
aryanku-dev deleted the fix/cli-app-coverage-and-ci branch September 1, 2026 14:27
Sign up for freeto 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

@aryanku-dev@rishigupta1599