Skip to content

fix(scopetimer): harden sinks and require c++20 - #4

Merged
stephenlclarke merged 3 commits into
mainfrom
critical-review-fixes
Jul 21, 2026
Merged

fix(scopetimer): harden sinks and require c++20#4
stephenlclarke merged 3 commits into
mainfrom
critical-review-fixes

Conversation

@stephenlclarke

Copy link
Copy Markdown
Owner

Pull Request

Summary

  • Require C++20 or newer for ScopeTimer consumers and prevent CMake subprojects from inheriting demo, benchmark, or test targets.
  • Harden timer labels, static teardown, file creation, and custom, buffered, and asynchronous sink behavior.
  • Bound benchmark workloads, improve validation coverage, and restrict SonarQube analysis to maintained production sources on main.

Type Of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Maintenance or workflow update

Motivation And Context

C++20 is now the supported baseline. The accompanying strict review fixes correctness, shutdown-safety, secure logging, and consumer-integration issues without removing intentional performance optimizations.

Testing

  • Tested locally
  • Added or updated tests where appropriate
  • Updated documentation where appropriate

Validation: CTest in debug, release, strict AppleClang, strict GCC, ASan/UBSan, and TSan configurations; MinGW compilation; header coverage; ShellCheck, actionlint, pylint; and the MacBook benchmark matrix.

Contributor Checklist

  • This pull request is focused on one issue or one coherent change.
  • I used Conventional Commits in commit messages and the pull request title.
  • I signed my commits with a GitHub-supported signature method.
  • I removed credentials, tokens, private keys, personal data, and private environment details from code, tests, logs, and screenshots.

@stephenlclarke
stephenlclarke marked this pull request as ready for review July 21, 2026 06:52
@stephenlclarke
stephenlclarke merged commit ecf9e81 into main Jul 21, 2026
1 check passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d3d65cb451

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread include/ScopeTimer.hpp
#include <sys/stat.h>
#if defined(_WIN32)
#include <io.h>
#include <windows.h>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Define NOMINMAX before including windows.h

On Windows builds where the consumer has not already defined NOMINMAX, this public include causes windows.h to define min/max macros before the rest of ScopeTimer.hpp is parsed. The header later uses std::min(...) in inline functions, so those macros expand inside the header and break a default Windows CMake consumer, and they also leak to downstream files. Define NOMINMAX/WIN32_LEAN_AND_MEAN before including windows.h or avoid pulling it into the public header.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Retrospective disposition: accepted as an actionable review. This pull request merged without an explicit response, so I am not treating the merge as resolving the finding. The item is now carried as requiring verification against the repository's current main branch and, if still present, a focused follow-up fix. This thread will remain open until a correcting commit or concrete verification is linked.

metric_name = "throughput_cost_per_record_us"
current_value = current_report.get(metric_name)
previous_value = previous_profile.get(metric_name)
if current_value is None and previous_value is None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Compare new per-record metric to legacy baselines

When the current report has the new throughput_cost_per_record_us key but the checked-in main baseline only has the legacy approx_per_record_us, current_value is non-null and previous_value is null, so this condition skips the legacy fallback and the comparison falls through to delta_mean_s. That makes BENCHMARK.md compare a different metric, or report unavailable, even though both per-record values exist under compatible names. Fall back per side before using mean overhead.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Retrospective disposition: accepted as an actionable review. This pull request merged without an explicit response, so I am not treating the merge as resolving the finding. The item is now carried as requiring verification against the repository's current main branch and, if still present, a focused follow-up fix. This thread will remain open until a correcting commit or concrete verification is linked.

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