-
Notifications
You must be signed in to change notification settings - Fork 2
fix(spew): fixed more panic & hang cases in the internalized spew #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@ccoVeille you might find this one interesting. This PR takes a systematic approach to exploring edge cases in spew. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request fixes two critical bugs in the internalized spew package that caused hangs and panics, and adds a comprehensive property-based testing framework to catch such issues in the future.
Changes:
- Fixed circular reference hang when an interface contains a self-referencing pointer
- Fixed panic/hang when dumping maps with circular references
- Added new integration test module using rapid for property-based testing
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
internal/spew/dump.go |
Fixed circular reference detection in pointers wrapped in interfaces; extracted map dumping to dedicated function with cycle detection |
internal/spew/edgecases_test.go |
Added edge case tests for the fixed scenarios (circular maps, pointer-to-interface patterns) |
internal/assertions/doc.go |
Added documentation link for API search by domain |
go.work |
Added testintegration module to workspace |
.golangci.yml |
Increased gocognit complexity threshold to 35 |
internal/testintegration/go.mod |
New module for integration tests with rapid dependency |
internal/testintegration/go.sum |
Dependency checksums |
internal/testintegration/README.md |
Comprehensive documentation of test architecture and usage |
internal/testintegration/spew/doc.go |
Package documentation |
internal/testintegration/spew/options.go |
Options system for test generators |
internal/testintegration/spew/generator.go |
Reflection-based random value generator for comprehensive testing |
internal/testintegration/spew/generator_test.go |
Tests for the generator itself |
internal/testintegration/spew/edgecases.go |
Hand-crafted edge case generators for known problematic patterns |
internal/testintegration/spew/edgecases_test.go |
Tests using edge case generators |
internal/testintegration/spew/dump_test.go |
Main property-based tests with rapid.Check |
internal/testintegration/spew/dump_fuzz_test.go |
Go native fuzz tests integrated with rapid |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #29 +/- ##
==========================================
+ Coverage 88.21% 88.68% +0.46%
==========================================
Files 60 63 +3
Lines 7467 8244 +777
==========================================
+ Hits 6587 7311 +724
- Misses 735 769 +34
- Partials 145 164 +19 ☔ View full report in Codecov by Sentry. |
* fixed case of circular reference that hangs * fixed unrecoverable panic when dumping a map with a circular reference test(integrationtest): added new module for integration tests This new module takes a systematic approach to explore edge cases in spew by producing random scenarios with uncommon data types. This approach uncovered 2 bugs in spew (fixed above)... and one in the fmt standard library. This new module leverages the rapid library to build generators and exercises spew.Sdump. The "property based" tests produced with rapid are generalized in a fuzz test. Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
9a8080e to
748f31b
Compare
test(integrationtest): added new module for integration tests
This new module takes a systematic approach to explore edge cases in spew by producing random scenarios with uncommon data types.
This approach uncovered 2 bugs in spew (fixed above)... and one in the fmt standard library.
This new module leverages the rapid library to build generators and exercises spew.Sdump. The "property based" tests produced with rapid are generalized in a fuzz test.
Change type
Please select: 🆕 New feature or enhancement|🔧 Bug fix'|📃 Documentation update
Short description
Fixes
Full description
Checklist