Skip to content

Disable LML client limiter in CI to fix metadata-lml suite drain (BS#955)#957

Merged
jakebromberg merged 1 commit into
mainfrom
fix-955-metadata-lml
May 19, 2026
Merged

Disable LML client limiter in CI to fix metadata-lml suite drain (BS#955)#957
jakebromberg merged 1 commit into
mainfrom
fix-955-metadata-lml

Conversation

@jakebromberg
Copy link
Copy Markdown
Member

Closes #955

Summary

  • G4 (PR lml.client: semaphore + token-bucket on /lookup to mirror LML's Discogs ceilings #948 / BS#906) added a process-wide Semaphore(5) + TokenBucket(50/min) to apps/backend/services/lml/lml.client.ts as a prod safety net mirroring LML's Discogs ceilings. The bucket persists across spec files under --runInBand, drains during the > 50 fire-and-forget /lookup calls the earlier suites issue, and stalls every later call ~1200ms per token — timing out metadata-lml.spec.js at 30s.
  • The unit-test author for G4 had already documented the risk (tests/unit/services/lml.client.test.ts:792-793 sets LML_CLIENT_RATE_PER_MIN: '60000' with the comment "effectively no rate cap in tests") but the convention wasn't propagated to either CI environment.
  • This PR overrides LML_CLIENT_MAX_CONCURRENT=10000 and LML_CLIENT_RATE_PER_MIN=60000 in both CI surfaces — .github/workflows/test.yml's Start services env block (actual GHA CI, host node processes) and dev_env/docker-compose.yml's backend ci-profile service (local npm run ci:testmock). A source-grep unit test pins both surfaces against future drift.

Test plan

  • npm run test:unit -- --testPathPatterns=lml-limiter-test-env — 4/4 green (pins both surfaces).
  • npm run typecheck, npm run lint, npm run format:check — all clean.
  • Full local integration suite via docker-compose ci stack: PASS tests/integration/metadata-lml.spec.js, 11/11 tests green including the six that were failing on CI:
    • adding a non-library track triggers LML search — was lookupCalls.length === 0
    • artwork_url, streaming URLs, artist bio, search URLs — were Received has value: null
    • GET /proxy/metadata/album returns enriched metadata — was 30002ms timeout; now 7ms
  • GHA Integration-Tests job goes green on this PR.

Notes

  • LML_CLIENT_MAX_CONCURRENT and LML_CLIENT_RATE_PER_MIN defaults in lml.client.ts (5 / 50/min) are unchanged. Prod still mirrors LML's Discogs ceiling. This change is test-environment scoped.
  • Surfaced as a side note: local npm run ci:testmock (docker-compose) and actual GHA CI (host node processes) diverged independently — they don't share an env source. Worth a follow-up to unify or document.

…955)

G4 (PR #948 / BS#906) added a module-level Semaphore(5) + TokenBucket(50/min) to apps/backend/services/lml/lml.client.ts as a prod safety net mirroring LML's Discogs ceilings. Under integration's --runInBand the bucket persists across spec files; the full suite triggers > 50 fire-and-forget /lookup calls during earlier suites, draining the bucket. By the time metadata-lml.spec.js runs, every call waits ~1200ms for a token and the proxy test times out at 30s. The unit test author for G4 had already documented this risk (tests/unit/services/lml.client.test.ts:792 sets `LML_CLIENT_RATE_PER_MIN: '60000'` with the comment "effectively no rate cap in tests") but the convention wasn't propagated to either CI environment.

CI for this repo has two surfaces that diverged independently:
- .github/workflows/test.yml `Start services` env — actual GitHub Actions CI, host node processes
- dev_env/docker-compose.yml ci backend env — local `npm run ci:testmock`

Both override LML_CLIENT_MAX_CONCURRENT and LML_CLIENT_RATE_PER_MIN to high values so the limiter is effectively a no-op in tests. The source-grep test pins both surfaces against future drift.

Verified locally: full integration suite shows `PASS tests/integration/metadata-lml.spec.js` with all 11 tests green, including the six that were failing on CI:
- adding a non-library track triggers LML search (was: lookupCalls.length === 0)
- artwork_url, streaming, artist_bio, search URLs (was: Received has value: null)
- GET /proxy/metadata/album returns enriched metadata (was: 30002 ms timeout) — now 7 ms
@jakebromberg jakebromberg merged commit 27fae71 into main May 19, 2026
5 checks passed
@jakebromberg jakebromberg deleted the fix-955-metadata-lml branch May 19, 2026 18:29
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.

Integration tests fail deterministically in metadata-lml.spec.js (post-#949 PR run)

1 participant