Observability for Harper binary resolution + loopback setup verification#24
Observability for Harper binary resolution + loopback setup verification#24heskew wants to merge 4 commits into
Conversation
…s/dist ambiguity Which binary runs is the most consequential decision the harness makes and it was invisible: resolving the auto-installed 'harper' peer from node_modules while the caller expected their local build produces wholesale test failures with no hint of the cause (#23). Log the resolved path and its source once per distinct path, and warn with the override when the node_modules copy wins while ./dist/bin/harper.js also exists. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RXx78W5LxbvxEdSyrB1vvn
A partial run (expired sudo credential mid-loop, interruption) still printed the ✓ success line, leaving the test runner failing later on the missing addresses with no connection back to the setup step. Re-check every address after the loop; on any miss, print the exact per-address fix commands and exit non-zero. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RXx78W5LxbvxEdSyrB1vvn
There was a problem hiding this comment.
Code Review
This pull request introduces robust verification for loopback address configuration in setup-loopback.sh and adds detailed logging and warnings for Harper binary resolution in harperLifecycle.ts to prevent testing stale builds. The review feedback suggests optimizing the loopback verification script by caching the ifconfig output to avoid spawning subprocesses in a loop, and improving the local build warning robustness by walking up the directory tree instead of relying solely on process.cwd().
…tput once The pre-loop range announcement doubles as a tell when two checkouts run package versions with different pool conventions. Single ifconfig capture for the verify loop per review. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RXx78W5LxbvxEdSyrB1vvn
process.cwd() alone misses the local build when tests run from a repo subdirectory; mirror resolution step 4's ancestor walk. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RXx78W5LxbvxEdSyrB1vvn
| MISSING=() | ||
| LO0_STATE=$(ifconfig lo0) | ||
| for i in $(seq $START $END); do | ||
| if ! echo "$LO0_STATE" | grep -q "inet 127\.0\.0\.$i "; then |
There was a problem hiding this comment.
The success check can still accept the configuration this script is meant to repair. If an old 127.0.0.$i alias has a /8 netmask and either the delete or re-add fails (those statuses are currently ignored), the old alias remains in LO0_STATE; this IP-only grep passes and prints ✓ even though the overlapping-subnet/mDNS CPU problem remains. Could the verifier require the matching alias to have netmask 0xffffffff (macOS's representation of /32) before reporting success? Checking/reporting a failed add would also make the immediate error clearer. A fake-ifconfig regression test with an existing /8 alias would lock this down.
The uncontroversial half of #23 — no resolution-order or dependency changes, just making the two silent failure modes visible:
Binary resolution logging
getHarperScriptnow logs the resolved Harper path and which rule chose it (harperBinPath option/HARPER_INTEGRATION_TEST_INSTALL_SCRIPT/node_modules/ancestor dist), once per distinct path. When thenode_modulescopy wins while./dist/bin/harper.jsalso exists, it warns with the env-var override — the exact situation in #23 where the harness silently tested the published npm package instead of the local build.Loopback setup verification
setup-loopback.shpreviously printed its ✓ success line unconditionally — a partial run (expired sudo credential mid-loop, interruption) claimed success and left the test runner failing later on missing addresses with no connection back to the setup step. The script now re-checks every address after the loop and, on any miss, prints the exact per-address fix commands and exits non-zero. It also announces the range up front, which doubles as a tell when two checkouts run different package versions with different pool conventions (0.3.x started at.1, current starts at.2).Verification
npm run checkclean,npm test19/19 passingbash -nclean on the script; verification loop exercised manually on macOS (missing-alias case prints the fix command and exits 1; complete case prints ✓)Deliberately not included (pending direction on #23):
peerDependenciesMeta.harper.optionalor any resolution-precedence change.🤖 Generated with Claude Code
https://claude.ai/code/session_01RXx78W5LxbvxEdSyrB1vvn