Skip to content

test: deterministic perf invariants for the datatree cache#124

Open
lhoupert wants to merge 1 commit into
fix/issue-118-stale-cachefrom
test/issue-118-perf-invariants
Open

test: deterministic perf invariants for the datatree cache#124
lhoupert wants to merge 1 commit into
fix/issue-118-stale-cachefrom
test/issue-118-perf-invariants

Conversation

@lhoupert

Copy link
Copy Markdown
Contributor

The "optional hardening" split out of #119 per review: extra test/CI rigor for the version-aware cache (#122). No runtime code.

Wall-clock benchmarks are too noisy to catch "1 HEAD became 30". These pin the cache's perf invariants by counting side effects with spies:

  • no HEAD storm: N opens within version_probe_ttl → one obstore.head; re-probes after the window (monkeypatched clock).
  • store built once: N opens → _get_store's constructor runs once.
  • no redundant reopen: stable token → one open; changed token → exactly one more.
  • bounded memo: _open_dataset_cached is an lru_cache with positive maxsize.

Also adds a warm-open benchmark (test_open_cached) so the CI github-action-benchmark job alerts if the probe throttle/memo regress.

uv run pytest → 107 passed; benchmarks collect; pre-commit clean.

Refs #118. Stacked on #122 — this PR targets the fix/issue-118-stale-cache branch; retarget to main (gh pr edit <num> --base main) once #122 merges.

🤖 Generated with Claude Code

Wall-clock benchmarks are too noisy to catch "1 HEAD became 30". Pin the perf
invariants of the version-aware cache by counting side effects with spies:
- no HEAD storm: N opens within version_probe_ttl => one obstore.head; re-probes
  after the window elapses (monkeypatched clock).
- store built once: N opens => _get_store's constructor runs once (no per-request
  Boto3CredentialProvider/S3Store rebuild).
- no redundant reopen: a stable token => one open; a changed token => exactly one
  more.
- bounded memo: _open_dataset_cached is an lru_cache with a positive maxsize
  (regression guard vs the prior unbounded @cache).

Also adds a warm-open benchmark (test_open_cached) so the CI github-action
-benchmark job alerts if the probe throttle/memo regress on the hot path.

These were split out of #119 as the "optional hardening" the reviewer asked to
separate; the runtime fix they guard is in the cache PR.

Refs #118

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant