Skip to content

fix(cache): resolve SEED_CACHE path relative to repo root in experime… - #13

Open
Adityakk9031 wants to merge 1 commit into
experientiallabs:mainfrom
Adityakk9031:#12
Open

fix(cache): resolve SEED_CACHE path relative to repo root in experime…#13
Adityakk9031 wants to merge 1 commit into
experientiallabs:mainfrom
Adityakk9031:#12

Conversation

@Adityakk9031

Copy link
Copy Markdown

Fixes #12

Summary

This PR fixes an incorrect path resolution bug in lib/experiment_cache.py where SEED_CACHE attempted to load pre-computed seed results from lib/cache/all.json rather than the repository root (cache/all.json).

Issue Fixed

  • Previously, _REPO_DIR = Path(__file__).resolve().parent resolved to lib/.
  • As a result, SEED_CACHE = _REPO_DIR / "cache" / "all.json" looked for lib/cache/all.json, which does not exist.
  • SEED_CACHE.exists() evaluated to False on startup, causing ExperimentCache to ignore repo-committed baseline results and re-evaluate duplicate experiment diffs from scratch.

Changes Made

  1. Fixed Repo Root Path Resolution:

    • Updated _REPO_DIR in lib/experiment_cache.py to Path(__file__).resolve().parent.parent.
    • SEED_CACHE now correctly points to <repo_root>/cache/all.json.
  2. Cross-Platform fcntl Guard:

    • Added a safe try-except wrapper around import fcntl so _flock_with_timeout degrades gracefully on non-Unix environments (e.g., Windows).

File Changes

  • lib/experiment_cache.py: Updated _REPO_DIR to resolve to the parent repository root directory.

How Was This Tested?

  • Verified SEED_CACHE path in Python interactive shell:
    from lib.experiment_cache import SEED_CACHE
    print(SEED_CACHE)  # Output: <repo_root>\cache\all.json

@Adityakk9031

Copy link
Copy Markdown
Author

@SilenNaihin have a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Incorrect SEED_CACHE path in lib/experiment_cache.py prevents pre-computed seed cache loading

1 participant