Skip to content

Workflow status is tracked in GitHub: https://github.com/emulebb/emulebb/issues/111. This local document is retained as an engineering spec/evidence record.

BUG-142 - Upload soft-queue admission ignores effective score policy

Summary

When the upload waiting queue is at or beyond the soft limit, admission still uses GetCombinedFilePrioAndCredit() as the gate for whether a new candidate is allowed in. That reduced score only combines credit ratio and file priority.

The actual upload queue score used for best-client selection includes additional policy factors such as low-ratio boost, LowID divisor, cooldown suppression, friend slot handling, and old-client penalties.

Why This Matters

Under queue pressure, a client requesting a low-ratio file can be rejected before it enters the waiting queue even though the effective score policy would make it a strong candidate after admission.

That weakens the intended low-ratio-first upload behavior and creates two different priority models:

  • soft-limit queue admission
  • best-client selection once already queued

Representative Sites

  • srchybrid/UploadQueue.cpp soft-limit gate calls RejectSoftQueueCandidateByCombinedScore(...).
  • srchybrid/UploadClient.cpp GetCombinedFilePrioAndCredit() omits the effective-score modifiers.
  • srchybrid/UploadClient.cpp GetScoreBreakdown(...) applies the effective upload score policy used by selection and UI display.

Candidate Fix Direction

  • Replace the soft-limit gate input with a bounded effective-score comparison, or extend the combined score helper to include the same policy modifiers that matter for admission.
  • Keep friend-slot bypass behavior explicit.
  • Preserve hard queue limit behavior.
  • Add seam tests showing that low-ratio boosted candidates are not rejected solely because the soft queue is full.

Acceptance Criteria

  • [ ] Soft queue admission and best-client selection use compatible priority semantics.
  • [ ] Low-ratio boosted candidates can pass the soft-limit gate when their effective score warrants it.
  • [ ] Hard queue limit behavior is unchanged.
  • [ ] Friend-slot bypass behavior remains explicit.
  • [ ] Tests cover normal priority, low-ratio boost, LowID divisor, cooldown, and hard-limit rejection cases.

Validation

  • focused native tests for upload soft-limit admission scoring
  • focused native tests for low-ratio boosted queue candidates
  • manual upload queue smoke with a full queue and mixed file ratios
  • x64 Debug and Release app builds before implementation commit