← Back to Pull requests

Resource name validation (DNS-1123 subdomain) + decouple MCP Package Server name from resource name #511

Closed
unknown closed this pull request without merging on May 27, 2026 23:28 UTC
View on GitHub
unknown unknown commented on May 22, 2026 13:32 UTC
Author

Description

We currently have a few issues in our system:
1. Throughout our codebase we flip-flop on requiring resource name sto follow PREFIX/NAME convention - iirc ui + cli both differ in requirements.
2. We mistakenly split NAMESPACE/NAME on a resource name into the {metadata.namespace, metadata.name} form - while we currently haven't fully implemented the differing namespace use-case.
- When defining the resource name, we should not parse this - we should treat is as the name only.
3. For MCP validation, we compare the resource name against the package name in the upstream registry
- This is currently _not_ an issue, but will be if we tighten the name validation, since mcp registry naming convention is REVERSE_DNS/NAME, unrelated to our namespaces.

To resolve the above, the TL;DR:
1. We now have strict DNS-1123 subdomain compliancy requirement for resource names - similar to k8s resource name https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names.
- This fixes the UX to follow this new naming convention.
2. We added a new field serverName for MCP packages from external registries to use during validation.

Changes:

  • Added new field for MCP Packages (used during package validation): serverName

  • - pkg/api/v1alpha1/mcpserver.go
  • Added validation conditions for the new naming:metadata.name -> DNS-label on all resources + [...].package.serverName -> PREFIX/NAME

  • - pkg/api/v1alpha1/validation.go, pkg/api/v1alpha1/mcpserver_validate.go, pkg/api/v1alpha1/registry_validate.go
  • Updated MCP CLI init command to client-side validate based on new DNS-label requirements

  • - internal/cli/declarative/init.go
  • Updated UI component to validate based on new DNS-label requirement + added new mcpPackage field for MCP.

  • - ui/components/add-server-dialog.tsx
  • Updated MCP UI server shim to not parse into "NAMESPACE/NAME", and instead do {namespace: "default", name: NAME}

  • - ui/lib/ui-shims.ts
  • Updated tests to expect & use correct DNS-label naming for resources

  • - e2e/declarative_test.go, e2e/init_build_run_test.go, internal/cli/declarative/init_test.go, internal/cli/mcp/manifest/manager_envelope_test.go, internal/cli/scheme/scheme_test.go, pkg/api/v1alpha1/validation_test.go, ui/components/__tests__/server-card.test.tsx
  • Updated examples to use the new naming

  • - examples/agent.yaml, examples/full-stack.yaml, examples/mcp-remote.yaml, examples/mcp.yaml,
  • Updated CLI to update examples using NAME DNS-label compliancy

  • - internal/cli/declarative/delete.go, internal/cli/declarative/init.go

    NOTE: These are breaking. There is more info on it in a below section.

    Change Type

    /kind breaking_change
    /kind fix
    

    Changelog

    ``release-note
    AgentRegistry resource names must now use DNS-1123 subdomain format (lowercase letters, numbers, hyphens, and periods). MCP package manifests now use
    spec.source.package.serverName for the upstream MCP server name, so manifests that used slash-delimited resource names such as namespace/name must rename those resources and set serverName when package validation needs the upstream name.

    
    # Additional Notes
    
    ## Breaking Changes
    
    Due to the new constraints, this is a breaking change to **all** resources & references to them. Users must update their declarative YAMLs to follow this new naming requirement.
    
    ## Local Validation (Script)
    
    _thanks to Claude for this local setup script to manually validate CLI, you can also validate UI on the running instance_
    
    
    sh
    #!/usr/bin/env bash

    # Interactive validation harness for the DNS-1123 subdomain naming rule across


    v1alpha1 resource kinds (Agent, Skill, Prompt, Deployment, MCPServer).


    # 1. Builds + starts the daemon against the currently checked-out branch.


    2. Probes the validator with several non-compliant names across kinds and


    asserts each one is rejected with a DNS-1123 error.


    3. Applies a small set of compliant fixtures (MCPServer + Agent + Skill +


    Prompt) and lists them.


    4. Pauses so you can poke the UI / CLI yourself before cleanup.


    # Trap-on-exit purges the daemon so the next run starts from a clean DB.


    # Requires: clean tracked-file working tree (untracked OK), Docker daemon


    running, current directory is the repo root, AND network access to the npm


    registry (the package-shape MCPServer fixture in step 2 exercises the npm


    ownership validator against @modelcontextprotocol/server-memory).

    set -euo pipefail

    API_URL="http://localhost:12121/v0"
    UI_URL="http://localhost:12121"
    ARCTL="./bin/arctl"
    TMP_DIR="$(mktemp -d -t dns-validate.XXXXXX)"
    trap 'rm -rf "$TMP_DIR"' EXIT

    ----- preflight -----------------------------------------------------------

    if ! git diff --quiet || ! git diff --cached --quiet; then
    echo "Tracked files have uncommitted changes. Commit or stash before running." >&2
    echo "(Untracked files are ignored — only modifications to tracked files block.)" >&2
    git status --short >&2
    exit 1
    fi

    ----- cleanup trap (purge daemon) -----------------------------------------

    cleanup() {
    local code=$?
    echo
    echo "=== cleanup: purging daemon ==="
    make daemon-stop-purge >/dev/null 2>&1 || true
    exit "$code"
    }
    trap cleanup EXIT INT TERM

    ----- helpers -------------------------------------------------------------

    daemon_health() { curl -sf "$API_URL/health" >/dev/null 2>&1; }

    wait_for_daemon() {
    for _ in $(seq 1 60); do
    if daemon_health; then return 0; fi
    sleep 1
    done
    return 1
    }

    apply_stdin() {
    "$ARCTL" apply -f - --registry-url "$API_URL"
    }

    probe_rejection feeds a single-document YAML payload via stdin and asserts


    that the apply fails with an error matching the given pattern. Returns 0 on


    correct rejection, 1 on unexpected acceptance or wrong error shape.


    probe_rejection() {
    local label="$1"
    local pattern="$2"
    local payload="$3"
    local out
    out=$(printf '%s' "$payload" | "$ARCTL" apply -f - --registry-url "$API_URL" 2>&1 || true)
    if echo "$out" | grep -qiE "$pattern"; then
    echo " ✓ rejected: $label"
    return 0
    fi
    echo " ✗ FAIL: $label was NOT rejected with the expected error"
    echo " expected pattern: $pattern"
    echo " output: $out"
    return 1
    }

    probe_acceptance feeds a single-document YAML payload via stdin and asserts


    the apply succeeds. Mirrors probe_rejection for symmetric reporting.


    probe_acceptance() {
    local label="$1"
    local payload="$2"
    local out
    out=$(printf '%s' "$payload" | "$ARCTL" apply -f - --registry-url "$API_URL" 2>&1 || true)
    # arctl apply uses exit code via "✗ ... failed:" line on per-doc failure;
    # accept either a non-error exit or a stdout containing "✓".
    if echo "$out" | grep -qE "✓|configured|created|unchanged"; then
    echo " ✓ accepted: $label"
    return 0
    fi
    echo " ✗ FAIL: $label was REJECTED but should have been accepted"
    echo " output: $out"
    return 1
    }

    ----- run -----------------------------------------------------------------

    CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo '<unknown>')"
    echo "Validation harness for DNS-1123 subdomain naming rule"
    echo " branch under test: $CURRENT_BRANCH"
    echo " daemon URL: $API_URL"
    echo

    echo "→ purge any prior daemon state"
    make daemon-stop-purge >/dev/null 2>&1 || true

    echo "→ rebuild CLI + server image for $CURRENT_BRANCH"
    make build-cli docker docker-tag-as-dev >/dev/null

    echo "→ start daemon"
    make daemon-start
    wait_for_daemon || { echo "Daemon failed to come up." >&2; exit 1; }

    --- step 1: negative-path probes across kinds ---

    echo
    echo "→ verifying non-DNS-subdomain names are rejected across kinds"
    neg_failures=0

    DNS_PATTERN="DNS-1123 subdomain|invalid format"
    OWNERSHIP_PATTERN="ownership validation failed|Expected mcpName"

    MCPServer — slash


    probe_rejection "MCPServer name 'acme/foo' (slash)" "$DNS_PATTERN" "$(cat <<'EOF'
    apiVersion: ar.dev/v1alpha1
    kind: MCPServer
    metadata:
    name: acme/foo
    spec:
    remote: { type: streamable-http, url: https://mcp.example.com/x }
    EOF
    )" || neg_failures=$((neg_failures + 1))

    MCPServer — uppercase


    probe_rejection "MCPServer name 'MyServer' (uppercase)" "$DNS_PATTERN" "$(cat <<'EOF'
    apiVersion: ar.dev/v1alpha1
    kind: MCPServer
    metadata:
    name: MyServer
    spec:
    remote: { type: streamable-http, url: https://mcp.example.com/x }
    EOF
    )" || neg_failures=$((neg_failures + 1))

    MCPServer — > 63 chars


    long_name=$(printf 'a%.0s' {1..64})
    probe_rejection "MCPServer name (>63 chars)" "$DNS_PATTERN" "$(cat <<EOF
    apiVersion: ar.dev/v1alpha1
    kind: MCPServer
    metadata:
    name: $long_name
    spec:
    remote: { type: streamable-http, url: https://mcp.example.com/x }
    EOF
    )" || neg_failures=$((neg_failures + 1))

    Skill — underscore


    probe_rejection "Skill name 'my_skill' (underscore)" "$DNS_PATTERN" "$(cat <<'EOF'
    apiVersion: ar.dev/v1alpha1
    kind: Skill
    metadata:
    name: my_skill
    spec:
    description: skill with bad name
    source:
    repository: { url: https://github.com/example/repo }
    EOF
    )" || neg_failures=$((neg_failures + 1))

    Prompt — leading dot (still rejected — dots themselves are allowed by


    DNS-1123 subdomain, but leading/trailing/double dots are not)


    probe_rejection "Prompt name '.my-prompt' (leading dot)" "$DNS_PATTERN" "$(cat <<'EOF'
    apiVersion: ar.dev/v1alpha1
    kind: Prompt
    metadata:
    name: .my-prompt
    spec:
    content: hello
    EOF
    )" || neg_failures=$((neg_failures + 1))

    Agent ref — bad ref name in spec.mcpServers


    probe_rejection "Agent ref spec.mcpServers[].name 'acme/foo' (slash)" "$DNS_PATTERN" "$(cat <<'EOF'
    apiVersion: ar.dev/v1alpha1
    kind: Agent
    metadata:
    name: valid-agent
    spec:
    image: ghcr.io/example/agent:latest
    description: agent referencing a slash-named MCPServer
    language: python
    framework: adk
    modelProvider: gemini
    modelName: gemini-2.0-flash
    mcpServers:
    - kind: MCPServer
    name: acme/foo
    tag: latest
    EOF
    )" || neg_failures=$((neg_failures + 1))

    Package ownership — DNS-subdomain name, but serverName doesn't match what


    @modelcontextprotocol/server-memory publishes as its mcpName upstream. The


    npm ownership validator must reject this with an ownership-mismatch error,


    proving the serverName ↔ upstream cross-check actually fires.


    probe_rejection "MCPServer package serverName mismatch (npm ownership)" "$OWNERSHIP_PATTERN" "$(cat <<'EOF'
    apiVersion: ar.dev/v1alpha1
    kind: MCPServer
    metadata:
    name: validate-bad-ownership
    spec:
    title: Mismatched serverName, should be rejected by npm ownership validator
    source:
    package:
    registryType: npm
    identifier: "@modelcontextprotocol/server-memory"
    version: latest
    serverName: "io.github.example/wrong-name"
    transport:
    type: stdio
    EOF
    )" || neg_failures=$((neg_failures + 1))

    if (( neg_failures > 0 )); then
    echo
    echo "Validator probe failed: $neg_failures payload(s) were NOT rejected as expected." >&2
    exit 1
    fi

    echo
    echo "→ verifying compliant boundary cases are accepted"
    pos_failures=0

    Single-char name — DNS-1123 subdomain accepts 1-char names.


    probe_acceptance "MCPServer name 'a' (single char)" "$(cat <<'EOF'
    apiVersion: ar.dev/v1alpha1
    kind: MCPServer
    metadata:
    name: a
    spec:
    remote: { type: streamable-http, url: https://mcp.example.com/a-only }
    EOF
    )" || pos_failures=$((pos_failures + 1))

    Dotted reverse-DNS name — newly allowed by subdomain (was rejected under label).


    probe_acceptance "MCPServer name 'io.example.mcp' (dotted reverse-DNS)" "$(cat <<'EOF'
    apiVersion: ar.dev/v1alpha1
    kind: MCPServer
    metadata:
    name: io.example.mcp
    spec:
    remote: { type: streamable-http, url: https://mcp.example.com/dotted }
    EOF
    )" || pos_failures=$((pos_failures + 1))

    Hyphen + dot in same name — common ecosystem shape (e.g. mcp-server.example.io).


    probe_acceptance "Skill name 'data-tools.example.io' (hyphen + dot)" "$(cat <<'EOF'
    apiVersion: ar.dev/v1alpha1
    kind: Skill
    metadata:
    name: data-tools.example.io
    spec:
    description: skill with hyphen and dot
    source:
    repository: { url: https://github.com/example/repo }
    EOF
    )" || pos_failures=$((pos_failures + 1))

    if (( pos_failures > 0 )); then
    echo
    echo "Validator probe failed: $pos_failures payload(s) were REJECTED but should have been accepted." >&2
    exit 1
    fi

    --- step 2: apply compliant fixtures across kinds ---

    echo
    echo "→ applying compliant DNS-subdomain resources"
    "$ARCTL" apply -f - --registry-url "$API_URL" <<'EOF'
    apiVersion: ar.dev/v1alpha1
    kind: MCPServer
    metadata:
    name: validate-mcp-a
    spec:
    title: Validation MCP A
    remote:
    type: streamable-http
    url: https://mcp.example.com/a
    ---
    apiVersion: ar.dev/v1alpha1
    kind: MCPServer
    metadata:
    name: validate-mcp-b
    spec:
    title: Validation MCP B
    remote:
    type: streamable-http
    url: https://mcp.example.com/b
    ---

    Package-shape MCPServer with the new spec.source.package.serverName field.


    Exercises the upstream ownership validator (npm metadata lookup) AND the UI's


    new "Server Name" sidebar row. Requires network access to the npm registry


    AND that @modelcontextprotocol/server-memory's published package carries


    mcpName: io.github.modelcontextprotocol/server-memory — if either drifts,


    the apply will fail with an ownership-validation error.


    apiVersion: ar.dev/v1alpha1
    kind: MCPServer
    metadata:
    name: validate-mcp-memory
    spec:
    title: Memory MCP (npm package, ownership-validated)
    source:
    package:
    registryType: npm
    identifier: "@modelcontextprotocol/server-memory"
    version: latest
    serverName: "io.github.modelcontextprotocol/server-memory"
    transport:
    type: stdio
    ---
    apiVersion: ar.dev/v1alpha1
    kind: Skill
    metadata:
    name: validate-skill
    spec:
    description: validation harness skill
    source:
    repository:
    url: https://github.com/example/repo
    ---
    apiVersion: ar.dev/v1alpha1
    kind: Prompt
    metadata:
    name: validate-prompt
    spec:
    content: You are a validation prompt.
    ---
    apiVersion: ar.dev/v1alpha1
    kind: Agent
    metadata:
    name: validate-agent
    spec:
    image: ghcr.io/example/agent:latest
    description: References two compliant remote MCPServers.
    language: python
    framework: adk
    modelProvider: gemini
    modelName: gemini-2.0-flash
    mcpServers:
    - kind: MCPServer
    name: validate-mcp-a
    tag: latest
    - kind: MCPServer
    name: validate-mcp-b
    tag: latest
    EOF

    --- step 3: pause for manual inspection ---

    echo
    echo "────────────────────────────────────────────────────────────────"
    echo " UI: $UI_URL"
    echo " API: $API_URL"
    echo " CLI: $ARCTL get mcp --registry-url $API_URL"
    echo " $ARCTL get agent --registry-url $API_URL"
    echo " $ARCTL get skill --registry-url $API_URL"
    echo " $ARCTL get prompt --registry-url $API_URL"
    echo "────────────────────────────────────────────────────────────────"
    echo "Press any key to finish (will purge daemon on exit)."
    echo "(Ctrl-C also works; trap will purge.)"
    read -rsn1
    echo
    echo "Done."
    ``

    Screenshots

    <img width="1193" height="827" alt="ui validation" src="https://github.com/user-attachments/assets/16c85125-7954-4a01-8c54-ecf6030548ff" />

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: inFocus7 Review duration: 7796m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #511"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%