Skip to content

fix(test): extract shellQuote to standalone module to fix broken main#1900

Merged
ericksoa merged 1 commit into
mainfrom
fix/config-io-shell-quote-import
Apr 15, 2026
Merged

fix(test): extract shellQuote to standalone module to fix broken main#1900
ericksoa merged 1 commit into
mainfrom
fix/config-io-shell-quote-import

Conversation

@ericksoa

@ericksoa ericksoa commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • main is broken since commit 57ea768f (PR fix(cli): harden config file permission handling #1370) — the checks workflow fails with Cannot find module './platform' in sandbox-version.test.ts and secret-redaction.test.ts
  • Root cause: fix(cli): harden config file permission handling #1370 added import { shellQuote } from "./runner" to config-io.ts, which causes vitest to load runner.ts from source. runner.ts uses CJS require("./platform") which fails because Node's native require() cannot resolve .ts extensions
  • Fix: extract shellQuote into a standalone shell-quote.ts module with no heavy dependencies, and point config-io.ts at it. runner.ts keeps its own copy for CJS consumers

Files changed

File Change
src/lib/shell-quote.ts New standalone ESM module with shellQuote
src/lib/config-io.ts Import from ./shell-quote instead of ./runner
test/runner.test.ts Update regression guard to expect both runner.ts and shell-quote.ts

Test plan

  • sandbox-version.test.ts passes (was failing)
  • secret-redaction.test.ts passes (was failing)
  • runner.test.ts regression guard passes (updated)
  • Full CLI test suite: 71 files, 1259 tests, 0 failures

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Internal code reorganization and test updates.

…resolution

config-io.ts importing shellQuote from runner.ts caused vitest to load
runner.ts from source, where the CJS require("./platform") fails because
Node cannot resolve .ts extensions. Extract shellQuote into shell-quote.ts
so config-io.ts no longer pulls in runner.ts and its platform dependency.

Fixes the MODULE_NOT_FOUND error in sandbox-version.test.ts and
secret-redaction.test.ts introduced by #1370.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ec0b50b0-821c-493d-bad4-c25747537b09

📥 Commits

Reviewing files that changed from the base of the PR and between f808af4 and 5c13040.

📒 Files selected for processing (3)
  • src/lib/config-io.ts
  • src/lib/shell-quote.ts
  • test/runner.test.ts

📝 Walkthrough

Walkthrough

A refactoring that extracts the shellQuote function into a dedicated module src/lib/shell-quote.ts. The import in config-io.ts is updated to reference the new module, and regression tests are modified to accommodate the function existing in both the new and original files.

Changes

Cohort / File(s) Summary
Module Extraction
src/lib/shell-quote.ts
New module exporting shellQuote(value: string): string that wraps strings in single quotes and escapes embedded quotes for safe bash interpolation.
Import Update
src/lib/config-io.ts
Updated to import shellQuote from ./shell-quote instead of ./runner.
Regression Test Update
test/runner.test.ts
Modified "keeps a single shellQuote definition" test to allow shellQuote function to exist in both src/lib/runner.ts and src/lib/shell-quote.ts, sorting matches and comparing against an explicit two-element list.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A function finds its home so true,
No longer bound to just one view,
In shell-quote.ts it now does rest,
A modular nest, simple and blessed!
Our imports dance, our tests align,
Refactoring—now that's divine! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: extracting shellQuote to a standalone module to fix a broken build in main.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/config-io-shell-quote-import

Comment @coderabbitai help to get the list of available commands and usage tips.

@ericksoa ericksoa self-assigned this Apr 15, 2026
@ericksoa ericksoa merged commit 930802f into main Apr 15, 2026
11 checks passed
@wscurran wscurran added the bug-fix PR fixes a bug or regression label Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants