|
| 1 | +--- |
| 2 | +id: dead-env-gotchas |
| 3 | +title: Build/test/harness gotchas for java-reggie and consumer-repo regex audits — stale-jar trap, gradle caching, piped-build chains, JDK-differential tests, JDK matcher statefulness (resolved — don't re-debug) |
| 4 | +kind: dead-end |
| 5 | +tags: [environment, git, gradle, classpath] |
| 6 | +applies_to: [] |
| 7 | +source: dd_backend_fit/dead-env-gotchas |
| 8 | +status: active |
| 9 | +recorded: 2026-09-28 |
| 10 | +valid_at: 2026-09-28 |
| 11 | +--- |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +# Environment gotchas hit (resolved — don't re-debug) |
| 16 | + |
| 17 | +- Both consumer repos had stale `.git/index.lock` from crashed git processes → |
| 18 | + pull failed with "an editor opened by git commit" message; fix: `rm .git/index.lock`. |
| 19 | +- Large consumer repos (e.g. logs-backend): remote may carry dead refspecs |
| 20 | + (plain fetch dies with "couldn't find remote ref …"; workaround |
| 21 | + `git fetch origin <branch> && git merge --ff-only FETCH_HEAD`) and |
| 22 | + filesystem-wide greps time out — ALWAYS `git ls-files '*.java' | xargs grep …`. |
| 23 | +- reggie-runtime jar does NOT bundle ASM (declared `implementation`): any |
| 24 | + standalone harness needs asm/asm-commons/asm-util 9.10.1 on the classpath |
| 25 | + (from ~/.gradle/caches), else every compile fails with |
| 26 | + NoClassDefFoundError MethodTooLargeException (misleading). |
| 27 | +- Harness must emit results incrementally + per-entry timing; buffered output |
| 28 | + + one hung pattern (semver) loses 15 min of work. |
| 29 | + |
| 30 | +Reggie build discipline (don't repeat): |
| 31 | +- STALE-JAR TRAP: requesting only the runtime jar after editing reggie-codegen sources can |
| 32 | + be an up-to-date NO-OP — the fat runtime jar embeds the codegen classes and did not |
| 33 | + repackage. After codegen changes run :reggie-codegen:compileJava explicitly and |
| 34 | + sanity-check via a changed generated-class hash. |
| 35 | +- `./gradlew jar ... | grep BUILD` in an && chain does NOT stop on BUILD FAILED — grep |
| 36 | + exits 0 on match and the following test/verify runs against the STALE jar. Check exit |
| 37 | + codes explicitly; never pipe-build-then-run in one chain. |
| 38 | +- Gradle test tasks are cached: `./gradlew test` returning BUILD SUCCESSFUL |
| 39 | + in <1s means UP-TO-DATE, not re-run. For real verification use |
| 40 | + `./gradlew cleanTest test`. |
| 41 | +- git commit signing via ~/.ssh/datadog_git_commit_signing can fail |
| 42 | + ("agent refused operation") until the key passphrase is cached; retry after |
| 43 | + unlocking (user unlocked on demand 2026-09-16). |
| 44 | +- Writing regression tests: do NOT hand-derive expectations (repeated |
| 45 | + test-assertion bugs from misread semantics); write JDK-differential tests |
| 46 | + (compute expected values from java.util.regex at runtime). |
| 47 | +- JDK Matcher is STATEFUL: matcher.matches() then matcher.find() continues |
| 48 | + from the end of the previous match — use a fresh Matcher per operation in |
| 49 | + differential tests (ReggieMatcher is stateless per call). |
| 50 | +- jstack sampling root-causes compile hangs; run the victim via nohup+disown |
| 51 | + in one tool call, sample in the next (the tool kills the process group |
| 52 | + when the command ends). |
0 commit comments