You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(farm): pass string messages to Farm warn and error context - #648
Normalize this.warn() and this.error() arguments to a string in unpluginContext (src/farm/context.ts) before forwarding to Farm's CompilationContext.warn / CompilationContext.error.
Farm's native binding expects a string argument and panics (SIGABRT) when passed an Error or non-string object.
Updated unit tests in test/unit-tests/farm/context.test.ts covering string, Error, and { message } inputs for both warn and error.
Verification
pnpm build
pnpm typecheck
pnpm lint
pnpm vitest run test/unit-tests/farm (3 files, 50/50 tests passed)
Summary by CodeRabbit
Bug Fixes
Error and warning messages are now consistently provided as readable text. Existing string messages remain unchanged, while errors and objects with a message display that message. Other values are converted to text, helping ensure diagnostic details are available in a consistent format.
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
No actionable comments were generated in the recent review.
Walkthrough
The Farm adapter now converts warning and error inputs to strings before forwarding them to the compilation context. It preserves string inputs, uses messages from errors and objects with string messages, and converts other values with String.
Changes: Farm context message forwarding
Layer / File(s)
Summary
Format and forward messages src/farm/context.ts, test/unit-tests/farm/context.test.ts
The adapter formats warning and error inputs as strings before forwarding them. Tests cover string inputs, Error instances, and objects with string messages.
This change makes Farm's warn and error calls pass string messages, which avoids the reported native abort. The change is small, tests cover the main input shapes, and no merge-blocking risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the Farm adapter fix: string messages are now passed to the Farm warn and error context. The change normalizes this.warn() and this.error() arguments to strings in unpluginContext, and…
Linked Issues check
Issue #647 requires that this.warn and this.error pass messages to Farm as strings, so that Farm does not panic for string, Error, or { message } arguments. At the reviewed head, `src/farm/con…
Out of Scope Changes check
The PR changes src/farm/context.ts (message normalization in unpluginContext) and test/unit-tests/farm/context.test.ts (tests for the new behavior). Both changes directly implement the issue #64…
Full details: Title check
Explanation
The title names the Farm adapter fix: string messages are now passed to the Farm warn and error context. The change normalizes this.warn() and this.error() arguments to strings in unpluginContext, and the tests cover string, Error, and { message } inputs. The title matches the main change and is specific.
Full details: Linked Issues check
Explanation
Issue #647 requires that this.warn and this.error pass messages to Farm as strings, so that Farm does not panic for string, Error, or { message } arguments. At the reviewed head, src/farm/context.ts adds formatMessage. It returns strings unchanged, returns error.message for Error instances and for objects with a string message, and falls back to String(error). unpluginContext passes the result to context.warn and context.error, so Farm receives a string in every case. The unit tests in test/unit-tests/farm/context.test.ts cover string, Error, and { message } inputs for both methods, per the PR description. The issue expected behavior (warnings print, errors fail the build with the message) depends on Farm's native runtime. That runtime behavior was not executed in this review. The evidence from the code change and the reported unit-test results supports the requirement. The issue's resolveIdenforce: 'pre' note concerns reproduction setup, not a code requirement. No non-coding requirements apply.
Full details: Out of Scope Changes check
Explanation
The PR changes src/farm/context.ts (message normalization in unpluginContext) and test/unit-tests/farm/context.test.ts (tests for the new behavior). Both changes directly implement the issue #647 objective. No unrelated changes appear in the PR summary. The whole-PR diff could not be read as text, so this verdict relies on the PR summary and the head file content. The head file contains only the Farm context changes, with no unrelated edits visible.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
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.
src/farm/context.ts
ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.
test/unit-tests/farm/context.test.ts
ESLint skipped: the matched ESLint configuration already failed (missing-dependency).
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.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: faf2d312-38aa-44e2-89f0-b8a7ccb7fe54
Commits
Reviewing files that changed from the base of the PR and between 5daf6e6 and 5cbfff1.
Files selected for processing: 2
src/farm/context.ts
test/unit-tests/farm/context.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #647
Summary
this.warn()andthis.error()arguments to astringinunpluginContext(src/farm/context.ts) before forwarding to Farm'sCompilationContext.warn/CompilationContext.error.stringargument and panics (SIGABRT) when passed anErroror non-string object.test/unit-tests/farm/context.test.tscovering string,Error, and{ message }inputs for bothwarnanderror.Verification
pnpm buildpnpm typecheckpnpm lintpnpm vitest run test/unit-tests/farm(3 files, 50/50 tests passed)Summary by CodeRabbit