Repository navigation
fix(test): match semver version tag in rebuild-hermes live test - #6138
Conversation
#6089 re-pinned the Hermes manifest to semver 0.17.0, but the live test at rebuild-hermes.test.ts:696 was extracting the parenthesized calver (2026.6.19) with /\((\d+\.\d+\.\d+)\)/. The two formats never match, causing the rebuild-hermes nightly to fail on main after #6089 merged. Switch to /v(\d+\.\d+\.\d+)/ to capture the semver tag. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
📝 WalkthroughWalkthroughThe PR updates one Hermes e2e assertion and adds a dedicated nemoclaw-start preload and log-hardening test file, while removing the old overlapping suites and lowering the legacy test file budget. ChangesHermes version parsing update
Nemoclaw-start gateway test split
Estimated code review effort: 3 (Moderate) | ~25 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
E2E Advisor RecommendationRequired E2E: None Dispatch hint: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
E2E Target RecommendationRequired E2E targets: Dispatch required E2E targets:
Full E2E target advisor summaryE2E Target AdvisorBase: Required E2E targets
Optional E2E targets
Relevant changed files
|
PR Review Advisor — No blocking findingsMerge posture: No blocking advisor findings Action checklist
Findings index
Review findings by urgency: 0 required fixes, 0 items to resolve/justify, 2 in-scope improvements
|
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in the Show a code coverage summary of the most covered files.
TypeScript / code-coverage/cliThe overall coverage in the Show a code coverage summary of the most covered files.
Updated |
PR Review Advisor (Nemotron Ultra) — Changes requestedMerge posture: Do not merge yet Action checklist
Findings index
🚨 Required before mergeAddress these before merging unless a maintainer explicitly overrides the advisor with rationale.
|
… legacy budget test/nemoclaw-start.test.ts had grown to 5043 lines, 96 lines above its legacy budget of 4947. Move the self-contained "gateway preload process detection" and "persistent gateway log hardening" describe blocks to a new test/nemoclaw-start-preload-gateway.test.ts with their required helper functions duplicated inline. Original file now sits at 4937 lines; budget entry updated accordingly. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/nemoclaw-start-preload-gateway.test.ts (1)
48-77: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueBrace-matching is line-based and only tracks heredocs, not nested
{ ... }blocks.
extractShellFunctionFromSourcecloses on the first line that is exactly}, skipping only heredoc bodies. It works forstart_persistent_gateway_log_mirror(whose subshell is a single-line{ ... } &, per context snippet 1), but would break if a future extracted function contains a multi-line brace block ending on its own}line. Low priority given current usage, but worth a comment noting the limitation for future maintainers.🤖 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 `@test/nemoclaw-start-preload-gateway.test.ts` around lines 48 - 77, The brace parsing in extractShellFunctionFromSource only detects the first standalone closing brace and ignores nested multi-line { ... } blocks, so update the helper to either track nested brace depth or explicitly document this limitation near the function name. Keep the logic around heredoc handling intact, and reference extractShellFunctionFromSource so future maintainers know the parser is intentionally line-based and limited to the current shell patterns.
🤖 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.
Nitpick comments:
In `@test/nemoclaw-start-preload-gateway.test.ts`:
- Around line 48-77: The brace parsing in extractShellFunctionFromSource only
detects the first standalone closing brace and ignores nested multi-line { ... }
blocks, so update the helper to either track nested brace depth or explicitly
document this limitation near the function name. Keep the logic around heredoc
handling intact, and reference extractShellFunctionFromSource so future
maintainers know the parser is intentionally line-based and limited to the
current shell patterns.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 5445f717-4680-4982-a1e2-3c1808140a6d
📒 Files selected for processing (3)
ci/test-file-size-budget.jsontest/nemoclaw-start-preload-gateway.test.tstest/nemoclaw-start.test.ts
💤 Files with no reviewable changes (1)
- test/nemoclaw-start.test.ts
✅ Files skipped from review due to trivial changes (1)
- ci/test-file-size-budget.json
…statement guardrail The relocated test file added 8 if statements (from duplicated helpers) which tripped the codebase-growth-guardrails "no new if statements in test files" check. Extract extractShellFunctionFromSource into test/support/shell-function-extractor.ts (a non-test file excluded from the guardrail) and replace the startScriptHeredoc calls with direct fs.readFileSync for the two preload marker constants. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
There was a problem hiding this comment.
🧹 Nitpick comments (2)
test/support/shell-function-extractor.ts (1)
16-38: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winBrace matching lacks depth tracking;
<<-heredoc terminators aren't tab-stripped.Two robustness gaps in this now-shared helper:
bareLine === "}"(Line 32) terminates on the first standalone closing brace, so any nested block (subshell, trap, inner function def) with its own}on its own line would truncate extraction early.- For
<<-heredocs (Line 28), bash strips only leading tabs from the body and terminator line before comparison, butheredocEndcomparison (Line 23) compares the rawbareLinewithout stripping leading tabs — an indented<<-terminator would never match, leavingheredocEndset and either silently corrupting the extracted body or triggering the "Expected closing brace" error.Neither is currently triggered by
start_persistent_gateway_log_mirror(no nested brace-only lines or<<-heredocs there), but as a shared utility this will silently misbehave for other functions.🔧 Suggested fix: track brace depth and strip tabs for `<<-`
const bodyStart = start + header.length; const lines = src.slice(bodyStart).split(/(?<=\n)/); let offset = 0; let heredocEnd: string | undefined; + let depth = 0; + let stripTabs = false; for (const line of lines) { const bareLine = line.replace(/\r?\n$/, ""); if (heredocEnd) { offset += line.length; - if (bareLine === heredocEnd) { + const comparable = stripTabs ? bareLine.replace(/^\t+/, "") : bareLine; + if (comparable === heredocEnd) { heredocEnd = undefined; } continue; } - const heredoc = line.match(/<<-?\s*['"]?([A-Za-z_][A-Za-z0-9_]*)['"]?/); + const heredoc = line.match(/<<(-?)\s*['"]?([A-Za-z_][A-Za-z0-9_]*)['"]?/); if (heredoc) { - heredocEnd = heredoc[1]; + heredocEnd = heredoc[2]; + stripTabs = heredoc[1] === "-"; } - if (bareLine === "}") { + if (/\{\s*$/.test(bareLine.trimEnd()) && bareLine.trim() !== "}") depth++; + if (bareLine.trim() === "}") { + if (depth > 0) { + depth--; + } else { return `${name}() {${src.slice(bodyStart, bodyStart + offset)}\n}`; + } } offset += line.length; }🤖 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 `@test/support/shell-function-extractor.ts` around lines 16 - 38, The shared shell extraction helper is too naive: it stops at the first standalone "}" and does not handle indented `<<-` heredoc terminators correctly. Update the brace scanning logic in `shell-function-extractor` to track nested brace depth so `}` only ends the outer function body, and adjust the heredoc termination check to ignore leading tabs when `heredocEnd` was opened with `<<-`. Keep the fix localized to the helper used for functions like `start_persistent_gateway_log_mirror` so extraction remains accurate for other scripts.test/nemoclaw-start-preload-gateway.test.ts (1)
85-89: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMissing symmetric ciao-guard non-activation test.
Only
safetyNetScriptis checked for non-installation on non-gateway commands (Line 85-89); there's no analogous assertion forciaoGuardScriptnot activating underopenclaw agent. Worth adding for full behavioral coverage of both guard scripts.✅ Suggested additional test
it("does not install the safety net for non-gateway CLI commands", () => { const run = runEmbeddedPreload(safetyNetScript, "/usr/local/bin/openclaw", "agent"); expect(run.status).toBe(0); expect(run.stderr).not.toContain("[sandbox-safety-net] loaded"); }); + + it("does not install the ciao guard for non-gateway CLI commands", () => { + const run = runEmbeddedPreload(ciaoGuardScript, "/usr/local/bin/openclaw", "agent"); + expect(run.status).toBe(0); + expect(run.stderr).not.toContain("[guard] ciao-network-guard loaded"); + }); });🤖 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 `@test/nemoclaw-start-preload-gateway.test.ts` around lines 85 - 89, The preload gateway test only verifies that safetyNetScript stays inactive for non-gateway commands, so add the same symmetric coverage for ciaoGuardScript when running openclaw agent. Extend the existing non-gateway CLI test or add a nearby test in nemoclaw-start-preload-gateway.test.ts that uses runEmbeddedPreload with ciaoGuardScript and asserts the guard does not load, matching the existing safety net assertion pattern.
🤖 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.
Nitpick comments:
In `@test/nemoclaw-start-preload-gateway.test.ts`:
- Around line 85-89: The preload gateway test only verifies that safetyNetScript
stays inactive for non-gateway commands, so add the same symmetric coverage for
ciaoGuardScript when running openclaw agent. Extend the existing non-gateway CLI
test or add a nearby test in nemoclaw-start-preload-gateway.test.ts that uses
runEmbeddedPreload with ciaoGuardScript and asserts the guard does not load,
matching the existing safety net assertion pattern.
In `@test/support/shell-function-extractor.ts`:
- Around line 16-38: The shared shell extraction helper is too naive: it stops
at the first standalone "}" and does not handle indented `<<-` heredoc
terminators correctly. Update the brace scanning logic in
`shell-function-extractor` to track nested brace depth so `}` only ends the
outer function body, and adjust the heredoc termination check to ignore leading
tabs when `heredocEnd` was opened with `<<-`. Keep the fix localized to the
helper used for functions like `start_persistent_gateway_log_mirror` so
extraction remains accurate for other scripts.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: ff39d22e-2826-4764-86cb-00e8a95ed5d5
📒 Files selected for processing (2)
test/nemoclaw-start-preload-gateway.test.tstest/support/shell-function-extractor.ts
|
✨ |
…IA#6138) ## Summary After NVIDIA#6089 merged (re-pinning the Hermes manifest to semver `0.17.0`), the `rebuild-hermes` live test started failing on main. The regex at line 696 was extracting a calver version in parentheses — `(2026.6.19)` — but the version output now uses a semver tag format — `v0.17.0`. The two never match. ## Related Issue Regression introduced by NVIDIA#6089 (merged as `2ab9e525`). The live `rebuild-hermes` test doesn't run on PRs so it merged green. ## Changes - `test/e2e/live/rebuild-hermes.test.ts:696` — change `/\((\d+\.\d+\.\d+)\)/` to `/v(\d+\.\d+\.\d+)/` ## Type of Change - [x] Code change (feature, bug fix, or refactor) ## Quality Gates - [x] Tests added or updated for changed behavior - [x] Docs not applicable — justification: live test fix, no user-facing change - [x] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) — no ## Verification - [x] Git hooks passed during commit and push - [x] No secrets, API keys, or credentials committed --- Signed-off-by: Prekshi Vyas <[email protected]> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Updated end-to-end Hermes version parsing to match the latest CLI output format. * Added new test coverage for `nemoclaw-start` gateway preload selection and persistent gateway log mirroring, including refusal on unsafe symlinked log directories. * Removed overlapping preload/log hardening suites from the existing `nemoclaw-start` test file. * Introduced a helper to extract shell functions from script sources for more reliable testing. * **Chores** * Adjusted the `nemoclaw-start` test file size budget to reflect the new suite layout. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Summary
After #6089 merged (re-pinning the Hermes manifest to semver
0.17.0), therebuild-hermeslive test started failing on main. The regex at line 696 was extracting a calver version in parentheses —(2026.6.19)— but the version output now uses a semver tag format —v0.17.0. The two never match.Related Issue
Regression introduced by #6089 (merged as
2ab9e525). The liverebuild-hermestest doesn't run on PRs so it merged green.Changes
test/e2e/live/rebuild-hermes.test.ts:696— change/\((\d+\.\d+\.\d+)\)/to/v(\d+\.\d+\.\d+)/Type of Change
Quality Gates
Verification
Signed-off-by: Prekshi Vyas [email protected]
Summary by CodeRabbit
nemoclaw-startgateway preload selection and persistent gateway log mirroring, including refusal on unsafe symlinked log directories.nemoclaw-starttest file.nemoclaw-starttest file size budget to reflect the new suite layout.