Commit 1cd8d5b
committed
test(grpc): Add race condition regression tests from PR #7 with analysis
Adds test/race_condition_test.dart (293 lines, 3 tests) from PR #7 to provide
regression coverage for the race condition fixes applied in commit dedce7a.
SOURCE:
• Original PR: #7
• Feature Branch: https://github.com/open-runtime/grpc-dart/tree/hiro/race_condition_fix
• Original Commits:
- e8b9ad8 (main fixes)
- 4371c8d (test coverage)
• Author: hiro@pieces
• Date: September 1, 2025
TEST COVERAGE:
1. "Should handle serialization error without crashing when stream closes concurrently"
- Simulates serialization failure + concurrent client disconnect
- Validates no "Cannot add event after closing" exception
- Result: ✅ PASSING
2. "Stress test - multiple concurrent disconnections during serialization errors"
- Runs 10 concurrent iterations with random timing
- Tests different disconnect methods
- Result: ✅ PASSING
3. "Reproduce exact 'Cannot add event after closing' scenario"
- Attempts exact production scenario
- Shows error is handled gracefully
- Result: ✅ PASSING (error properly handled)
MODIFICATIONS:
• Removed unused import: package:grpc/src/server/handler.dart
• Removed unused variable: gotError
• Fixed type annotations (changed int/bool to var)
• Result: No lint issues, all tests passing
VERIFICATION:
• Total test suite: 172 tests (169 + 3 new)
• All tests passing
• No analyzer errors
• Production-ready
PR #7 ANALYSIS:
• Added PR_7_ANALYSIS.md (672 lines) documenting:
- Complete diff analysis between PR branch and aot_monorepo_compat
- Why PR #7 cannot be merged directly (removes v5.0.0 + ServerInterceptor)
- Review comments from mark-at-pieces about Sentry logging
- Recommendation to close PR #7 (superseded by our work)
- Decision matrix and risk analysis
RELATED:
• PR #7: #7
• Fixes applied: dedce7a
• Documentation: e8b6d521 parent e8b6d52 commit 1cd8d5b
2 files changed
+962
-0
lines changed
0 commit comments