Skip to content

day 7 cold-run resolve cap + result dedup + tuning-knob hardening - #7

Merged
erick-ti merged 3 commits into
mainfrom
day7-deploy
May 25, 2026
Merged

day 7 cold-run resolve cap + result dedup + tuning-knob hardening#7
erick-ti merged 3 commits into
mainfrom
day7-deploy

Conversation

@erick-ti

@erick-ti erick-ti commented May 25, 2026

Copy link
Copy Markdown
Owner

The first real Docker run of the Day-6 image surfaced that a popular seed's cold recommendation overruns the worker timeout: MusicBrainz's 1 req/s (×3 paced calls/candidate ≈ 7s each) makes resolving a full 100–200 candidate pool infeasible, so a 194-candidate seed was cancelled at 85 resolved. This caps resolve+embed to the top-N cultural candidates (RESOLVE_CANDIDATE_LIMIT, default 75) and backfills the rest culturally, bounding cold latency while the lazy corpus still grows across queries. Three review rounds then hardened the edges — GATE1_ASYNC_THRESHOLD drops to 5 (≤ Gate 2, closing the inline-resolve-then-defer dead band), WORKER_MAX_JOBS=1 since cold jobs share one MB limiter so concurrency only adds latency, a _validate_tuning import guard rejects incoherent knob combinations, and results dedupe on the verified resolver MBID and exclude the seed's own recording (a duplicate and a seed-alias leak were both reproduced live). 261 passed / 4 skipped across the offline gate and the --run-db suite; the full image build/run validation and the VPS deploy are the remaining Day-7 work.

erick-ti added 3 commits May 25, 2026 12:41
Knobs for the cold-run bound + a fail-fast validator, from Day-7 validation and
three adversarial-review rounds:
- RESOLVE_CANDIDATE_LIMIT (75), JOB_TIMEOUT_S (900), WORKER_MAX_JOBS (1); and
  GATE1_ASYNC_THRESHOLD 15->5 so it stays <= GATE2 (closes the
  inline-resolve-then-defer dead band). All env-tunable, passed through compose.
- WORKER_MAX_JOBS=1 because cold work is MusicBrainz-bound: worker concurrency
  shares one ~1 req/s limiter, so >1 only multiplies latency + embed memory.
- _validate_tuning (at import) rejects incoherent values: non-positive knobs, a
  cap that can't finish in the timeout under concurrency (max_jobs*N*cost), and
  GATE1 > GATE2.
- app Gate-1 counts uncached only within the capped top-N; worker reads
  job_timeout/max_jobs from config.
- Resolve/embed only the top-N (RESOLVE_CANDIDATE_LIMIT) cultural candidates and
  backfill the rest culturally. A 194-candidate seed had overrun job_timeout at
  85 resolved (~7s each via MusicBrainz ~1 req/s); the cap bounds + scales it.
- Dedup results on the verified resolver MBID and drop the seed's own MBID, so
  two credits for one recording can't both appear and the seed can't recommend
  itself (both reproduced in a live container run).
@erick-ti
erick-ti merged commit dd106aa into main May 25, 2026
9 checks passed
@erick-ti
erick-ti deleted the day7-deploy branch May 25, 2026 19:55
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