codegen: address open review comments#4
Merged
tmckayus merged 1 commit intoMay 22, 2026
Merged
Conversation
Apply outstanding CodeRabbit feedback on the gRPC code generator:
- Warm-start: detect presence via arrays.count() across all warm-start
arrays instead of decoding the first array's bytes. The previous sentinel
silently dropped valid payloads when the first warm-start array was empty
but companion arrays carried data.
- Setter groups (CSR-style): guard on the offsets field rather than
values/indices, so zero-nnz sparse matrices are not silently dropped.
Also throw on values/indices size mismatch.
- Chunked extractors (get_doubles, get_ints): throw on misaligned payload
size rather than returning {}, matching bytes_to_typed() in
grpc_solution_mapper.cpp. Treating truncated payloads as "absent" let bad
uploads be accepted as partial problems.
- Validation: add an ArrayFieldId uniqueness pass alongside ResultFieldId.
Duplicate array_ids in optimization_problem.arrays would have made
chunked uploads ambiguous.
- build.sh codegen: delete previously generated files before regenerating,
so artifacts no longer emitted by the generator do not linger and cause
verify_grpc_codegen.sh to fail.
Regenerated artifacts under cpp/src/grpc/codegen/generated/.
Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
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.
Summary
Applies the outstanding CodeRabbit feedback on NVIDIA#1107:
generate_conversions.py) — detect viaarrays.count()across all warm-start arrays. The previous first-array sentinel dropped valid payloads when that one array was empty but companions carried data, and emittedcuopt::remote::Noneif the array list was ever empty.generate_conversions.py) — guard on the*_offsetsfield, not values/indices, so zero-nnz sparse matrices are not silently dropped; throw on values/indices size mismatch.generate_conversions.py) —get_doubles/get_intsnow throw on misaligned payload size instead of returning{}, matchingbytes_to_typed()ingrpc_solution_mapper.cpp.generate_conversions.py) — added anArrayFieldIdduplicate pass alongside the existingResultFieldIdcheck.generated/before regenerating soverify_grpc_codegen.shconverges.Regenerated artifacts are committed.
Testing
bash build.sh codegenregenerates cleanly.bash ci/verify_grpc_codegen.sh→OK: All generated files match field_registry.yaml._validate_registry_uniquenessrejects a syntheticArrayFieldIdcollision.pre-commit runon changed files passes.Docs
No user-facing API changes; generator-internal only.