Repository navigation
ADR-0144: trust a community cache hit, check one in fifty - #401
Merged
Merged
Conversation
…0144) A features hit at the current FEATURES_VERSION is stored as it is and the track is not decoded; one hit in fifty, chosen from the fingerprint, is also analysed locally, its disagreements recorded and its result not contributed. A miss or an unanswered lookup is analysed exactly as before. The worker logs which path each track took. Building it found the cache's section analysis was being discarded: fetched into analysis_detail, then reset to None and recomputed by the next block, so a hit with cached detail decoded the track anyway. It is now kept; a hit without it is left to the backfill (point 3). tests/test_features_cache_trust.py runs run_track_features against the test database with the decoder rigged to record calls; five of its eight tests fail on the replaced code. Full backend suite: 2475 passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014hHXQAoTT1g8ATYHgVhGwb
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.
Builds ADR-0144 (accepted 2026-10-02).
What changes in
run_track_featuresfeatures_path()→hit/hit (sampled)/local.is_sampled_hit()is deterministic from the fingerprint (SHA-256, modHIT_SAMPLE_RATE = 50), so every installation samples the same tracks.hit: cached features + deep scalars stored;precompute_sharednever called; cachedanalysis_detailstored if the cache had it, otherwise leftNULLfor the backfill phase.hit (sampled): decoded and analysed; cache values stay primary; local values →local_features, disagreements →feature_confidence; not contributed (point 2).local(miss, or a lookup that failed): unchanged, still contributed.Features path for <title>: <path>; the task result carriesfeatures_path(point 5).Found while building — recorded in the ADR's Implementation block
analysis_detail, then reset toNoneby the "always run local" block and recomputed. A hit with cached detail therefore still decoded the track. Now kept.community_cache:recording/:hash"as today"; that is ADR-0119's embedding path. The features path is fingerprint-only and writescommunity_cache, and still does.Tests.
tests/test_features_cache_trust.py(8): the sample rule (deterministic, ~2%), andrun_track_featuresend-to-end on the test DB with outside services faked and the decoder recording calls — trusted hit decodes nothing, cached detail kept, hit without detail leftNULL, sampled hit compared and not contributed, miss unchanged. 5 of 8 fail onmain. Full backend suite: 2475 passed, 18 skipped.To measure after release (the ADR's follow-ups): the
Features pathlines in Familiar Server'sserver.loggive the hit rate and per-path times.🤖 Generated with Claude Code
https://claude.ai/code/session_014hHXQAoTT1g8ATYHgVhGwb