test-infra: local_instrumented.sh builds the wrong tree when CWD != repo root #284

Closed
opened 2026-07-04 05:01:01 +00:00 by JMR-dev · 0 comments
JMR-dev commented 2026-07-04 05:01:01 +00:00 (Migrated from github.com)

The merged helper (#280, .claude/skills/preflight/local_instrumented.sh) computes GRADLEW from its own script location but never cds to the repo root and doesn't pass -p, so when invoked from a CWD other than the target tree it silently builds the wrong Gradle project.

Observed (#257 agent): first invocation built the main repo's APK → ClassNotFoundException for the worktree's new test class; re-running with CWD set to the worktree fixed it.

Fix: cd to the resolved repo/worktree root before invoking gradlew (or pass -p "$ROOT"), so it always targets the correct tree regardless of CWD. Quick fix, and the helper is now the mandated emulator-validation tool, so this reliability matters.

The merged helper (#280, `.claude/skills/preflight/local_instrumented.sh`) computes `GRADLEW` from its own script location but never `cd`s to the repo root and doesn't pass `-p`, so when invoked from a CWD other than the target tree it **silently builds the wrong Gradle project**. Observed (#257 agent): first invocation built the main repo's APK → `ClassNotFoundException` for the worktree's new test class; re-running with CWD set to the worktree fixed it. **Fix:** `cd` to the resolved repo/worktree root before invoking gradlew (or pass `-p "$ROOT"`), so it always targets the correct tree regardless of CWD. Quick fix, and the helper is now the mandated emulator-validation tool, so this reliability matters.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: JMR-dev/LibreMail#284