Skip to content

gpu-config [4/13]: parse the GPU configuration document - #3250

Open
henry118 wants to merge 4 commits into
NVIDIA:mainfrom
henry118:gpu-config/04-config
Open

henry118 wants to merge 4 commits into
NVIDIA:mainfrom
henry118:gpu-config/04-config

Conversation

@henry118

@henry118 henry118 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Part of #3246 (4/13). Depends on: none. Review only the last commit.

Adds internal/gpuconfig/config: parsing and validation of the
configuration document, matching GPUs to entries, and the document hash.
go.yaml.in/yaml/v2 becomes a direct dependency. Not used yet.


Devin Review

@henry118
henry118 requested a review from a team as a code owner November 17, 2026 18:34
devin-ai-integration[bot]

This comment was marked as resolved.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

Walkthrough

The changes add GPU configuration parsing, validation, hashing, and matching. They also add driver load identification and readiness checks, a locked file-backed store for apply and gate state, and a function that compares the applied configuration hash with the current hash to determine synchronization status.

Merge Risk: Low · up to 9708e

This change adds GPU configuration parsing, node-local state, and sync-status packages that nothing calls yet. Two edge cases should be fixed before the packages are wired in. A crafted YAML merge can silently drop a GPU entry and hide an overlap. A state file with conflicting key spellings can become unreadable after a write. Both need unusual input, so the merge risk is low.

Security architecture risk: Minimal · up to 9708e

The new contracts are not yet connected to running GPU configuration or allocation behavior. The inspected change establishes no material new risk to security, failure containment, rollback, or ownership guarantees.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The contracts concern node-local GPU configuration and coordination, but the reviewed head does not connect them to an independently reachable configuration endpoint, privileged GPU operation, or allocator gate. Wider tenant, service, or environment exposure is not established by the exported Go symbols or test fanout.

Trust Boundaries and Controls

  • observed — Source represents caller-supplied ConfigMap data. Parsing validates document structure, and Hash provides a content fingerprint; neither function authenticates the ConfigMap writer or authorizes GPU changes. No production source-to-sink integration is present to evaluate those future authority checks.

Resilience and Maintainability Implications

  • observed — A missing state file produces an empty state, malformed or unsupported-version state returns an error, and writes refuse to proceed without a successful read. Missing apply state, unknown decisions, mismatched load identifiers, and mismatched hashes do not satisfy the in-sync predicate.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

Other comments: 1

internal/gpuconfig/statefile/state.go: 1

91-91: Minor · Data Integrity & Integration · Quick win

Reject conflicting JSON field aliases before accepting state.

For {"version":2,"Version":1}, parse accepts version 1 but retains both raw keys. Go 1.26.3 matches struct fields case-insensitively and sorts map keys during encoding. A gate write therefore emits "Version":1 before "version":2. (pkg.go.dev)

write replaces the state file before reparsing those bytes. The write then returns ErrParse, and subsequent reads cannot recover. Reject conflicting aliases before accepting the file. Add a parse → gate-write → read regression test.

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 246a9ca and 9708e14.

Files selected for processing: 15

  • go.mod
  • internal/gpuconfig/config/document.go
  • internal/gpuconfig/config/document_test.go
  • internal/gpuconfig/config/match.go
  • internal/gpuconfig/config/match_test.go
  • internal/gpuconfig/config/schema.go
  • internal/gpuconfig/loadid/driver.go
  • internal/gpuconfig/loadid/loadid.go
  • internal/gpuconfig/loadid/loadid_test.go
  • internal/gpuconfig/statefile/file.go
  • internal/gpuconfig/statefile/file_test.go
  • internal/gpuconfig/statefile/state.go
  • internal/gpuconfig/statefile/state_test.go
  • internal/gpuconfig/status/sync.go
  • internal/gpuconfig/status/sync_test.go

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 8 remain after this review.

Comment thread internal/gpuconfig/config/document.go Resolved
Signed-off-by: Henry Wang <henrwang@nvidia.com>
Signed-off-by: Henry Wang <henrwang@nvidia.com>
Signed-off-by: Henry Wang <henrwang@nvidia.com>
Signed-off-by: Henry Wang <henrwang@nvidia.com>
@henry118
henry118 force-pushed the gpu-config/04-config branch from 6766881 to 45a9589 Compare November 19, 2026 00:16
@henry118 henry118 changed the title gpu-config: parse the GPU configuration document gpu-config [4/13]: parse the GPU configuration document Nov 19, 2026

This branch has not been deployed

No deployments
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.

1 participant