Commit 850ce6e
feat(resolve): update astjson to arena-safe API, remove redundant copies (#1400)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Chores**
* Bumped CI lint action version and adjusted module dependencies
(added/upgraded entries).
* **Refactor**
* Improved internal JSON/value memory management to use arena-scoped
lifetimes for safer GC behavior.
* Minor printing/formatting tweaks in execution logging.
* **Tests**
* Added a comprehensive GC-stress test suite validating arena safety and
resolver behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Updates `github.com/wundergraph/astjson` to a version that copies input
bytes onto the arena internally, eliminating the need for manual
pre-copy steps in `loader.go`. Removes the `parseStringOnArena` helper
(16 call sites) and `stringValueOnArena` helper (7 call sites), and
drops the inline byte copy in `mergeResult`. Updates all call sites for
the revised astjson API (`SetValue`, `AppendToArray`, `SetNull`,
`AppendArrayItems`, `TrueValue` now take an arena argument). Adds 47 GC
safety tests covering all astjson-touching codepaths in `loader.go` and
`resolvable.go`, including status-code error paths, error filtering,
resolvable scalar walks, and type mismatches.
## Checklist
- [ ] I have discussed my proposed changes in an issue and have received
approval to proceed.
- [x] I have followed the coding standards of the project.
- [x] Tests or benchmarks have been added or updated.
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent f811b29 commit 850ce6e
11 files changed
Lines changed: 1343 additions & 112 deletions
File tree
- .github/workflows
- v2
- pkg/engine
- datasource/grpc_datasource
- resolve
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | 3 | | |
6 | 4 | | |
7 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | | - | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
60 | | - | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
| 136 | + | |
| 137 | + | |
140 | 138 | | |
141 | 139 | | |
142 | 140 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
284 | | - | |
| 284 | + | |
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
292 | | - | |
| 292 | + | |
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
299 | | - | |
300 | | - | |
| 299 | + | |
| 300 | + | |
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | | - | |
| 386 | + | |
387 | 387 | | |
388 | 388 | | |
0 commit comments