Skip to content

test(mcp): resolve module-path expectations portably - #13779

Merged
czubocha merged 1 commit into
mainfrom
fix/mcp-compose-tests-windows
Aug 5, 2026
Merged

test(mcp): resolve module-path expectations portably#13779
czubocha merged 1 commit into
mainfrom
fix/mcp-compose-tests-windows

Conversation

@czubocha

@czubocha czubocha commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

The release workflow's Windows leg fails on six resolveServerModulePath tests in compose.test.js: the tests stub the filesystem with POSIX string literals (/var/task/src/crm.mjs), while the resolver builds candidates with path.resolve — which on Windows yields drive-qualified backslash paths (C:\var\task\src\crm.mjs). No candidate ever matches the stub, so all six tests throw the not-in-package error.

Failing run: https://github.com/serverless/serverless/actions/runs/31014879879/job/92336224583

Test-only change — product code is untouched. The MCP entry executes only on Lambda's Linux runtime; the failures are pure test portability. The stub keys and the expectations are now built with the same path.resolve('/var/task', …) call the resolver uses, so the assertions hold on every runner by construction.

Why this surfaced only post-merge: the cross-platform matrix (Windows/arm) runs only in Release: Framework CLI, which no PR CI exercises — this was the suite's first contact with Windows. The Windows job ran the full 186-suite fleet and this was the only failure.

Impact

release-canary needs: [test-matrix, test-engine], so the failing leg blocked the release cleanly — nothing was published. Merging this unblocks the release train.

Testing

  • compose.test.js 57/57 green on POSIX; the win32 resolution shape was probed explicitly to confirm the mismatch mechanism and that the fix keys both sides on the same call.
  • The Windows leg itself re-runs on this PR's merge via the release workflow.

Summary by CodeRabbit

  • Tests
    • Improved path-resolution test coverage across different operating systems.
    • Updated error-message checks to reflect platform-specific resolved paths.

The resolveServerModulePath tests stubbed the filesystem with POSIX string
literals while the resolver builds candidates with path.resolve — which on
the release workflow's Windows leg yields drive-qualified backslash paths
(C:\var\task\src\crm.mjs), so no candidate ever matched the stub and all
six tests threw the not-in-package error. First contact between these tests
and Windows: the cross-platform matrix runs only in the release workflow,
which no PR CI exercises.

The stub keys and the expectations are now built with the same path.resolve
call the resolver uses, so the assertions hold on every runner. Product code
is untouched — the entry only ever runs on Lambda's Linux.
@Mmarzex

Mmarzex commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6f6d59cb-79fc-4d49-b972-87a9f3f86e6e

📥 Commits

Reviewing files that changed from the base of the PR and between 68210ee and 8261d79.

📒 Files selected for processing (1)
  • packages/serverless/test/unit/lib/plugins/aws/mcp/entry/compose.test.js

📝 Walkthrough

Walkthrough

The MCP compose unit tests now compute expected filesystem paths with path.resolve('/var/task', relative). All relevant stubs, return assertions, and error-message checks use the resolved paths.

Changes

MCP path resolution tests

Layer / File(s) Summary
Resolve expected filesystem paths
packages/serverless/test/unit/lib/plugins/aws/mcp/entry/compose.test.js
Adds an at(relative) helper and uses it for filesystem stubs, successful resolution assertions, and missing-path error assertions.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the test-only change that makes MCP module-path expectations portable across platforms.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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/mcp-compose-tests-windows

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/serverless/test/unit/lib/plugins/aws/mcp/entry/compose.test.js

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@czubocha
czubocha merged commit d626736 into main Aug 5, 2026
12 checks passed
@czubocha
czubocha deleted the fix/mcp-compose-tests-windows branch August 5, 2026 14:38
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants