fix(adapters): memoize $ref expansion with node-budget accounting (OAI-11)
- memo-hit clones counted against MAX_REF_EXPANSION_NODES (closes the
unbounded-clone hole that let acyclic diamond chains materialize
exponentially before tripping the budget)
- split MAX_REF_HOP_DEPTH (64, chain length) from structural nesting
depth (128, schema height) — legit 40-hop chains were tripping the
old combined budget
- shared-chain acceptance test: bounded node-budget error inside 1s
wall (debug-profile margin); single-chain test asserts full expansion
- tested: cargo test 308+5 pass, clippy -D warnings, fmt --check
Verified under systemd-run MemoryMax=2G scope (the previous
unbounded-clone bug OOM-killed the dev server twice during review-002).
Verification:
- cargo test: 308 lib + 5 integration, 0 failed
- cargo clippy --all-targets -- -D warnings: clean
- cargo fmt --check: clean