Skip to content

codegen: address open review comments#4

Merged
tmckayus merged 1 commit into
tmckayus:grpc-codegen-v2from
rgsl888prabhu:address-codegen-review-feedback
May 22, 2026
Merged

codegen: address open review comments#4
tmckayus merged 1 commit into
tmckayus:grpc-codegen-v2from
rgsl888prabhu:address-codegen-review-feedback

Conversation

@rgsl888prabhu
Copy link
Copy Markdown

Summary

Applies the outstanding CodeRabbit feedback on NVIDIA#1107:

  • Warm-start presence (generate_conversions.py) — detect via arrays.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 emitted cuopt::remote::None if the array list was ever empty.
  • CSR setter groups (generate_conversions.py) — guard on the *_offsets field, not values/indices, so zero-nnz sparse matrices are not silently dropped; throw on values/indices size mismatch.
  • Chunked extractors (generate_conversions.py) — get_doubles / get_ints now throw on misaligned payload size instead of returning {}, matching bytes_to_typed() in grpc_solution_mapper.cpp.
  • Validation (generate_conversions.py) — added an ArrayFieldId duplicate pass alongside the existing ResultFieldId check.
  • build.sh codegen — delete stale files in generated/ before regenerating so verify_grpc_codegen.sh converges.

Regenerated artifacts are committed.

Testing

  • bash build.sh codegen regenerates cleanly.
  • bash ci/verify_grpc_codegen.shOK: All generated files match field_registry.yaml.
  • Validated _validate_registry_uniqueness rejects a synthetic ArrayFieldId collision.
  • pre-commit run on changed files passes.

Docs

No user-facing API changes; generator-internal only.

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>
@tmckayus tmckayus merged commit 1c23b16 into tmckayus:grpc-codegen-v2 May 22, 2026
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.

2 participants