fix(experiments): resolve the sweep harnesses' paths, so a recorded run can be re-run - #265
Merged
Merged
Conversation
…un can be re-run
Four harnesses hardcoded two absolute paths: the deployment DB under one laptop's
home, and an output directory inside a per-session temp dir that is collected when
that session ends. A recorded experiment that cannot be re-run is the one thing a
recorded experiment must not be, and the output path had already gone stale.
Both now resolve, and both are overridable:
DB = $KEEL_EXPERIMENT_DB or ~/keel/keel.db
OUT_DIR = $KEEL_EXPERIMENT_OUT or <script dir>/_out
The default DB resolves to the same physical file it named before, so nothing
changes on the machine these were written on -- it just stops being the only
machine where they work.
`_out/` is gitignored but deliberately NOT temporary: these sweeps are resumable,
reading their own append-only JSONL back to skip completed cells, so that file has
to outlive the run. A per-session scratch dir is precisely what broke that, and it
is also the shared handoff point -- each `*-rsi-scale` run reads the JSONL its
matching `*-intersection` run writes as the ANCHOR supplying its oversold=20 rows.
Both chains were checked by name, and the two studies were checked not to collide
(`intersection.jsonl` vs `intersection_257.jsonl`).
Only two of the four were visible to ruff. The other two spelled the dead path as
a multi-line `SCRATCH` constant, which is under the line limit and so was flagged
by nothing; they were found by grepping for the literal rather than by trusting the
linter's list.
Also clears the 13 remaining ruff findings in `docs/` -- 6 import blocks (autofix)
and 5 long lines rewrapped without changing any output, the other 2 being the path
literals above. `ruff check .` now passes repo-wide; previously only the CI-scoped
`ruff check keel tests packages` did.
Verified: candles load through the resolved DB path (44,407 bars for BTC-USD, the
~44k those docstrings cite); defaults and both env overrides assert-checked,
including that the output dir is created; `_out/` confirmed ignored; mypy clean;
pytest 2717 passed, 1 skipped.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Four sweep harnesses in
docs/experiments/hardcoded two absolute paths — the deployment DB under one laptop's home, and an output dir inside a per-session temp directory that is collected when that session ends. Both now resolve, and both are overridable:The default DB resolves to the same physical file it named before, so nothing changes on the machine these were written on — it just stops being the only machine where they work.
Why it matters more than it looks
A recorded experiment that cannot be re-run is the one thing a recorded experiment must not be, and the output path had already gone stale.
_out/is gitignored but deliberately not temporary: these sweeps are resumable, reading their own append-only JSONL back to skip completed cells, so that file has to outlive the run. A per-session scratch dir is exactly what broke that.It is also the handoff point between scripts — each
*-rsi-scalerun reads the JSONL its matching*-intersectionrun writes, as the ANCHOR supplying itsoversold=20rows. Both chains verified by name, and the two studies verified not to collide (intersection.jsonlvsintersection_257.jsonl).Only half of this was lintable
Ruff saw two of the four files. The other two spelled the dead path as a multi-line
SCRATCHconstant — under the line limit, so flagged by nothing. They were found by grepping for the literal rather than trusting the linter's list. The hardcodedDBwas invisible to ruff in all four.Lint cleanup
Also clears the 13 remaining ruff findings under
docs/: 6 import blocks (autofix) and 5 long lines rewrapped without changing any output; the other 2 were the path literals above.ruff check .now passes repo-wide — previously only the CI-scopedruff check keel tests packagesdid.Verification
_out/confirmed gitignored and absent fromgit status.mypyclean;pytest2717 passed, 1 skipped.🤖 Generated with Claude Code