# mgmt-svc ListClusters — BASIC vs FULL View Comparison

## Context

Real response samples from `tidb_mgmt_service.v1.ClusterService/ListClusters`
against the **dev** environment for cluster `10798713358572785944`
(`chenf-test-cdc`, a Dedicated cluster on AWS us-west-2, state: AVAILABLE).

**Purpose:** Compare `CLUSTER_VIEW_BASIC` and `CLUSTER_VIEW_FULL` responses to confirm
the known issue: mgmt-service returns FULL view even when BASIC is requested,
unless `allow_non_full_view: true` is set.

---

## How to Reproduce

```bash
# Port-forward tidb-mgmt-service gRPC port
kubectl --context=arn:aws:eks:us-west-2:385595570414:cluster/dev-base-us-west-2 \
  port-forward -n tidb-management-service svc/tidb-mgmt-service 10001:10001 &

# FULL view
grpcurl -plaintext -d '{
  "filter": {
    "cluster_ids": ["10798713358572785944"],
    "view": "CLUSTER_VIEW_FULL"
  }
}' 127.0.0.1:10001 tidb_mgmt_service.v1.ClusterService/ListClusters

# BASIC view (without allow_non_full_view — returns FULL due to known issue)
grpcurl -plaintext -d '{
  "filter": {
    "cluster_ids": ["10798713358572785944"],
    "view": "CLUSTER_VIEW_BASIC"
  }
}' 127.0.0.1:10001 tidb_mgmt_service.v1.ClusterService/ListClusters

# BASIC view (with allow_non_full_view=true — returns actual BASIC)
grpcurl -plaintext -d '{
  "filter": {
    "cluster_ids": ["10798713358572785944"],
    "view": "CLUSTER_VIEW_BASIC",
    "allow_non_full_view": true
  }
}' 127.0.0.1:10001 tidb_mgmt_service.v1.ClusterService/ListClusters
```

ClusterView enum values (from `tidb_mgmt_service/v1/resources.proto`):
- `CLUSTER_VIEW_UNSPECIFIED = 0`
- `CLUSTER_VIEW_LOCAL = 1`
- `CLUSTER_VIEW_BASIC = 2`
- `CLUSTER_VIEW_FULL = 3`

---

## Key Finding

**BASIC view without `allow_non_full_view` returns identical data to FULL view.**
This is the known issue documented in `mgmt_svc.go:149`:

```go
// It's used for workaround the issue that the mgmt-service always returns full view even if given basic view.
AllowNonFullView: lo.ToPtr(true),
```

**With `allow_non_full_view: true`, BASIC view strips the following fields:**

| Field | FULL view | BASIC view (`allow_non_full_view=true`) |
|-------|-----------|----------------------------------------|
| `dedicatedCluster.proxyBaseUrl` | ✅ present | ❌ missing |
| `dedicatedCluster.tokenBasedAuthEnabled` | ✅ `true` | ❌ missing |
| `dedicatedCluster.tidbNodeGroupEndpoints` | ✅ full endpoints | ❌ missing |
| `dedicatedCluster.agentBaseUrl` | ✅ present | ❌ missing |
| `dedicatedCluster.features` | includes `DELEGATE_USER` | `DELEGATE_USER` removed |

---

## CLUSTER_VIEW_BASIC Response (with `allow_non_full_view=true`)

```yaml
clusters:
- clusterId: '10798713358572785944'
  projectId: '3199728'
  organizationId: '60205'
  clusterName: chenf-test-cdc
  cloudProvider: aws
  deployType: DEPLOY_TYPE_DEDICATED
  createdBy: '5'
  region: us-west-2
  dedicatedCluster:
    clusterId: '10798713358572785944'
    organizationId: '60205'
    projectId: '3199728'
    createTime: '2026-06-03T03:35:45.737Z'
    createFinishedTime: '2026-06-03T03:42:53.619Z'
    updateTime: '2026-06-03T03:42:53.643Z'
    cloudProviderId: AWS
    regionId: AWS_US_WEST_2
    clusterComponents:
    - id: '38324'
      createTime: '2026-06-03T03:35:45.751Z'
      componentType: TIDB
      spuName: 2C8G
      count: 1
      tidbGroupId: '2062015355273875456'
      clusterId: '10798713358572785944'
      isDefaultTidbGroup: true
      tidbGroupDisplayName: DefaultGroup
      spuDisplayName: 2 vCPU, 8 GiB
      instanceType: m6g.large
      cpuNum: 2
      memorySizeGi: 8
      skuKey: aws:tidb:m6g.large:local-storage:0:0
      spuKey: 2C8G:DEPLOY_TYPE_DEDICATED:COMPONENT_TYPE_TIDB
      instanceCpuArch: ARM64
      meteringSkuKeys:
        node:aws:us-west-2:DEPLOY_TYPE_DEDICATED:m6g.large: 1
      instanceCpuGeneration: GRAVITON2
      spuVersion: V1
    - id: '38325'
      createTime: '2026-06-03T03:35:45.756Z'
      componentType: TIKV
      spuName: 2C4G
      count: 3
      storages:
        data:
          storageId: '66079'
          sizeGi: 60
          iops: 3000
          throughputMibps: 141
          volumeType: GP3
          meteringSkuKeys:
            disk-additional-iops:aws:us-west-2:Standard:data:gp3: 0
            disk-iops:aws:us-west-2:Standard:data:gp3: 3000
            disk-storage:aws:us-west-2:Standard:data:gp3: 60
            disk-throughput:aws:us-west-2:Standard:data:gp3: 141
          componentId: '38325'
          diskType: DATA
        raftlog:
          storageId: '66080'
          sizeGi: 40
          iops: 3000
          throughputMibps: 125
          volumeType: GP3
          meteringSkuKeys:
            disk-additional-iops:aws:us-west-2:Standard:raftlog:gp3: 0
            disk-iops:aws:us-west-2:Standard:raftlog:gp3: 3000
            disk-storage:aws:us-west-2:Standard:raftlog:gp3: 40
            disk-throughput:aws:us-west-2:Standard:raftlog:gp3: 125
          componentId: '38325'
          diskType: RAFT_LOG
      tidbGroupId: '2062015355273875456'
      clusterId: '10798713358572785944'
      isDefaultTidbGroup: true
      tidbGroupDisplayName: DefaultGroup
      spuDisplayName: 2 vCPU, 4 GiB
      instanceType: t4g.medium
      cpuNum: 2
      memorySizeGi: 4
      skuKey: aws:tikv:t4g.medium:gp3:4000:400:Standard
      spuKey: 2C4G:DEPLOY_TYPE_DEDICATED:COMPONENT_TYPE_TIKV
      instanceCpuArch: ARM64
      meteringSkuKeys:
        node:aws:us-west-2:DEPLOY_TYPE_DEDICATED:t4g.medium: 1
      instanceCpuGeneration: GRAVITON2
      spuVersion: V1
    - id: '38326'
      createTime: '2026-06-03T03:35:45.763Z'
      componentType: PD
      spuName: t4g.medium
      count: 3
      storages:
        data:
          storageId: '66081'
          sizeGi: 10
          iops: 4000
          throughputMibps: 400
          volumeType: GP3
          meteringSkuKeys:
            disk-additional-iops:aws:us-west-2:STORAGE_TYPE_UNSPECIFIED:data:gp3: 0
            disk-iops:aws:us-west-2:STORAGE_TYPE_UNSPECIFIED:data:gp3: 4000
            disk-storage:aws:us-west-2:STORAGE_TYPE_UNSPECIFIED:data:gp3: 10
            disk-throughput:aws:us-west-2:STORAGE_TYPE_UNSPECIFIED:data:gp3: 400
          componentId: '38326'
          diskType: DATA
      tidbGroupId: '2062015355273875456'
      clusterId: '10798713358572785944'
      isDefaultTidbGroup: true
      tidbGroupDisplayName: DefaultGroup
      spuDisplayName: 2 vCPU, 4 GiB
      instanceType: t4g.medium
      cpuNum: 2
      memorySizeGi: 4
      skuKey: aws:pd:t4g.medium:gp3:4000:400
      spuKey: t4g.medium:DEPLOY_TYPE_DEDICATED:COMPONENT_TYPE_PD
      instanceCpuArch: ARM64
      meteringSkuKeys:
        node:aws:us-west-2:DEPLOY_TYPE_DEDICATED:t4g.medium: 1
      instanceCpuGeneration: GRAVITON2
      spuVersion: V1
    port: 4000
    encryptedCloudAdminPassword: <redacted>
    version: v8.5.6
    features:
    - DISABLE_PUBLIC_LB
    - PRIVATELINK
    state: AVAILABLE
    healthState: HEALTHY
    regionDisplayName: Oregon (us-west-2)
  tikvStorageType: Standard
  servicePlan: Dedicated
  originalProjectId: '3199728'
  ruVersion: 1
  labels:
    x-user-id: '5'
  createTime: '2026-06-03T03:35:44.113Z'
  updateTime: '2026-06-03T03:35:44.113Z'
total: 1
```

---

## CLUSTER_VIEW_FULL Response (additional fields)

The FULL view includes all fields from BASIC above, plus:

```yaml
    # Only in FULL view:
    proxyBaseUrl: http://k8s-tidbadmi-proxyclu-e9ead8872f-f7ffa3abc7739669.elb.us-west-2.amazonaws.com/proxy/cluster/10798713358572785944
    tokenBasedAuthEnabled: true
    agentBaseUrl: http://k8s-tidbadmi-clusterg-32e154ad1a-996825b662f85096.elb.us-west-2.amazonaws.com
    features:
    - DELEGATE_USER        # <-- extra in FULL
    - DISABLE_PUBLIC_LB
    - PRIVATELINK
    tidbNodeGroupEndpoints:
    - tidbGroupId: '2062015355273875456'
      publicEndpoint:
        host: tidb.chcaxh2b15zl.clusters.dev.tidb-cloud.com
        port: 4000
        enablePublicLb: true
      vpcPeeringEndpoint:
        host: private-tidb.chcaxh2b15zl.clusters.dev.tidb-cloud.com
        port: 4000
      privateLinkEndpoints:
      - host: privatelink-20620153.chcaxh2b15zl.clusters.dev.tidb-cloud.com
        port: 4000
```

---

## References

- Source code: `repos/dataflow-service/pkg/grpc/grpcli/mgmt_svc.go`
- Proto definition: `tidb_mgmt_service/v1/resources.proto` (ClusterFilter, ClusterView enum)
- Related methods: `GetAnyDedicatedClusterBasicByID`, `GetDedicatedClusterBasicByID`
