fix: decode Apple inspect state object and nested ipv4 address#43
Conversation
Containers used to report running with an empty IP because the decoder cast 'status' as a string and read networks at the top level, where Apple does not put them.
Apple does not expose a real exit code, so 'Exited (0)' was a lie. Replace the two hardcoded strings with 'ContainerState.exited.displayString' so the runtime sync and stop paths show 'Exited' honestly.
|
Thanks @jahirvidrio — great catch. 🙌 The old Verified locally: builds clean, full suite green (your 11 Merging now — thanks for the fix! |
What problem does this solve?
fetchContainerInfocaststatustoString(Apple emits it as an object)and read networks at the top level (they live nested under
status.networks).Both casts silently failed, so every container reported as running with an
empty IP. This broke the
mocker psstatus column for stopped containers,the
Statefields inmocker container inspect, and Compose/etc/hostsinjection (which silently no-ops because
networkAddressis empty).What changed
ContainerEngine.decodeInspectso the decode logicis unit-testable without a live container, and rewired
fetchContainerInfoto call it. Returns
nilto keep the existing outer fallback intact./24mask fromstatus.networks[0].ipv4Addressso the IP we handto
mocker ps, theinspectDTO, and Compose hostname resolution is plain..running(safe default — a live containeris never hidden from
mocker ps)."Exited (0)"strings withContainerState.exited.displayStringso the stopped display is honest("Exited" — no fake exit code, per the maintainer's "omit > fake" policy).