Skip to content

feat(mcpx): testsupport/gen core (ChaCha8 streams) + FuzzStripJSONC proof target (#1956) - #2636

Merged
dezren39 merged 2 commits into
mainfrom
queue/3251-1956-gen-core
Oct 30, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/3251-1956-gen-core

Conversation

@dezren39

@dezren39 dezren39 commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Implements #1956 Approach C core — queue task 3251. Stdlib only; go.mod/go.sum untouched, rapid NOT adopted.

internal/testsupport/gen — the generator core:

Golden stability test pins the exact first draws of the bytes@1 stream for a fixed test-vector seed: if generation output ever changes, the test fails and the change must land as a new generator version, never silently.

Proof target — FuzzStripJSONC in internal/config: fuzz bytes become a BytesSource, the generator draws the input, and StripJSONC must never panic, never grow its input, and be deterministic. f.Add seeds plus a corpus under testdata/fuzz/FuzzStripJSONC/ run as ordinary tests under plain go test ./....

Verified before pushing (laptop): go test green for testsupport/gen and the full internal/config package; a 15s -fuzz run completed 1.33M execs with no crash. Full go test ./... runs in CI on this PR.

Left as named follow-on work on #1956 (per the packet): fuzz targets for codegen.TypeFor, launcher.Expand, settings.ParseBytes; the generator registry (#1958); the scheduled -fuzz soak job (#1985 family).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…roof target (#1956)

Approach C core, stdlib only (go.mod untouched): internal/testsupport/gen with the Source interface, ChaCha8 streams keyed by stream(test, name@version) under SHA-256 derivation v1 from #1949, a BytesSource fuzz adapter (big-endian draws, zeros past the end), Lemire Intn, and a size-growing runner (the shrinking substitute). Golden test pins the bytes@1 stream output for a fixed test-vector seed, so a generator-output change can only land as a new version. Proof target: FuzzStripJSONC in internal/config drives StripJSONC through BytesSource, with f.Add seeds plus a seed corpus under testdata/fuzz/ that runs under plain go test; a 15s local -fuzz run (1.33M execs) found no crash. Follow-on work left named on #1956: fuzz targets for codegen.TypeFor, launcher.Expand, settings.ParseBytes, the #1958 registry, and the -fuzz soak job.
@dezren39
dezren39 requested a review from a team as a code owner October 30, 2026 08:35
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 10d548dd-16da-4ce0-8379-16e94615d22b
Commits

Reviewing files that changed from the base of the PR and between dd2c88f and 65cf3e9.

Files ignored due to path filters: 2
  • pkgs/mcpx/internal/testsupport/gen/gen.go is excluded by !**/gen/**
  • pkgs/mcpx/internal/testsupport/gen/gen_test.go is excluded by !**/gen/**
Files selected for processing: 6
  • pkgs/mcpx/internal/config/stripjsonc_fuzz_test.go
  • pkgs/mcpx/internal/config/testdata/fuzz/FuzzStripJSONC/seed-0
  • pkgs/mcpx/internal/config/testdata/fuzz/FuzzStripJSONC/seed-1
  • pkgs/mcpx/internal/config/testdata/fuzz/FuzzStripJSONC/seed-2
  • pkgs/mcpx/internal/config/testdata/fuzz/FuzzStripJSONC/seed-3
  • pkgs/mcpx/internal/config/testdata/fuzz/FuzzStripJSONC/seed-4
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 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-10-30T08:39:16.437145Z 4ba9a55 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.

@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: 4ba9a559ad

ℹ️ 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 on lines +27 to +28
size := gen.Intn(src, 4096)
input := gen.Bytes(src, size)

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 Preserve the intended corpus inputs when selecting the size

For the checked-in corpus and f.Add seeds, Intn consumes the first eight payload bytes as a length, so StripJSONC never receives the intended examples. For example, // only a comment becomes a comment followed by NUL padding, the block-comment seed loses its opening /*, and the seven-byte binary seed becomes empty input. This undermines the targeted comment/string edge-case coverage during ordinary go test runs. Derive the size from len(data) without consuming the source, or encode a separate length prefix in every seed so the intended payload reaches the stripper intact.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 65cf3e9: the size is no longer drawn from the source. input := gen.Bytes(src, len(data)) — Bytes over a BytesSource round-trips (pinned by TestBytesSourceReadsZerosPastTheEnd), so every seed/corpus payload now reaches StripJSONC byte-for-byte intact, including // only a comment, the block-comment seed, and the 7-byte binary seed.

Derive the input size from len(data) instead of drawing it from the
BytesSource: gen.Intn consumed the first eight payload bytes as a
length, so seed-corpus examples never reached StripJSONC intact
(Codex P2 finding on PR #2636). Bytes over a BytesSource round-trips,
so the full payload now reaches the stripper unchanged.
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