refactor(rest-api): Use our generic cdb.GetPtr instead of per-type GetXPtr helpers#2171
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
🔐 TruffleHog Secret Scan✅ No secrets or credentials found! Your code has been scanned for 700+ types of secrets and credentials. All clear! 🎉 🕐 Last updated: 2026-06-03 21:29:30 UTC | Commit: 5958b51 |
|
Hey @coderabbitai! There's a .coderabbit.yaml in rest-api/ for you to use (or maybe it's in the repo root now)? Care to take a peek? You helped provide guidance for some of the original work around |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check for .coderabbit.yaml in rest-api/ and repo root
echo "=== rest-api/.coderabbit.yaml ==="
cat rest-api/.coderabbit.yaml 2>/dev/null || echo "(not found)"
echo ""
echo "=== .coderabbit.yaml (root) ==="
cat .coderabbit.yaml 2>/dev/null || echo "(not found)"
echo ""
echo "=== rest-api/AGENTS.md ==="
cat rest-api/AGENTS.md 2>/dev/null || echo "(not found)"Length of output: 30783 🏁 Script executed: #!/bin/bash
# Fetch the PR diff for `#2171`
gh pr view 2171 --json title,body,files 2>/dev/null | jq '.'
gh pr diff 2171 2>/dev/null | head -500Length of output: 56820
Configuration The root
PR assessment This is a clean, production-grade refactor. Specific observations:
No blocking concerns. The API is simpler, the intent is clearer, and the AGENTS.md conventions are respected throughout. Well done to you and 🐇 ✨ ✏️ Learnings added
🧠 Learnings used |
|
Hi @chet, we could take this opportunity to move the |
@thossain-nv Genius!! Moving! |
🔍 Container Scan Summary
Per-CVE detail lives in the per-service |
…tXPtr helpers @bcavnvidia pointed out that after `cdb.Ptr` got introduced as a generic helper in NVIDIA/infra-controller-rest#569 (which I probably should have just named `cdb.GetPtr`), we could actually get rid of all of our type-specific helpers and just lean on this across the board. To summarize: - `cutil.GetPtr` (in `common/pkg/util`) is now the one helper for any value type (renamed from `cdb.Ptr` and moved out of `db/pkg/db` -- thanks to @thossain-nv for that suggestion). - The per-type helpers (`GetStrPtr`, `GetIntPtr`, `GetBoolPtr`, `GetUUIDPtr`, `GetTimePtr`) go away. But, `cdb.GetTypedStrPtr` stays, because it converts a typed-string value (e.g. `MachineCapabilityType`) to `*string`, which `GetPtr` can't do generically (i.e. it'd return `*MachineCapabilityType`). Per-type tests collapsed into a single `TestGetPtr` with type subtests, alongside its sibling converter tests. Signed-off-by: Chet Nichols III <chetn@nvidia.com>
@thossain-nv Done! |
thossain-nv
left a comment
There was a problem hiding this comment.
Thank you for moving it to common!
Description
@bcavnvidia pointed out that after
cdb.Ptrgot introduced as a generic helper in NVIDIA/infra-controller-rest#569 (which I probably should have just namedcdb.GetPtr), we could actually get rid of all of our type-specific helpers and just lean on this across the board.To summarize:
cutil.GetPtr(incommon/pkg/util) is now the one helper for any value type (renamed fromcdb.Ptrand moved out ofdb/pkg/db-- thanks to @thossain-nv for that suggestion).GetStrPtr,GetIntPtr,GetBoolPtr,GetUUIDPtr,GetTimePtr) go away.But,
cdb.GetTypedStrPtrstays, because it converts a typed-string value (e.g.MachineCapabilityType) to*string, whichGetPtrcan't do generically (i.e. it'd return*MachineCapabilityType).Per-type tests collapsed into a single
TestGetPtrwith type subtests, alongside its converter tests.Signed-off-by: Chet Nichols III chetn@nvidia.com
Type of Change
Related Issues (Optional)
Breaking Changes
Testing
Additional Notes