GitLabgitlab-org

cli

main
ply6 git calls39 ms96 KiB5 cachedprotocol v2
81 lines1.8 KiBRaw
1package mcpannotations
3import (
4 "testing"
6 "github.com/stretchr/testify/assert"
7)
9func TestHasAnnotation(t *testing.T) {
10 t.Parallel()
12 tests := []struct {
13 name string
14 annotations map[string]string
15 expected bool
16 }{
17 {
18 name: "nil annotations",
19 annotations: nil,
20 expected: false,
21 },
22 {
23 name: "empty annotations map",
24 annotations: map[string]string{},
25 expected: false,
26 },
27 {
28 name: "only non-MCP annotations",
29 annotations: map[string]string{"help:arguments": "some help", "other": "value"},
30 expected: false,
31 },
32 {
33 name: "has Safe annotation",
34 annotations: map[string]string{Safe: "true"},
35 expected: true,
36 },
37 {
38 name: "has Destructive annotation",
39 annotations: map[string]string{Destructive: "true"},
40 expected: true,
41 },
42 {
43 name: "has Exclude annotation",
44 annotations: map[string]string{Exclude: "true"},
45 expected: true,
46 },
47 {
48 name: "has Interactive annotation",
49 annotations: map[string]string{Interactive: "true"},
50 expected: true,
51 },
52 {
53 name: "has multiple MCP annotations",
54 annotations: map[string]string{Safe: "true", Exclude: "true"},
55 expected: true,
56 },
57 {
58 name: "has MCP annotation with other annotations",
59 annotations: map[string]string{Safe: "true", "help:arguments": "some help"},
60 expected: true,
61 },
62 {
63 name: "MCP annotation with false value still counts",
64 annotations: map[string]string{Safe: "false"},
65 expected: true,
66 },
67 {
68 name: "MCP annotation with empty value still counts",
69 annotations: map[string]string{Destructive: ""},
70 expected: true,
71 },
72 }
74 for _, tt := range tests {
75 t.Run(tt.name, func(t *testing.T) {
76 t.Parallel()
77 result := HasAnnotation(tt.annotations)
78 assert.Equal(t, tt.expected, result)
79 })
80 }
Diagnostics6 git calls · 39 ms
CallStatusSizeTime039 ms
discover200185 B2 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=2
git.response.bytes=185
git.server.agent=git/2.56.g1891de4-Linux
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch server-option object-format
git.server.fetch=shallow wait-for-done filter
git.protocol.version=2
git.pkt.frames=9
git.pkt.data=7
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=185
git.pkt.payload.max=35
ls-refs20058 KiB · hit8 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=2
git.response.bytes=59849
git.response.cache=HIT
git.response.duration_ms=8
git.protocol.version=2
git.pkt.frames=731
git.pkt.data=730
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=59849
git.pkt.payload.max=143
git.ls_refs.count=730
git.ls_refs.head=refs/heads/main
fetchcombine:blob:none+tree:2 · deepen 12004.2 KiB · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=4273
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=combine:blob:none+tree:2
git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9
git.fetch.haves.count=0
git.fetch.deepen=1
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=7
git.pkt.data=5
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=4273
git.pkt.payload.max=4173
git.sideband.band1.bytes=4173
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=11
git.pack.bytes=4173
git.fetch.wide.objects=11
git.fetch.wide.extra_bytes=3930
git.fetch.wide.blobs=0
fetchtree:0 · deepen 1020032 KiB · hit4 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=32926
git.response.cache=HIT
git.response.duration_ms=4
git.fetch.filter=tree:0
git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=22
git.pkt.data=20
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=32926
git.pkt.payload.max=32046
git.sideband.band1.bytes=32046
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=80
git.pack.bytes=32046
git.pack.ofs_delta=36
git.pack.ref_delta=0
git.pack.chain.max=2
git.pack.trailer=cb0bad5d7ffc514895d8b21c4dd470327f90bc91
git.pack.full=44
Open pack map
fetchtree:0200143 B · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=143
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=tree:0
git.fetch.wants=c9dee8514beb1290dbd1a7e8bb3b11cb271706b0
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=143
git.pkt.payload.max=116
git.sideband.band1.bytes=116
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=116
git.pack.trailer=4e41c818c454113750402cca89a8011eed480243
Open pack map
fetch200538 B · hit26 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=26
git.response.bytes=538
git.response.cache=HIT
git.response.duration_ms=26
git.fetch.wants=7c0f04d45288de8cf927b4f072bb7c3dbfb368e7
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=538
git.pkt.payload.max=511
git.sideband.band1.bytes=511
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://gitlab.com/gitlab-org/cli
Ref
refs/heads/main
Commit
0dd7574dce9e385c5c30540e6c15657adc6bdce9
cf-ray
a5e139ec4e4c18aa
Request
bd009a5c…
Protocol
v2 · sha1
Agent
git/2.56.g1891de4-Linux
Filter
advertised
Fetch
shallow wait-for-done filter
Capabilities
agent ls-refs fetch server-option object-format