v0.2.2 — post-v0.2.1 review pass
External code review pass closing four correctness issues, two spec/doc drifts, and one Windows-portability bug Copilot flagged on the fix-PR itself. No public API changes; all fixes are behaviour-preserving on POSIX, behaviour-tightening on Windows + edge-case responses.
Fixed
MAGPIE_FILES_ROOTbypass via symlinked parent (security). When a target file didn't yet exist (typical fordownload_to/save_to),canonicalizefell back to lexicalpath.resolve— meaning<root>/symlinked-dir/new.txtcould passisUnderRootwhile the actual write landed outsideMAGPIE_FILES_ROOT.canonicalizenow walks up to the nearest existing ancestor,realpathSyncs that, and re-attaches the non-existent suffix. Implementation usespath.dirname+path.parse(abs).rootso it works on POSIX, Windows drive roots (C:\\), and UNC shares.- 307 / 308 redirect on streamed (multipart) body now fails fast. RFC 7231 says preserve method+body, but a Readable body has been consumed by the first request — replaying it threw "Response body object should not be disturbed or locked" from undici, which surfaced as a generic
network_error. Now detected explicitly:invalid_inputwith the final URL so the caller can re-issue the request directly. next_step_hintsno longer suggestsmap({id, name})for scalar arrays. For{ data: [1,2,3] }the projection is nonsense and produces a jq parse error if the agent runs it. Branches on object-array vs scalar-array; scalars getuniqueinstead, and projections use identifier-safe keys actually present on the first object.body_mode: "auto"on empty body now resolves toinline(matches spec §4). Previously returnedschema. Body isnulleither way; the behaviour change is observable only inmeta.body_inclusion.resolved_mode.http_inspectnow returnsnext_step_hintsfor JSON bodies (matches spec §5.6). Previously the spec advertised it but the wire response only carriedschema.- Binary +
body_mode: "inline"error message no longer suggestshttp_read. After v0.2.1's recovery-path narrowing there's nocache_idsurfaced for that error, so the previous "use download_to or http_read with save_to" was misleading. Now: "use download_to to stream straight to disk, or omit body_mode (defaults to schema for binary)".
Docs
- README
server_infoexample: version0.2.0→0.2.1. CONTRIBUTING.mdCHANGELOG template usesX.Y.Z — YYYY-MM-DDplaceholder instead of a stale specific version/date.