Commit e40df04
Trim drift walker and its tests
Simplify cycle detection: stop on first revisit instead of allowing one
self-referential expansion. The "expand once" gold-plating produced a
"next.<field>" entry on linked-list-shaped types, but no real CRD or
runtime config has cyclic shape, and stop-on-revisit is the simpler
contract for drift detection. The visited tracker becomes a
map[reflect.Type]struct{} and maxStructRevisits goes away.
Compress the FlattenJSONLeafFields godoc from a 9-bullet semantics list
into one paragraph. Most of the bullets are now subsumed by the single
"json.Marshaler => leaf, otherwise recurse on Struct/Slice/Array/Map"
rule. The detailed encoding/json reference belongs in the standard
library, not here.
Drop redundant subtests in TestFlattenJSONLeafFields. After the
json.Marshaler refactor, the json.RawMessage / thvjson.Map+Any /
vmcpconfig.Duration cases all exercise the same short-circuit branch as
metav1.Duration, so one Marshaler example is enough. Drop slice-of-
pointer-to-struct (covered by combining the pointer-deref and slice-of-
struct cases). Fold the dedicated PointerInputDereferenced test into the
table. Remove TestFlattenJSONLeafFields_OutputIsSorted: the table-
driven test already pins exact sorted-string equality on every case.
Update the recursive-type expectation to ["name"] to lock in the new
stop-on-revisit semantics.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 376f6d6 commit e40df04
2 files changed
Lines changed: 29 additions & 107 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
49 | 26 | | |
50 | 27 | | |
51 | 28 | | |
| |||
61 | 38 | | |
62 | 39 | | |
63 | 40 | | |
64 | | - | |
| 41 | + | |
65 | 42 | | |
66 | 43 | | |
67 | 44 | | |
| |||
96 | 73 | | |
97 | 74 | | |
98 | 75 | | |
99 | | - | |
| 76 | + | |
100 | 77 | | |
101 | 78 | | |
102 | 79 | | |
| |||
140 | 117 | | |
141 | 118 | | |
142 | 119 | | |
143 | | - | |
| 120 | + | |
144 | 121 | | |
145 | 122 | | |
146 | 123 | | |
| |||
185 | 162 | | |
186 | 163 | | |
187 | 164 | | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | 165 | | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
203 | 171 | | |
204 | 172 | | |
205 | | - | |
206 | | - | |
| 173 | + | |
| 174 | + | |
207 | 175 | | |
208 | 176 | | |
209 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
15 | 13 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | 14 | | |
20 | 15 | | |
21 | 16 | | |
| |||
52 | 47 | | |
53 | 48 | | |
54 | 49 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | 50 | | |
60 | 51 | | |
61 | 52 | | |
| |||
90 | 81 | | |
91 | 82 | | |
92 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
93 | 87 | | |
94 | 88 | | |
95 | 89 | | |
96 | 90 | | |
97 | 91 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | 92 | | |
112 | 93 | | |
113 | 94 | | |
| |||
153 | 134 | | |
154 | 135 | | |
155 | 136 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | 137 | | |
162 | 138 | | |
163 | 139 | | |
| |||
189 | 165 | | |
190 | 166 | | |
191 | 167 | | |
192 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
193 | 172 | | |
194 | 173 | | |
195 | 174 | | |
196 | 175 | | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
210 | 179 | | |
211 | 180 | | |
212 | | - | |
213 | | - | |
214 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
215 | 184 | | |
216 | 185 | | |
217 | 186 | | |
| |||
224 | 193 | | |
225 | 194 | | |
226 | 195 | | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | 196 | | |
243 | 197 | | |
244 | 198 | | |
| |||
0 commit comments