lablup / lablup/backend.ai-webui

feat(WebUI Smoke CLI): add preflight/doctor subcommand and role auto-detection

Open
#7,382 0 comments 0 reactions 0 assignees View on GitHub
phase-2
Dominant language
TypeScript
Stars
133
Forks
81
Avg merge
1d 11h
Merged PRs (30d)
344

Description

## Parent

- Epic: [FR-2871](https://lablup.atlassian.net/browse/FR-2871)
- Spec Task: [FR-2872](https://lablup.atlassian.net/browse/FR-2872)
- Spec: `.specs/FR-2871-webui-smoke-cli/spec.md` § FR-D

## Goal

Add a `doctor` / `preflight` subcommand that runs reachability, TLS, login, browser-presence, and disk-space checks before the runner starts, plus auto-detect the logged-in account's role and use it to scope the selected tag set.

## Acceptance criteria

- [ ] `bai-smoke doctor` checks: endpoint reachability, TLS, login succeeds, browser binary present at expected path, free disk space ≥ configured minimum, and warns on webui-version-vs-CLI-version mismatch by reading the webui SHA from `/manifest.json` or `index.html` meta.
- [ ] `bai-smoke preflight` (or a `--preflight-only` flag on `run`) performs the doctor checks then exits without running specs.
- [ ] Role auto-detection: after login, the runner inspects the existing login response / `/server/login-check` signal to classify the account as `admin`, `user`, or `monitor`, and includes only tags compatible with the detected role.
- [ ] `--role auto` (default) uses detection; explicit `--role admin|user|monitor` overrides.
- [ ] Detection must not introduce new backend APIs.
- [ ] Running `doctor` against an unreachable endpoint exits non-zero with a precise reason.
- [ ] Running `doctor` against a wrong-credential endpoint reports "login failed" distinctly from "endpoint unreachable".
- [ ] With `--role auto`, an admin login runs `@smoke + @smoke-admin + @smoke-any`; a user login runs `@smoke + @smoke-user + @smoke-any`.

## In scope

- `packages/backend.ai-webui-smoke-cli/src/commands/{doctor,preflight}.ts`
- `packages/backend.ai-webui-smoke-cli/src/role/detect.ts`
- Wiring in `src/commands/run.ts` for `--preflight-only` and `--role`

## Out of scope

- Report post-processing (FR-E)
- Bundled browser path resolution (FR-G owns the actual bundling; this task only checks for presence)

## Test plan

- Run `doctor` against unreachable host → non-zero, "endpoint unreachable".
- Run `doctor` against reachable host with wrong password → non-zero, "login failed".
- Run `run --role auto` with admin creds, confirm admin-tagged specs are included; repeat with user creds.

JIRA Issue: FR-2878

[FR-2871]: https://lablup.atlassian.net/browse/FR-2871?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[FR-2872]: https://lablup.atlassian.net/browse/FR-2872?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.