Conversation
- Generate pointer types for all RPC parameters that have default values - Fix non-deterministic code generation by sorting map keys before iteration - Apply to both GetModelDecl() and RpcNormalizeTableAliases() functions - Update golden file with correct expectations for TestGenerateRpc_ComplexFunction
- Skip nil pointer parameters (e.g., *string, *int64) - Skip nil slice parameters (e.g., []int64, []uuid.UUID) - Allows Supabase to use default values for omitted parameters - Add tests to verify nil parameters are excluded from requests
- Only skip parameters that have default values (check column tag) - Skip zero UUID values (uuid.Nil) for parameters with defaults - Skip zero *uuid.UUID pointer values for parameters with defaults - Add comprehensive tests for UUID handling - Fix: check column tag exists before parsing (len > 0 instead of >= 0) - No Go vet warnings, all tests pass
- Remove trailing whitespace - Fix comment alignment - Apply gofmt -s formatting rules
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
toopay
approved these changes
Jan 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR fixes non-deterministic test failures in the RPC generator and improves RPC parameter handling when forwarding requests to Supabase. The changes ensure consistent code generation output and enable proper use of database default values for optional parameters.
Problem Statement
Issue 1: Non-Deterministic Test Failures
TestGenerateRpc_ComplexFunctionwas failing intermittentlyIssue 2: Incorrect Parameter Type Generation
Issue 3: All Parameters Sent to Supabase
Changes Made
1. Generate Pointer Types for Parameters with Defaults
File:
pkg/generator/rpc.goLines: 694-706
int64→*int64[]uuid.UUID→[]*uuid.UUIDExample:
2. Ensure Deterministic Code Generation
Files:
pkg/generator/rpc.goLines: 613-628 (RpcNormalizeTableAliases), 745-750 (GetModelDecl)
RpcNormalizeTableAliases(): Deterministic alias assignmentGetModelDecl(): Alphabetically sorted BindModel chainImpact:
3. Skip Nil/Empty Parameters When Forwarding to Supabase
File:
rpc.goLines: 997-1028
Logic:
columntag)Supported Types:
*string,*int64)[]uuid.UUID,[]int64)uuid.Nil)nil,&uuid.Nil)Example:
Files Changed
pkg/generator/rpc.gopkg/generator/rpc_test.gopkg/generator/testdata/*.goldenpkg/generator/testdata/*.sqlrpc.gorpc_test.godocs/rpc-generator.mddocs/test-coverage-report.mdTesting
New Tests Added
Generator Tests
TestGenerateRpc_ComplexFunctionRPC Execution Tests
✅
TestExecuteRpc_SkipsNilParameters✅
TestExecuteRpc_IncludesNonNilOptionalParameters✅
TestExecuteRpc_SkipsZeroUUIDuuid.Nilis skipped&uuid.Nilis skipped✅
TestExecuteRpc_IncludesNonZeroUUIDTest Results
Code Coverage
ExecuteRpc()GetParams()GetModelDecl()RpcNormalizeTableAliases()Modified Lines Coverage: 71/71 lines = 100% ✅
See docs/test-coverage-report.md for full coverage analysis.
Behavior Changes
Breaking Changes
Before:
After:
Migration Required:
raiden generateto regenerate RPC filesNon-Breaking Changes
✅ Parameter forwarding logic - Backward compatible
Quality Assurance
Static Analysis
Test Coverage
Determinism
Documentation
docs/rpc-generator.md- Complete RPC generator documentationdocs/test-coverage-report.md- Detailed coverage analysisBenefits
For Developers
nilmeans "use default", not "send null"For Runtime
For Maintenance
Checklist
Related Issues
Fixes: TestGenerateRpc_ComplexFunction test failures
Migration Guide
Step 1: Regenerate RPC Files
Step 2: Update RPC Calls