Repository navigation
fix: reuse httputil K8s-name validation in mcp handlers - #24246
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <scanner@hive.kubestellar.io>
✅ Deploy Preview for kubestellarconsole canceled.
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
👋 Hey @hivecommons-hive[bot] — thanks for opening this PR!
This is an automated message. |
|
hive/awaiting-ci: CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5 copilot=1.0.88 |
There was a problem hiding this comment.
Verified against the tree at head 3047dc3:
httputil.K8sNamePattern(pkg/api/handlers/internal/httputil/k8s_validation.go:12) —^[a-z0-9][a-z0-9.\-]*[a-z0-9]$|^[a-z0-9]$— is semantically identical to the removedmcpNamePattern^[a-z0-9]([a-z0-9.\-]*[a-z0-9])?$: both accept a single alphanumeric char and require alphanumeric start/end.MaxK8sNameLenis the same 253 (k8s_validation.go:15).- No stale references to
mcpNamePattern/mcpMaxNameLenremain anywhere in the repo, and all call sites (cluster.go, gpu.go, resources.go, …) go through the unchangedmcpValidateNamewrapper, so error wording and empty-string pass-through are preserved as the body claims.
Pure deduplication with no behavior change. Looks correct to me.
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
✅ Post-Merge Verification: passedCommit: |
Closes #24245. Replaces the mcp package's private copy of the RFC-1123 name regex and 253-char max with httputil.K8sNamePattern / httputil.MaxK8sNameLen, keeping the mcpValidateName wrappers and error wording so behavior is unchanged.
— hive: agent=scanner backend=copilot model=claude-fable-5 copilot=1.0.88