chore(rest-api): Apply our new FromProto/ToProto modeling to Machine#2139
chore(rest-api): Apply our new FromProto/ToProto modeling to Machine#2139chet wants to merge 1 commit into
Conversation
Brings two inline workflow-request builders in the `Machine` handler in line with the proto-modeling changes. Both flows have no API request body -- Maintenance toggles a state and Metadata-update syncs labels -- so the methods live on the entity rather than on an API request type. Primary callouts are: - Maintenance: `Machine.ToMaintenanceRequestProto(operation, reference)`. - Metadata-update: `Machine.ToMetadataUpdateRequestProto(labels)` (reads the current site-metadata Name from stored metadata, falling back to `m.ID`). - Handler simplified to one-liners at both sites. Tests added! Signed-off-by: Chet Nichols III <chetn@nvidia.com>
|
@coderabbitai Hey! There is a .coderabbit.yaml in rest-api/.coderabbit.yaml in this repo that you can use, with a rest-api/AGENTS.md with general guidelines. This PR actually should be good to go based on previous work we've done (we just brought all of this code over from https://github.com/NVIDIA/infra-controller-rest, where you might have a lot of context), but looping you in directly since we haven't gotten the plumbing wired up yet. I think we should be good here, since we've been working through things over every PR, but it's always good to have you sign-off/verify. Thank you! |
🔐 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-02 23:55:28 UTC | Commit: be7b093 |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Get PR details and diff
gh pr view 2139 --repo NVIDIA/infra-controller --json files,additions,deletions,title,body 2>/dev/null | jq '.files[].path'
echo "---"
gh pr diff 2139 --repo NVIDIA/infra-controller 2>/dev/nullLength of output: 6598 🏁 Script executed: #!/bin/bash
# Read AGENTS.md and .coderabbit.yaml
cat rest-api/AGENTS.md 2>/dev/null || echo "AGENTS.md not found"
echo "==="
cat rest-api/.coderabbit.yaml 2>/dev/null || echo ".coderabbit.yaml not found"Length of output: 30368 🏁 Script executed: #!/bin/bash
# Read the Machine model and handler files
fd -e go . rest-api/ | xargs grep -l -i "machine" 2>/dev/null | head -30Length of output: 1764
Verdict: LGTM ✅ Here's what I verified against the AGENTS.md proto-conversion rules:
One small improvement worth calling out: the new if m.Metadata != nil && m.Metadata.Metadata != nil && m.Metadata.Metadata.Name != "" {The old handler didn't have this, so it would have forwarded an empty string as the Everything looks production-grade here. Ship it! 🚀 (=^・ω・^=) [approve] 🧠 Learnings used |
🔍 Container Scan Summary
Per-CVE detail lives in the per-service |
Description
Brings two inline workflow-request builders in the
Machinehandler in line with the proto-modeling changes. Both flows have no API request body -- Maintenance toggles a state and Metadata-update syncs labels -- so the methods live on the entity rather than on an API request type.Primary callouts are:
Machine.ToMaintenanceRequestProto(operation, reference).Machine.ToMetadataUpdateRequestProto(labels)(reads the current site-metadata Name from stored metadata, falling back tom.ID).Tests added!
Signed-off-by: Chet Nichols III chetn@nvidia.com
Type of Change
Related Issues (Optional)
Breaking Changes
Testing
Additional Notes