Skip to content

fix(dashboard): fast refusal budget when no install can run, and untangle the deps gate - #1239

Merged
Fmarzochi merged 2 commits into
mainfrom
fix/dashboard-launch-followup
Aug 8, 2026
Merged

fix(dashboard): fast refusal budget when no install can run, and untangle the deps gate#1239
Fmarzochi merged 2 commits into
mainfrom
fix/dashboard-launch-followup

Conversation

@Fmarzochi

@Fmarzochi Fmarzochi commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Follow-up to #1234, addressing its post-merge review and the one new Sonar finding on main.

Summary

  • The launcher's 60s readiness budget now requires the dashboard directory to be writable: in the root-owned bug(dashboard): first launch dies silently when the global npm prefix is root-owned (EACCES on on-demand npm install) #1233 scenario no install can run, the child refuses within a second, and the long budget only delayed the honest failure line by a minute. The writability probe moved into the shared helper (checkDashboardDeps now returns writable) so both callers see the same answer
  • The dependency/install gate in scripts/dashboard.js moved out of start() into ensureDashboardDeps(), resolving the cognitive complexity finding (S3776) the merge introduced on main
  • The behavioral poll tests keep the positive-case server alive on its bound port while waitForDashboard runs (no release-and-rebind race), and the helper test gains an unwritable-directory case on POSIX

Testing

  • node --check on the three scripts
  • node tests/scripts/dashboard-launch.test.js: 6/6
  • node tests/dashboard-server.test.js: passing

Summary by cubic

Speed up honest failures when the dashboard can’t install deps and unify the writability check to avoid 60s stalls. Also simplify the start path by extracting the dependency gate to reduce complexity.

  • Bug Fixes

    • Launcher widens the readiness wait (60s) only if deps are missing and the dashboard dir is writable; otherwise it keeps the 4s budget for a fast, clear failure.
    • Stabilized readiness polling tests (keep the server alive during checks), added an unwritable-directory case on POSIX, and skip that case when running as root.
  • Refactors

    • Extracted ensureDashboardDeps() from start() in scripts/dashboard.js to address Sonar cognitive complexity (S3776).
    • Moved the directory writability probe into checkDashboardDeps() and exposed writable, so both the CLI and launcher use the same logic and messages for installs and failures (@egchq/egc, npm).

Written for commit 2c14484. Summary will update on new commits.

Review in cubic

…ngle the deps gate

Post-merge review of #1234 plus the Sonar complexity finding on main:

- the launcher's 60s readiness budget now requires the dashboard
  directory to be writable: in the root-owned #1233 scenario the child
  refuses within a second, so the long budget only delayed the honest
  failure line by a minute; the writability probe moved into the shared
  helper so both callers see the same answer
- the dependency/install gate in scripts/dashboard.js moved out of
  start() into ensureDashboardDeps(), resolving the cognitive
  complexity finding the merge introduced
- the behavioral poll tests now keep the positive-case server alive on
  its bound port while waitForDashboard runs (no release-and-rebind
  race), and the helper gains an unwritable-directory case on POSIX

Signed-off-by: Felipe Marzochi <fmarzochi@gmail.com>
@codecov

codecov Bot commented Aug 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 53.33333% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
scripts/lib/dashboard-launch.js 0.00% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread tests/scripts/dashboard-launch.test.js
Root bypasses the W_OK access probe (accessSync succeeds on a 0o555
directory under uid 0), so the case would fail in root-running Docker
or CI environments; same skip family as the existing Windows guard.

Signed-off-by: Felipe Marzochi <fmarzochi@gmail.com>
@sonarqubecloud

sonarqubecloud Bot commented Aug 8, 2026

Copy link
Copy Markdown

@Fmarzochi
Fmarzochi merged commit 055e0c9 into main Aug 8, 2026
41 checks passed
@Fmarzochi
Fmarzochi deleted the fix/dashboard-launch-followup branch August 8, 2026 23:03
@Fmarzochi Fmarzochi added this to the v1.1.19 milestone Aug 9, 2026
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.

1 participant