Skip to content

Conversation

@fi3ework
Copy link
Member

@fi3ework fi3ework commented Feb 4, 2026

human input:

introducing rstest-cdp package to let agent use skill by npx rstest-cdp --plan - to set breakpoint at source file position (leverage sourcemap inference to dist file) and read the variable throw CDP while test is running. skip the log -> build -> find log (sometimes agent even don't know the loop, lol) loop while testing.

i tested the skill locally in Rsbuild codebase, by intentionally broke some source code and had opencode + sonnet 4.5 (using a relatively simple model to prevent it from directly locating the error in the source code) call skill to assist in troubleshooting, and it turned out to be useful. the usefulness of skill varies from project to project, and it will be more valuable in codebases with interleaved states or race conditions.

here's the exported transcript:

session-ses_3d89-sanitized.md

excerpt:

## User

do you think rstest-cdp skill help out?

---

## Assistant

Yes, absolutely! The rstest-cdp skill was very helpful for this investigation. Here's why:

## What rstest-cdp helped with:

### 1. **Pinpointing exact variable values at runtime**
Without rstest-cdp, I could only read the code and make educated guesses. With it, I could see the **actual values** at the critical decision points:

- **Test #1**: I saw that `filename.image` = `"foo"` (no `[ext]`), which confirmed the issue was in `getFilename` returning the custom value as-is.

- **Test #2**: I saw that `filename.includes('-')` = `true`, which proved the hyphen logic was being triggered incorrectly.

- **Test #3**: I saw that `prefix` = `"html"` and `config.html.outputStructure` = `"flat"`, confirming that the prefix was being applied even for flat structures.

### 2. **Understanding the control flow**
By setting breakpoints at key decision points (line 106, line 110, line 41), I could see which code paths were being executed and why the tests were failing.

### 3. **Quick iteration**
I could investigate all three failures in quick succession by adjusting the plan for each test case, without having to add console.log statements or modify the source code.

## Where it provided unique value:

The rstest-cdp skill was especially valuable because:
- The test failures showed **what was wrong** (snapshot mismatches, assertion failures)
- But rstest-cdp showed **why it was wrong** (the exact variable values and logic being executed)

For example, without rstest-cdp, I might have guessed that the hyphen logic was the issue in Test #2, but seeing `filename.includes('-')` = `true` and the resulting concatenation `` `static/image-my-asset-[name]` `` made it crystal clear.

## Could I have done this without rstest-cdp?

Technically yes, by:
1. Reading the code carefully
2. Tracing through the logic manually
3. Adding console.log statements

But rstest-cdp made it **much faster and more reliable** by letting me inspect the exact runtime state at the moment of failure, without any code modifications.

---

@gemini-code-assist
Copy link

Summary of Changes

Hello @fi3ework, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the debugging capabilities for AI agents by introducing the rstest-cdp skill. This new tool allows agents to interact with rstest test runs at a deeper level, setting breakpoints and inspecting variables directly at runtime using the Chrome DevTools Protocol. This capability is crucial for quickly diagnosing and resolving complex issues by providing precise runtime context, thereby improving the efficiency and effectiveness of automated debugging workflows. The changes also lay down a robust foundation for future agent skill development and ensure project consistency.

Highlights

  • New rstest-cdp Skill: Introduced a new rstest-cdp skill that allows AI agents to debug rstest tests using the Chrome DevTools Protocol (CDP). This enables setting sourcemap-mapped breakpoints and evaluating expressions at runtime, significantly streamlining the debugging process by avoiding manual logging and recompilation cycles.
  • Agent-Focused CLI: The rstest-cdp functionality is exposed via a dedicated CLI designed for agent invocation. It accepts a JSON plan specifying runner configuration and breakpoint tasks, and outputs structured JSON results, making it machine-readable and easy for agents to integrate.
  • Comprehensive E2E Testing: Added extensive end-to-end tests for rstest-cdp to validate its core functionality, including evaluating local variables, handling multiple breakpoints across files, gracefully managing non-existent breakpoint lines, and reporting sourcemap mismatches in diagnostics.
  • Project Infrastructure Updates: The pull request includes updates to foundational project files such as .gitignore, .nvmrc, biome.json, package.json, pnpm-lock.yaml, and pnpm-workspace.yaml to establish a consistent development environment and support the new rstest-cdp package and its E2E tests.
  • Agent Skills Documentation: A new AGENTS.md file has been added, providing comprehensive guidance for AI coding agents on how to create new skills, including directory structure, naming conventions, SKILL.md format, and best practices for context efficiency.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .gitignore
    • Added a comprehensive list of common Node.js and web development patterns to ignore, improving repository cleanliness.
  • .nvmrc
    • Added 'v24' to specify the recommended Node.js version for the project.
  • AGENTS.md
    • Added a new document providing detailed guidance for AI coding agents on creating and structuring new skills, including naming conventions, SKILL.md format, and best practices for context efficiency.
  • biome.json
    • Added Biome configuration for consistent code formatting across the project, specifying indentation, line width, and JavaScript style rules.
  • e2e/cdp/fixtures/basic-no-debug/package.json
    • Added package.json for a basic CDP fixture designed for testing scenarios without debug flags.
  • e2e/cdp/fixtures/basic-no-debug/rstest.config.ts
    • Added rstest configuration for the basic CDP fixture without debug, enabling inline source maps.
  • e2e/cdp/fixtures/basic-no-debug/src/math.ts
    • Added a math.ts utility file for the basic CDP fixture without debug, containing summarizeScores function.
  • e2e/cdp/fixtures/basic-no-debug/src/profile.ts
    • Added a profile.ts utility file for the basic CDP fixture without debug, containing formatUser function.
  • e2e/cdp/fixtures/basic-no-debug/test/combined.test.ts
    • Added combined tests for the basic CDP fixture without debug, covering both math and profile functionalities.
  • e2e/cdp/fixtures/basic-no-debug/test/math.test.ts
    • Added math-specific tests for the basic CDP fixture without debug.
  • e2e/cdp/fixtures/basic-no-debug/test/profile.test.ts
    • Added profile-specific tests for the basic CDP fixture without debug.
  • e2e/cdp/fixtures/basic-no-debug/tsconfig.json
    • Added TypeScript configuration for the basic CDP fixture without debug.
  • e2e/cdp/fixtures/basic/package.json
    • Added package.json for a basic CDP fixture.
  • e2e/cdp/fixtures/basic/rstest.config.ts
    • Added rstest configuration for the basic CDP fixture, enabling inline source maps.
  • e2e/cdp/fixtures/basic/src/math.ts
    • Added a math.ts utility file for the basic CDP fixture, containing summarizeScores function.
  • e2e/cdp/fixtures/basic/src/profile.ts
    • Added a profile.ts utility file for the basic CDP fixture, containing formatUser function.
  • e2e/cdp/fixtures/basic/test/combined.test.ts
    • Added combined tests for the basic CDP fixture, covering both math and profile functionalities.
  • e2e/cdp/fixtures/basic/test/math.test.ts
    • Added math-specific tests for the basic CDP fixture.
  • e2e/cdp/fixtures/basic/test/profile.test.ts
    • Added profile-specific tests for the basic CDP fixture.
  • e2e/cdp/fixtures/basic/tsconfig.json
    • Added TypeScript configuration for the basic CDP fixture.
  • e2e/cdp/fixtures/invalid-line/package.json
    • Added package.json for a CDP fixture designed to test invalid breakpoint lines.
  • e2e/cdp/fixtures/invalid-line/rstest.config.ts
    • Added rstest configuration for the invalid-line CDP fixture, enabling inline source maps.
  • e2e/cdp/fixtures/invalid-line/src/math.ts
    • Added a math.ts utility file for the invalid-line CDP fixture.
  • e2e/cdp/fixtures/invalid-line/src/profile.ts
    • Added a profile.ts utility file for the invalid-line CDP fixture.
  • e2e/cdp/fixtures/invalid-line/test/combined.test.ts
    • Added combined tests for the invalid-line CDP fixture.
  • e2e/cdp/fixtures/invalid-line/test/math.test.ts
    • Added math-specific tests for the invalid-line CDP fixture.
  • e2e/cdp/fixtures/invalid-line/test/profile.test.ts
    • Added profile-specific tests for the invalid-line CDP fixture.
  • e2e/cdp/fixtures/invalid-line/tsconfig.json
    • Added TypeScript configuration for the invalid-line CDP fixture.
  • e2e/cdp/fixtures/mismatch/package.json
    • Added package.json for a CDP fixture designed to test sourcemap mismatches.
  • e2e/cdp/fixtures/mismatch/rstest.config.ts
    • Added rstest configuration for the mismatch CDP fixture, enabling inline source maps.
  • e2e/cdp/fixtures/mismatch/src/math.ts
    • Added a math.ts utility file for the mismatch CDP fixture.
  • e2e/cdp/fixtures/mismatch/src/profile.ts
    • Added a profile.ts utility file for the mismatch CDP fixture.
  • e2e/cdp/fixtures/mismatch/test/combined.test.ts
    • Added combined tests for the mismatch CDP fixture.
  • e2e/cdp/fixtures/mismatch/test/math.test.ts
    • Added math-specific tests for the mismatch CDP fixture.
  • e2e/cdp/fixtures/mismatch/test/profile.test.ts
    • Added profile-specific tests for the mismatch CDP fixture.
  • e2e/cdp/fixtures/mismatch/tsconfig.json
    • Added TypeScript configuration for the mismatch CDP fixture.
  • e2e/cdp/fixtures/multi/package.json
    • Added package.json for a multi-breakpoint CDP fixture.
  • e2e/cdp/fixtures/multi/rstest.config.ts
    • Added rstest configuration for the multi-breakpoint CDP fixture, enabling inline source maps.
  • e2e/cdp/fixtures/multi/src/math.ts
    • Added a math.ts utility file for the multi-breakpoint CDP fixture.
  • e2e/cdp/fixtures/multi/src/profile.ts
    • Added a profile.ts utility file for the multi-breakpoint CDP fixture.
  • e2e/cdp/fixtures/multi/test/combined.test.ts
    • Added combined tests for the multi-breakpoint CDP fixture.
  • e2e/cdp/fixtures/multi/test/math.test.ts
    • Added math-specific tests for the multi-breakpoint CDP fixture.
  • e2e/cdp/fixtures/multi/test/profile.test.ts
    • Added profile-specific tests for the multi-breakpoint CDP fixture.
  • e2e/cdp/fixtures/multi/tsconfig.json
    • Added TypeScript configuration for the multi-breakpoint CDP fixture.
  • e2e/cdp/index.test.ts
    • Added E2E tests for the rstest-cdp skill, covering scenarios like local variable evaluation, multiple breakpoints, and error handling for invalid lines and sourcemap mismatches.
  • e2e/package.json
    • Added package.json for the E2E test suite, including @rstest/core and tinyexec dependencies.
  • e2e/rstest.config.ts
    • Added rstest configuration for the E2E test suite, setting a global test timeout.
  • package.json
    • Updated root package.json to include new scripts for formatting, building, type checking, and testing across the monorepo.
    • Added @biomejs/biome, @types/node, and typescript as development dependencies.
  • packages/rstest-cdp/AGENTS.md
    • Added internal documentation for the rstest-cdp CLI, detailing its architecture, output contract, and development guidelines for maintainers.
  • packages/rstest-cdp/README.md
    • Added a README file for the rstest-cdp package, explaining its purpose as an agent-invoked CDP debugger CLI for rstest, its usage, CLI arguments, and output format.
  • packages/rstest-cdp/package.json
    • Added package.json for the new rstest-cdp package, defining its metadata, scripts, and dependencies required for CDP communication, sourcemap handling, and CLI parsing.
  • packages/rstest-cdp/rslib.config.ts
    • Added rslib configuration for the rstest-cdp package, specifying build settings like CJS format, bundling, and environment variable definitions for ws.
  • packages/rstest-cdp/schema/plan.schema.json
    • Added the JSON schema for the rstest-cdp plan, which defines the expected structure for input plans, including runner and task configurations.
  • packages/rstest-cdp/scripts/genPlanSchema.mts
    • Added a script to automatically generate the plan.schema.json from Valibot schemas, ensuring schema consistency.
  • packages/rstest-cdp/src/cdp.ts
    • Added the core CDP client implementation, responsible for establishing WebSocket connections to the Node.js inspector and handling expression evaluation on paused call frames.
  • packages/rstest-cdp/src/cli.ts
    • Added the CLI entry point for the rstest-cdp tool.
  • packages/rstest-cdp/src/index.ts
    • Added the main logic for the rstest-cdp CLI, orchestrating argument parsing, plan loading, runner process management, and debug session lifecycle.
  • packages/rstest-cdp/src/plan.ts
    • Added utility functions for parsing CLI options, loading and normalizing the debug plan from various sources (file/stdin), spawning the test runner, and waiting for the inspector URL.
  • packages/rstest-cdp/src/schema.ts
    • Added Valibot schemas for robust validation of the rstest-cdp plan input, ensuring data integrity and correctness.
  • packages/rstest-cdp/src/session.ts
    • Added the DebugSession class, which manages the entire CDP debugging workflow, including listening for script parsed events, handling debugger pauses, evaluating expressions, and finalizing results.
  • packages/rstest-cdp/src/sourcemap.ts
    • Added sourcemap resolution logic to accurately map breakpoint locations from original source files to their corresponding positions in the generated (compiled) code.
  • packages/rstest-cdp/src/types.ts
    • Added TypeScript type definitions for all data structures used within the rstest-cdp CLI, including plans, runner configurations, task definitions, results, errors, and debug status.
  • packages/rstest-cdp/tsconfig.json
    • Added TypeScript configuration for the rstest-cdp package, extending the root configuration.
  • pnpm-lock.yaml
    • Updated the pnpm lockfile to include all new dependencies and reflect the new monorepo structure.
  • pnpm-workspace.yaml
    • Added pnpm workspace configuration to define the monorepo structure, including packages/*, e2e, and e2e/**.
  • skills/rspack-debugging/scripts/setup_debug_deps.cjs
    • Applied minor formatting adjustments to improve code readability.
  • skills/rspack-tracing/scripts/analyze_trace.js
    • Applied minor formatting adjustments to improve code readability and consistency.
  • skills/rstest-cdp/SKILL.md
    • Added the detailed skill definition for rstest-cdp, outlining its quick start guide, required inputs, plan format, core workflow, and troubleshooting tips for agents.
  • tsconfig.json
    • Added a root TypeScript configuration file for the monorepo, defining common compiler options.
Activity
  • The pull request introduces a new feature, rstest-cdp, which is a skill for AI agents to debug rstest tests using CDP.
  • The author, fi3ework, has provided a detailed description of the skill's purpose and its benefits, including a transcript of a session where the skill was successfully used to troubleshoot an issue.
  • The provided transcript highlights how rstest-cdp helped pinpoint exact variable values, understand control flow, and enabled quick iteration during debugging, demonstrating its practical utility.
  • The changes involve adding a new package (rstest-cdp), extensive documentation for it, new E2E tests to ensure its reliability, and updating overall project configuration files to support the new structure.
  • The PR sets up a new development environment with pnpm workspaces, biome for consistent code formatting, and specifies Node.js version requirements, indicating a focus on maintainability and developer experience.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new rstest-cdp skill, which is a powerful tool for debugging rstest tests using the Chrome DevTools Protocol. The implementation is well-structured, with a clear separation of concerns between plan parsing, CDP communication, session management, and sourcemap resolution. The use of instrumentation breakpoints to reliably set breakpoints before script execution is a clever and robust approach. The end-to-end tests cover various scenarios, ensuring the tool's reliability.

My feedback includes a few suggestions to improve maintainability and correctness. I've pointed out an opportunity to refactor duplicated code in the e2e tests, a small enhancement to improve the debuggability of the tool itself by adding more logging, and a correction in the skill's documentation to accurately reflect the output format.

Overall, this is an excellent contribution that adds a valuable debugging capability.

Comment on lines 81 to 141
it('evaluates locals via CDP', async () => {
const fixturesTargetPath = `${__dirname}/fixtures/basic`;

const profileSourcePath = path.join(fixturesTargetPath, 'src/profile.ts');
const plan = {
runner: {
cmd: 'pnpm',
args: ['rstest', 'run', '-c', 'rstest.config.ts', '--include', 'test/profile.test.ts'],
cwd: fixturesTargetPath,
env: {
FORCE_COLOR: '0',
},
},
tasks: [
{
description: 'Inspect formatted profile fields',
sourcePath: profileSourcePath,
line: 7,
column: 0,
expressions: ['trimmed', 'normalized', 'displayName', 'role'],
},
],
};
const stdinPayload = JSON.stringify(plan, null, 2);

let stdout = '';
const cli = x(
'node',
[
path.resolve(__dirname, '../../packages/rstest-cdp/dist/rstest-cdp.cjs'),
'--plan',
'-',
'--debug',
'1',
],
{
nodeOptions: {
cwd: fixturesTargetPath,
},
},
);

cli.process?.stdout?.on('data', (chunk) => {
stdout += chunk.toString();
});

cli.process?.stdin?.write(stdinPayload);
cli.process?.stdin?.end();

try {
await Promise.race([
cli,
new Promise<void>((_resolve, reject) => {
setTimeout(() => reject(new Error('rstest-cdp timed out.')), 45_000);
}),
]);
} catch (_error) {
const details = stdout.trim() ? `\n${stdout}` : '';
throw new Error(`rstest-cdp failed.${details}`);
}

const result = JSON.parse(stdout) as DebugResult;
if (result.status === 'failed') {
throw new Error(`rstest-cdp failed.\n${JSON.stringify(result)}`);
}

expect(result.status).toBe('full_succeed');
expect(result.meta).toBeTruthy();
expect(result.meta?.pendingTaskIds.length).toBe(0);

expect(result.meta?.forwardedArgs).toContain('--pool.maxWorkers=1');
expect(result.meta?.forwardedArgs).toContain('--pool.execArgv=--inspect-brk=0');

const profileResult = result.results.find((item) => item.id === 'task-1');
expect(profileResult).toBeTruthy();
const values = Object.fromEntries(
(profileResult?.values || []).map((entry) => [entry.expression, entry.value]),
);
expect(values.trimmed).toBe('Ada Lovelace');
expect(values.normalized).toBe('ada-lovelace');
expect(values.displayName).toBe('Ada Lovelace');
expect(values.role).toBe('admin');
}, 60_000);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This test case contains a lot of boilerplate for running the rstest-cdp CLI, which is already encapsulated in the runCdpDebug helper function. To improve maintainability and reduce code duplication, this test should be refactored to use the helper function, just like the other tests in this file.

  it('evaluates locals via CDP', async () => {
    const fixturesTargetPath = `${__dirname}/fixtures/basic`;

    const profileSourcePath = path.join(fixturesTargetPath, 'src/profile.ts');
    const plan = {
      runner: {
        cmd: 'pnpm',
        args: ['rstest', 'run', '-c', 'rstest.config.ts', '--include', 'test/profile.test.ts'],
        cwd: fixturesTargetPath,
        env: {
          FORCE_COLOR: '0',
        },
      },
      tasks: [
        {
          description: 'Inspect formatted profile fields',
          sourcePath: profileSourcePath,
          line: 7,
          column: 0,
          expressions: ['trimmed', 'normalized', 'displayName', 'role'],
        },
      ],
    };

    const result = await runCdpDebug({
      plan,
      cwd: fixturesTargetPath,
      debug: true,
    });

    if (result.status === 'failed') {
      throw new Error(`rstest-cdp failed.\n${JSON.stringify(result)}`);
    }

    expect(result.status).toBe('full_succeed');
    expect(result.meta).toBeTruthy();
    expect(result.meta?.pendingTaskIds.length).toBe(0);

    expect(result.meta?.forwardedArgs).toContain('--pool.maxWorkers=1');
    expect(result.meta?.forwardedArgs).toContain('--pool.execArgv=--inspect-brk=0');

    const profileResult = result.results.find((item) => item.id === 'task-1');
    expect(profileResult).toBeTruthy();
    const values = Object.fromEntries(
      (profileResult?.values || []).map((entry) => [entry.expression, entry.value]),
    );
    expect(values.trimmed).toBe('Ada Lovelace');
    expect(values.normalized).toBe('ada-lovelace');
    expect(values.displayName).toBe('Ada Lovelace');
    expect(values.role).toBe('admin');
  }, 60_000);

Comment on lines 114 to 180
export const evaluateExpressions = async ({
cdp,
callFrameId,
expressions,
}: {
cdp: CdpClient;
callFrameId: string;
expressions: string[];
}): Promise<EvaluatedValue[]> => {
return Promise.all(
expressions.map(async (expression) => {
const result = await cdp.send<{ result?: RemoteObject }>('Debugger.evaluateOnCallFrame', {
callFrameId,
expression,
});
const payload = result?.result;
let value = payload?.value;
const type = payload?.type;
const subtype = payload?.subtype;
const preview = payload?.description;

// For objects without a primitive value, fetch shallow properties
if (value === undefined && payload?.objectId) {
try {
const properties = await cdp.send<{ result?: PropertyDescriptor[] }>(
'Runtime.getProperties',
{ objectId: payload.objectId, ownProperties: true },
);
const shallow: Record<string, unknown> = {};
for (const prop of properties?.result || []) {
if (!prop?.name || prop?.value == null) continue;
const propVal = prop.value;
shallow[prop.name] = propVal.value ?? propVal.description ?? propVal.type;
}
value = shallow;
} catch {
value = preview;
}
}

return {
expression,
value,
type,
subtype,
preview,
} satisfies EvaluatedValue;
}),
);
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The catch block for Runtime.getProperties is empty. While falling back to the preview description is a good defensive measure, swallowing the error silently can make it harder to debug issues with property fetching. Consider adding a debug log here to report the error when in debug mode. This will require passing the debugLog function into evaluateExpressions.

After applying this change, you'll also need to update the call site in packages/rstest-cdp/src/session.ts to pass this.debugLog.

export const evaluateExpressions = async ({
  cdp,
  callFrameId,
  expressions,
  debugLog,
}: {
  cdp: CdpClient;
  callFrameId: string;
  expressions: string[];
  debugLog?: (...args: unknown[]) => void;
}): Promise<EvaluatedValue[]> => {
  return Promise.all(
    expressions.map(async (expression) => {
      const result = await cdp.send<{ result?: RemoteObject }>('Debugger.evaluateOnCallFrame', {
        callFrameId,
        expression,
      });
      const payload = result?.result;
      let value = payload?.value;
      const type = payload?.type;
      const subtype = payload?.subtype;
      const preview = payload?.description;

      // For objects without a primitive value, fetch shallow properties
      if (value === undefined && payload?.objectId) {
        try {
          const properties = await cdp.send<{ result?: PropertyDescriptor[] }>(
            'Runtime.getProperties',
            { objectId: payload.objectId, ownProperties: true },
          );
          const shallow: Record<string, unknown> = {};
          for (const prop of properties?.result || []) {
            if (!prop?.name || prop?.value == null) continue;
            const propVal = prop.value;
            shallow[prop.name] = propVal.value ?? propVal.description ?? propVal.type;
          }
          value = shallow;
        } catch (error) {
          debugLog?.(
            'Failed to get properties for objectId',
            payload.objectId,
            error instanceof Error ? error.message : String(error),
          );
          value = preview;
        }
      }

      return {
        expression,
        value,
        type,
        subtype,
        preview,
      } satisfies EvaluatedValue;
    }),
  );
};


Read these fields:

- `ok`: success/failure

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The documentation for the output format is incorrect. The output JSON does not contain an ok field. The field indicating the result status is status, which can have values 'full_succeed', 'partial_succeed', or 'failed'. Please update the documentation to reflect the correct field name and possible values.

Suggested change
- `ok`: success/failure
- `status`: 'full_succeed', 'partial_succeed', or 'failed'

@fi3ework fi3ework force-pushed the cdp-debug branch 2 times, most recently from 42112f4 to d029773 Compare February 4, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant