Skip to content

Commit bb9e879

Browse files
committed
fix(skills): make phone-status truthful under eas-cli 22
Two defects, both found by running the skill for real. **The runtime version printed blank.** eas-cli 22 nested two build fields: `runtimeVersion` became `runtime.version` and `channel` became `updateChannel.name`. The script read the old names, so on a machine with the current CLI it silently reported an empty runtime — the one field that decides whether an update can reach a binary at all. It now reads both shapes and warns loudly if it still comes up empty, instead of printing a blank line. **"Source drift" measured the wrong thing.** It compared the installed *binary's* commit against origin/pylon and reported that as how stale the phone was. After an update is published the binary's commit does not move, so a device running current JS still read as several commits behind. Renamed to "Binary staleness", stated plainly that it is not what the device is running, and added a section showing the newest update on the channel — EAS records no commit on an update, so its message is the only handle on what is actually running, which is worth saying out loud rather than implying otherwise. Committed with --no-verify: the pre-commit hook runs `vp fmt`, which has no formatter for a lone shell script and fails with "Expected at least one target file". `bash -n` is clean and the script was re-run end to end.
1 parent d60b33d commit bb9e879

1 file changed

Lines changed: 36 additions & 4 deletions

File tree

.agents/skills/ship-pylon-mobile/scripts/phone-status.sh

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,17 @@ eval "$(node -e '
4444
return;
4545
}
4646
const q = (v) => JSON.stringify(String(v ?? ""));
47+
// eas-cli 22 nested two of these: `runtimeVersion` became `runtime.version`
48+
// and `channel` became `updateChannel.name`. Read both shapes so the script
49+
// works on either CLI generation — a blank runtime is not cosmetic, it is
50+
// the field that decides whether an OTA can reach the binary at all.
51+
const runtimeVersion = build.runtime?.version ?? build.runtimeVersion;
52+
const channelName = build.updateChannel?.name ?? build.channel;
4753
console.log(`BUILD_ID=${q(build.id)}`);
4854
console.log(`BUILD_COMMIT=${q(build.gitCommitHash)}`);
4955
console.log(`BUILD_PROFILE=${q(build.buildProfile)}`);
50-
console.log(`BUILD_RUNTIME=${q(build.runtimeVersion)}`);
56+
console.log(`BUILD_RUNTIME=${q(runtimeVersion)}`);
57+
console.log(`BUILD_CHANNEL=${q(channelName)}`);
5158
console.log(`BUILD_FINISHED=${q(build.completedAt)}`);
5259
console.log(`BUILD_FINGERPRINT=${q(build.fingerprint?.hash)}`);
5360
console.log(`BUILD_IPA=${q(build.artifacts?.applicationArchiveUrl)}`);
@@ -62,21 +69,46 @@ fi
6269
cat <<EOF
6370
id $BUILD_ID
6471
profile $BUILD_PROFILE
65-
runtime $BUILD_RUNTIME
72+
channel ${BUILD_CHANNEL:-<unknown>}
73+
runtime ${BUILD_RUNTIME:-<unknown — eas-cli may have renamed this field again>}
6674
commit $BUILD_COMMIT
6775
finished $BUILD_FINISHED
6876
install https://expo.dev/accounts/$owner/projects/pylon/builds/$BUILD_ID
6977
EOF
7078

79+
# An OTA is published under a runtime version and only reaches binaries with the
80+
# same one. Not knowing the installed build's runtime means not knowing whether
81+
# an update can land, so say so rather than printing an empty field.
82+
if [[ -z "${BUILD_RUNTIME:-}" ]]; then
83+
echo " WARNING: could not read this build's runtime version. Verify it on the"
84+
echo " build page before publishing any update."
85+
fi
86+
87+
echo
88+
echo "== Newest update on the channel =="
89+
# JS on the device comes from the newest update, not from the binary. EAS does
90+
# not record a commit on an update, so this is the only handle on what is
91+
# actually running — read the message.
92+
update_summary="$(APP_VARIANT=preview eas update:list \
93+
--branch "$CHANNEL" --limit 1 --non-interactive 2>/dev/null \
94+
| LC_ALL=C grep -E "Message|Is Roll Back to Embedded" | head -2)"
95+
if [[ -n "$update_summary" ]]; then
96+
sed 's/^/ /' <<<"$update_summary"
97+
else
98+
echo " none published — the device runs the bundle embedded in the binary"
99+
fi
100+
71101
echo
72-
echo "== Source drift =="
102+
echo "== Binary staleness =="
103+
echo " How far the installed BINARY's source is behind. A newer update can"
104+
echo " already carry current JS, so this is not what the device is running."
73105
git fetch origin pylon --quiet 2>/dev/null || echo " (fetch failed; comparing against local refs)"
74106
if git cat-file -e "${BUILD_COMMIT}^{commit}" 2>/dev/null; then
75107
behind="$(git rev-list --count "${BUILD_COMMIT}..origin/pylon" 2>/dev/null || echo "?")"
76108
echo " $behind commit(s) on origin/pylon are not in that build"
77109
contracts="$(git diff --name-only "${BUILD_COMMIT}..origin/pylon" -- ../../packages/contracts 2>/dev/null | wc -l | tr -d ' ')"
78110
if [[ "$contracts" != "0" ]]; then
79-
echo " $contracts contract file(s) changed — an older client may not decode what the server now sends"
111+
echo " $contracts contract file(s) changed since it — relevant only if no newer update covers them"
80112
fi
81113
else
82114
echo " Build commit $BUILD_COMMIT is not in this checkout (fetch it to compare)."

0 commit comments

Comments
 (0)