#25: handle MCP startup failure#33
Conversation
GHX5T-SOL
left a comment
There was a problem hiding this comment.
Verified the startup failure handling for #25. The top-level async startup now reports server.connect(...) rejection with context and exits with status 1 instead of leaving an unhandled rejection.
Validation:
npm ci-> completed; npm reports existing audit findings, and this PR does not change dependenciesnpm exec jest -- --config jest.config.ts --no-color --ci test/index.test.ts --coverage=false-> 1 suite passed, 1 test passednpm exec eslint -- index.ts test/index.test.ts --config eslint.config.mjs-> passednpm exec tsc -- --noEmit-> passedgit diff --check origin/master...HEAD-> passedgit diff origin/master...HEAD | gitleaks stdin --no-banner --redact --exit-code 1-> no leaks found
Live pre-review state: open, non-draft, mergeable/UNSTABLE only because no GitHub checks are reported, no existing comments/reviews. Same-scope open PR search for server connect failure startup returned no competing PR. I did not run the full live endpoint suite.
kreinba
left a comment
There was a problem hiding this comment.
The catch handler matches the fix proposed in issue #25: rejections from server.connect now log with context and exit 1 instead of bubbling up as unhandled rejections. The regression test mocks the rejection, asserts both console.error and process.exit(1) are called, and confirms no unhandled rejection escapes. Targeted jest run passes locally.
|
@kreinba Thanks for the review! You've earned +10 points for this: +18 as a basis; -8 for absolutely no comments posted. Your running score is +1446; don't forget to check your Zerocracy account too). |
|
Merged current Notes:
Validation:
Hosted checks on Limitation: this Windows shell does not have GNU |
Closes #25.
This adds a catch handler around the MCP server startup promise so a
server.connect(...)rejection is reported with context and exits with status1instead of surfacing as an unhandled promise rejection.Changes:
Failed to start MCP server:1after reporting the failureserver.connectrejection and assertsconsole.errorplusprocess.exit(1)Validation:
npm exec jest -- --config jest.config.ts --no-color --ci test/index.test.ts --coverage=false->1 passednpm exec eslint -- index.ts test/index.test.ts --config eslint.config.mjs-> passednpm exec tsc -- --noEmit-> passedgit diff --cached --check-> passed before commitgit diff --cached | gitleaks stdin --no-banner --redact-> no leaks before commitLimitations:
npm exec jest -- --config jest.config.ts --no-color --ci --coverage=falseis not clean locally because existing live Zerocracy API tests fail with dummy-tokenHTTP error 303/400responses intest/baza.test.tsandtest/server.test.ts. The new startup test and mocked local tests pass.