Skip to content

Commit 509ff0c

Browse files
lihaoyiclaude
andcommitted
Document ExtractDependencies regression + add sbt-bridge tests to smoke-test.sh
The reverted iter13/17/18 changes all broke xsbt.ExtractUsedNamesSpecification (extractUsedNamesInTypeOfTree and extractTypeNamesForObjectsDependingOnAbstractTypes). Smoke-test.sh previously only ran the compiler's Test/compile (typecheck) — which doesn't exercise the dependency-recording layer. Add scala3-sbt-bridge-bootstrapped/test to the smoke harness so future ExtractDependencies edits are caught locally before push. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ba80c36 commit 509ff0c

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

claude-memory.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ This file records non-git context: dead-ends, recipes, setup state.
4444
7. **Profiling with JFR adds 5–10% overhead.** Measure the commit-message metric WITHOUT JFR; use JFR only for profile capture.
4545
8. **JDK 25 changed JFR JSON shape**: events are at `.recording.events[]` (not `.events[]`). The analyze-jfr.sh script handles both.
4646
9. **Already-present fast-paths**: terminal type fast-paths in `TypeMap.mapOver` for `NoPrefix`/`ThisType`/`BoundType`/`NoType`/`ConstantType` were there before iter1. Don't add them again.
47+
9b. **Caching persistent dedup state across compiler runs in `ExtractDependencies` is UNSAFE.** Iter13 (persistent `TypeDependencyTraverser`), iter17 (per-from-class `_seenMemberRef`), and iter18 (per-from-class `_seenTopLevelType`) ALL caused regressions in `xsbt.ExtractUsedNamesSpecification` (extractUsedNamesInTypeOfTree, extractTypeNamesForObjectsDependingOnAbstractTypes) — only caught by `scala3-sbt-bridge-bootstrapped/test`, NOT by `Test/compile`. Symptoms: missing names (state leaks → already-seen-skips suppress legitimate references) AND extra names (cached state from previous compile leaks into fresh compile). All three reverted at commits `4b842dd269`, `66439bef4b`, `ba80c36e9d`. Smoke-test.sh expanded to include sbt-bridge-bootstrapped/test going forward.
48+
**Lesson**: any optimization in `ExtractDependencies.scala` MUST be validated against `scala3-sbt-bridge-bootstrapped/test`, not just compiler self-compile. The dependency-recording layer is only exercised by zinc-driven incremental tests.
4749
10. **Intermittent `InvalidScalaInstance` / `IntStream/T` errors** in `__.compile` runs: a flaky daemon-side race when many modules build in parallel — has nothing to do with classpath logic. If you only see it in *one* sample of `measure-mill.sh` while four samples are clean, re-run; do NOT chase the false signal. Both errors cleared on retry without code change.
4850
11. **`__.compile` measurement variance is ±2-3s warm-steady** on this hardware. A change with 97% counter-confirmed dedup rate (iter18 _seenTopLevelType) measured 78.7-84.1s post-opt vs 80.4s baseline — algorithmic correctness verified, but wall-clock impact is below the noise floor (~1-2%). For dedup-style optimizations targeting already-cheap inner loops (a `markMemberRefSeen` returning false is itself ~5ns), the cost of the dedup probe may approximately match the saved work. Don't chase wall-clock confirmation past 5 samples; if borderline, ship the algorithmic improvement and move on.
4951
12. **Iter19 confirmed dual-workload methodology works.** Promoting `_period`/`_mode`/`_owner`/etc. fields from `FreshContext` up to abstract `Context` (so getters become non-virtual `final def x = _x` on the parent) showed:

claude-scripts/smoke-test.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ set -euo pipefail
99
SCALA3=${SCALA3:-/Users/lihaoyi/Github/scala3}
1010
cd "$SCALA3"
1111

12-
echo "[smoke-test] (1/2) scala3-compiler-bootstrapped/compile"
12+
echo "[smoke-test] (1/3) scala3-compiler-bootstrapped/compile"
1313
/usr/bin/time -p sbt -batch "scala3-compiler-bootstrapped/compile" 2>&1 | tail -5
1414

1515
echo
16-
echo "[smoke-test] (2/2) scala3-compiler-bootstrapped/Test/compile"
16+
echo "[smoke-test] (2/3) scala3-compiler-bootstrapped/Test/compile"
1717
/usr/bin/time -p sbt -batch "scala3-compiler-bootstrapped/Test/compile" 2>&1 | tail -5
1818

1919
echo
20-
echo "[smoke-test] BOTH GREEN"
20+
echo "[smoke-test] (3/3) scala3-sbt-bridge-bootstrapped/test (catches dependency-recording regressions)"
21+
/usr/bin/time -p sbt -batch "scala3-sbt-bridge-bootstrapped/test" 2>&1 | tail -8
22+
23+
echo
24+
echo "[smoke-test] ALL GREEN"

0 commit comments

Comments
 (0)