fix(browser): serialize undefined run results as null - #278
Conversation
🟢 No documentation gap found — medium confidenceThe automated review found no documentation gap in the supplied changes. This review is advisory and does not block merging. |
Maintainer review: changes requestedThe one-line behavior change is sensible, but this PR needs a regression test and a minimal problem statement before it is safe to merge. Why the behavior is valid
Representing that top-level “no value” as JSON Why a test is requiredThis branch changes the public result contract for both local and hosted browser runs:
A later cleanup could easily revert Please add a focused test in it('serializes a program with no explicit return as null', async () => {
const output = await run(`
await page.locator('button').click();
`);
expect(output.result).toBeNull();
});Keep or explicitly assert the complementary invariant: await expect(run('return 1n;')).rejects.toMatchObject({
code: 'BROWSER_RUN_SERIALIZATION_ERROR',
});A CLI/envelope assertion would also be useful if there is already a cheap browser-run fixture, but one runner-level regression test is the minimum needed. PR contextThe description currently contains only the repository template, has no reproduction/output, and links no issue. Please document:
Deployment implicationOnce merged and released, local users receive the behavior in the new CLI package. Cloud receives it only after its exact With that small test and description update, I would consider the implementation appropriate and minimal. |
Added the runner-level regression test for programs without an explicit return. It asserts result: null, while the existing BigInt assertion continues to cover BROWSER_RUN_SERIALIZATION_ERROR. |
Description
Related issue:
Type of Change
Checklist
Adapter Notes
CliErrorsubclasses instead of rawErrorScreenshots / Output