test(onboard): split helper coverage#3640
Conversation
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
E2E Advisor RecommendationRequired E2E: Dispatch hint: Auto-dispatched E2E: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/lib/onboard/dashboard-port.ts`:
- Around line 147-154: The current owner lookup re-parses forwardListOutput with
a simple split and may match non-live or ANSI-colored rows; replace this ad-hoc
logic and reuse the same live-forward parsing and ANSI-stripping routine used
for allocation lookup so only live rows are considered. Specifically, instead of
splitting and inspecting lines in the portLine computation that references
forwardListOutput and portToStop, run the existing parser (the function/module
that strips ANSI and determines live status used elsewhere in this file) to
produce row objects, filter for rows where status is live, find the row whose
port equals portToStop, and then return that row's owner/id (or null) instead of
parsing parts[0] from a raw string. Ensure you reference forwardListOutput and
portToStop and preserve null when not found.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 69f135b3-8912-4a3d-a4e5-f6b98ed5d7ad
📒 Files selected for processing (27)
src/lib/adapters/http/probe.test.tssrc/lib/build-context.test.tssrc/lib/core/url-utils.test.tssrc/lib/inference/config.test.tssrc/lib/inference/onboard-probes.test.tssrc/lib/onboard.tssrc/lib/onboard/credential-env.test.tssrc/lib/onboard/credential-env.tssrc/lib/onboard/dashboard-port.test.tssrc/lib/onboard/dashboard-port.tssrc/lib/onboard/dockerfile-patch.test.tssrc/lib/onboard/providers.test.tssrc/lib/onboard/sandbox-gpu-mode.test.tssrc/lib/onboard/sandbox-gpu-mode.tssrc/lib/onboard/summary.test.tssrc/lib/onboard/summary.tssrc/lib/onboard/vm-dns-monkeypatch.test.tssrc/lib/onboard/web-search-support.test.tssrc/lib/validation.test.tstest/gateway-state.test.tstest/onboard-brave-validation.test.tstest/onboard-custom-dockerfile.test.tstest/onboard-gateway-runtime.test.tstest/onboard-messaging.test.tstest/onboard-model-router.test.tstest/onboard-openshell-version.test.tstest/onboard.test.ts
✅ Files skipped from review due to trivial changes (2)
- src/lib/build-context.test.ts
- src/lib/onboard/vm-dns-monkeypatch.test.ts
| const portLine = forwardListOutput | ||
| .split("\n") | ||
| .map((line) => line.trim()) | ||
| .find((line) => { | ||
| const parts = line.split(/\s+/); | ||
| return parts[2] === portToStop; | ||
| }); | ||
| return portLine ? (portLine.split(/\s+/)[0] ?? null) : null; |
There was a problem hiding this comment.
Use live-forward parsing for owner lookup to avoid stale matches.
Line 147–154 reparses rows manually and does not apply the same live-status + ANSI-stripping rules used for allocation. This can return an owner from non-live rows and target the wrong sandbox.
Proposed fix
export function findDashboardForwardOwner(
forwardListOutput: string | null | undefined,
portToStop: string,
): string | null {
if (!forwardListOutput) return null;
- const portLine = forwardListOutput
- .split("\n")
- .map((line) => line.trim())
- .find((line) => {
- const parts = line.split(/\s+/);
- return parts[2] === portToStop;
- });
- return portLine ? (portLine.split(/\s+/)[0] ?? null) : null;
+ return getOccupiedPorts(forwardListOutput).get(portToStop) ?? null;
}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/lib/onboard/dashboard-port.ts` around lines 147 - 154, The current owner
lookup re-parses forwardListOutput with a simple split and may match non-live or
ANSI-colored rows; replace this ad-hoc logic and reuse the same live-forward
parsing and ANSI-stripping routine used for allocation lookup so only live rows
are considered. Specifically, instead of splitting and inspecting lines in the
portLine computation that references forwardListOutput and portToStop, run the
existing parser (the function/module that strips ANSI and determines live status
used elsewhere in this file) to produce row objects, filter for rows where
status is live, find the row whose port equals portToStop, and then return that
row's owner/id (or null) instead of parsing parts[0] from a raw string. Ensure
you reference forwardListOutput and portToStop and preserve null when not found.
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Selective E2E Results — ✅ All requested jobs passedRun: 25957237788
|
Selective E2E Results — ✅ All requested jobs passedRun: 25957499806
|
Summary
Splits helper-oriented coverage out of the oversized
test/onboard.test.tsfile into focused unit test files. The PR keeps source-shape coverage at zero, preserves equivalent behavior coverage, and makes the remaining onboard orchestration tests easier to navigate.Related Issue
Stacked on #3632 / #3636.
Changes
src/lib/onboard/gateway-gpu-passthrough.test.tssrc/lib/onboard/sandbox-gpu-create.test.tssrc/lib/onboard/sandbox-gpu-mode.test.tssrc/lib/onboard/initial-policy.test.tstest/onboard-policy-suggestions.test.ts.test/onboard-dashboard.test.tsand dashboard port helper coverage intosrc/lib/onboard/dashboard-port.test.ts.test/onboard-sandbox-name.test.ts.test/onboard-openshell-version.test.ts.src/lib/onboard/dockerfile-patch.test.ts.test/onboard-gateway-runtime.test.ts.test/onboard-model-router.test.ts.test/onboard-messaging.test.ts.test/onboard-custom-dockerfile.test.ts.src/lib/inference/config.test.tssrc/lib/inference/onboard-probes.test.tssrc/lib/onboard/providers.test.tssrc/lib/validation.test.tssrc/lib/core/url-utils.test.tssrc/lib/adapters/http/probe.test.tssrc/lib/onboard/web-search-support.test.ts/test/onboard-brave-validation.test.ts.src/lib/build-context.test.ts.src/lib/onboard/credential-env.tssrc/lib/onboard/summary.tssrc/lib/onboard/sandbox-gpu-mode.tsandsrc/lib/onboard/dashboard-port.tstest/onboard.test.ts; it is now much smaller while keeping the remaining orchestration/integration-style coverage.Type of Change
Verification
npm run source-shape:checkpassesnpm run build:clipassesnpx tsc -p tsconfig.cli.json --noUnusedLocals --noUnusedParameters --pretty falsepassesnpx prek run --all-filespassesnpm testpassesmake docsbuilds without warnings (doc changes only)Signed-off-by: Carlos Villela cvillela@nvidia.com
Summary by CodeRabbit
Release Notes
Tests
Refactor