Skip to content

test(cli): stabilize coverage dist sourcemaps - #2961

Merged
cv merged 61 commits into
mainfrom
test/stabilize-cli-coverage-dist
May 5, 2026
Merged

test(cli): stabilize coverage dist sourcemaps#2961
cv merged 61 commits into
mainfrom
test/stabilize-cli-coverage-dist

Conversation

@cv

@cv cv commented May 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Stabilize CLI coverage runs by cleaning compiled CLI output before coverage builds and validating that generated JavaScript sourcemaps point at existing sources. This makes coverage use a clean dist/ baseline instead of stale generated files.

Stack Navigation

Changes

  • Added npm run clean:cli for removing stale dist/ artifacts without changing the normal build:cli ordering.
  • Added scripts/check-dist-sourcemaps.ts and npm run dist:sourcemaps:check to fail fast on stale generated sourcemaps.
  • Updated the CLI coverage pre-push hook to clean dist/, rebuild, and validate sourcemaps before running coverage.
  • Rebaselined CLI function coverage to the clean-dist value exposed by the stabilized run.
  • Added unit coverage for the sourcemap checker.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Verification

  • npx prek run --all-files passes
  • npm test passes
  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes
  • make docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Carlos Villela cvillela@nvidia.com

Summary by CodeRabbit

  • Chores

    • Enhanced pre-commit checks with additional build and cleanup steps before testing
    • Added validation for sourcemap integrity in the distribution directory
    • Adjusted code coverage thresholds for CLI functions
  • Tests

    • Added tests for sourcemap validation

cv added 30 commits May 2, 2026 13:36
@cv
cv requested a review from prekshivyas May 5, 2026 22:40
cv added a commit that referenced this pull request May 5, 2026
## Summary
Remove broad coverage ignores from small runtime utility modules that
already have or can have direct tests.

## Stack Navigation
- Position: 45 of 60
- Previous PR: [#2943 — test(cli): cover global action
facade](#2943)
- Next PR: [#2961 — test(cli): stabilize coverage dist
sourcemaps](#2961)

## Changes
- Removed the file-level V8 ignore from the oclif runner, which is
already directly tested.
- Removed the file-level V8 ignore from terminal style constants.
- Added a small terminal style export test to keep the presentation
constants covered.

## Type of Change
- [x] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)

## Verification
- [x] `npx prek run --all-files` passes
- [x] `npm test` passes
- [x] Tests added or updated for new or changed behavior
- [x] No secrets, API keys, or credentials committed
- [ ] Docs updated for user-facing behavior changes
- [ ] `make docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
Signed-off-by: Carlos Villela <cvillela@nvidia.com>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Extended CLI actions with optional runtime hook configuration for
sandbox upgrades, enabling customizable upgrade handling.

* **Chores**
  * Cleaned up obsolete code annotations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Co-authored-by: Prekshi Vyas <34834085+prekshivyas@users.noreply.github.com>
@cv
cv marked this pull request as ready for review May 5, 2026 22:46
@cv
cv changed the base branch from refactor/coverage-runtime-utility-helpers to main May 5, 2026 22:46
@cv
cv enabled auto-merge (squash) May 5, 2026 22:47
Signed-off-by: Carlos Villela <cvillela@nvidia.com>

@prekshivyas prekshivyas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Test infrastructure / build hygiene PR — 5 files / +120 / -2, no src/ touched.

  • clean:cli + dist:sourcemaps:check npm scripts added.
  • New scripts/check-dist-sourcemaps.ts walks .js.map files and asserts every sources entry resolves on disk; correctly skips node:/webpack:///node_modules/absolute paths.
  • Pre-commit test-cli hook now runs clean:cli && build:cli && dist:sourcemaps:check before vitest coverage — defensive against stale dist/ polluting coverage.
  • Coverage function threshold rebaselined 32 → 31.8 to reflect the real value once stale dist files (which had been counting deleted code as "covered") are eliminated. Rationale clearly explained in the PR description.
  • +35 lines of fixture-based test for the sourcemap checker.

CI: pr.yaml mostly green (lint/dco/check-hash/legacy-path-guard/changes PASS); macos-e2e/wsl-e2e/checks + pr-self-hosted builds still in flight at review time. No failures.

@cv
cv merged commit e7e73c1 into main May 5, 2026
12 of 13 checks passed
cv added a commit that referenced this pull request May 5, 2026
## Summary
Extract pure Docker image parsing and orphan-selection logic from the
subprocess-heavy maintenance action module.

## Stack Navigation
- Position: 47 of 60
- Previous PR: [#2961 — test(cli): stabilize coverage dist
sourcemaps](#2961)
- Next PR: [#2963 — refactor(cli): extract upgrade sandbox
helpers](#2963)

## Changes
- Added `maintenance-image-helpers.ts` for Docker image row parsing and
registered image-tag comparison.
- Updated `garbageCollectImages` to use the extracted helpers while
keeping Docker/prompt orchestration in `maintenance-actions.ts`.
- Added direct helper coverage for image parsing, registered tag
collection, and orphan detection.

## Type of Change
- [x] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)

## Verification
- [x] `npx prek run --all-files` passes
- [x] `npm test` passes
- [x] Tests added or updated for new or changed behavior
- [x] No secrets, API keys, or credentials committed
- [ ] Docs updated for user-facing behavior changes
- [ ] `make docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
Signed-off-by: Carlos Villela <cvillela@nvidia.com>

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv
cv deleted the test/stabilize-cli-coverage-dist branch May 27, 2026 21:19
@wscurran wscurran added area: ci CI workflows, checks, release automation, or GitHub Actions area: cli Command line interface, flags, terminal UX, or output area: e2e End-to-end tests, nightly failures, or validation infrastructure chore Build, CI, dependency, or tooling maintenance feature PR adds or expands user-visible functionality and removed CI/CD feature PR adds or expands user-visible functionality labels Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI workflows, checks, release automation, or GitHub Actions area: cli Command line interface, flags, terminal UX, or output area: e2e End-to-end tests, nightly failures, or validation infrastructure chore Build, CI, dependency, or tooling maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants