Skip to content

reject an empty processor performance query - #55

Merged
JamesLinYJ merged 1 commit into
mainfrom
cursor/empty-processor-query
Nov 9, 2026
Merged

JamesLinYJ merged 1 commit into
mainfrom
cursor/empty-processor-query

Conversation

@JamesLinYJ

Copy link
Copy Markdown
Owner

Summary

A successful processor-performance query with a zero returned length used to return Ok(()) and leave the output vector filled with default zero times. Those zeros are not a sample.

  • Success with returned == 0 is an error, and the default-zero rows are cleared.
  • A nonzero exact buffer that matches the requested count still returns Ok.
  • A short buffer, a length that is not a multiple of the struct, and a count mismatch keep their existing errors.

The status decision lives in a pure function and is unit-tested. Only src/system/cpu_sampler.rs changed.

Testing

The configured Windows MSVC build stops on this Linux agent because llvm-rc is not installed, so the full package tests were not run. The pure tests in src/system/cpu_sampler.rs were compiled and run without the Windows resource step: 11 passed, including zero-length success, an exact multiple, and a non-multiple length. The live processor-count test still needs Windows.

Open in Web Open in Cursor 

A successful NtQuerySystemInformation result with a zero returned length is not a sample. Return an error and drop the default-zero counters instead of treating them as idle time.

Co-authored-by: jameslincn <jameslincn@outlook.sg>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T07:13:49.065082Z 889dd0f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@JamesLinYJ
JamesLinYJ merged commit ac33017 into main Nov 9, 2026
3 checks passed
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.

2 participants