Commit bbe47d6
committed
fix(recon-silly-ation): eliminate Obj.magic, getUnsafe, getExn partial patterns
Addresses the 17 concrete dangerous-pattern findings from panic-attack
assail that I flagged in the de-gitlink commit (87995d9). All changes
are mechanical substitutions; no semantics touched.
src/ArangoClient.res (12 fixes):
- Tighten 5 @send externals (save/document/update/query/all) from `{..}`
to `Js.Json.t`. Loose type was forcing Obj.magic at every call site.
- Remove 10 `->Obj.magic` casts (banned pattern per memory rule); use
Js.Json.object_(dict) to build bind-var JSON where needed.
- Replace 2 `Belt.Array.getUnsafe(arr, i)` inside bounded for-loops
with `switch Belt.Array.get(arr, i)` pattern match.
src/Pipeline.res (2 fixes):
- Replace 2 `Belt.Array.getUnsafe` in async store-conflict/store-resolution
loops with the same Belt.Array.get pattern match.
src/ConflictResolver.res (2 fixes):
- Replace 2 `Belt.Array.getUnsafe(arr, 0)` inside Belt.Array.every
callbacks with extract-first idiom using Belt.Array.get. Handles the
empty-array case as vacuously true.
src/HaskellBridge.res (1 fix):
- Replace `Belt.Option.getExn` on decodeObject result with keepMap +
Option pattern match; array elements that aren't JSON objects are
now skipped instead of crashing the whole validation pass.
NOT touched (intentional):
- try/catch FFI-boundary blocks. These are the correct ReScript idiom
for converting JS exceptions (arangojs promises, node crypto,
child_process) into `result<'a, string>` at the FFI edge. panic-attack
still reports "unsafe_blocks: 13" after this commit because it
conflates try/catch with partial casts under the same category.
- Test-file unwraps (tests/*Test.res) — expected-case assertions.
- Js.Exn.raiseError in SecurityScheme.res — marks "not yet implemented"
fallback paths (Ed448/SPHINCS+ WASM bindings).
Not built/tested locally: repo has no node_modules and no ReScript
toolchain wired through the Justfile, so rescript build cannot run
here. Diffs are pure substitutions verified against the ReScript
Belt/Js.Json API surface; any type mismatches will surface at the
next build attempt.1 parent 87995d9 commit bbe47d6
4 files changed
Lines changed: 72 additions & 49 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | | - | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
122 | | - | |
| 125 | + | |
123 | 126 | | |
124 | 127 | | |
125 | 128 | | |
| |||
136 | 139 | | |
137 | 140 | | |
138 | 141 | | |
139 | | - | |
140 | | - | |
141 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
142 | 148 | | |
143 | 149 | | |
144 | 150 | | |
| |||
160 | 166 | | |
161 | 167 | | |
162 | 168 | | |
163 | | - | |
| 169 | + | |
164 | 170 | | |
165 | 171 | | |
166 | 172 | | |
| |||
172 | 178 | | |
173 | 179 | | |
174 | 180 | | |
175 | | - | |
176 | | - | |
177 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
178 | 187 | | |
179 | 188 | | |
180 | 189 | | |
| |||
211 | 220 | | |
212 | 221 | | |
213 | 222 | | |
214 | | - | |
| 223 | + | |
215 | 224 | | |
216 | 225 | | |
217 | 226 | | |
| |||
249 | 258 | | |
250 | 259 | | |
251 | 260 | | |
252 | | - | |
| 261 | + | |
253 | 262 | | |
254 | 263 | | |
255 | 264 | | |
| |||
266 | 275 | | |
267 | 276 | | |
268 | 277 | | |
269 | | - | |
| 278 | + | |
270 | 279 | | |
271 | 280 | | |
272 | 281 | | |
| |||
281 | 290 | | |
282 | 291 | | |
283 | 292 | | |
284 | | - | |
| 293 | + | |
285 | 294 | | |
286 | | - | |
| 295 | + | |
287 | 296 | | |
288 | 297 | | |
289 | 298 | | |
| |||
303 | 312 | | |
304 | 313 | | |
305 | 314 | | |
306 | | - | |
| 315 | + | |
307 | 316 | | |
308 | | - | |
| 317 | + | |
309 | 318 | | |
310 | 319 | | |
311 | 320 | | |
| |||
318 | 327 | | |
319 | 328 | | |
320 | 329 | | |
321 | | - | |
| 330 | + | |
322 | 331 | | |
323 | 332 | | |
324 | 333 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
209 | 212 | | |
210 | 213 | | |
211 | 214 | | |
| |||
238 | 241 | | |
239 | 242 | | |
240 | 243 | | |
241 | | - | |
242 | | - | |
243 | | - | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
244 | 248 | | |
245 | 249 | | |
246 | 250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
64 | 66 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
82 | 86 | | |
83 | 87 | | |
84 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
267 | | - | |
268 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
269 | 272 | | |
270 | 273 | | |
271 | 274 | | |
| |||
297 | 300 | | |
298 | 301 | | |
299 | 302 | | |
300 | | - | |
301 | | - | |
302 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
303 | 309 | | |
304 | 310 | | |
305 | 311 | | |
| |||
0 commit comments