Add agent rehearsal harness, findings, and per-run evidence for split-loop-with-lambda

Six scripted pi sub-agent runs (3 tool regimes × 2 models) rehearsed the
exercise; deterministic gate = solution test + approved file. Key results:
mandated CLI triples cost on the strong model (4:06 vs 0:39, PASS both);
weak model fails only under the mandate (A+Q), passes when free or optional.
Drift documented with code: scorer.updateSelection left inside the extracted
method (A+Q, C+Q). Harness in tools/rehearse; summary in
rehearsal-findings.md; per-run evidence in rehearsal-runs/; cheat sheet in
rehearse-with-agent.md corrected (lambda-typed parameters unsupported).
This commit is contained in:
Your Name
2026-09-27 17:36:19 +00:00
parent a27e32688a
commit b993f25c53
51 changed files with 2281 additions and 2 deletions
@@ -0,0 +1,35 @@
--- Run B ---
session file: /tmp/rehearsal/runs/B/session/2026-09-27T14-53-00-499Z_01a0e35a-e6d3-70ca-b02c-6d99534cf397.jsonl
model: z-ai/glm-5.3-flash
session span: 39.2 s
assistant messages: 10
tool calls: 10 total
bash 5
edit 4
read 1
tokens input: 21722
tokens output: 4361
tokens cacheRead: 33984
tokens cacheWrite: 0
tokens reasoning: 2129
tokens TOTAL (sum): 62196
--- /usr/bin/time -v (wall clock + max RSS) ---
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:39.35
Maximum resident set size (kbytes): 249312
Exit status: 0
--- pi stdout (last 15 lines) ---
Boolean lookupWeather = dayOffsetToWeather.apply(daysForward);
expectedWeather.add(lookupWeather);
}
return expectedWeather;
}
}
```
**Diff summary** (relative to the original):
1. Added import `java.util.function.LongFunction`.
2. The scorer-dependent code (`scorer.updateSelection()` + `scorer.lookupWeather(daysForward)`) was extracted into a lambda, now passed in as `dayOffsetToWeather` (`LongFunction<Boolean>`); the invocation site (`dayOffsetToWeather.apply(daysForward)`) stayed in the loop.
3. The weather-collection loop (with `interestingDates`) moved into new private method `collectExpectedWeather(LongFunction<Boolean> dayOffsetToWeather)` returning `List<Boolean>`.
4. Signature changed from `longRangeForecast(String quarter)` to `longRangeForecast(LongFunction<Boolean> dayOffsetToWeather)`; the `String quarter` parameter and its `Q1`/`Q4` block were removed, and a public no-arg overload was added that delegates and wraps the `scorer` field in a lambda.
**Note:** the test call site in `src/test/java/codingdojo/LongRangeForecastsTest.java` was updated (`longRangeForecast(quarter)` → `longRangeForecast()`) so the project still compiles after the signature change.